1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20#ifndef _SPI_CHANNEL_H_
21#define _SPI_CHANNEL_H_
22
23#include <linux/types.h>
24
25
26#define SPI_CTL_EN 0x00000001
27#define SPI_CTL_MSTR 0x00000002
28#define SPI_CTL_PSSE 0x00000004
29#define SPI_CTL_ODM 0x00000008
30#define SPI_CTL_CPHA 0x00000010
31#define SPI_CTL_CPOL 0x00000020
32#define SPI_CTL_ASSEL 0x00000040
33#define SPI_CTL_SELST 0x00000080
34#define SPI_CTL_EMISO 0x00000100
35#define SPI_CTL_SIZE 0x00000600
36#define SPI_CTL_SIZE08 0x00000000
37#define SPI_CTL_SIZE16 0x00000200
38#define SPI_CTL_SIZE32 0x00000400
39#define SPI_CTL_LSBF 0x00001000
40#define SPI_CTL_FCEN 0x00002000
41#define SPI_CTL_FCCH 0x00004000
42#define SPI_CTL_FCPL 0x00008000
43#define SPI_CTL_FCWM 0x00030000
44#define SPI_CTL_FIFO0 0x00000000
45#define SPI_CTL_FIFO1 0x00010000
46#define SPI_CTL_FIFO2 0x00020000
47#define SPI_CTL_FMODE 0x00040000
48#define SPI_CTL_MIOM 0x00300000
49#define SPI_CTL_MIO_DIS 0x00000000
50#define SPI_CTL_MIO_DUAL 0x00100000
51#define SPI_CTL_MIO_QUAD 0x00200000
52#define SPI_CTL_SOSI 0x00400000
53
54#define SPI_RXCTL_REN 0x00000001
55#define SPI_RXCTL_RTI 0x00000004
56#define SPI_RXCTL_RWCEN 0x00000008
57#define SPI_RXCTL_RDR 0x00000070
58#define SPI_RXCTL_RDR_DIS 0x00000000
59#define SPI_RXCTL_RDR_NE 0x00000010
60#define SPI_RXCTL_RDR_25 0x00000020
61#define SPI_RXCTL_RDR_50 0x00000030
62#define SPI_RXCTL_RDR_75 0x00000040
63#define SPI_RXCTL_RDR_FULL 0x00000050
64#define SPI_RXCTL_RDO 0x00000100
65#define SPI_RXCTL_RRWM 0x00003000
66#define SPI_RXCTL_RWM_0 0x00000000
67#define SPI_RXCTL_RWM_25 0x00001000
68#define SPI_RXCTL_RWM_50 0x00002000
69#define SPI_RXCTL_RWM_75 0x00003000
70#define SPI_RXCTL_RUWM 0x00070000
71#define SPI_RXCTL_UWM_DIS 0x00000000
72#define SPI_RXCTL_UWM_25 0x00010000
73#define SPI_RXCTL_UWM_50 0x00020000
74#define SPI_RXCTL_UWM_75 0x00030000
75#define SPI_RXCTL_UWM_FULL 0x00040000
76
77#define SPI_TXCTL_TEN 0x00000001
78#define SPI_TXCTL_TTI 0x00000004
79#define SPI_TXCTL_TWCEN 0x00000008
80#define SPI_TXCTL_TDR 0x00000070
81#define SPI_TXCTL_TDR_DIS 0x00000000
82#define SPI_TXCTL_TDR_NF 0x00000010
83#define SPI_TXCTL_TDR_25 0x00000020
84#define SPI_TXCTL_TDR_50 0x00000030
85#define SPI_TXCTL_TDR_75 0x00000040
86#define SPI_TXCTL_TDR_EMPTY 0x00000050
87#define SPI_TXCTL_TDU 0x00000100
88#define SPI_TXCTL_TRWM 0x00003000
89#define SPI_TXCTL_RWM_FULL 0x00000000
90#define SPI_TXCTL_RWM_25 0x00001000
91#define SPI_TXCTL_RWM_50 0x00002000
92#define SPI_TXCTL_RWM_75 0x00003000
93#define SPI_TXCTL_TUWM 0x00070000
94#define SPI_TXCTL_UWM_DIS 0x00000000
95#define SPI_TXCTL_UWM_25 0x00010000
96#define SPI_TXCTL_UWM_50 0x00020000
97#define SPI_TXCTL_UWM_75 0x00030000
98#define SPI_TXCTL_UWM_EMPTY 0x00040000
99
100#define SPI_CLK_BAUD 0x0000FFFF
101
102#define SPI_DLY_STOP 0x000000FF
103#define SPI_DLY_LEADX 0x00000100
104#define SPI_DLY_LAGX 0x00000200
105
106#define SPI_SLVSEL_SSE1 0x00000002
107#define SPI_SLVSEL_SSE2 0x00000004
108#define SPI_SLVSEL_SSE3 0x00000008
109#define SPI_SLVSEL_SSE4 0x00000010
110#define SPI_SLVSEL_SSE5 0x00000020
111#define SPI_SLVSEL_SSE6 0x00000040
112#define SPI_SLVSEL_SSE7 0x00000080
113#define SPI_SLVSEL_SSEL1 0x00000200
114#define SPI_SLVSEL_SSEL2 0x00000400
115#define SPI_SLVSEL_SSEL3 0x00000800
116#define SPI_SLVSEL_SSEL4 0x00001000
117#define SPI_SLVSEL_SSEL5 0x00002000
118#define SPI_SLVSEL_SSEL6 0x00004000
119#define SPI_SLVSEL_SSEL7 0x00008000
120
121#define SPI_RWC_VALUE 0x0000FFFF
122
123#define SPI_RWCR_VALUE 0x0000FFFF
124
125#define SPI_TWC_VALUE 0x0000FFFF
126
127#define SPI_TWCR_VALUE 0x0000FFFF
128
129#define SPI_IMSK_RUWM 0x00000002
130#define SPI_IMSK_TUWM 0x00000004
131#define SPI_IMSK_ROM 0x00000010
132#define SPI_IMSK_TUM 0x00000020
133#define SPI_IMSK_TCM 0x00000040
134#define SPI_IMSK_MFM 0x00000080
135#define SPI_IMSK_RSM 0x00000100
136#define SPI_IMSK_TSM 0x00000200
137#define SPI_IMSK_RFM 0x00000400
138#define SPI_IMSK_TFM 0x00000800
139
140#define SPI_IMSK_CLR_RUW 0x00000002
141#define SPI_IMSK_CLR_TUWM 0x00000004
142#define SPI_IMSK_CLR_ROM 0x00000010
143#define SPI_IMSK_CLR_TUM 0x00000020
144#define SPI_IMSK_CLR_TCM 0x00000040
145#define SPI_IMSK_CLR_MFM 0x00000080
146#define SPI_IMSK_CLR_RSM 0x00000100
147#define SPI_IMSK_CLR_TSM 0x00000200
148#define SPI_IMSK_CLR_RFM 0x00000400
149#define SPI_IMSK_CLR_TFM 0x00000800
150
151#define SPI_IMSK_SET_RUWM 0x00000002
152#define SPI_IMSK_SET_TUWM 0x00000004
153#define SPI_IMSK_SET_ROM 0x00000010
154#define SPI_IMSK_SET_TUM 0x00000020
155#define SPI_IMSK_SET_TCM 0x00000040
156#define SPI_IMSK_SET_MFM 0x00000080
157#define SPI_IMSK_SET_RSM 0x00000100
158#define SPI_IMSK_SET_TSM 0x00000200
159#define SPI_IMSK_SET_RFM 0x00000400
160#define SPI_IMSK_SET_TFM 0x00000800
161
162#define SPI_STAT_SPIF 0x00000001
163#define SPI_STAT_RUWM 0x00000002
164#define SPI_STAT_TUWM 0x00000004
165#define SPI_STAT_ROE 0x00000010
166#define SPI_STAT_TUE 0x00000020
167#define SPI_STAT_TCE 0x00000040
168#define SPI_STAT_MODF 0x00000080
169#define SPI_STAT_RS 0x00000100
170#define SPI_STAT_TS 0x00000200
171#define SPI_STAT_RF 0x00000400
172#define SPI_STAT_TF 0x00000800
173#define SPI_STAT_RFS 0x00007000
174#define SPI_STAT_RFIFO_EMPTY 0x00000000
175#define SPI_STAT_RFIFO_25 0x00001000
176#define SPI_STAT_RFIFO_50 0x00002000
177#define SPI_STAT_RFIFO_75 0x00003000
178#define SPI_STAT_RFIFO_FULL 0x00004000
179#define SPI_STAT_TFS 0x00070000
180#define SPI_STAT_TFIFO_FULL 0x00000000
181#define SPI_STAT_TFIFO_25 0x00010000
182#define SPI_STAT_TFIFO_50 0x00020000
183#define SPI_STAT_TFIFO_75 0x00030000
184#define SPI_STAT_TFIFO_EMPTY 0x00040000
185#define SPI_STAT_FCS 0x00100000
186#define SPI_STAT_RFE 0x00400000
187#define SPI_STAT_TFF 0x00800000
188
189#define SPI_ILAT_RUWMI 0x00000002
190#define SPI_ILAT_TUWMI 0x00000004
191#define SPI_ILAT_ROI 0x00000010
192#define SPI_ILAT_TUI 0x00000020
193#define SPI_ILAT_TCI 0x00000040
194#define SPI_ILAT_MFI 0x00000080
195#define SPI_ILAT_RSI 0x00000100
196#define SPI_ILAT_TSI 0x00000200
197#define SPI_ILAT_RFI 0x00000400
198#define SPI_ILAT_TFI 0x00000800
199
200#define SPI_ILAT_CLR_RUWMI 0x00000002
201#define SPI_ILAT_CLR_TUWMI 0x00000004
202#define SPI_ILAT_CLR_ROI 0x00000010
203#define SPI_ILAT_CLR_TUI 0x00000020
204#define SPI_ILAT_CLR_TCI 0x00000040
205#define SPI_ILAT_CLR_MFI 0x00000080
206#define SPI_ILAT_CLR_RSI 0x00000100
207#define SPI_ILAT_CLR_TSI 0x00000200
208#define SPI_ILAT_CLR_RFI 0x00000400
209#define SPI_ILAT_CLR_TFI 0x00000800
210
211
212
213
214struct bfin_spi_regs {
215 u32 revid;
216 u32 control;
217 u32 rx_control;
218 u32 tx_control;
219 u32 clock;
220 u32 delay;
221 u32 ssel;
222 u32 rwc;
223 u32 rwcr;
224 u32 twc;
225 u32 twcr;
226 u32 reserved0;
227 u32 emask;
228 u32 emaskcl;
229 u32 emaskst;
230 u32 reserved1;
231 u32 status;
232 u32 elat;
233 u32 elatcl;
234 u32 reserved2;
235 u32 rfifo;
236 u32 reserved3;
237 u32 tfifo;
238};
239
240#define MAX_CTRL_CS 8
241
242
243struct bfin_spi3_master {
244 u16 num_chipselect;
245 u16 pin_req[7];
246};
247
248
249
250
251struct bfin_spi3_chip {
252 u32 control;
253 u16 cs_chg_udelay;
254 u32 tx_dummy_val;
255 bool enable_dma;
256};
257
258#endif
259