summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/export/config.h5
-rw-r--r--firmware/target/arm/as3525/usb-as3525.c21
-rw-r--r--firmware/target/arm/as3525/usb-drv-as3525.c1
3 files changed, 22 insertions, 5 deletions
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 0cc3251c70..8e9afe5937 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -724,8 +724,11 @@ Lyre prototype 1 */
724#if CONFIG_CPU != IMX31L 724#if CONFIG_CPU != IMX31L
725#define INCLUDE_TIMEOUT_API 725#define INCLUDE_TIMEOUT_API
726#endif 726#endif
727#endif /* HAVE_USBSTACK */ 727#endif /* HAVE_USBSTACK && USBOTG_ARC */
728 728
729#if defined(HAVE_USBSTACK) && CONFIG_USBOTG == USBOTG_AS3525
730#define USB_DETECT_BY_DRV
731#endif /* HAVE_USBSTACK && USBOTG_AS3525 */
729 732
730#endif /* BOOTLOADER */ 733#endif /* BOOTLOADER */
731 734
diff --git a/firmware/target/arm/as3525/usb-as3525.c b/firmware/target/arm/as3525/usb-as3525.c
index 45e608a6fe..1c411b074f 100644
--- a/firmware/target/arm/as3525/usb-as3525.c
+++ b/firmware/target/arm/as3525/usb-as3525.c
@@ -29,7 +29,8 @@
29#include "power.h" 29#include "power.h"
30#include "as3525.h" 30#include "as3525.h"
31 31
32static int usb_status = USB_EXTRACTED; 32static bool bus_activity = 0;
33static bool connected = 0;
33 34
34void usb_enable(bool on) 35void usb_enable(bool on)
35{ 36{
@@ -45,12 +46,19 @@ void usb_enable(bool on)
45 46
46void usb_insert_int(void) 47void usb_insert_int(void)
47{ 48{
48 usb_status = USB_INSERTED; 49 connected = 1;
49} 50}
50 51
51void usb_remove_int(void) 52void usb_remove_int(void)
52{ 53{
53 usb_status = USB_EXTRACTED; 54 connected = 0;
55 bus_activity = 0;
56}
57
58void usb_drv_usb_detect_event(void)
59{
60 /* Bus activity seen */
61 bus_activity = 1;
54} 62}
55 63
56int usb_detect(void) 64int usb_detect(void)
@@ -61,5 +69,10 @@ int usb_detect(void)
61 * TODO: Implement USB in rockbox for these players */ 69 * TODO: Implement USB in rockbox for these players */
62 return USB_EXTRACTED; 70 return USB_EXTRACTED;
63#endif 71#endif
64 return usb_status; 72 if(bus_activity && connected)
73 return USB_INSERTED;
74 else if(connected)
75 return USB_POWERED;
76 else
77 return USB_EXTRACTED;
65} 78}
diff --git a/firmware/target/arm/as3525/usb-drv-as3525.c b/firmware/target/arm/as3525/usb-drv-as3525.c
index 3a2cc9df3f..2e5330ec1b 100644
--- a/firmware/target/arm/as3525/usb-drv-as3525.c
+++ b/firmware/target/arm/as3525/usb-drv-as3525.c
@@ -754,6 +754,7 @@ void INT_USB(void)
754 } 754 }
755 if (intr & USB_DEV_INTR_USB_RESET) {/* usb reset from host? */ 755 if (intr & USB_DEV_INTR_USB_RESET) {/* usb reset from host? */
756 logf("usb reset\n"); 756 logf("usb reset\n");
757 usb_drv_usb_detect_event();
757 reset_endpoints(1); 758 reset_endpoints(1);
758 usb_core_bus_reset(); 759 usb_core_bus_reset();
759 intr &= ~USB_DEV_INTR_USB_RESET; 760 intr &= ~USB_DEV_INTR_USB_RESET;