summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx31/gigabeat-s/usb-imx31.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2008-04-18 16:42:50 +0000
committerMichael Sevakis <jethead71@rockbox.org>2008-04-18 16:42:50 +0000
commit94f7d0f29095e056de281b2159a85e0f4c73d61a (patch)
tree65c9b8476cee034848cab13e5f73561e6fc35254 /firmware/target/arm/imx31/gigabeat-s/usb-imx31.c
parent689d207bfbfe0cbc3d9cc840748ab9f07cc6a721 (diff)
downloadrockbox-94f7d0f29095e056de281b2159a85e0f4c73d61a.tar.gz
rockbox-94f7d0f29095e056de281b2159a85e0f4c73d61a.tar.bz2
rockbox-94f7d0f29095e056de281b2159a85e0f4c73d61a.zip
UMS for the Gigabeat S. Bootloader USB mode. Has a couple quirks 1) First plug has problems if cold. Replug if it doesn't connect or not at high speed 2) Linux doesn't like the odd bootable flag value used in the partitions so it won't mount but Windows works. Fix minor OTG driver bugs and clean up device memory handling. Generic name for ARC controller driver.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17154 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.c39
1 files changed, 36 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 130e884d70..2ef0bc6f6e 100644
--- a/firmware/target/arm/imx31/gigabeat-s/usb-imx31.c
+++ b/firmware/target/arm/imx31/gigabeat-s/usb-imx31.c
@@ -22,17 +22,50 @@
#include "kernel.h"
#include "ata.h"
#include "usb.h"
+#include "usb_core.h"
+#include "clkctl-imx31.h"
+#include "mc13783.h"
-inline int usb_detect(void)
+static int usb_status = USB_EXTRACTED;
+
+void usb_set_status(bool plugged)
+{
+ usb_status = plugged ? USB_INSERTED : USB_EXTRACTED;
+}
+
+int usb_detect(void)
+{
+ return usb_status;
+}
+
+/* Read the immediate state of the cable from the PMIC */
+bool usb_plugged(void)
{
- return USB_EXTRACTED;
+ return mc13783_read(MC13783_INTERRUPT_SENSE0) & MC13783_USB4V4;
}
void usb_init_device(void)
{
+ mc13783_clear(MC13783_INTERRUPT_MASK0, MC13783_USB4V4);
}
void usb_enable(bool on)
{
- (void)on;
+ if (on)
+ {
+ imx31_clkctl_module_clock_gating(CG_USBOTG, CGM_ON_ALL);
+ GPIO3_DR &= ~(1 << 16); /* Reset ISP1504 */
+ GPIO3_DR |= (1 << 16);
+ GPIO1_DR &= ~(1 << 30); /* Select ISP1504 */
+ usb_core_init();
+ }
+ else
+ {
+ /* Module clock should be on since this could be called first */
+ imx31_clkctl_module_clock_gating(CG_USBOTG, CGM_ON_ALL);
+ GPIO1_DR &= ~(1 << 30); /* Select ISP1504 */
+ usb_core_exit();
+ GPIO1_DR |= (1 << 30); /* Deselect ISP1504 */
+ imx31_clkctl_module_clock_gating(CG_USBOTG, CGM_OFF);
+ }
}