1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#ifndef __LINUX_SSP_H
20#define __LINUX_SSP_H
21
22#include <linux/list.h>
23#include <linux/io.h>
24
25
26
27
28
29
30
31#define SSCR0 (0x00)
32#define SSCR1 (0x04)
33#define SSSR (0x08)
34#define SSITR (0x0C)
35#define SSDR (0x10)
36
37#define SSTO (0x28)
38#define SSPSP (0x2C)
39#define SSTSA (0x30)
40#define SSRSA (0x34)
41#define SSTSS (0x38)
42#define SSACD (0x3C)
43#define SSACDD (0x40)
44
45
46#define SSCR0_DSS (0x0000000f)
47#define SSCR0_DataSize(x) ((x) - 1)
48#define SSCR0_FRF (0x00000030)
49#define SSCR0_Motorola (0x0 << 4)
50#define SSCR0_TI (0x1 << 4)
51#define SSCR0_National (0x2 << 4)
52#define SSCR0_ECS (1 << 6)
53#define SSCR0_SSE (1 << 7)
54#define SSCR0_SCR(x) ((x) << 8)
55
56
57#define SSCR0_EDSS (1 << 20)
58#define SSCR0_NCS (1 << 21)
59#define SSCR0_RIM (1 << 22)
60#define SSCR0_TUM (1 << 23)
61#define SSCR0_FRDC (0x07000000)
62#define SSCR0_SlotsPerFrm(x) (((x) - 1) << 24)
63#define SSCR0_FPCKE (1 << 29)
64#define SSCR0_ACS (1 << 30)
65#define SSCR0_MOD (1 << 31)
66
67
68#define SSCR1_RIE (1 << 0)
69#define SSCR1_TIE (1 << 1)
70#define SSCR1_LBM (1 << 2)
71#define SSCR1_SPO (1 << 3)
72#define SSCR1_SPH (1 << 4)
73#define SSCR1_MWDS (1 << 5)
74
75#define SSSR_ALT_FRM_MASK 3
76#define SSSR_TNF (1 << 2)
77#define SSSR_RNE (1 << 3)
78#define SSSR_BSY (1 << 4)
79#define SSSR_TFS (1 << 5)
80#define SSSR_RFS (1 << 6)
81#define SSSR_ROR (1 << 7)
82
83#ifdef CONFIG_ARCH_PXA
84#define RX_THRESH_DFLT 8
85#define TX_THRESH_DFLT 8
86
87#define SSSR_TFL_MASK (0xf << 8)
88#define SSSR_RFL_MASK (0xf << 12)
89
90#define SSCR1_TFT (0x000003c0)
91#define SSCR1_TxTresh(x) (((x) - 1) << 6)
92#define SSCR1_RFT (0x00003c00)
93#define SSCR1_RxTresh(x) (((x) - 1) << 10)
94
95#else
96
97#define RX_THRESH_DFLT 2
98#define TX_THRESH_DFLT 2
99
100#define SSSR_TFL_MASK (0x3 << 8)
101#define SSSR_RFL_MASK (0x3 << 12)
102
103#define SSCR1_TFT (0x000000c0)
104#define SSCR1_TxTresh(x) (((x) - 1) << 6)
105#define SSCR1_RFT (0x00000c00)
106#define SSCR1_RxTresh(x) (((x) - 1) << 10)
107#endif
108
109
110#define SSCR0_TISSP (1 << 4)
111#define SSCR0_PSP (3 << 4)
112#define SSCR1_TTELP (1 << 31)
113#define SSCR1_TTE (1 << 30)
114#define SSCR1_EBCEI (1 << 29)
115#define SSCR1_SCFR (1 << 28)
116#define SSCR1_ECRA (1 << 27)
117#define SSCR1_ECRB (1 << 26)
118#define SSCR1_SCLKDIR (1 << 25)
119#define SSCR1_SFRMDIR (1 << 24)
120#define SSCR1_RWOT (1 << 23)
121#define SSCR1_TRAIL (1 << 22)
122#define SSCR1_TSRE (1 << 21)
123#define SSCR1_RSRE (1 << 20)
124#define SSCR1_TINTE (1 << 19)
125#define SSCR1_PINTE (1 << 18)
126#define SSCR1_IFS (1 << 16)
127#define SSCR1_STRF (1 << 15)
128#define SSCR1_EFWR (1 << 14)
129
130#define SSSR_BCE (1 << 23)
131#define SSSR_CSS (1 << 22)
132#define SSSR_TUR (1 << 21)
133#define SSSR_EOC (1 << 20)
134#define SSSR_TINT (1 << 19)
135#define SSSR_PINT (1 << 18)
136
137
138#define SSPSP_SCMODE(x) ((x) << 0)
139#define SSPSP_SFRMP (1 << 2)
140#define SSPSP_ETDS (1 << 3)
141#define SSPSP_STRTDLY(x) ((x) << 4)
142#define SSPSP_DMYSTRT(x) ((x) << 7)
143#define SSPSP_SFRMDLY(x) ((x) << 9)
144#define SSPSP_SFRMWDTH(x) ((x) << 16)
145#define SSPSP_DMYSTOP(x) ((x) << 23)
146#define SSPSP_FSRT (1 << 25)
147
148
149#define SSPSP_EDMYSTRT(x) ((x) << 26)
150#define SSPSP_EDMYSTOP(x) ((x) << 28)
151#define SSPSP_TIMING_MASK (0x7f8001f0)
152
153#define SSACD_SCDB (1 << 3)
154#define SSACD_ACPS(x) ((x) << 4)
155#define SSACD_ACDS(x) ((x) << 0)
156#define SSACD_SCDX8 (1 << 7)
157
158
159#define SSITF 0x44
160#define SSITF_TxLoThresh(x) (((x) - 1) << 8)
161#define SSITF_TxHiThresh(x) ((x) - 1)
162
163#define SSIRF 0x48
164#define SSIRF_RxThresh(x) ((x) - 1)
165
166enum pxa_ssp_type {
167 SSP_UNDEFINED = 0,
168 PXA25x_SSP,
169 PXA25x_NSSP,
170 PXA27x_SSP,
171 PXA3xx_SSP,
172 PXA168_SSP,
173 PXA910_SSP,
174 CE4100_SSP,
175 LPSS_SSP,
176};
177
178struct ssp_device {
179 struct platform_device *pdev;
180 struct list_head node;
181
182 struct clk *clk;
183 void __iomem *mmio_base;
184 unsigned long phys_base;
185
186 const char *label;
187 int port_id;
188 int type;
189 int use_count;
190 int irq;
191 int drcmr_rx;
192 int drcmr_tx;
193};
194
195
196
197
198
199
200
201
202static inline void pxa_ssp_write_reg(struct ssp_device *dev, u32 reg, u32 val)
203{
204 __raw_writel(val, dev->mmio_base + reg);
205}
206
207
208
209
210
211
212
213static inline u32 pxa_ssp_read_reg(struct ssp_device *dev, u32 reg)
214{
215 return __raw_readl(dev->mmio_base + reg);
216}
217
218#ifdef CONFIG_ARCH_PXA
219struct ssp_device *pxa_ssp_request(int port, const char *label);
220void pxa_ssp_free(struct ssp_device *);
221#else
222static inline struct ssp_device *pxa_ssp_request(int port, const char *label)
223{
224 return NULL;
225}
226static inline void pxa_ssp_free(struct ssp_device *ssp) {}
227#endif
228
229#endif
230