aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1/board-htcherald.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap1/board-htcherald.c')
-rw-r--r--arch/arm/mach-omap1/board-htcherald.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/arch/arm/mach-omap1/board-htcherald.c b/arch/arm/mach-omap1/board-htcherald.c
index 5f28a5ceacac..e36639f66150 100644
--- a/arch/arm/mach-omap1/board-htcherald.c
+++ b/arch/arm/mach-omap1/board-htcherald.c
@@ -39,6 +39,7 @@
39#include <plat/common.h> 39#include <plat/common.h>
40#include <plat/board.h> 40#include <plat/board.h>
41#include <plat/keypad.h> 41#include <plat/keypad.h>
42#include <plat/usb.h>
42 43
43#include <mach/irqs.h> 44#include <mach/irqs.h>
44 45
@@ -140,6 +141,15 @@ static struct platform_device kp_device = {
140 .resource = kp_resources, 141 .resource = kp_resources,
141}; 142};
142 143
144/* USB Device */
145static struct omap_usb_config htcherald_usb_config __initdata = {
146 .otg = 0,
147 .register_host = 0,
148 .register_dev = 1,
149 .hmc_mode = 4,
150 .pins[0] = 2,
151};
152
143/* LCD Device resources */ 153/* LCD Device resources */
144static struct platform_device lcd_device = { 154static struct platform_device lcd_device = {
145 .name = "lcd_htcherald", 155 .name = "lcd_htcherald",
@@ -214,6 +224,57 @@ static void __init htcherald_disable_watchdog(void)
214 } 224 }
215} 225}
216 226
227#define HTCHERALD_GPIO_USB_EN1 33
228#define HTCHERALD_GPIO_USB_EN2 73
229#define HTCHERALD_GPIO_USB_DM 35
230#define HTCHERALD_GPIO_USB_DP 36
231
232static void __init htcherald_usb_enable(void)
233{
234 unsigned int tries = 20;
235 unsigned int value = 0;
236
237 /* Request the GPIOs we need to control here */
238 if (gpio_request(HTCHERALD_GPIO_USB_EN1, "herald_usb") < 0)
239 goto err1;
240
241 if (gpio_request(HTCHERALD_GPIO_USB_EN2, "herald_usb") < 0)
242 goto err2;
243
244 if (gpio_request(HTCHERALD_GPIO_USB_DM, "herald_usb") < 0)
245 goto err3;
246
247 if (gpio_request(HTCHERALD_GPIO_USB_DP, "herald_usb") < 0)
248 goto err4;
249
250 /* force USB_EN GPIO to 0 */
251 do {
252 /* output low */
253 gpio_direction_output(HTCHERALD_GPIO_USB_EN1, 0);
254 } while ((value = gpio_get_value(HTCHERALD_GPIO_USB_EN1)) == 1 &&
255 --tries);
256
257 if (value == 1)
258 printk(KERN_WARNING "Unable to reset USB, trying to continue\n");
259
260 gpio_direction_output(HTCHERALD_GPIO_USB_EN2, 0); /* output low */
261 gpio_direction_input(HTCHERALD_GPIO_USB_DM); /* input */
262 gpio_direction_input(HTCHERALD_GPIO_USB_DP); /* input */
263
264 goto done;
265
266err4:
267 gpio_free(HTCHERALD_GPIO_USB_DM);
268err3:
269 gpio_free(HTCHERALD_GPIO_USB_EN2);
270err2:
271 gpio_free(HTCHERALD_GPIO_USB_EN1);
272err1:
273 printk(KERN_ERR "Unabled to request GPIO for USB\n");
274done:
275 printk(KERN_INFO "USB setup complete.\n");
276}
277
217static void __init htcherald_init(void) 278static void __init htcherald_init(void)
218{ 279{
219 printk(KERN_INFO "HTC Herald init.\n"); 280 printk(KERN_INFO "HTC Herald init.\n");
@@ -225,6 +286,9 @@ static void __init htcherald_init(void)
225 platform_add_devices(devices, ARRAY_SIZE(devices)); 286 platform_add_devices(devices, ARRAY_SIZE(devices));
226 287
227 htcherald_disable_watchdog(); 288 htcherald_disable_watchdog();
289
290 htcherald_usb_enable();
291 omap_usb_init(&htcherald_usb_config);
228} 292}
229 293
230static void __init htcherald_init_irq(void) 294static void __init htcherald_init_irq(void)