summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/pp/usb-fw-pp5002.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/pp/usb-fw-pp5002.c')
-rw-r--r--firmware/target/arm/pp/usb-fw-pp5002.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/firmware/target/arm/pp/usb-fw-pp5002.c b/firmware/target/arm/pp/usb-fw-pp5002.c
index d296b05b2f..d0fbbd6e48 100644
--- a/firmware/target/arm/pp/usb-fw-pp5002.c
+++ b/firmware/target/arm/pp/usb-fw-pp5002.c
@@ -28,12 +28,14 @@
void usb_pin_init(void)
{
- /* TODO: add USB init for iPod 3rd gen */
-
-#if defined(IPOD_1G2G) || defined(IPOD_3G)
+#if defined(IPOD_1G2G)
/* GPIO C bit 7 is firewire detect */
GPIOC_ENABLE |= 0x80;
GPIOC_OUTPUT_EN &= ~0x80;
+#elif defined(IPOD_3G)
+ /* GPIO D bit 4 is USB detect */
+ GPIOD_ENABLE |= 0x10;
+ GPIOD_OUTPUT_EN &= ~0x10;
#endif
}
@@ -62,13 +64,17 @@ void usb_enable(bool on)
int usb_detect(void)
{
-#if defined(IPOD_1G2G) || defined(IPOD_3G)
+#if defined(IPOD_1G2G)
/* GPIO C bit 7 is firewire detect */
if (!(GPIOC_INPUT_VAL & 0x80))
return USB_INSERTED;
#endif
- /* TODO: add USB detection for iPod 3rd gen */
+#if defined(IPOD_3G)
+ /* GPIO D bit 4 is USB detect */
+ if (GPIOD_INPUT_VAL & 0x10)
+ return USB_INSERTED;
+#endif
return USB_EXTRACTED;
}