Use bus reset detection for all ARC OTG devices. Remove conflict from LV24020LP driver with some GPIO-by-number macros for PP502x. Start monitoring for USB stack once all core threads and queues are created otherwise queues will likely be registered after USB acks. Putting PP502x system_reboot in IRAM (unmapped, uncached) memory seems to help it work more consistently. Hopefully I got all the PP USB connect handlers in the right spot in irq_handler. If device seems unresponsive to cable, check there first.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19819 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sevakis 2009-01-22 22:05:04 +00:00
parent 81df953da5
commit da76a34694
16 changed files with 345 additions and 188 deletions

View file

@ -53,14 +53,19 @@ static void enable_transceiver(bool enable)
}
}
/* Read the immediate state of the cable from the PMIC */
bool usb_plugged(void)
{
return mc13783_read(MC13783_INTERRUPT_SENSE0) & MC13783_USB4V4S;
}
void usb_connect_event(void)
{
uint32_t status = mc13783_read(MC13783_INTERRUPT_SENSE0);
usb_status = (status & MC13783_USB4V4S) ?
USB_INSERTED : USB_EXTRACTED;
int status = usb_plugged() ? USB_INSERTED : USB_EXTRACTED;
usb_status = status;
/* Notify power that USB charging is potentially available */
charger_usb_detect_event(usb_status);
usb_status_event(usb_status);
charger_usb_detect_event(status);
usb_status_event((status == USB_INSERTED) ? USB_POWERED : USB_UNPOWERED);
}
int usb_detect(void)
@ -68,12 +73,6 @@ int usb_detect(void)
return usb_status;
}
/* Read the immediate state of the cable from the PMIC */
bool usb_plugged(void)
{
return mc13783_read(MC13783_INTERRUPT_SENSE0) & MC13783_USB4V4S;
}
void usb_init_device(void)
{
/* Do one-time inits */
@ -107,7 +106,7 @@ void usb_enable(bool on)
void usb_attach(void)
{
usb_enable(true);
usb_drv_attach();
}
static void __attribute__((interrupt("IRQ"))) USB_OTG_HANDLER(void)
@ -122,3 +121,9 @@ void usb_drv_int_enable(bool enable)
else
avic_disable_int(USB_OTG);
}
/* Called during the bus reset interrupt when in detect mode */
void usb_drv_usb_detect_event(void)
{
usb_status_event(USB_INSERTED);
}

View file

@ -25,9 +25,6 @@
#define USB_DRIVER_CLOSE
#endif
/* Connect by events, not by tick polling */
#define USB_STATUS_BY_EVENT
void usb_connect_event(void);
void usb_init_device(void);
int usb_detect(void);