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/delay.h>
14 #include <linux/platform_device.h>
15 #include <linux/clk.h>
16 #include <linux/err.h>
17 #include <linux/gpio.h>
18 #include <linux/usb/musb.h>
19 #include <mach/gpmc.h>
22 #define TUSB_ASYNC_CS 1
23 #define TUSB_SYNC_CS 4
24 #define GPIO_TUSB_INT 58
25 #define GPIO_TUSB_ENABLE 0
27 static int tusb_set_power(int state
);
28 static int tusb_set_clock(struct clk
*osc_ck
, int state
);
30 #if defined(CONFIG_USB_MUSB_OTG)
31 # define BOARD_MODE MUSB_OTG
32 #elif defined(CONFIG_USB_MUSB_PERIPHERAL)
33 # define BOARD_MODE MUSB_PERIPHERAL
34 #else /* defined(CONFIG_USB_MUSB_HOST) */
35 # define BOARD_MODE MUSB_HOST
38 static struct musb_hdrc_eps_bits musb_eps
[] = {
71 static struct musb_hdrc_config musb_config
= {
82 static struct musb_hdrc_platform_data tusb_data
= {
84 .set_power
= tusb_set_power
,
85 .set_clock
= tusb_set_clock
,
86 .min_power
= 25, /* x2 = 50 mA drawn from VBUS as peripheral */
87 .power
= 100, /* Max 100 mA VBUS for host mode */
89 .config
= &musb_config
,
93 * Enable or disable power to TUSB6010. When enabling, turn on 3.3 V and
94 * 1.5 V voltage regulators of PM companion chip. Companion chip will then
95 * provide then PGOOD signal to TUSB6010 which will release it from reset.
97 static int tusb_set_power(int state
)
102 gpio_set_value(GPIO_TUSB_ENABLE
, 1);
105 /* Wait until TUSB6010 pulls INT pin down */
107 while (i
&& gpio_get_value(GPIO_TUSB_INT
)) {
113 printk(KERN_ERR
"tusb: powerup failed\n");
117 gpio_set_value(GPIO_TUSB_ENABLE
, 0);
124 static int osc_ck_on
;
126 static int tusb_set_clock(struct clk
*osc_ck
, int state
)
147 void __init
n800_usb_init(void)
150 static char announce
[] __initdata
= KERN_INFO
"TUSB 6010\n";
152 /* PM companion chip power control pin */
153 ret
= gpio_request(GPIO_TUSB_ENABLE
, "TUSB6010 enable");
155 printk(KERN_ERR
"Could not get TUSB power GPIO%i\n",
159 gpio_direction_output(GPIO_TUSB_ENABLE
, 0);
163 ret
= tusb6010_setup_interface(&tusb_data
, TUSB6010_REFCLK_19
, 2,
164 TUSB_ASYNC_CS
, TUSB_SYNC_CS
,
165 GPIO_TUSB_INT
, 0x3f);
174 gpio_free(GPIO_TUSB_ENABLE
);