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
This commit is contained in:
Michael Sevakis 2009-01-19 19:23:59 +00:00
parent 76042cb389
commit 5d1eb8ee31

View file

@ -272,6 +272,7 @@
/* OTGSC Register Bit Masks */
#define OTGSC_B_SESSION_VALID (0x00000800)
#define OTGSC_A_VBUS_VALID (0x00000200)
#define QH_MULT_POS (30)
#define QH_ZLT_SEL (0x20000000)
@ -516,6 +517,9 @@ void usb_drv_int(void)
if (UNLIKELY(usbintr == USBINTR_RESET_EN)) {
/* USB detected - detach and inform */
usb_drv_stop();
/* A false reset may occur upon unplugging, be sure VBUS is above
* the 4V4 threshold. */
if (usb_drv_powered())
usb_drv_usb_detect_event();
}
else
@ -594,7 +598,8 @@ bool usb_drv_connected(void)
bool usb_drv_powered(void)
{
return (REG_OTGSC & OTGSC_B_SESSION_VALID) ? true : false;
/* true = bus 4V4 ok */
return (REG_OTGSC & OTGSC_A_VBUS_VALID) ? true : false;
}
void usb_drv_set_address(int address)