diff options
-rw-r--r-- | bootloader/gigabeat-s.c | 4 | ||||
-rw-r--r-- | firmware/target/arm/imx31/gigabeat-s/system-target.h | 1 | ||||
-rw-r--r-- | firmware/target/arm/imx31/gigabeat-s/usb-gigabeat-s.c | 9 |
3 files changed, 10 insertions, 4 deletions
diff --git a/bootloader/gigabeat-s.c b/bootloader/gigabeat-s.c index 5b5361530b..909194e1b2 100644 --- a/bootloader/gigabeat-s.c +++ b/bootloader/gigabeat-s.c | |||
@@ -109,7 +109,7 @@ static void handle_usb(int connect_timeout) | |||
109 | break; | 109 | break; |
110 | } | 110 | } |
111 | 111 | ||
112 | if (usb_detect() == USB_EXTRACTED) | 112 | if (usb_plugged() == USB_EXTRACTED) |
113 | break; /* Cable pulled */ | 113 | break; /* Cable pulled */ |
114 | } | 114 | } |
115 | 115 | ||
@@ -376,7 +376,7 @@ void main(void) | |||
376 | 376 | ||
377 | /* Do USB first since a tar or binary could be added to the MTP directory | 377 | /* Do USB first since a tar or binary could be added to the MTP directory |
378 | * at the time and we can untar or move after unplugging. */ | 378 | * at the time and we can untar or move after unplugging. */ |
379 | if (usb_detect() == USB_INSERTED) | 379 | if (usb_plugged() == USB_INSERTED) |
380 | handle_usb(HZ*2); | 380 | handle_usb(HZ*2); |
381 | 381 | ||
382 | handle_untar(); | 382 | handle_untar(); |
diff --git a/firmware/target/arm/imx31/gigabeat-s/system-target.h b/firmware/target/arm/imx31/gigabeat-s/system-target.h index 533b2a1bd3..44a97c7ca9 100644 --- a/firmware/target/arm/imx31/gigabeat-s/system-target.h +++ b/firmware/target/arm/imx31/gigabeat-s/system-target.h | |||
@@ -85,6 +85,7 @@ struct ARM_REGS { | |||
85 | 85 | ||
86 | void dumpregs(void); | 86 | void dumpregs(void); |
87 | 87 | ||
88 | bool usb_plugged(void); | ||
88 | void usb_connect_event(void); | 89 | void usb_connect_event(void); |
89 | 90 | ||
90 | /** Sector read/write filters **/ | 91 | /** Sector read/write filters **/ |
diff --git a/firmware/target/arm/imx31/gigabeat-s/usb-gigabeat-s.c b/firmware/target/arm/imx31/gigabeat-s/usb-gigabeat-s.c index d967cd67f6..b157544016 100644 --- a/firmware/target/arm/imx31/gigabeat-s/usb-gigabeat-s.c +++ b/firmware/target/arm/imx31/gigabeat-s/usb-gigabeat-s.c | |||
@@ -53,11 +53,16 @@ static void enable_transceiver(bool enable) | |||
53 | } | 53 | } |
54 | } | 54 | } |
55 | 55 | ||
56 | /* Read the immediate state of the cable from the PMIC */ | ||
57 | bool usb_plugged(void) | ||
58 | { | ||
59 | return mc13783_read(MC13783_INTERRUPT_SENSE0) & MC13783_USB4V4S; | ||
60 | } | ||
61 | |||
56 | void usb_connect_event(void) | 62 | void usb_connect_event(void) |
57 | { | 63 | { |
58 | /* Read the immediate state of the cable from the PMIC */ | 64 | /* Read the immediate state of the cable from the PMIC */ |
59 | int status = (mc13783_read(MC13783_INTERRUPT_SENSE0) & MC13783_USB4V4S) | 65 | int status = usb_plugged() ? USB_INSERTED : USB_EXTRACTED; |
60 | ? USB_INSERTED : USB_EXTRACTED; | ||
61 | usb_status = status; | 66 | usb_status = status; |
62 | /* Notify power that USB charging is potentially available */ | 67 | /* Notify power that USB charging is potentially available */ |
63 | charger_usb_detect_event(status); | 68 | charger_usb_detect_event(status); |