1/*
2 * bfin_sport.h - interface to Blackfin SPORTs
3 *
4 * Copyright 2004-2009 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8#ifndef __BFIN_SPORT_H__
9#define __BFIN_SPORT_H__
10
11
12#include <linux/types.h>
13#include <uapi/asm/bfin_sport.h>
14
15/*
16 * All Blackfin system MMRs are padded to 32bits even if the register
17 * itself is only 16bits.  So use a helper macro to streamline this.
18 */
19#define __BFP(m) u16 m; u16 __pad_##m
20struct sport_register {
21	__BFP(tcr1);
22	__BFP(tcr2);
23	__BFP(tclkdiv);
24	__BFP(tfsdiv);
25	union {
26		u32 tx32;
27		u16 tx16;
28	};
29	u32 __pad_tx;
30	union {
31		u32 rx32;	/* use the anomaly wrapper below */
32		u16 rx16;
33	};
34	u32 __pad_rx;
35	__BFP(rcr1);
36	__BFP(rcr2);
37	__BFP(rclkdiv);
38	__BFP(rfsdiv);
39	__BFP(stat);
40	__BFP(chnl);
41	__BFP(mcmc1);
42	__BFP(mcmc2);
43	u32 mtcs0;
44	u32 mtcs1;
45	u32 mtcs2;
46	u32 mtcs3;
47	u32 mrcs0;
48	u32 mrcs1;
49	u32 mrcs2;
50	u32 mrcs3;
51};
52#undef __BFP
53
54struct bfin_snd_platform_data {
55	const unsigned short *pin_req;
56};
57
58#define bfin_read_sport_rx32(base) \
59({ \
60	struct sport_register *__mmrs = (void *)base; \
61	u32 __ret; \
62	unsigned long flags; \
63	if (ANOMALY_05000473) \
64		local_irq_save(flags); \
65	__ret = __mmrs->rx32; \
66	if (ANOMALY_05000473) \
67		local_irq_restore(flags); \
68	__ret; \
69})
70
71#endif
72