diff options
author | Dave Chapman <dave@dchapman.com> | 2009-10-10 15:26:38 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2009-10-10 15:26:38 +0000 |
commit | 8c078f34ffc8b20282263a31d8a7e0c8294a848f (patch) | |
tree | 09e6a3e39eb21b5a5e4d950ff50995a203abffdd /firmware | |
parent | 4ff7666388b58fe06e8de28eb55f54d9bb7afb34 (diff) | |
download | rockbox-8c078f34ffc8b20282263a31d8a7e0c8294a848f.tar.gz rockbox-8c078f34ffc8b20282263a31d8a7e0c8294a848f.zip |
Nano2G - reboot into disk mode when USB is inserted.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23070 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/export/config-ipodnano2g.h | 5 | ||||
-rw-r--r-- | firmware/target/arm/s5l8700/usb-s5l8700.c | 31 |
2 files changed, 25 insertions, 11 deletions
diff --git a/firmware/export/config-ipodnano2g.h b/firmware/export/config-ipodnano2g.h index d9c5cbf3ea..f94584b3cf 100644 --- a/firmware/export/config-ipodnano2g.h +++ b/firmware/export/config-ipodnano2g.h | |||
@@ -3,6 +3,8 @@ | |||
3 | */ | 3 | */ |
4 | #define TARGET_TREE /* this target is using the target tree system */ | 4 | #define TARGET_TREE /* this target is using the target tree system */ |
5 | 5 | ||
6 | #define IPOD_ARCH 1 | ||
7 | |||
6 | /* For Rolo and boot loader */ | 8 | /* For Rolo and boot loader */ |
7 | #define MODEL_NUMBER 62 | 9 | #define MODEL_NUMBER 62 |
8 | 10 | ||
@@ -152,6 +154,9 @@ | |||
152 | /* USB On-the-go */ | 154 | /* USB On-the-go */ |
153 | //#define CONFIG_USBOTG USBOTG_M5636 | 155 | //#define CONFIG_USBOTG USBOTG_M5636 |
154 | 156 | ||
157 | /* We reboot into the OF to handle USB */ | ||
158 | #define USB_HANDLED_BY_OF | ||
159 | |||
155 | /* Define this if you have adjustable CPU frequency */ | 160 | /* Define this if you have adjustable CPU frequency */ |
156 | #define HAVE_ADJUSTABLE_CPU_FREQ | 161 | #define HAVE_ADJUSTABLE_CPU_FREQ |
157 | 162 | ||
diff --git a/firmware/target/arm/s5l8700/usb-s5l8700.c b/firmware/target/arm/s5l8700/usb-s5l8700.c index 6ad4dcea95..c0bf7a951b 100644 --- a/firmware/target/arm/s5l8700/usb-s5l8700.c +++ b/firmware/target/arm/s5l8700/usb-s5l8700.c | |||
@@ -20,6 +20,9 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include "config.h" | 21 | #include "config.h" |
22 | #include "usb.h" | 22 | #include "usb.h" |
23 | #include "cpu.h" | ||
24 | #include "system.h" | ||
25 | #include "string.h" | ||
23 | 26 | ||
24 | void usb_init_device(void) | 27 | void usb_init_device(void) |
25 | { | 28 | { |
@@ -27,21 +30,27 @@ void usb_init_device(void) | |||
27 | 30 | ||
28 | void usb_enable(bool on) | 31 | void usb_enable(bool on) |
29 | { | 32 | { |
30 | (void)on; | 33 | /* This device specific code will eventually give way to proper USB |
31 | } | 34 | handling, which should be the same for all S5L870x targets. */ |
32 | 35 | if (on) | |
33 | void usb_attach(void) | 36 | { |
34 | { | 37 | #ifdef IPOD_ARCH |
38 | /* For iPod, we can only do one thing with USB mode atm - reboot | ||
39 | into the flash-based disk-mode. This does not return. */ | ||
35 | 40 | ||
36 | } | 41 | memcpy((void *)0x0002bf00, "diskmodehotstuff\1\0\0\0", 20); |
37 | 42 | ||
38 | static bool usb_pin_state(void) | 43 | system_reboot(); /* Reboot */ |
39 | { | 44 | #endif |
40 | return false; | 45 | } |
41 | } | 46 | } |
42 | 47 | ||
43 | /* detect host or charger (INSERTED or EXTRACTED) */ | ||
44 | int usb_detect(void) | 48 | int usb_detect(void) |
45 | { | 49 | { |
46 | return usb_pin_state() ? USB_INSERTED : USB_EXTRACTED; | 50 | #if defined(IPOD_NANO2G) |
51 | if ((PDAT14 & 0x8) == 0x0) | ||
52 | return USB_INSERTED; | ||
53 | #endif | ||
54 | |||
55 | return USB_EXTRACTED; | ||
47 | } | 56 | } |