summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/target/arm/as3525/usb-drv-as3525v2.c185
-rw-r--r--firmware/target/arm/as3525/usb-drv-as3525v2.h109
2 files changed, 282 insertions, 12 deletions
diff --git a/firmware/target/arm/as3525/usb-drv-as3525v2.c b/firmware/target/arm/as3525/usb-drv-as3525v2.c
index 83a5701a11..369a838c65 100644
--- a/firmware/target/arm/as3525/usb-drv-as3525v2.c
+++ b/firmware/target/arm/as3525/usb-drv-as3525v2.c
@@ -48,6 +48,9 @@ struct usb_endpoint
48static struct usb_endpoint endpoints[USB_NUM_ENDPOINTS*2]; 48static struct usb_endpoint endpoints[USB_NUM_ENDPOINTS*2];
49#endif 49#endif
50 50
51static unsigned int usb_num_in_ep = 0;
52static unsigned int usb_num_out_ep = 0;
53
51void usb_attach(void) 54void usb_attach(void)
52{ 55{
53 usb_enable(true); 56 usb_enable(true);
@@ -102,6 +105,51 @@ static void as3525v2_connect(void)
102 usb_delay(); 105 usb_delay();
103} 106}
104 107
108static void usb_enable_common_interrupts(void)
109{
110 /* Clear any pending otg interrupt */
111 USB_GOTGINT = 0xffffffff;
112 /* Clear any pending interrupt */
113 USB_GINTSTS = 0Xffffffff;
114 /* Enable interrupts */
115 USB_GINTMSK |= USB_GINTMSK_modemismatch |
116 USB_GINTMSK_otgintr |
117 USB_GINTMSK_rxstsqlvl | /* for dma */
118 USB_GINTMSK_conidstschng |
119 USB_GINTMSK_wkupintr |
120 USB_GINTMSK_disconnect |
121 USB_GINTMSK_usbsuspend |
122 USB_GINTMSK_sessreqintr;
123}
124
125static void usb_flush_tx_fifos(int nums)
126{
127 unsigned int i = 0;
128
129 USB_GRSTCTL = (USB_GRSTCTL & (~USB_GRSTCTL_txfnum_bits))
130 | (nums << USB_GRSTCTL_txfnum_bit_pos)
131 | USB_GRSTCTL_txfflsh_flush;
132 while(USB_GRSTCTL & USB_GRSTCTL_txfflsh_flush && i < 0x300)
133 i++;
134 if(USB_GRSTCTL & USB_GRSTCTL_txfflsh_flush)
135 panicf("usb: hang of flush tx fifos (%x)", nums);
136 /* wait 3 phy clocks */
137 sleep(1);
138}
139
140static void usb_flush_rx_fifo(void)
141{
142 unsigned int i = 0;
143
144 USB_GRSTCTL |= USB_GRSTCTL_rxfflsh_flush;
145 while(USB_GRSTCTL & USB_GRSTCTL_rxfflsh_flush && i < 0x300)
146 i++;
147 if(USB_GRSTCTL & USB_GRSTCTL_rxfflsh_flush)
148 panicf("usb: hang of flush rx fifo");
149 /* wait 3 phy clocks */
150 sleep(1);
151}
152
105static void core_reset(void) 153static void core_reset(void)
106{ 154{
107 unsigned int i = 0; 155 unsigned int i = 0;
@@ -118,26 +166,137 @@ static void core_reset(void)
118 i++; 166 i++;
119 167
120 if(USB_GRSTCTL & USB_GRSTCTL_csftrst) 168 if(USB_GRSTCTL & USB_GRSTCTL_csftrst)
121 { 169 panicf("oops, usb core soft reset hang :(");
122 logf("oops, usb core soft reset hang :(");
123 }
124 170
125 /* Wait for 3 PHY Clocks */ 171 /* Wait for 3 PHY Clocks */
126 /*mdelay(100);*/ 172 /*mdelay(100);*/
127 sleep(1); 173 sleep(1);
128 174
129 logf("%ld endpoints", USB_GHWCFG2_NUM_EP); 175 /* Check hardware capabilityies */
130 for(i = 0; i < USB_GHWCFG2_NUM_EP; i++) 176 if(USB_GHWCFG2_ARCH != USB_INT_DMA_ARCH)
131 logf(" EP%d: IN=%ld OUT=%ld", i, USB_GHWCFG1_IN_EP(i), USB_GHWCFG1_OUT_EP(i)); 177 panicf("usb: wrong architecture (%ld)", USB_GHWCFG2_ARCH);
178 if(USB_GHWCFG2_HS_PHY_TYPE != USB_PHY_TYPE_UTMI)
179 panicf("usb: wrong HS phy type (%ld)", USB_GHWCFG2_HS_PHY_TYPE);
180 if(USB_GHWCFG2_FS_PHY_TYPE != USB_PHY_TYPE_UNSUPPORTED)
181 panicf("usb: wrong FS phy type (%ld)", USB_GHWCFG2_FS_PHY_TYPE);
182 if(USB_GHWCFG2_DYN_FIFO != 1)
183 panicf("usb: no dynamic fifo");
184 if(USB_GHWCFG4_UTMI_PHY_DATA_WIDTH != 0x2)
185 panicf("usb: wrong utmi data width (%ld)", USB_GHWCFG4_UTMI_PHY_DATA_WIDTH);
186 if(USB_GHWCFG4_DED_FIFO_EN != 1) /* it seems to be multiple tx fifo support */
187 panicf("usb: no multiple tx fifo");
188
132 logf("hwcfg1: %08lx", USB_GHWCFG1); 189 logf("hwcfg1: %08lx", USB_GHWCFG1);
133 logf("hwcfg2: %08lx", USB_GHWCFG2); 190 logf("hwcfg2: %08lx", USB_GHWCFG2);
134 logf("hwcfg3: %08lx", USB_GHWCFG3); 191 logf("hwcfg3: %08lx", USB_GHWCFG3);
135 logf("hwcfg4: %08lx", USB_GHWCFG4); 192 logf("hwcfg4: %08lx", USB_GHWCFG4);
136 193
137 logf("%ld in ep", USB_GHWCFG4_NUM_IN_EP); 194 logf("%ld endpoints", USB_GHWCFG2_NUM_EP);
138 logf("tot fifo sz: %ld", USB_GHWCFG3_DFIFO_LEN); 195 usb_num_in_ep = 0;
139 logf("rx fifo sz: %ld", USB_GRXFSIZ); 196 usb_num_out_ep = 0;
140 logf("tx fifo sz: %ld", USB_GNPTXFSIZ >> 16); /* there is no perio ep so print only non-perio */ 197 for(i = 0; i < USB_GHWCFG2_NUM_EP; i++)
198 {
199 if(USB_GHWCFG1_IN_EP(i))
200 usb_num_in_ep++;
201 if(USB_GHWCFG1_OUT_EP(i))
202 usb_num_out_ep++;
203 logf(" EP%d: IN=%ld OUT=%ld", i, USB_GHWCFG1_IN_EP(i), USB_GHWCFG1_OUT_EP(i));
204 }
205
206 if(usb_num_in_ep != USB_GHWCFG4_NUM_IN_EP)
207 panicf("usb: num in ep mismatch(%d,%lu)", usb_num_in_ep, USB_GHWCFG4_NUM_IN_EP);
208
209 logf("%d in ep, %d out ep", usb_num_in_ep, usb_num_out_ep);
210 logf("initial:");
211 logf(" tot fifo sz: %ld", USB_GHWCFG3_DFIFO_LEN);
212 logf(" rx fifo sz: %ld", USB_GRXFSIZ);
213 logf(" tx fifo sz: %ld", USB_GET_FIFOSIZE_DEPTH(USB_GNPTXFSIZ)); /* there is no perio ep so print only non-perio */
214 for(i = 1; i <= USB_GHWCFG4_NUM_IN_EP; i++)
215 {
216 logf(" dieptx fifo sd (%2u): %ld", i, USB_GET_FIFOSIZE_DEPTH(USB_DIEPTXFSIZ(i)));
217 }
218
219 /* Setup FIFOs */
220 /* Organize FIFO as follow (unsure):
221 * 0 -> rxfsize : RX fifo
222 * rxfsize -> rxfsize + nptxfsize : TX fifo for first IN ep
223 * rxfsize + nptxfsize -> rxfsize + 2 * nptxfsize : TX fifo for second IN ep
224 * rxfsize + 2 * nptxfsize -> rxfsize + 3 * nptxfsize : TX fifo for third IN ep
225 * ...
226 */
227
228 unsigned short adr = USB_GRXFSIZ;
229 unsigned short depth = USB_GET_FIFOSIZE_DEPTH(USB_GNPTXFSIZ);
230 USB_GNPTXFSIZ = USB_MAKE_FIFOSIZE_DATA(adr, depth);
231 adr += depth;
232
233 for(i = 1; i <= USB_GHWCFG4_NUM_IN_EP; i++)
234 {
235 depth = USB_GET_FIFOSIZE_DEPTH(USB_DIEPTXFSIZ(i));
236 USB_DIEPTXFSIZ(i) = USB_MAKE_FIFOSIZE_DATA(adr, depth);
237 adr += depth;
238 }
239
240 logf("used:");
241 logf(" rx fifo: [%04x,+%4lx]", 0, USB_GRXFSIZ);
242 logf(" nptx fifo: [%04lx,+%4lx]", USB_GET_FIFOSIZE_START_ADR(USB_GNPTXFSIZ),
243 USB_GET_FIFOSIZE_DEPTH(USB_GNPTXFSIZ));
244 for(i = 1; i <= USB_GHWCFG4_NUM_IN_EP; i++)
245 {
246 logf(" dieptx fifo(%2u): [%04lx,+%4lx]", i,
247 USB_GET_FIFOSIZE_START_ADR(USB_DIEPTXFSIZ(i)),
248 USB_GET_FIFOSIZE_DEPTH(USB_DIEPTXFSIZ(i)));
249 }
250
251 /* flush the fifos */
252 usb_flush_tx_fifos(0x10); /* flush all */
253 usb_flush_rx_fifo();
254
255 /* flush learning queue */
256 USB_GRSTCTL |= USB_GRSTCTL_intknqflsh;
257
258 /* Clear all pending device interrupts */
259 USB_DIEPMSK = 0;
260 USB_DOEPMSK = 0;
261 USB_DAINT = 0xffffffff;
262 USB_DAINTMSK = 0;
263
264 for(i = 0; i <= usb_num_in_ep; i++)
265 {
266 /* disable endpoint if enabled */
267 if(USB_DIEPCTL(i) & USB_DEPCTL_epena)
268 USB_DIEPCTL(i) = USB_DEPCTL_epdis | USB_DEPCTL_snak;
269 else
270 USB_DIEPCTL(i) = 0;
271
272 USB_DIEPTSIZ(i) = 0;
273 USB_DIEPDMA(i) = 0;
274 USB_DIEPINT(i) = 0xff;
275 }
276
277 for(i = 0; i <= usb_num_out_ep; i++)
278 {
279 /* disable endpoint if enabled */
280 if(USB_DOEPCTL(i) & USB_DEPCTL_epena)
281 USB_DOEPCTL(i) = USB_DEPCTL_epdis | USB_DEPCTL_snak;
282 else
283 USB_DOEPCTL(i) = 0;
284
285 USB_DOEPTSIZ(i) = 0;
286 USB_DOEPDMA(i) = 0;
287 USB_DOEPINT(i) = 0xff;
288 }
289}
290
291static void core_dev_init(void)
292{
293 /* Restart the phy clock */
294 USB_PCGCCTL = 0;
295 /* Set phy speed : high speed */
296 USB_DCFG = (USB_DCFG & (~USB_DCFG_devspd_bits)) | USB_DCFG_devspd_hs_phy_hs;
297 /* Set periodic frame interval */
298 USB_DCFG = (USB_DCFG & (~USB_DCFG_perfrint_bits)) | (USB_DCFG_FRAME_INTERVAL_80 << USB_DCFG_perfrint_bit_pos);
299 /* Configure data fifo size */
141} 300}
142 301
143static void core_init(void) 302static void core_init(void)
@@ -169,6 +328,12 @@ static void core_init(void)
169 USB_GAHBCFG |= USB_GAHBCFG_dma_enable; 328 USB_GAHBCFG |= USB_GAHBCFG_dma_enable;
170 /* Disable HNP and SRP, not sure it's useful because we already forced dev mode */ 329 /* Disable HNP and SRP, not sure it's useful because we already forced dev mode */
171 USB_GUSBCFG &= ~(USB_GUSBCFG_SRP_cap | USB_GUSBCFG_HNP_cap); 330 USB_GUSBCFG &= ~(USB_GUSBCFG_SRP_cap | USB_GUSBCFG_HNP_cap);
331
332 /* enable basic interrupts */
333 usb_enable_common_interrupts();
334
335 /* perform device model specific init */
336 core_dev_init();
172} 337}
173 338
174void usb_drv_init(void) 339void usb_drv_init(void)
diff --git a/firmware/target/arm/as3525/usb-drv-as3525v2.h b/firmware/target/arm/as3525/usb-drv-as3525v2.h
index 4abbdb7dc2..ce132ad7b5 100644
--- a/firmware/target/arm/as3525/usb-drv-as3525v2.h
+++ b/firmware/target/arm/as3525/usb-drv-as3525v2.h
@@ -50,19 +50,47 @@
50#define USB_GHWCFG3 (*(volatile unsigned long *)(USB_BASE + 0x04C)) /** User HW Config3 Register */ 50#define USB_GHWCFG3 (*(volatile unsigned long *)(USB_BASE + 0x04C)) /** User HW Config3 Register */
51#define USB_GHWCFG4 (*(volatile unsigned long *)(USB_BASE + 0x050)) /** User HW Config4 Register */ 51#define USB_GHWCFG4 (*(volatile unsigned long *)(USB_BASE + 0x050)) /** User HW Config4 Register */
52 52
53/* 1<=ep<=15, don't use ep=0 !!! */
54/** Device IN Endpoint Transmit FIFO (ep) Size Register */
55#define USB_DIEPTXFSIZ(ep) (*(volatile unsigned long *)(USB_BASE + 0x100 + 4 * (ep)))
56
57#define USB_MAKE_FIFOSIZE_DATA(startadr, depth) \
58 (((startadr) & 0xffff) | ((depth) << 16))
59
60#define USB_GET_FIFOSIZE_DEPTH(data) \
61 ((data) >> 16)
62
63#define USB_GET_FIFOSIZE_START_ADR(data) \
64 ((data) & 0xffff)
65
53#define USB_GRSTCTL_csftrst (1 << 0) /** Core soft reset */ 66#define USB_GRSTCTL_csftrst (1 << 0) /** Core soft reset */
54#define USB_GRSTCTL_hsftrst (1 << 1) /** Hclk soft reset */ 67#define USB_GRSTCTL_hsftrst (1 << 1) /** Hclk soft reset */
68#define USB_GRSTCTL_intknqflsh (1 << 3) /** In Token Sequence Learning Queue Flush */
69#define USB_GRSTCTL_txfnum_bit_pos 6 /** TxFIFO Number */
70#define USB_GRSTCTL_txfnum_bits (0x1f << 6)
71#define USB_GRSTCTL_txfflsh_flush (1 << 5) /** TxFIFO Flush */
72#define USB_GRSTCTL_rxfflsh_flush (1 << 4) /** RxFIFO Flush */
55#define USB_GRSTCTL_ahbidle (1 << 31) /** AHB idle state*/ 73#define USB_GRSTCTL_ahbidle (1 << 31) /** AHB idle state*/
56 74
57#define USB_GHWCFG1_IN_EP(ep) ((USB_GHWCFG1 >> ((ep) *2)) & 0x1) /** 1 if EP(ep) has in cap */ 75#define USB_GHWCFG1_IN_EP(ep) ((USB_GHWCFG1 >> ((ep) *2)) & 0x1) /** 1 if EP(ep) has in cap */
58#define USB_GHWCFG1_OUT_EP(ep) ((USB_GHWCFG1 >> ((ep) *2 + 1)) & 0x1)/** 1 if EP(ep) has out cap */ 76#define USB_GHWCFG1_OUT_EP(ep) ((USB_GHWCFG1 >> ((ep) *2 + 1)) & 0x1)/** 1 if EP(ep) has out cap */
59 77
78#define USB_GHWCFG2_ARCH ((USB_GHWCFG2 >> 3) & 0x3) /** Architecture */
79#define USB_GHWCFG2_HS_PHY_TYPE ((USB_GHWCFG2 >> 6) & 0x3) /** High speed PHY type */
80#define USB_GHWCFG2_FS_PHY_TYPE ((USB_GHWCFG2 >> 8) & 0x3) /** Full speed PHY type */
81#define USB_GHWCFG2_NUM_EP ((USB_GHWCFG2 >> 10) & 0xf) /** Number of endpoints */
82#define USB_GHWCFG2_DYN_FIFO ((USB_GHWCFG2 >> 19) & 0x1) /** Dynamic FIFO */
83
84#define USB_PHY_TYPE_UNSUPPORTED 0
85#define USB_PHY_TYPE_UTMI 1
86#define USB_INT_DMA_ARCH 2
87
60#define USB_GHWCFG3_DFIFO_LEN (USB_GHWCFG3 >> 16) /** Total fifo size */ 88#define USB_GHWCFG3_DFIFO_LEN (USB_GHWCFG3 >> 16) /** Total fifo size */
61 89
90#define USB_GHWCFG4_UTMI_PHY_DATA_WIDTH ((USB_GHWCFG4 >> 14) & 0x3)
91#define USB_GHWCFG4_DED_FIFO_EN ((USB_GHWCFG4 >> 25) & 0x1)
62#define USB_GHWCFG4_NUM_IN_EP ((USB_GHWCFG4 >> 26) & 0xf) /** Number of IN endpoints */ 92#define USB_GHWCFG4_NUM_IN_EP ((USB_GHWCFG4 >> 26) & 0xf) /** Number of IN endpoints */
63 93
64#define USB_GHWCFG2_NUM_EP ((USB_GHWCFG2 >> 10) & 0xf) /** Number of endpoints */
65
66#define USB_GUSBCFG_ulpi_utmi_sel (1 << 4) /** select ulpi:1 or utmi:0 */ 94#define USB_GUSBCFG_ulpi_utmi_sel (1 << 4) /** select ulpi:1 or utmi:0 */
67#define USB_GUSBCFG_phy_if (1 << 3) /** select utmi bus width ? */ 95#define USB_GUSBCFG_phy_if (1 << 3) /** select utmi bus width ? */
68#define USB_GUSBCFG_SRP_cap 0x100 96#define USB_GUSBCFG_SRP_cap 0x100
@@ -72,6 +100,40 @@
72#define USB_GAHBCFG_INT_DMA_BURST_INCR 1 /** note: the linux patch has several other value, this is one picked for internal dma */ 100#define USB_GAHBCFG_INT_DMA_BURST_INCR 1 /** note: the linux patch has several other value, this is one picked for internal dma */
73#define USB_GAHBCFG_dma_enable (1 << 5) 101#define USB_GAHBCFG_dma_enable (1 << 5)
74 102
103#define USB_GINTMSK_usb_rst 0x00001000 /*!< USB Reset Mask */
104#define USB_GINTMSK_EnumDone 0x00000200 /*!< Enumeration Done Mask */
105#define USB_GINTMSK_ErlySusp 0x00000400 /*!< Early Suspend Mask */
106#define USB_GINTMSK_USBSusp 0x00000800 /*!< USB Suspend Mask */
107#define USB_GINTMSK_SOF 0x00000008 /*!< Start of (micro)Frame Mask */
108#define USB_GINTMSK_NPTxFEmp 0x00000020 /*!< Non-periodic TxFIFO Empty Mask */
109
110#define USB_GINTMSK_wkupintr (1 << 31)
111#define USB_GINTMSK_sessreqintr (1 << 30)
112#define USB_GINTMSK_disconnect (1 << 29)
113#define USB_GINTMSK_conidstschng (1 << 28)
114#define USB_GINTMSK_ptxfempty (1 << 26)
115#define USB_GINTMSK_hcintr (1 << 25)
116#define USB_GINTMSK_portintr (1 << 24)
117#define USB_GINTMSK_incomplisoout (1 << 21)
118#define USB_GINTMSK_incomplisoin (1 << 20)
119#define USB_GINTMSK_outepintr (1 << 19)
120#define USB_GINTMSK_inepintr (1 << 18)
121#define USB_GINTMSK_epmismatch (1 << 17)
122#define USB_GINTMSK_eopframe (1 << 15)
123#define USB_GINTMSK_isooutdrop (1 << 14)
124#define USB_GINTMSK_enumdone (1 << 13)
125#define USB_GINTMSK_usbreset (1 << 12)
126#define USB_GINTMSK_usbsuspend (1 << 11)
127#define USB_GINTMSK_erlysuspend (1 << 10)
128#define USB_GINTMSK_i2cintr (1 << 9)
129#define USB_GINTMSK_goutnakeff (1 << 7)
130#define USB_GINTMSK_ginnakeff (1 << 6)
131#define USB_GINTMSK_nptxfempty (1 << 5)
132#define USB_GINTMSK_rxstsqlvl (1 << 4)
133#define USB_GINTMSK_sofintr (1 << 3)
134#define USB_GINTMSK_otgintr (1 << 2)
135#define USB_GINTMSK_modemismatch (1 << 1)
136
75/** 137/**
76 * Device Registers Base Addresses 138 * Device Registers Base Addresses
77 */ 139 */
@@ -86,6 +148,49 @@
86#define USB_DTKNQR2 (*(volatile unsigned long *)(USB_DEVICE + 0x24)) /** Device IN Token Sequence Learning Queue Register 2 */ 148#define USB_DTKNQR2 (*(volatile unsigned long *)(USB_DEVICE + 0x24)) /** Device IN Token Sequence Learning Queue Register 2 */
87#define USB_DTKNQP (*(volatile unsigned long *)(USB_DEVICE + 0x28)) /** Device IN Token Queue Pop register */ 149#define USB_DTKNQP (*(volatile unsigned long *)(USB_DEVICE + 0x28)) /** Device IN Token Queue Pop register */
88 150
151#define USB_DCFG_devspd_bits 0x3
152#define USB_DCFG_devspd_hs_phy_hs 0 /** High speed PHY running at high speed */
153#define USB_DCFG_devspd_hs_phy_fs 1 /** High speed PHY running at full speed */
154#define USB_DCFG_perfrint_bit_pos 11 /** Periodic Frame Interval */
155#define USB_DCFG_perfrint_bits (0x3 << USB_DCFG_perfrint_bit_pos)
156#define USB_DCFG_FRAME_INTERVAL_80 0
157#define USB_DCFG_FRAME_INTERVAL_85 1
158#define USB_DCFG_FRAME_INTERVAL_90 2
159#define USB_DCFG_FRAME_INTERVAL_95 3
160
161/* 0<=ep<=15, you can use ep=0 */
162/** Device IN Endpoint (ep) Control Register */
163#define USB_DIEPCTL(ep) (*(volatile unsigned long *)(USB_DEVICE + 0x100 + (ep) * 0x20))
164/** Device IN Endpoint (ep) Interrupt Register */
165#define USB_DIEPINT(ep) (*(volatile unsigned long *)(USB_DEVICE + 0x100 + (ep) * 0x20 + 0x8))
166/** Device IN Endpoint (ep) Transfer Size Register */
167#define USB_DIEPTSIZ(ep) (*(volatile unsigned long *)(USB_DEVICE + 0x100 + (ep) * 0x20 + 0x10))
168/** Device IN Endpoint (ep) DMA Address Register */
169#define USB_DIEPDMA(ep) (*(volatile unsigned long *)(USB_DEVICE + 0x100 + (ep) * 0x20 + 0x14))
170/** Device IN Endpoint (ep) Transmit FIFO Status Register */
171#define USB_DTXFSTS(ep) (*(volatile unsigned long *)(USB_DEVICE + 0x100 + (ep) * 0x20 + 0x18))
172
173/** Device OUT Endpoint (ep) Control Register */
174#define USB_DOEPCTL(ep) (*(volatile unsigned long *)(USB_DEVICE + 0x300 + (ep) * 0x20))
175/** Device OUT Endpoint (ep) Frame number Register */
176#define USB_DOEPFN(ep) (*(volatile unsigned long *)(USB_DEVICE + 0x300 + (ep) * 0x20 + 0x4))
177/** Device Endpoint (ep) Interrupt Register */
178#define USB_DOEPINT(ep) (*(volatile unsigned long *)(USB_DEVICE + 0x300 + (ep) * 0x20 + 0x8))
179/** Device OUT Endpoint (ep) Transfer Size Register */
180#define USB_DOEPTSIZ(ep) (*(volatile unsigned long *)(USB_DEVICE + 0x300 + (ep) * 0x20 + 0x10))
181/** Device Endpoint (ep) DMA Address Register */
182#define USB_DOEPDMA(ep) (*(volatile unsigned long *)(USB_DEVICE + 0x300 + (ep) * 0x20 + 0x14))
183
89#define USB_PCGCCTL (*(volatile unsigned long *)(USB_BASE + 0xE00)) /** Power and Clock Gating Control Register */ 184#define USB_PCGCCTL (*(volatile unsigned long *)(USB_BASE + 0xE00)) /** Power and Clock Gating Control Register */
90 185
186#define USB_DEPCTL_epena (1 << 31) /** Endpoint enable */
187#define USB_DEPCTL_epdis (1 << 30) /** Endpoint disable */
188#define USB_DEPCTL_snak (1 << 27) /** Set NAK */
189#define USB_DEPCTL_cnak (1 << 28) /** Clear NAK */
190
191/**
192 * Parameters
193 */
194
195
91#endif /* __USB_DRV_AS3525v2_H__ */ 196#endif /* __USB_DRV_AS3525v2_H__ */