summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx31/gigabeat-s/usb-imx31.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2008-05-21 08:42:11 +0000
committerMichael Sevakis <jethead71@rockbox.org>2008-05-21 08:42:11 +0000
commita9c20f5789c13b486d217024a020f9d6163e2d51 (patch)
tree5da52ca9cc7a28ba21ced042cb739e6160d5f87b /firmware/target/arm/imx31/gigabeat-s/usb-imx31.c
parent5f796087b009fee1ae60904b0355cc7febe3330f (diff)
downloadrockbox-a9c20f5789c13b486d217024a020f9d6163e2d51.tar.gz
rockbox-a9c20f5789c13b486d217024a020f9d6163e2d51.tar.bz2
rockbox-a9c20f5789c13b486d217024a020f9d6163e2d51.zip
Gigabeat S:
1) Rework event handling and static registration mechanism. No target- specific code in mc13783 driver. GPIO event driver interfaces more cleanly. 2) Somewhat related - enable thread priority for bootloader which is desireable here (ffs is used for GPIO event enabling anyway and that goes along with priority). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17593 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/imx31/gigabeat-s/usb-imx31.c')
-rw-r--r--firmware/target/arm/imx31/gigabeat-s/usb-imx31.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/firmware/target/arm/imx31/gigabeat-s/usb-imx31.c b/firmware/target/arm/imx31/gigabeat-s/usb-imx31.c
index f12fd8f0b1..ad6c77138c 100644
--- a/firmware/target/arm/imx31/gigabeat-s/usb-imx31.c
+++ b/firmware/target/arm/imx31/gigabeat-s/usb-imx31.c
@@ -48,9 +48,10 @@ static void enable_transceiver(bool enable)
}
}
-void usb_set_status(bool plugged)
+void usb_connect_event(void)
{
- usb_status = plugged ? USB_INSERTED : USB_EXTRACTED;
+ uint32_t status = mc13783_read(MC13783_INTERRUPT_SENSE0);
+ usb_status = (status & MC13783_USB4V4S) ? USB_INSERTED : USB_EXTRACTED;
}
int usb_detect(void)
@@ -73,7 +74,11 @@ void usb_init_device(void)
/* Module will be turned off later after firmware init */
usb_drv_startup();
- mc13783_clear(MC13783_INTERRUPT_MASK0, MC13783_USB4V4M);
+ /* Initially poll */
+ usb_connect_event();
+
+ /* Enable PMIC event */
+ mc13783_enable_event(MC13783_USB4V4_EVENT);
}
void usb_enable(bool on)