summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2009-01-19 19:23:59 +0000
committerMichael Sevakis <jethead71@rockbox.org>2009-01-19 19:23:59 +0000
commit5d1eb8ee3193c0b0c779258e754218929fa09723 (patch)
tree279a9fcc48e9c8a409e22fe09d25351a2229d6ac
parent76042cb389d18726c60103a5d0d84ad756a56143 (diff)
downloadrockbox-5d1eb8ee3193c0b0c779258e754218929fa09723.tar.gz
rockbox-5d1eb8ee3193c0b0c779258e754218929fa09723.zip
This should take care of resetting when unplugging on e200 as reported in FS#9812. Be sure VBUS is valid before posting insert message as a spurious reset can occur. It seems to fix it for me (tested by insulating D+/D- pins).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19800 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/usb-drv-arc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/firmware/target/arm/usb-drv-arc.c b/firmware/target/arm/usb-drv-arc.c
index 99845c2a49..b6d6ff154d 100644
--- a/firmware/target/arm/usb-drv-arc.c
+++ b/firmware/target/arm/usb-drv-arc.c
@@ -272,6 +272,7 @@
272 272
273/* OTGSC Register Bit Masks */ 273/* OTGSC Register Bit Masks */
274#define OTGSC_B_SESSION_VALID (0x00000800) 274#define OTGSC_B_SESSION_VALID (0x00000800)
275#define OTGSC_A_VBUS_VALID (0x00000200)
275 276
276#define QH_MULT_POS (30) 277#define QH_MULT_POS (30)
277#define QH_ZLT_SEL (0x20000000) 278#define QH_ZLT_SEL (0x20000000)
@@ -516,7 +517,10 @@ void usb_drv_int(void)
516 if (UNLIKELY(usbintr == USBINTR_RESET_EN)) { 517 if (UNLIKELY(usbintr == USBINTR_RESET_EN)) {
517 /* USB detected - detach and inform */ 518 /* USB detected - detach and inform */
518 usb_drv_stop(); 519 usb_drv_stop();
519 usb_drv_usb_detect_event(); 520 /* A false reset may occur upon unplugging, be sure VBUS is above
521 * the 4V4 threshold. */
522 if (usb_drv_powered())
523 usb_drv_usb_detect_event();
520 } 524 }
521 else 525 else
522#endif 526#endif
@@ -594,7 +598,8 @@ bool usb_drv_connected(void)
594 598
595bool usb_drv_powered(void) 599bool usb_drv_powered(void)
596{ 600{
597 return (REG_OTGSC & OTGSC_B_SESSION_VALID) ? true : false; 601 /* true = bus 4V4 ok */
602 return (REG_OTGSC & OTGSC_A_VBUS_VALID) ? true : false;
598} 603}
599 604
600void usb_drv_set_address(int address) 605void usb_drv_set_address(int address)