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/usb/musb.h>
18 #include <asm/arch/gpmc.h>
19 #include <asm/arch/gpio.h>
20 #include <asm/arch/pm.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_platform_data tusb_data = {
41 .set_power = tusb_set_power,
42 .set_clock = tusb_set_clock,
43 .min_power = 25, /* x2 = 50 mA drawn from VBUS as peripheral */
44 .power = 100, /* Max 100 mA VBUS for host mode */
49 * Enable or disable power to TUSB6010. When enabling, turn on 3.3 V and
50 * 1.5 V voltage regulators of PM companion chip. Companion chip will then
51 * provide then PGOOD signal to TUSB6010 which will release it from reset.
53 static int tusb_set_power(int state)
58 omap_set_gpio_dataout(GPIO_TUSB_ENABLE, 1);
61 /* Wait until TUSB6010 pulls INT pin down */
63 while (i && omap_get_gpio_datain(GPIO_TUSB_INT)) {
69 printk(KERN_ERR "tusb: powerup failed\n");
73 omap_set_gpio_dataout(GPIO_TUSB_ENABLE, 0);
82 static int tusb_set_clock(struct clk *osc_ck, int state)
103 void __init n800_usb_init(void)
106 static char announce[] __initdata = KERN_INFO "TUSB 6010\n";
108 /* PM companion chip power control pin */
109 ret = omap_request_gpio(GPIO_TUSB_ENABLE);
111 printk(KERN_ERR "Could not get TUSB power GPIO%i\n",
115 omap_set_gpio_direction(GPIO_TUSB_ENABLE, 0);
119 ret = tusb6010_setup_interface(&tusb_data, TUSB6010_REFCLK_19, 2,
120 TUSB_ASYNC_CS, TUSB_SYNC_CS,
121 GPIO_TUSB_INT, 0x3f);
130 omap_free_gpio(GPIO_TUSB_ENABLE);