1 /* linux/arch/arm/plat-s3c/include/plat/regs-otg.h
3 * Copyright (C) 2004 Herbert Poetzl <herbert@13thfloor.at>
5 * This include file is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of
8 * the License, or (at your option) any later version.
11 #ifndef __ASM_ARCH_REGS_USB_OTG_HS_H
12 #define __ASM_ARCH_REGS_USB_OTG_HS_H
14 /* USB2.0 OTG Controller register */
15 #define S3C_USBOTG_PHYREG(x) ((x) + S3C_VA_OTGSFR)
16 #define S3C_USBOTG_PHYPWR S3C_USBOTG_PHYREG(0x0)
17 #define S3C_USBOTG_PHYCLK S3C_USBOTG_PHYREG(0x4)
18 #define S3C_USBOTG_RSTCON S3C_USBOTG_PHYREG(0x8)
19 #define S3C_USBOTG_PHYTUNE S3C_USBOTG_PHYREG(0x24)
20 #define S3C_USBOTG_PHY1CON S3C_USBOTG_PHYREG(0x34)
22 /* USB2.0 OTG Controller register */
23 #define S3C_USBOTGREG(x) ((x) + S3C_VA_OTG)
24 /*============================================================================================== */
25 /* Core Global Registers */
26 #define S3C_UDC_OTG_GOTGCTL S3C_USBOTGREG(0x000) /* OTG Control & Status */
27 #define S3C_UDC_OTG_GOTGINT S3C_USBOTGREG(0x004) /* OTG Interrupt */
28 #define S3C_UDC_OTG_GAHBCFG S3C_USBOTGREG(0x008) /* Core AHB Configuration */
29 #define S3C_UDC_OTG_GUSBCFG S3C_USBOTGREG(0x00C) /* Core USB Configuration */
30 #define S3C_UDC_OTG_GRSTCTL S3C_USBOTGREG(0x010) /* Core Reset */
31 #define S3C_UDC_OTG_GINTSTS S3C_USBOTGREG(0x014) /* Core Interrupt */
32 #define S3C_UDC_OTG_GINTMSK S3C_USBOTGREG(0x018) /* Core Interrupt Mask */
33 #define S3C_UDC_OTG_GRXSTSR S3C_USBOTGREG(0x01C) /* Receive Status Debug Read/Status Read */
34 #define S3C_UDC_OTG_GRXSTSP S3C_USBOTGREG(0x020) /* Receive Status Debug Pop/Status Pop */
35 #define S3C_UDC_OTG_GRXFSIZ S3C_USBOTGREG(0x024) /* Receive FIFO Size */
36 #define S3C_UDC_OTG_GNPTXFSIZ S3C_USBOTGREG(0x028) /* Non-Periodic Transmit FIFO Size */
37 #define S3C_UDC_OTG_GNPTXSTS S3C_USBOTGREG(0x02C) /* Non-Periodic Transmit FIFO/Queue Status */
39 #define S3C_UDC_OTG_HPTXFSIZ S3C_USBOTGREG(0x100) /* Host Periodic Transmit FIFO Size */
40 #define S3C_UDC_OTG_DIEPTXF(n) S3C_USBOTGREG(0x104 + (n-1)*0x4)/* Device IN EP Transmit FIFO Size Register */
42 /*============================================================================================== */
43 /* Host Mode Registers */
44 /*------------------------------------------------ */
45 /* Host Global Registers */
46 #define S3C_UDC_OTG_HCFG S3C_USBOTGREG(0x400) /* Host Configuration */
47 #define S3C_UDC_OTG_HFIR S3C_USBOTGREG(0x404) /* Host Frame Interval */
48 #define S3C_UDC_OTG_HFNUM S3C_USBOTGREG(0x408) /* Host Frame Number/Frame Time Remaining */
49 #define S3C_UDC_OTG_HPTXSTS S3C_USBOTGREG(0x410) /* Host Periodic Transmit FIFO/Queue Status */
50 #define S3C_UDC_OTG_HAINT S3C_USBOTGREG(0x414) /* Host All Channels Interrupt */
51 #define S3C_UDC_OTG_HAINTMSK S3C_USBOTGREG(0x418) /* Host All Channels Interrupt Mask */
53 /*------------------------------------------------ */
54 /* Host Port Control & Status Registers */
55 #define S3C_UDC_OTG_HPRT S3C_USBOTGREG(0x440) /* Host Port Control & Status */
57 /*------------------------------------------------ */
58 /* Host Channel-Specific Registers */
59 #define S3C_UDC_OTG_HCCHAR0 S3C_USBOTGREG(0x500) /* Host Channel-0 Characteristics */
60 #define S3C_UDC_OTG_HCSPLT0 S3C_USBOTGREG(0x504) /* Host Channel-0 Split Control */
61 #define S3C_UDC_OTG_HCINT0 S3C_USBOTGREG(0x508) /* Host Channel-0 Interrupt */
62 #define S3C_UDC_OTG_HCINTMSK0 S3C_USBOTGREG(0x50C) /* Host Channel-0 Interrupt Mask */
63 #define S3C_UDC_OTG_HCTSIZ0 S3C_USBOTGREG(0x510) /* Host Channel-0 Transfer Size */
64 #define S3C_UDC_OTG_HCDMA0 S3C_USBOTGREG(0x514) /* Host Channel-0 DMA Address */
67 /*============================================================================================== */
68 /* Device Mode Registers */
69 /*------------------------------------------------ */
70 /* Device Global Registers */
71 #define S3C_UDC_OTG_DCFG S3C_USBOTGREG(0x800) /* Device Configuration */
72 #define S3C_UDC_OTG_DCTL S3C_USBOTGREG(0x804) /* Device Control */
73 #define S3C_UDC_OTG_DSTS S3C_USBOTGREG(0x808) /* Device Status */
74 #define S3C_UDC_OTG_DIEPMSK S3C_USBOTGREG(0x810) /* Device IN Endpoint Common Interrupt Mask */
75 #define S3C_UDC_OTG_DOEPMSK S3C_USBOTGREG(0x814) /* Device OUT Endpoint Common Interrupt Mask */
76 #define S3C_UDC_OTG_DAINT S3C_USBOTGREG(0x818) /* Device All Endpoints Interrupt */
77 #define S3C_UDC_OTG_DAINTMSK S3C_USBOTGREG(0x81C) /* Device All Endpoints Interrupt Mask */
78 #define S3C_UDC_OTG_DTKNQR1 S3C_USBOTGREG(0x820) /* Device IN Token Sequence Learning Queue Read 1 */
79 #define S3C_UDC_OTG_DTKNQR2 S3C_USBOTGREG(0x824) /* Device IN Token Sequence Learning Queue Read 2 */
80 #define S3C_UDC_OTG_DVBUSDIS S3C_USBOTGREG(0x828) /* Device VBUS Discharge Time */
81 #define S3C_UDC_OTG_DVBUSPULSE S3C_USBOTGREG(0x82C) /* Device VBUS Pulsing Time */
82 #define S3C_UDC_OTG_DTKNQR3 S3C_USBOTGREG(0x830) /* Device IN Token Sequence Learning Queue Read 3 */
83 #define S3C_UDC_OTG_DTKNQR4 S3C_USBOTGREG(0x834) /* Device IN Token Sequence Learning Queue Read 4 */
85 /*------------------------------------------------ */
86 /* Device Logical IN Endpoint-Specific Registers */
87 #define S3C_UDC_OTG_DIEPCTL(n) S3C_USBOTGREG(0x900 + n*0x20) /* Device IN Endpoint n Control */
88 #define S3C_UDC_OTG_DIEPINT(n) S3C_USBOTGREG(0x908 + n*0x20) /* Device IN Endpoint n Interrupt */
89 #define S3C_UDC_OTG_DIEPTSIZ(n) S3C_USBOTGREG(0x910 + n*0x20) /* Device IN Endpoint n Transfer Size */
90 #define S3C_UDC_OTG_DIEPDMA(n) S3C_USBOTGREG(0x914 + n*0x20) /* Device IN Endpoint n DMA Address */
92 /*------------------------------------------------ */
93 /* Device Logical OUT Endpoint-Specific Registers */
94 #define S3C_UDC_OTG_DOEPCTL(n) S3C_USBOTGREG(0xB00 + n*0x20) /* Device OUT Endpoint n Control */
95 #define S3C_UDC_OTG_DOEPINT(n) S3C_USBOTGREG(0xB08 + n*0x20) /* Device OUT Endpoint n Interrupt */
96 #define S3C_UDC_OTG_DOEPTSIZ(n) S3C_USBOTGREG(0xB10 + n*0x20) /* Device OUT Endpoint n Transfer Size */
97 #define S3C_UDC_OTG_DOEPDMA(n) S3C_USBOTGREG(0xB14 + n*0x20) /* Device OUT Endpoint n DMA Address */
99 /*------------------------------------------------ */
100 /* Endpoint FIFO address */
101 #define S3C_UDC_OTG_EP0_FIFO S3C_USBOTGREG(0x1000)
102 #define S3C_UDC_OTG_EP1_FIFO S3C_USBOTGREG(0x2000)
103 #define S3C_UDC_OTG_EP2_FIFO S3C_USBOTGREG(0x3000)
104 #define S3C_UDC_OTG_EP3_FIFO S3C_USBOTGREG(0x4000)
105 #define S3C_UDC_OTG_EP4_FIFO S3C_USBOTGREG(0x5000)
106 #define S3C_UDC_OTG_EP5_FIFO S3C_USBOTGREG(0x6000)
107 #define S3C_UDC_OTG_EP6_FIFO S3C_USBOTGREG(0x7000)
108 #define S3C_UDC_OTG_EP7_FIFO S3C_USBOTGREG(0x8000)
109 #define S3C_UDC_OTG_EP8_FIFO S3C_USBOTGREG(0x9000)
110 #define S3C_UDC_OTG_EP9_FIFO S3C_USBOTGREG(0xA000)
111 #define S3C_UDC_OTG_EP10_FIFO S3C_USBOTGREG(0xB000)
112 #define S3C_UDC_OTG_EP11_FIFO S3C_USBOTGREG(0xC000)
113 #define S3C_UDC_OTG_EP12_FIFO S3C_USBOTGREG(0xD000)
114 #define S3C_UDC_OTG_EP13_FIFO S3C_USBOTGREG(0xE000)
115 #define S3C_UDC_OTG_EP14_FIFO S3C_USBOTGREG(0xF000)
116 #define S3C_UDC_OTG_EP15_FIFO S3C_USBOTGREG(0x10000)
118 /*===================================================================== */
119 /*definitions related to CSR setting */
121 /* S3C_UDC_OTG_GOTGCTL */
122 #define B_SESSION_VALID (0x1<<19)
123 #define A_SESSION_VALID (0x1<<18)
125 /* S3C_UDC_OTG_GAHBCFG */
126 #define PTXFE_HALF (0<<8)
127 #define PTXFE_ZERO (1<<8)
128 #define NPTXFE_HALF (0<<7)
129 #define NPTXFE_ZERO (1<<7)
130 #define MODE_SLAVE (0<<5)
131 #define MODE_DMA (1<<5)
132 #define BURST_SINGLE (0<<1)
133 #define BURST_INCR (1<<1)
134 #define BURST_INCR4 (3<<1)
135 #define BURST_INCR8 (5<<1)
136 #define BURST_INCR16 (7<<1)
137 #define GBL_INT_UNMASK (1<<0)
138 #define GBL_INT_MASK (0<<0)
140 /* S3C_UDC_OTG_GRSTCTL */
141 #define AHB_MASTER_IDLE (1u<<31)
142 #define CORE_SOFT_RESET (0x1<<0)
144 /* S3C_UDC_OTG_GINTSTS/S3C_UDC_OTG_GINTMSK core interrupt register */
145 #define INT_RESUME (1u<<31)
146 #define INT_DISCONN (0x1<<29)
147 #define INT_CONN_ID_STS_CNG (0x1<<28)
148 #define INT_OUT_EP (0x1<<19)
149 #define INT_IN_EP (0x1<<18)
150 #define INT_ENUMDONE (0x1<<13)
151 #define INT_RESET (0x1<<12)
152 #define INT_SUSPEND (0x1<<11)
153 #define INT_EARLY_SUSPEND (0x1<<10)
154 #define INT_NP_TX_FIFO_EMPTY (0x1<<5)
155 #define INT_RX_FIFO_NOT_EMPTY (0x1<<4)
156 #define INT_SOF (0x1<<3)
157 #define INT_DEV_MODE (0x0<<0)
158 #define INT_HOST_MODE (0x1<<1)
159 #define INT_GOUTNakEff (0x01<<7)
160 #define INT_GINNakEff (0x01<<6)
162 #define FULL_SPEED_CONTROL_PKT_SIZE 8
163 #define FULL_SPEED_BULK_PKT_SIZE 64
165 #define HIGH_SPEED_CONTROL_PKT_SIZE 64
166 #define HIGH_SPEED_BULK_PKT_SIZE 512
168 #ifdef CONFIG_CPU_S5P6450
169 #define RX_FIFO_SIZE (4096>>2)
170 #define NPTX_FIFO_START_ADDR RX_FIFO_SIZE
171 #define NPTX_FIFO_SIZE (4096>>2)
172 #define PTX_FIFO_SIZE (1520>>2)
174 #define RX_FIFO_SIZE (4096>>2)
175 #define NPTX_FIFO_START_ADDR RX_FIFO_SIZE
176 #define NPTX_FIFO_SIZE (4096>>2)
177 #define PTX_FIFO_SIZE (1024>>2)
180 /* Enumeration speed */
181 #define USB_HIGH_30_60MHZ (0x0<<1)
182 #define USB_FULL_30_60MHZ (0x1<<1)
183 #define USB_LOW_6MHZ (0x2<<1)
184 #define USB_FULL_48MHZ (0x3<<1)
186 /* S3C_UDC_OTG_GRXSTSP STATUS */
187 #define OUT_PKT_RECEIVED (0x2<<17)
188 #define OUT_TRANSFER_COMPLELTED (0x3<<17)
189 #define SETUP_TRANSACTION_COMPLETED (0x4<<17)
190 #define SETUP_PKT_RECEIVED (0x6<<17)
191 #define GLOBAL_OUT_NAK (0x1<<17)
193 /* S3C_UDC_OTG_DCTL device control register */
194 #define NORMAL_OPERATION (0x1<<0)
195 #define SOFT_DISCONNECT (0x1<<1)
196 #define TEST_CONTROL_MASK (0x7<<4)
197 #define TEST_J_MODE (0x1<<4)
198 #define TEST_K_MODE (0x2<<4)
199 #define TEST_SE0_NAK_MODE (0x3<<4)
200 #define TEST_PACKET_MODE (0x4<<4)
201 #define TEST_FORCE_ENABLE_MODE (0x5<<4)
203 /* S3C_UDC_OTG_DAINT device all endpoint interrupt register */
204 #define DAINT_OUT_BIT (16)
205 #define DAINT_MASK (0xFFFF)
207 /* S3C_UDC_OTG_DIEPCTL0/DOEPCTL0 device control IN/OUT endpoint 0 control register */
208 #define DEPCTL_EPENA (0x1<<31)
209 #define DEPCTL_EPDIS (0x1<<30)
210 #define DEPCTL_SETD1PID (0x1<<29)
211 #define DEPCTL_SETD0PID (0x1<<28)
212 #define DEPCTL_SNAK (0x1<<27)
213 #define DEPCTL_CNAK (0x1<<26)
214 #define DEPCTL_STALL (0x1<<21)
215 #define DEPCTL_TYPE_BIT (18)
216 #define DEPCTL_TXFNUM_BIT (22)
217 #define DEPCTL_TXFNUM_MASK (0xF<<22)
218 #define DEPCTL_TYPE_MASK (0x3<<18)
219 #define DEPCTL_CTRL_TYPE (0x0<<18)
220 #define DEPCTL_ISO_TYPE (0x1<<18)
221 #define DEPCTL_BULK_TYPE (0x2<<18)
222 #define DEPCTL_INTR_TYPE (0x3<<18)
223 #define DEPCTL_NAKSTS (0x1<<17)
224 #define DEPCTL_USBACTEP (0x1<<15)
225 #define DEPCTL_NEXT_EP_BIT (11)
226 #define DEPCTL_MPS_BIT (0)
227 #define DEPCTL_MPS_MASK (0x7FF)
229 #define DEPCTL0_MPS_64 (0x0<<0)
230 #define DEPCTL0_MPS_32 (0x1<<0)
231 #define DEPCTL0_MPS_16 (0x2<<0)
232 #define DEPCTL0_MPS_8 (0x3<<0)
233 #define DEPCTL_MPS_BULK_512 (512<<0)
234 #define DEPCTL_MPS_INT_MPS_16 (16<<0)
236 #define DIEPCTL0_NEXT_EP_BIT (11)
238 /* S3C_UDC_OTG_DIEPCTLn/DOEPCTLn device control IN/OUT endpoint n control register */
240 /* S3C_UDC_OTG_DIEPMSK/DOEPMSK device IN/OUT endpoint common interrupt mask register */
241 /* S3C_UDC_OTG_DIEPINTn/DOEPINTn device IN/OUT endpoint interrupt register */
242 #define BACK2BACK_SETUP_RECEIVED (0x1<<6)
243 #define INTKNEPMIS (0x1<<5)
244 #define INTKN_TXFEMP (0x1<<4)
245 #define NON_ISO_IN_EP_TIMEOUT (0x1<<3)
246 #define CTRL_OUT_EP_SETUP_PHASE_DONE (0x1<<3)
247 #define AHB_ERROR (0x1<<2)
248 #define EPDISBLD (0x1<<1)
249 #define TRANSFER_DONE (0x1<<0)
251 /*DIEPTSIZ0 / DOEPTSIZ0 */
253 /* DEPTSIZ common bit */
254 #define DEPTSIZ_PKT_CNT_BIT (19)
255 #define DEPTSIZ_XFER_SIZE_BIT (0)
257 #define DEPTSIZ_SETUP_PKCNT_1 (1<<29)
258 #define DEPTSIZ_SETUP_PKCNT_2 (2<<29)
259 #define DEPTSIZ_SETUP_PKCNT_3 (3<<29)