aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorFrancisco Alecrim <francisco.alecrim@openbossa.org>2010-03-10 21:52:24 -0500
committerTony Lindgren <tony@atomide.com>2010-03-11 13:22:39 -0500
commit97b9ad1633ed3724e0563d250850763d20275da7 (patch)
treef7902dfc30c854c69a02b0e2e5ea5096e121b135 /arch
parentd660f9a26ef81c3bbced92514ffbe82e1b882ee1 (diff)
omap2: add USB initialization for tusb6010
Based on Kalle's and Tony's patches. Some variables re-organized and unused code removed. Signed-off-by: Kalle Valo <kalle.valo@iki.fi> Signed-off-by: Francisco Alecrim <francisco.alecrim@openbossa.org> [tony@atomide.com: this is needed to fix the related tusb6010 DMA API changes] Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/board-n8x0.c98
-rw-r--r--arch/arm/mach-omap2/clock2420_data.c1
2 files changed, 99 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index 4cab0522d7ce..da9bcb898991 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -37,6 +37,103 @@ static int slot1_cover_open;
37static int slot2_cover_open; 37static int slot2_cover_open;
38static struct device *mmc_device; 38static struct device *mmc_device;
39 39
40#define TUSB6010_ASYNC_CS 1
41#define TUSB6010_SYNC_CS 4
42#define TUSB6010_GPIO_INT 58
43#define TUSB6010_GPIO_ENABLE 0
44#define TUSB6010_DMACHAN 0x3f
45
46#if defined(CONFIG_USB_TUSB6010) || \
47 defined(CONFIG_USB_TUSB6010_MODULE)
48/*
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.
52 */
53static int tusb_set_power(int state)
54{
55 int i, retval = 0;
56
57 if (state) {
58 gpio_set_value(TUSB6010_GPIO_ENABLE, 1);
59 msleep(1);
60
61 /* Wait until TUSB6010 pulls INT pin down */
62 i = 100;
63 while (i && gpio_get_value(TUSB6010_GPIO_INT)) {
64 msleep(1);
65 i--;
66 }
67
68 if (!i) {
69 printk(KERN_ERR "tusb: powerup failed\n");
70 retval = -ENODEV;
71 }
72 } else {
73 gpio_set_value(TUSB6010_GPIO_ENABLE, 0);
74 msleep(10);
75 }
76
77 return retval;
78}
79
80static struct musb_hdrc_config musb_config = {
81 .multipoint = 1,
82 .dyn_fifo = 1,
83 .num_eps = 16,
84 .ram_bits = 12,
85};
86
87static struct musb_hdrc_platform_data tusb_data = {
88#if defined(CONFIG_USB_MUSB_OTG)
89 .mode = MUSB_OTG,
90#elif defined(CONFIG_USB_MUSB_PERIPHERAL)
91 .mode = MUSB_PERIPHERAL,
92#else /* defined(CONFIG_USB_MUSB_HOST) */
93 .mode = MUSB_HOST,
94#endif
95 .set_power = tusb_set_power,
96 .min_power = 25, /* x2 = 50 mA drawn from VBUS as peripheral */
97 .power = 100, /* Max 100 mA VBUS for host mode */
98 .config = &musb_config,
99};
100
101static void __init n8x0_usb_init(void)
102{
103 int ret = 0;
104 static char announce[] __initdata = KERN_INFO "TUSB 6010\n";
105
106 /* PM companion chip power control pin */
107 ret = gpio_request(TUSB6010_GPIO_ENABLE, "TUSB6010 enable");
108 if (ret != 0) {
109 printk(KERN_ERR "Could not get TUSB power GPIO%i\n",
110 TUSB6010_GPIO_ENABLE);
111 return;
112 }
113 gpio_direction_output(TUSB6010_GPIO_ENABLE, 0);
114
115 tusb_set_power(0);
116
117 ret = tusb6010_setup_interface(&tusb_data, TUSB6010_REFCLK_19, 2,
118 TUSB6010_ASYNC_CS, TUSB6010_SYNC_CS,
119 TUSB6010_GPIO_INT, TUSB6010_DMACHAN);
120 if (ret != 0)
121 goto err;
122
123 printk(announce);
124
125 return;
126
127err:
128 gpio_free(TUSB6010_GPIO_ENABLE);
129}
130#else
131
132static void __init n8x0_usb_init(void) {}
133
134#endif /*CONFIG_USB_TUSB6010 */
135
136
40static struct omap2_mcspi_device_config p54spi_mcspi_config = { 137static struct omap2_mcspi_device_config p54spi_mcspi_config = {
41 .turbo_mode = 0, 138 .turbo_mode = 0,
42 .single_channel = 1, 139 .single_channel = 1,
@@ -562,6 +659,7 @@ static void __init n8x0_init_machine(void)
562 n8x0_menelaus_init(); 659 n8x0_menelaus_init();
563 n8x0_onenand_init(); 660 n8x0_onenand_init();
564 n8x0_mmc_init(); 661 n8x0_mmc_init();
662 n8x0_usb_init();
565} 663}
566 664
567MACHINE_START(NOKIA_N800, "Nokia N800") 665MACHINE_START(NOKIA_N800, "Nokia N800")
diff --git a/arch/arm/mach-omap2/clock2420_data.c b/arch/arm/mach-omap2/clock2420_data.c
index f12af95ead45..d932b142d0b6 100644
--- a/arch/arm/mach-omap2/clock2420_data.c
+++ b/arch/arm/mach-omap2/clock2420_data.c
@@ -1841,6 +1841,7 @@ static struct omap_clk omap2420_clks[] = {
1841 CLK(NULL, "aes_ick", &aes_ick, CK_242X), 1841 CLK(NULL, "aes_ick", &aes_ick, CK_242X),
1842 CLK(NULL, "pka_ick", &pka_ick, CK_242X), 1842 CLK(NULL, "pka_ick", &pka_ick, CK_242X),
1843 CLK(NULL, "usb_fck", &usb_fck, CK_242X), 1843 CLK(NULL, "usb_fck", &usb_fck, CK_242X),
1844 CLK("musb_hdrc", "fck", &osc_ck, CK_242X),
1844}; 1845};
1845 1846
1846/* 1847/*