aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1/board-htcherald.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-12 14:40:13 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-12 14:40:13 -0500
commit9c3936cb694ffd559c80dc3eb75b61f769a39259 (patch)
treecc034c09e359e43b4ff01efabc7ce47602d80acf /arch/arm/mach-omap1/board-htcherald.c
parent5de76b18d1a7193c49c1a4ee72261421a17de57c (diff)
parent5ccf197859d6f6bcf56e85657019503b2d95767a (diff)
Merge branch 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6
* 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6: (75 commits) omap3: Fix OMAP35XX_REV macros omap: serial: fix non-empty uart fifo read abort omap3: Zoom2/3: Update hsmmc board config params omap3 : Enable TWL4030 Keypad for Zoom2 and Zoom3 boards omap3: id code detection 3525 vs 3515 omap3: rx51: Use wl1251 in SPI mode 3 omap3: zoom2/3: make MMC slot work again omap1: htcherald: Update defconfig to include mux support omap1: LCD_DMA: Use some define rather than a hexadecimal omap: header: remove unused data-type omap: arch/arm/plat-omap/devices.c - sort alphabetically omap: Correcting GPMC_CONFIG1_DEVICETYPE_NAND OMAP3: serial - allow platforms specify which UARTs to initialize omap3: cm-t35: add mux initialization OMAP4: Sync up omap4430 defconfig OMAP4: Remove the secondary wait loop OMAP4: AuxCoreBoot registers only accessible in secure mode OMAP4: Fix SRAM base and size OMAP4: Fix cpu detection omap3: pandora: board file updates for .33 ...
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)