diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2009-01-22 22:05:04 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2009-01-22 22:05:04 +0000 |
commit | da76a3469437261bd8857c6eddeaafcc601f373e (patch) | |
tree | 33e6c461aeb03d28575166c5ed5002aaf8ea9741 /firmware/target/arm/imx31/gigabeat-s/usb-imx31.c | |
parent | 81df953da55e75632b5efbe676f2b348e11b2c4b (diff) | |
download | rockbox-da76a3469437261bd8857c6eddeaafcc601f373e.tar.gz rockbox-da76a3469437261bd8857c6eddeaafcc601f373e.zip |
Use bus reset detection for all ARC OTG devices. Remove conflict from LV24020LP driver with some GPIO-by-number macros for PP502x. Start monitoring for USB stack once all core threads and queues are created otherwise queues will likely be registered after USB acks. Putting PP502x system_reboot in IRAM (unmapped, uncached) memory seems to help it work more consistently. Hopefully I got all the PP USB connect handlers in the right spot in irq_handler. If device seems unresponsive to cable, check there first.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19819 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.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/firmware/target/arm/imx31/gigabeat-s/usb-imx31.c b/firmware/target/arm/imx31/gigabeat-s/usb-imx31.c index c0d7cb8d2a..99f3e072eb 100644 --- a/firmware/target/arm/imx31/gigabeat-s/usb-imx31.c +++ b/firmware/target/arm/imx31/gigabeat-s/usb-imx31.c | |||
@@ -53,14 +53,19 @@ 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 | uint32_t status = mc13783_read(MC13783_INTERRUPT_SENSE0); | 64 | int status = usb_plugged() ? USB_INSERTED : USB_EXTRACTED; |
59 | usb_status = (status & MC13783_USB4V4S) ? | 65 | usb_status = status; |
60 | USB_INSERTED : USB_EXTRACTED; | ||
61 | /* Notify power that USB charging is potentially available */ | 66 | /* Notify power that USB charging is potentially available */ |
62 | charger_usb_detect_event(usb_status); | 67 | charger_usb_detect_event(status); |
63 | usb_status_event(usb_status); | 68 | usb_status_event((status == USB_INSERTED) ? USB_POWERED : USB_UNPOWERED); |
64 | } | 69 | } |
65 | 70 | ||
66 | int usb_detect(void) | 71 | int usb_detect(void) |
@@ -68,12 +73,6 @@ int usb_detect(void) | |||
68 | return usb_status; | 73 | return usb_status; |
69 | } | 74 | } |
70 | 75 | ||
71 | /* Read the immediate state of the cable from the PMIC */ | ||
72 | bool usb_plugged(void) | ||
73 | { | ||
74 | return mc13783_read(MC13783_INTERRUPT_SENSE0) & MC13783_USB4V4S; | ||
75 | } | ||
76 | |||
77 | void usb_init_device(void) | 76 | void usb_init_device(void) |
78 | { | 77 | { |
79 | /* Do one-time inits */ | 78 | /* Do one-time inits */ |
@@ -107,7 +106,7 @@ void usb_enable(bool on) | |||
107 | 106 | ||
108 | void usb_attach(void) | 107 | void usb_attach(void) |
109 | { | 108 | { |
110 | usb_enable(true); | 109 | usb_drv_attach(); |
111 | } | 110 | } |
112 | 111 | ||
113 | static void __attribute__((interrupt("IRQ"))) USB_OTG_HANDLER(void) | 112 | static void __attribute__((interrupt("IRQ"))) USB_OTG_HANDLER(void) |
@@ -122,3 +121,9 @@ void usb_drv_int_enable(bool enable) | |||
122 | else | 121 | else |
123 | avic_disable_int(USB_OTG); | 122 | avic_disable_int(USB_OTG); |
124 | } | 123 | } |
124 | |||
125 | /* Called during the bus reset interrupt when in detect mode */ | ||
126 | void usb_drv_usb_detect_event(void) | ||
127 | { | ||
128 | usb_status_event(USB_INSERTED); | ||
129 | } | ||