summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/target/arm/as3525/usb-drv-as3525v2.c75
1 files changed, 2 insertions, 73 deletions
diff --git a/firmware/target/arm/as3525/usb-drv-as3525v2.c b/firmware/target/arm/as3525/usb-drv-as3525v2.c
index d420c113b7..e408236b1a 100644
--- a/firmware/target/arm/as3525/usb-drv-as3525v2.c
+++ b/firmware/target/arm/as3525/usb-drv-as3525v2.c
@@ -155,38 +155,6 @@ static void flush_tx_fifos(int nums)
155 udelay(1); 155 udelay(1);
156} 156}
157 157
158static void flush_rx_fifo(void)
159{
160 unsigned int i = 0;
161
162 GRSTCTL = GRSTCTL_rxfflsh_flush;
163 while(GRSTCTL & GRSTCTL_rxfflsh_flush && i < 0x300)
164 i++;
165 if(GRSTCTL & GRSTCTL_rxfflsh_flush)
166 panicf("usb: hang of flush rx fifo");
167 /* wait 3 phy clocks */
168 udelay(1);
169}
170
171static void core_reset(void)
172{
173 unsigned int i = 0;
174 /* Wait for AHB master IDLE state. */
175 while((GRSTCTL & GRSTCTL_ahbidle) == 0)
176 udelay(10);
177 /* Core Soft Reset */
178 GRSTCTL |= GRSTCTL_csftrst;
179 /* Waits for the hardware to clear reset bit */
180 while(GRSTCTL & GRSTCTL_csftrst && i < 0x300)
181 i++;
182
183 if(GRSTCTL & GRSTCTL_csftrst)
184 panicf("oops, usb core soft reset hang :(");
185
186 /* Wait for 3 PHY Clocks */
187 udelay(1);
188}
189
190static void reset_endpoints(void) 158static void reset_endpoints(void)
191{ 159{
192 int i, ep; 160 int i, ep;
@@ -404,6 +372,8 @@ void usb_drv_init(void)
404void usb_drv_exit(void) 372void usb_drv_exit(void)
405{ 373{
406 logf("usb_drv_exit"); 374 logf("usb_drv_exit");
375
376 disable_global_interrupts();
407} 377}
408 378
409static bool handle_reset(void) 379static bool handle_reset(void)
@@ -480,43 +450,6 @@ static bool handle_out_ep_int(void)
480 return false; 450 return false;
481} 451}
482 452
483static void dump_intsts(char *buffer, size_t size, unsigned long sts)
484{
485 (void) size;
486 buffer[0] = 0;
487 #define DUMP_CASE(name) \
488 if(sts & GINTMSK_##name) strcat(buffer, #name " ");
489
490 DUMP_CASE(modemismatch)
491 DUMP_CASE(otgintr)
492 DUMP_CASE(sofintr)
493 DUMP_CASE(rxstsqlvl)
494 DUMP_CASE(nptxfempty)
495 DUMP_CASE(ginnakeff)
496 DUMP_CASE(goutnakeff)
497 DUMP_CASE(i2cintr)
498 DUMP_CASE(erlysuspend)
499 DUMP_CASE(usbsuspend)
500 DUMP_CASE(usbreset)
501 DUMP_CASE(enumdone)
502 DUMP_CASE(isooutdrop)
503 DUMP_CASE(eopframe)
504 DUMP_CASE(epmismatch)
505 DUMP_CASE(inepintr)
506 DUMP_CASE(outepintr)
507 DUMP_CASE(incomplisoin)
508 DUMP_CASE(incomplisoout)
509 DUMP_CASE(portintr)
510 DUMP_CASE(hcintr)
511 DUMP_CASE(ptxfempty)
512 DUMP_CASE(conidstschng)
513 DUMP_CASE(disconnect)
514 DUMP_CASE(sessreqintr)
515 DUMP_CASE(wkupintr)
516
517 buffer[strlen(buffer) - 1] = 0;
518}
519
520/* interrupt service routine */ 453/* interrupt service routine */
521void INT_USB(void) 454void INT_USB(void)
522{ 455{
@@ -541,12 +474,8 @@ void INT_USB(void)
541 /* device part */ 474 /* device part */
542 HANDLED_CASE(GINTMSK_usbreset, handle_reset) 475 HANDLED_CASE(GINTMSK_usbreset, handle_reset)
543 HANDLED_CASE(GINTMSK_enumdone, handle_enum_done) 476 HANDLED_CASE(GINTMSK_enumdone, handle_enum_done)
544 /*
545 HANDLED_CASE(GINTMSK_inepintr, handle_in_ep_int) 477 HANDLED_CASE(GINTMSK_inepintr, handle_in_ep_int)
546 HANDLED_CASE(GINTMSK_outepintr, handle_out_ep_int) 478 HANDLED_CASE(GINTMSK_outepintr, handle_out_ep_int)
547 */
548 UNHANDLED_CASE(GINTMSK_outepintr)
549 UNHANDLED_CASE(GINTMSK_inepintr)
550 479
551 /* common part */ 480 /* common part */
552 UNHANDLED_CASE(GINTMSK_otgintr) 481 UNHANDLED_CASE(GINTMSK_otgintr)