diff options
-rw-r--r-- | firmware/target/arm/usb-fw-pp502x.c | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/firmware/target/arm/usb-fw-pp502x.c b/firmware/target/arm/usb-fw-pp502x.c index e8711a6c26..19f21e12ed 100644 --- a/firmware/target/arm/usb-fw-pp502x.c +++ b/firmware/target/arm/usb-fw-pp502x.c | |||
@@ -106,19 +106,7 @@ | |||
106 | #define USB_GPIO_INT_CLR GPIO_INT_CLR(USB_GPIO) | 106 | #define USB_GPIO_INT_CLR GPIO_INT_CLR(USB_GPIO) |
107 | #define USB_GPIO_HI_INT_MASK GPIO_HI_INT_MASK(USB_GPIO) | 107 | #define USB_GPIO_HI_INT_MASK GPIO_HI_INT_MASK(USB_GPIO) |
108 | 108 | ||
109 | /* Enable raw status pin read only - not interrupt */ | 109 | static void usb_reset_controller(void) |
110 | void usb_pin_init(void) | ||
111 | { | ||
112 | GPIO_CLEAR_BITWISE(USB_GPIO_OUTPUT_EN, USB_GPIO_MASK); | ||
113 | GPIO_SET_BITWISE(USB_GPIO_ENABLE, USB_GPIO_MASK); | ||
114 | #ifdef USB_FIREWIRE_HANDLING | ||
115 | /* GPIO C bit 1 is firewire detect */ | ||
116 | GPIO_CLEAR_BITWISE(GPIOC_OUTPUT_EN, 0x02); | ||
117 | GPIO_SET_BITWISE(GPIOC_ENABLE, 0x02); | ||
118 | #endif | ||
119 | } | ||
120 | |||
121 | void usb_init_device(void) | ||
122 | { | 110 | { |
123 | /* enable usb module */ | 111 | /* enable usb module */ |
124 | outl(inl(0x7000002C) | 0x3000000, 0x7000002C); | 112 | outl(inl(0x7000002C) | 0x3000000, 0x7000002C); |
@@ -139,9 +127,6 @@ void usb_init_device(void) | |||
139 | udelay(100000); | 127 | udelay(100000); |
140 | XMB_RAM_CFG |= 0x47A; | 128 | XMB_RAM_CFG |= 0x47A; |
141 | 129 | ||
142 | /* Do one-time inits */ | ||
143 | usb_drv_startup(); | ||
144 | |||
145 | /* disable USB-devices until USB is detected via GPIO */ | 130 | /* disable USB-devices until USB is detected via GPIO */ |
146 | #ifndef BOOTLOADER | 131 | #ifndef BOOTLOADER |
147 | /* Disabling USB0 in the bootloader makes the OF not load, | 132 | /* Disabling USB0 in the bootloader makes the OF not load, |
@@ -151,6 +136,26 @@ void usb_init_device(void) | |||
151 | DEV_EN &= ~DEV_USB1; | 136 | DEV_EN &= ~DEV_USB1; |
152 | DEV_INIT2 &= ~INIT_USB; | 137 | DEV_INIT2 &= ~INIT_USB; |
153 | #endif | 138 | #endif |
139 | } | ||
140 | |||
141 | /* Enable raw status pin read only - not interrupt */ | ||
142 | void usb_pin_init(void) | ||
143 | { | ||
144 | GPIO_CLEAR_BITWISE(USB_GPIO_OUTPUT_EN, USB_GPIO_MASK); | ||
145 | GPIO_SET_BITWISE(USB_GPIO_ENABLE, USB_GPIO_MASK); | ||
146 | #ifdef USB_FIREWIRE_HANDLING | ||
147 | /* GPIO C bit 1 is firewire detect */ | ||
148 | GPIO_CLEAR_BITWISE(GPIOC_OUTPUT_EN, 0x02); | ||
149 | GPIO_SET_BITWISE(GPIOC_ENABLE, 0x02); | ||
150 | #endif | ||
151 | } | ||
152 | |||
153 | void usb_init_device(void) | ||
154 | { | ||
155 | usb_reset_controller(); | ||
156 | |||
157 | /* Do one-time inits (no dependency on controller) */ | ||
158 | usb_drv_startup(); | ||
154 | 159 | ||
155 | usb_pin_init(); | 160 | usb_pin_init(); |
156 | 161 | ||
@@ -186,14 +191,8 @@ void usb_enable(bool on) | |||
186 | } | 191 | } |
187 | else { | 192 | else { |
188 | usb_core_exit(); | 193 | usb_core_exit(); |
189 | #ifndef BOOTLOADER | ||
190 | /* Disable USB devices */ | 194 | /* Disable USB devices */ |
191 | DEV_RS |= (DEV_USB0 | DEV_USB1); | 195 | usb_reset_controller(); |
192 | DEV_RS &= ~(DEV_USB0 | DEV_USB1); | ||
193 | DEV_EN &=~ DEV_USB0; | ||
194 | DEV_EN &=~ DEV_USB1; | ||
195 | DEV_INIT2 &=~ INIT_USB; | ||
196 | #endif | ||
197 | } | 196 | } |
198 | } | 197 | } |
199 | 198 | ||