summaryrefslogtreecommitdiff
path: root/firmware/target/arm/usb-drv-arc.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/usb-drv-arc.c')
-rw-r--r--firmware/target/arm/usb-drv-arc.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/firmware/target/arm/usb-drv-arc.c b/firmware/target/arm/usb-drv-arc.c
index b6d6ff154d..15f3bf2c6c 100644
--- a/firmware/target/arm/usb-drv-arc.c
+++ b/firmware/target/arm/usb-drv-arc.c
@@ -419,13 +419,11 @@ static void _usb_drv_init(bool attach)
419 REG_ENDPOINTLISTADDR = (unsigned int)qh_array; 419 REG_ENDPOINTLISTADDR = (unsigned int)qh_array;
420 REG_DEVICEADDR = 0; 420 REG_DEVICEADDR = 0;
421 421
422#ifdef USB_DETECT_BY_DRV
423 if (!attach) { 422 if (!attach) {
424 /* enable RESET interrupt */ 423 /* enable RESET interrupt */
425 REG_USBINTR = USBINTR_RESET_EN; 424 REG_USBINTR = USBINTR_RESET_EN;
426 } 425 }
427 else 426 else
428#endif
429 { 427 {
430 /* enable USB interrupts */ 428 /* enable USB interrupts */
431 REG_USBINTR = 429 REG_USBINTR =
@@ -449,23 +447,17 @@ static void _usb_drv_init(bool attach)
449 (void)attach; 447 (void)attach;
450} 448}
451 449
452/** With USB_DETECT_BY_DRV, attach is distinct from init, otherwise eqivalent. **/
453
454/* USB_DETECT_BY_DRV - enable bus reset detection only
455 * else fully enable driver */
456void usb_drv_init(void) 450void usb_drv_init(void)
457{ 451{
458 _usb_drv_init(false); 452 _usb_drv_init(false);
459} 453}
460 454
461#ifdef USB_DETECT_BY_DRV
462/* fully enable driver */ 455/* fully enable driver */
463void usb_drv_attach(void) 456void usb_drv_attach(void)
464{ 457{
465 sleep(HZ/10); 458 sleep(HZ/10);
466 _usb_drv_init(true); 459 _usb_drv_init(true);
467} 460}
468#endif /* USB_DETECT_BY_DRV */
469 461
470void usb_drv_exit(void) 462void usb_drv_exit(void)
471{ 463{
@@ -513,7 +505,7 @@ void usb_drv_int(void)
513 /* reset interrupt */ 505 /* reset interrupt */
514 if (status & USBSTS_RESET) { 506 if (status & USBSTS_RESET) {
515 REG_USBSTS = USBSTS_RESET; 507 REG_USBSTS = USBSTS_RESET;
516#ifdef USB_DETECT_BY_DRV 508
517 if (UNLIKELY(usbintr == USBINTR_RESET_EN)) { 509 if (UNLIKELY(usbintr == USBINTR_RESET_EN)) {
518 /* USB detected - detach and inform */ 510 /* USB detected - detach and inform */
519 usb_drv_stop(); 511 usb_drv_stop();
@@ -523,7 +515,6 @@ void usb_drv_int(void)
523 usb_drv_usb_detect_event(); 515 usb_drv_usb_detect_event();
524 } 516 }
525 else 517 else
526#endif
527 { 518 {
528 bus_reset(); 519 bus_reset();
529 usb_core_bus_reset(); /* tell mom */ 520 usb_core_bus_reset(); /* tell mom */