2 * linux/arch/arm/mach-omap2/board-n800-usb.c
4 * Copyright (C) 2006 Nokia Corporation
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
12 #include <linux/types.h>
13 #include <linux/errno.h>
14 #include <linux/delay.h>
15 #include <linux/platform_device.h>
16 #include <linux/usb/musb.h>
17 #include <asm/arch/gpmc.h>
18 #include <asm/arch/gpio.h>
20 #define TUSB_ASYNC_CS 1
21 #define TUSB_SYNC_CS 4
22 #define GPIO_TUSB_INT 58
23 #define GPIO_TUSB_ENABLE 0
25 static int tusb_set_power(int state);
27 #if defined(CONFIG_USB_MUSB_OTG)
28 # define BOARD_MODE MUSB_OTG
29 #elif defined(CONFIG_USB_MUSB_PERIPHERAL)
30 # define BOARD_MODE MUSB_PERIPHERAL
31 #else /* defined(CONFIG_USB_MUSB_HOST) */
32 # define BOARD_MODE MUSB_HOST
35 static struct musb_hdrc_platform_data tusb_data = {
38 .set_power = tusb_set_power,
39 .min_power = 25, /* x2 = 50 mA drawn from VBUS as peripheral */
43 * Enable or disable power to TUSB6010. When enabling, turn on 3.3 V and
44 * 1.5 V voltage regulators of PM companion chip. Companion chip will then
45 * provide then PGOOD signal to TUSB6010 which will release it from reset.
47 static int tusb_set_power(int state)
52 omap_set_gpio_dataout(GPIO_TUSB_ENABLE, 1);
55 /* Wait until TUSB6010 pulls INT pin down */
57 while (i && omap_get_gpio_datain(GPIO_TUSB_INT)) {
63 printk(KERN_ERR "tusb: powerup failed\n");
67 omap_set_gpio_dataout(GPIO_TUSB_ENABLE, 0);
74 void __init n800_usb_init(void)
77 static char announce[] __initdata = KERN_INFO "TUSB 6010\n";
79 /* PM companion chip power control pin */
80 ret = omap_request_gpio(GPIO_TUSB_ENABLE);
82 printk(KERN_ERR "Could not get TUSB power GPIO%i\n",
86 omap_set_gpio_direction(GPIO_TUSB_ENABLE, 0);
90 ret = tusb6010_setup_interface(&tusb_data, TUSB6010_REFCLK_19, 2,
91 TUSB_ASYNC_CS, TUSB_SYNC_CS,
101 omap_free_gpio(GPIO_TUSB_ENABLE);