Add linux-next specific files for 20110831
[linux-2.6/next.git] / include / linux / usb / r8a66597.h
blobb6b8660d0c687f8459b70caaad34b054ae263ba4
1 /*
2 * R8A66597 driver platform data
4 * Copyright (C) 2009 Renesas Solutions Corp.
6 * Author : Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #ifndef __LINUX_USB_R8A66597_H
24 #define __LINUX_USB_R8A66597_H
26 #define R8A66597_PLATDATA_XTAL_12MHZ 0x01
27 #define R8A66597_PLATDATA_XTAL_24MHZ 0x02
28 #define R8A66597_PLATDATA_XTAL_48MHZ 0x03
30 struct r8a66597_platdata {
31 /* This callback can control port power instead of DVSTCTR register. */
32 void (*port_power)(int port, int power);
34 /* This parameter is for BUSWAIT */
35 u16 buswait;
37 /* set one = on chip controller, set zero = external controller */
38 unsigned on_chip:1;
40 /* (external controller only) set R8A66597_PLATDATA_XTAL_nnMHZ */
41 unsigned xtal:2;
43 /* set one = 3.3V, set zero = 1.5V */
44 unsigned vif:1;
46 /* set one = big endian, set zero = little endian */
47 unsigned endian:1;
49 /* (external controller only) set one = WR0_N shorted to WR1_N */
50 unsigned wr0_shorted_to_wr1:1;
53 /* Register definitions */
54 #define SYSCFG0 0x00
55 #define SYSCFG1 0x02
56 #define SYSSTS0 0x04
57 #define SYSSTS1 0x06
58 #define DVSTCTR0 0x08
59 #define DVSTCTR1 0x0A
60 #define TESTMODE 0x0C
61 #define PINCFG 0x0E
62 #define DMA0CFG 0x10
63 #define DMA1CFG 0x12
64 #define CFIFO 0x14
65 #define D0FIFO 0x18
66 #define D1FIFO 0x1C
67 #define CFIFOSEL 0x20
68 #define CFIFOCTR 0x22
69 #define CFIFOSIE 0x24
70 #define D0FIFOSEL 0x28
71 #define D0FIFOCTR 0x2A
72 #define D1FIFOSEL 0x2C
73 #define D1FIFOCTR 0x2E
74 #define INTENB0 0x30
75 #define INTENB1 0x32
76 #define INTENB2 0x34
77 #define BRDYENB 0x36
78 #define NRDYENB 0x38
79 #define BEMPENB 0x3A
80 #define SOFCFG 0x3C
81 #define INTSTS0 0x40
82 #define INTSTS1 0x42
83 #define INTSTS2 0x44
84 #define BRDYSTS 0x46
85 #define NRDYSTS 0x48
86 #define BEMPSTS 0x4A
87 #define FRMNUM 0x4C
88 #define UFRMNUM 0x4E
89 #define USBADDR 0x50
90 #define USBREQ 0x54
91 #define USBVAL 0x56
92 #define USBINDX 0x58
93 #define USBLENG 0x5A
94 #define DCPCFG 0x5C
95 #define DCPMAXP 0x5E
96 #define DCPCTR 0x60
97 #define PIPESEL 0x64
98 #define PIPECFG 0x68
99 #define PIPEBUF 0x6A
100 #define PIPEMAXP 0x6C
101 #define PIPEPERI 0x6E
102 #define PIPE1CTR 0x70
103 #define PIPE2CTR 0x72
104 #define PIPE3CTR 0x74
105 #define PIPE4CTR 0x76
106 #define PIPE5CTR 0x78
107 #define PIPE6CTR 0x7A
108 #define PIPE7CTR 0x7C
109 #define PIPE8CTR 0x7E
110 #define PIPE9CTR 0x80
111 #define PIPE1TRE 0x90
112 #define PIPE1TRN 0x92
113 #define PIPE2TRE 0x94
114 #define PIPE2TRN 0x96
115 #define PIPE3TRE 0x98
116 #define PIPE3TRN 0x9A
117 #define PIPE4TRE 0x9C
118 #define PIPE4TRN 0x9E
119 #define PIPE5TRE 0xA0
120 #define PIPE5TRN 0xA2
121 #define DEVADD0 0xD0
122 #define DEVADD1 0xD2
123 #define DEVADD2 0xD4
124 #define DEVADD3 0xD6
125 #define DEVADD4 0xD8
126 #define DEVADD5 0xDA
127 #define DEVADD6 0xDC
128 #define DEVADD7 0xDE
129 #define DEVADD8 0xE0
130 #define DEVADD9 0xE2
131 #define DEVADDA 0xE4
133 /* System Configuration Control Register */
134 #define XTAL 0xC000 /* b15-14: Crystal selection */
135 #define XTAL48 0x8000 /* 48MHz */
136 #define XTAL24 0x4000 /* 24MHz */
137 #define XTAL12 0x0000 /* 12MHz */
138 #define XCKE 0x2000 /* b13: External clock enable */
139 #define PLLC 0x0800 /* b11: PLL control */
140 #define SCKE 0x0400 /* b10: USB clock enable */
141 #define PCSDIS 0x0200 /* b9: not CS wakeup */
142 #define LPSME 0x0100 /* b8: Low power sleep mode */
143 #define HSE 0x0080 /* b7: Hi-speed enable */
144 #define DCFM 0x0040 /* b6: Controller function select */
145 #define DRPD 0x0020 /* b5: D+/- pull down control */
146 #define DPRPU 0x0010 /* b4: D+ pull up control */
147 #define USBE 0x0001 /* b0: USB module operation enable */
149 /* System Configuration Status Register */
150 #define OVCBIT 0x8000 /* b15-14: Over-current bit */
151 #define OVCMON 0xC000 /* b15-14: Over-current monitor */
152 #define SOFEA 0x0020 /* b5: SOF monitor */
153 #define IDMON 0x0004 /* b3: ID-pin monitor */
154 #define LNST 0x0003 /* b1-0: D+, D- line status */
155 #define SE1 0x0003 /* SE1 */
156 #define FS_KSTS 0x0002 /* Full-Speed K State */
157 #define FS_JSTS 0x0001 /* Full-Speed J State */
158 #define LS_JSTS 0x0002 /* Low-Speed J State */
159 #define LS_KSTS 0x0001 /* Low-Speed K State */
160 #define SE0 0x0000 /* SE0 */
162 /* Device State Control Register */
163 #define EXTLP0 0x0400 /* b10: External port */
164 #define VBOUT 0x0200 /* b9: VBUS output */
165 #define WKUP 0x0100 /* b8: Remote wakeup */
166 #define RWUPE 0x0080 /* b7: Remote wakeup sense */
167 #define USBRST 0x0040 /* b6: USB reset enable */
168 #define RESUME 0x0020 /* b5: Resume enable */
169 #define UACT 0x0010 /* b4: USB bus enable */
170 #define RHST 0x0007 /* b1-0: Reset handshake status */
171 #define HSPROC 0x0004 /* HS handshake is processing */
172 #define HSMODE 0x0003 /* Hi-Speed mode */
173 #define FSMODE 0x0002 /* Full-Speed mode */
174 #define LSMODE 0x0001 /* Low-Speed mode */
175 #define UNDECID 0x0000 /* Undecided */
177 /* Test Mode Register */
178 #define UTST 0x000F /* b3-0: Test select */
179 #define H_TST_PACKET 0x000C /* HOST TEST Packet */
180 #define H_TST_SE0_NAK 0x000B /* HOST TEST SE0 NAK */
181 #define H_TST_K 0x000A /* HOST TEST K */
182 #define H_TST_J 0x0009 /* HOST TEST J */
183 #define H_TST_NORMAL 0x0000 /* HOST Normal Mode */
184 #define P_TST_PACKET 0x0004 /* PERI TEST Packet */
185 #define P_TST_SE0_NAK 0x0003 /* PERI TEST SE0 NAK */
186 #define P_TST_K 0x0002 /* PERI TEST K */
187 #define P_TST_J 0x0001 /* PERI TEST J */
188 #define P_TST_NORMAL 0x0000 /* PERI Normal Mode */
190 /* Data Pin Configuration Register */
191 #define LDRV 0x8000 /* b15: Drive Current Adjust */
192 #define VIF1 0x0000 /* VIF = 1.8V */
193 #define VIF3 0x8000 /* VIF = 3.3V */
194 #define INTA 0x0001 /* b1: USB INT-pin active */
196 /* DMAx Pin Configuration Register */
197 #define DREQA 0x4000 /* b14: Dreq active select */
198 #define BURST 0x2000 /* b13: Burst mode */
199 #define DACKA 0x0400 /* b10: Dack active select */
200 #define DFORM 0x0380 /* b9-7: DMA mode select */
201 #define CPU_ADR_RD_WR 0x0000 /* Address + RD/WR mode (CPU bus) */
202 #define CPU_DACK_RD_WR 0x0100 /* DACK + RD/WR mode (CPU bus) */
203 #define CPU_DACK_ONLY 0x0180 /* DACK only mode (CPU bus) */
204 #define SPLIT_DACK_ONLY 0x0200 /* DACK only mode (SPLIT bus) */
205 #define DENDA 0x0040 /* b6: Dend active select */
206 #define PKTM 0x0020 /* b5: Packet mode */
207 #define DENDE 0x0010 /* b4: Dend enable */
208 #define OBUS 0x0004 /* b2: OUTbus mode */
210 /* CFIFO/DxFIFO Port Select Register */
211 #define RCNT 0x8000 /* b15: Read count mode */
212 #define REW 0x4000 /* b14: Buffer rewind */
213 #define DCLRM 0x2000 /* b13: DMA buffer clear mode */
214 #define DREQE 0x1000 /* b12: DREQ output enable */
215 #define MBW_8 0x0000 /* 8bit */
216 #define MBW_16 0x0400 /* 16bit */
217 #define MBW_32 0x0800 /* 32bit */
218 #define BIGEND 0x0100 /* b8: Big endian mode */
219 #define BYTE_LITTLE 0x0000 /* little dendian */
220 #define BYTE_BIG 0x0100 /* big endifan */
221 #define ISEL 0x0020 /* b5: DCP FIFO port direction select */
222 #define CURPIPE 0x000F /* b2-0: PIPE select */
224 /* CFIFO/DxFIFO Port Control Register */
225 #define BVAL 0x8000 /* b15: Buffer valid flag */
226 #define BCLR 0x4000 /* b14: Buffer clear */
227 #define FRDY 0x2000 /* b13: FIFO ready */
228 #define DTLN 0x0FFF /* b11-0: FIFO received data length */
230 /* Interrupt Enable Register 0 */
231 #define VBSE 0x8000 /* b15: VBUS interrupt */
232 #define RSME 0x4000 /* b14: Resume interrupt */
233 #define SOFE 0x2000 /* b13: Frame update interrupt */
234 #define DVSE 0x1000 /* b12: Device state transition interrupt */
235 #define CTRE 0x0800 /* b11: Control transfer stage transition interrupt */
236 #define BEMPE 0x0400 /* b10: Buffer empty interrupt */
237 #define NRDYE 0x0200 /* b9: Buffer not ready interrupt */
238 #define BRDYE 0x0100 /* b8: Buffer ready interrupt */
240 /* Interrupt Enable Register 1 */
241 #define OVRCRE 0x8000 /* b15: Over-current interrupt */
242 #define BCHGE 0x4000 /* b14: USB us chenge interrupt */
243 #define DTCHE 0x1000 /* b12: Detach sense interrupt */
244 #define ATTCHE 0x0800 /* b11: Attach sense interrupt */
245 #define EOFERRE 0x0040 /* b6: EOF error interrupt */
246 #define SIGNE 0x0020 /* b5: SETUP IGNORE interrupt */
247 #define SACKE 0x0010 /* b4: SETUP ACK interrupt */
249 /* BRDY Interrupt Enable/Status Register */
250 #define BRDY9 0x0200 /* b9: PIPE9 */
251 #define BRDY8 0x0100 /* b8: PIPE8 */
252 #define BRDY7 0x0080 /* b7: PIPE7 */
253 #define BRDY6 0x0040 /* b6: PIPE6 */
254 #define BRDY5 0x0020 /* b5: PIPE5 */
255 #define BRDY4 0x0010 /* b4: PIPE4 */
256 #define BRDY3 0x0008 /* b3: PIPE3 */
257 #define BRDY2 0x0004 /* b2: PIPE2 */
258 #define BRDY1 0x0002 /* b1: PIPE1 */
259 #define BRDY0 0x0001 /* b1: PIPE0 */
261 /* NRDY Interrupt Enable/Status Register */
262 #define NRDY9 0x0200 /* b9: PIPE9 */
263 #define NRDY8 0x0100 /* b8: PIPE8 */
264 #define NRDY7 0x0080 /* b7: PIPE7 */
265 #define NRDY6 0x0040 /* b6: PIPE6 */
266 #define NRDY5 0x0020 /* b5: PIPE5 */
267 #define NRDY4 0x0010 /* b4: PIPE4 */
268 #define NRDY3 0x0008 /* b3: PIPE3 */
269 #define NRDY2 0x0004 /* b2: PIPE2 */
270 #define NRDY1 0x0002 /* b1: PIPE1 */
271 #define NRDY0 0x0001 /* b1: PIPE0 */
273 /* BEMP Interrupt Enable/Status Register */
274 #define BEMP9 0x0200 /* b9: PIPE9 */
275 #define BEMP8 0x0100 /* b8: PIPE8 */
276 #define BEMP7 0x0080 /* b7: PIPE7 */
277 #define BEMP6 0x0040 /* b6: PIPE6 */
278 #define BEMP5 0x0020 /* b5: PIPE5 */
279 #define BEMP4 0x0010 /* b4: PIPE4 */
280 #define BEMP3 0x0008 /* b3: PIPE3 */
281 #define BEMP2 0x0004 /* b2: PIPE2 */
282 #define BEMP1 0x0002 /* b1: PIPE1 */
283 #define BEMP0 0x0001 /* b0: PIPE0 */
285 /* SOF Pin Configuration Register */
286 #define TRNENSEL 0x0100 /* b8: Select transaction enable period */
287 #define BRDYM 0x0040 /* b6: BRDY clear timing */
288 #define INTL 0x0020 /* b5: Interrupt sense select */
289 #define EDGESTS 0x0010 /* b4: */
290 #define SOFMODE 0x000C /* b3-2: SOF pin select */
291 #define SOF_125US 0x0008 /* SOF OUT 125us Frame Signal */
292 #define SOF_1MS 0x0004 /* SOF OUT 1ms Frame Signal */
293 #define SOF_DISABLE 0x0000 /* SOF OUT Disable */
295 /* Interrupt Status Register 0 */
296 #define VBINT 0x8000 /* b15: VBUS interrupt */
297 #define RESM 0x4000 /* b14: Resume interrupt */
298 #define SOFR 0x2000 /* b13: SOF frame update interrupt */
299 #define DVST 0x1000 /* b12: Device state transition interrupt */
300 #define CTRT 0x0800 /* b11: Control transfer stage transition interrupt */
301 #define BEMP 0x0400 /* b10: Buffer empty interrupt */
302 #define NRDY 0x0200 /* b9: Buffer not ready interrupt */
303 #define BRDY 0x0100 /* b8: Buffer ready interrupt */
304 #define VBSTS 0x0080 /* b7: VBUS input port */
305 #define DVSQ 0x0070 /* b6-4: Device state */
306 #define DS_SPD_CNFG 0x0070 /* Suspend Configured */
307 #define DS_SPD_ADDR 0x0060 /* Suspend Address */
308 #define DS_SPD_DFLT 0x0050 /* Suspend Default */
309 #define DS_SPD_POWR 0x0040 /* Suspend Powered */
310 #define DS_SUSP 0x0040 /* Suspend */
311 #define DS_CNFG 0x0030 /* Configured */
312 #define DS_ADDS 0x0020 /* Address */
313 #define DS_DFLT 0x0010 /* Default */
314 #define DS_POWR 0x0000 /* Powered */
315 #define DVSQS 0x0030 /* b5-4: Device state */
316 #define VALID 0x0008 /* b3: Setup packet detected flag */
317 #define CTSQ 0x0007 /* b2-0: Control transfer stage */
318 #define CS_SQER 0x0006 /* Sequence error */
319 #define CS_WRND 0x0005 /* Control write nodata status stage */
320 #define CS_WRSS 0x0004 /* Control write status stage */
321 #define CS_WRDS 0x0003 /* Control write data stage */
322 #define CS_RDSS 0x0002 /* Control read status stage */
323 #define CS_RDDS 0x0001 /* Control read data stage */
324 #define CS_IDST 0x0000 /* Idle or setup stage */
326 /* Interrupt Status Register 1 */
327 #define OVRCR 0x8000 /* b15: Over-current interrupt */
328 #define BCHG 0x4000 /* b14: USB bus chenge interrupt */
329 #define DTCH 0x1000 /* b12: Detach sense interrupt */
330 #define ATTCH 0x0800 /* b11: Attach sense interrupt */
331 #define EOFERR 0x0040 /* b6: EOF-error interrupt */
332 #define SIGN 0x0020 /* b5: Setup ignore interrupt */
333 #define SACK 0x0010 /* b4: Setup acknowledge interrupt */
335 /* Frame Number Register */
336 #define OVRN 0x8000 /* b15: Overrun error */
337 #define CRCE 0x4000 /* b14: Received data error */
338 #define FRNM 0x07FF /* b10-0: Frame number */
340 /* Micro Frame Number Register */
341 #define UFRNM 0x0007 /* b2-0: Micro frame number */
343 /* Default Control Pipe Maxpacket Size Register */
344 /* Pipe Maxpacket Size Register */
345 #define DEVSEL 0xF000 /* b15-14: Device address select */
346 #define MAXP 0x007F /* b6-0: Maxpacket size of default control pipe */
348 /* Default Control Pipe Control Register */
349 #define BSTS 0x8000 /* b15: Buffer status */
350 #define SUREQ 0x4000 /* b14: Send USB request */
351 #define CSCLR 0x2000 /* b13: complete-split status clear */
352 #define CSSTS 0x1000 /* b12: complete-split status */
353 #define SUREQCLR 0x0800 /* b11: stop setup request */
354 #define SQCLR 0x0100 /* b8: Sequence toggle bit clear */
355 #define SQSET 0x0080 /* b7: Sequence toggle bit set */
356 #define SQMON 0x0040 /* b6: Sequence toggle bit monitor */
357 #define PBUSY 0x0020 /* b5: pipe busy */
358 #define PINGE 0x0010 /* b4: ping enable */
359 #define CCPL 0x0004 /* b2: Enable control transfer complete */
360 #define PID 0x0003 /* b1-0: Response PID */
361 #define PID_STALL11 0x0003 /* STALL */
362 #define PID_STALL 0x0002 /* STALL */
363 #define PID_BUF 0x0001 /* BUF */
364 #define PID_NAK 0x0000 /* NAK */
366 /* Pipe Window Select Register */
367 #define PIPENM 0x0007 /* b2-0: Pipe select */
369 /* Pipe Configuration Register */
370 #define R8A66597_TYP 0xC000 /* b15-14: Transfer type */
371 #define R8A66597_ISO 0xC000 /* Isochronous */
372 #define R8A66597_INT 0x8000 /* Interrupt */
373 #define R8A66597_BULK 0x4000 /* Bulk */
374 #define R8A66597_BFRE 0x0400 /* b10: Buffer ready interrupt mode select */
375 #define R8A66597_DBLB 0x0200 /* b9: Double buffer mode select */
376 #define R8A66597_CNTMD 0x0100 /* b8: Continuous transfer mode select */
377 #define R8A66597_SHTNAK 0x0080 /* b7: Transfer end NAK */
378 #define R8A66597_DIR 0x0010 /* b4: Transfer direction select */
379 #define R8A66597_EPNUM 0x000F /* b3-0: Eendpoint number select */
381 /* Pipe Buffer Configuration Register */
382 #define BUFSIZE 0x7C00 /* b14-10: Pipe buffer size */
383 #define BUFNMB 0x007F /* b6-0: Pipe buffer number */
384 #define PIPE0BUF 256
385 #define PIPExBUF 64
387 /* Pipe Maxpacket Size Register */
388 #define MXPS 0x07FF /* b10-0: Maxpacket size */
390 /* Pipe Cycle Configuration Register */
391 #define IFIS 0x1000 /* b12: Isochronous in-buffer flush mode select */
392 #define IITV 0x0007 /* b2-0: Isochronous interval */
394 /* Pipex Control Register */
395 #define BSTS 0x8000 /* b15: Buffer status */
396 #define INBUFM 0x4000 /* b14: IN buffer monitor (Only for PIPE1 to 5) */
397 #define CSCLR 0x2000 /* b13: complete-split status clear */
398 #define CSSTS 0x1000 /* b12: complete-split status */
399 #define ATREPM 0x0400 /* b10: Auto repeat mode */
400 #define ACLRM 0x0200 /* b9: Out buffer auto clear mode */
401 #define SQCLR 0x0100 /* b8: Sequence toggle bit clear */
402 #define SQSET 0x0080 /* b7: Sequence toggle bit set */
403 #define SQMON 0x0040 /* b6: Sequence toggle bit monitor */
404 #define PBUSY 0x0020 /* b5: pipe busy */
405 #define PID 0x0003 /* b1-0: Response PID */
407 /* PIPExTRE */
408 #define TRENB 0x0200 /* b9: Transaction counter enable */
409 #define TRCLR 0x0100 /* b8: Transaction counter clear */
411 /* PIPExTRN */
412 #define TRNCNT 0xFFFF /* b15-0: Transaction counter */
414 /* DEVADDx */
415 #define UPPHUB 0x7800
416 #define HUBPORT 0x0700
417 #define USBSPD 0x00C0
418 #define RTPORT 0x0001
420 #endif /* __LINUX_USB_R8A66597_H */