aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorFelipe Balbi <felipe.balbi@nokia.com>2009-11-22 13:11:01 -0500
committerTony Lindgren <tony@atomide.com>2009-11-22 13:24:32 -0500
commit58a5491c936957011c92f8cc5097fb3231ee3f9c (patch)
tree8fd45f11ec46785900635279e40fca62cda8ecb5 /arch
parent83720a8230f87008deba8619428438f0276b83ca (diff)
omap: Add platform init code for EHCI driver
Add platform init code for EHCI driver. Various fixes to the original patch by Ajay Kumar Gupta <ajay.gupta@ti.com> and Anand Gadiyar <gadiyar@ti.com>. Overo support added by Olof Johansson <olof@lixom.net> Beagle support added by Koen Kooi <koen@beagleboard.org> CM-T32 support added by Mike Rapoport <mike@compulab.co.il> Signed-off-by: Signed-off-by: Olof Johansson <olof@lixom.net> Acked-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Koen Kooi <koen@beagleboard.org> Signed-off-by: Mike Rapoport <mike@compulab.co.il> Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com> Signed-off-by: Anand Gadiyar <gadiyar@ti.com> Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/Makefile1
-rw-r--r--arch/arm/mach-omap2/board-3430sdp.c13
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c13
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c15
-rw-r--r--arch/arm/mach-omap2/board-omap3pandora.c13
-rw-r--r--arch/arm/mach-omap2/board-overo.c21
-rw-r--r--arch/arm/mach-omap2/usb-ehci.c192
-rw-r--r--arch/arm/plat-omap/include/plat/omap34xx.h6
8 files changed, 265 insertions, 9 deletions
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 1d54ad349bfd..5c32b650ae12 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -80,6 +80,7 @@ obj-$(CONFIG_MACH_OMAP_4430SDP) += board-4430sdp.o
80# Platform specific device init code 80# Platform specific device init code
81obj-y += usb-musb.o 81obj-y += usb-musb.o
82obj-$(CONFIG_MACH_OMAP2_TUSB6010) += usb-tusb6010.o 82obj-$(CONFIG_MACH_OMAP2_TUSB6010) += usb-tusb6010.o
83obj-y += usb-ehci.o
83 84
84onenand-$(CONFIG_MTD_ONENAND_OMAP2) := gpmc-onenand.o 85onenand-$(CONFIG_MTD_ONENAND_OMAP2) := gpmc-onenand.o
85obj-y += $(onenand-m) $(onenand-y) 86obj-y += $(onenand-m) $(onenand-y)
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index 4f052982b7cc..491364e44c7d 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -494,6 +494,18 @@ static void enable_board_wakeup_source(void)
494 omap_cfg_reg(AF26_34XX_SYS_NIRQ); /* T2 interrupt line (keypad) */ 494 omap_cfg_reg(AF26_34XX_SYS_NIRQ); /* T2 interrupt line (keypad) */
495} 495}
496 496
497static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
498
499 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
500 .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
501 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
502
503 .phy_reset = true,
504 .reset_gpio_port[0] = 57,
505 .reset_gpio_port[1] = 61,
506 .reset_gpio_port[2] = -EINVAL
507};
508
497static void __init omap_3430sdp_init(void) 509static void __init omap_3430sdp_init(void)
498{ 510{
499 omap3430_i2c_init(); 511 omap3430_i2c_init();
@@ -510,6 +522,7 @@ static void __init omap_3430sdp_init(void)
510 usb_musb_init(); 522 usb_musb_init();
511 board_smc91x_init(); 523 board_smc91x_init();
512 enable_board_wakeup_source(); 524 enable_board_wakeup_source();
525 usb_ehci_init(&ehci_pdata);
513} 526}
514 527
515static void __init omap_3430sdp_map_io(void) 528static void __init omap_3430sdp_map_io(void)
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 4e69f8ed30dc..41480bd0e58a 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -410,6 +410,18 @@ static void __init omap3beagle_flash_init(void)
410 } 410 }
411} 411}
412 412
413static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
414
415 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
416 .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
417 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
418
419 .phy_reset = true,
420 .reset_gpio_port[0] = -EINVAL,
421 .reset_gpio_port[1] = 147,
422 .reset_gpio_port[2] = -EINVAL
423};
424
413static void __init omap3_beagle_init(void) 425static void __init omap3_beagle_init(void)
414{ 426{
415 omap3_beagle_i2c_init(); 427 omap3_beagle_i2c_init();
@@ -423,6 +435,7 @@ static void __init omap3_beagle_init(void)
423 gpio_direction_output(170, true); 435 gpio_direction_output(170, true);
424 436
425 usb_musb_init(); 437 usb_musb_init();
438 usb_ehci_init(&ehci_pdata);
426 omap3beagle_flash_init(); 439 omap3beagle_flash_init();
427 440
428 /* Ensure SDRC pins are mux'd for self-refresh */ 441 /* Ensure SDRC pins are mux'd for self-refresh */
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index e0cac96a7860..1edf06adbe3c 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -307,6 +307,18 @@ static struct platform_device *omap3_evm_devices[] __initdata = {
307 &omap3evm_smc911x_device, 307 &omap3evm_smc911x_device,
308}; 308};
309 309
310static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
311
312 .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN,
313 .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
314 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
315
316 .phy_reset = true,
317 .reset_gpio_port[0] = -EINVAL,
318 .reset_gpio_port[1] = 135,
319 .reset_gpio_port[2] = -EINVAL
320};
321
310static void __init omap3_evm_init(void) 322static void __init omap3_evm_init(void)
311{ 323{
312 omap3_evm_i2c_init(); 324 omap3_evm_i2c_init();
@@ -322,6 +334,9 @@ static void __init omap3_evm_init(void)
322 usb_nop_xceiv_register(); 334 usb_nop_xceiv_register();
323#endif 335#endif
324 usb_musb_init(); 336 usb_musb_init();
337 /* Setup EHCI phy reset padconfig */
338 omap_cfg_reg(AF4_34XX_GPIO135_OUT);
339 usb_ehci_init(&ehci_pdata);
325 ads7846_dev_init(); 340 ads7846_dev_init();
326} 341}
327 342
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index 3b2e5463fc5d..2db5ba5b3bf7 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -397,6 +397,18 @@ static struct platform_device *omap3pandora_devices[] __initdata = {
397 &pandora_keys_gpio, 397 &pandora_keys_gpio,
398}; 398};
399 399
400static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
401
402 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
403 .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN,
404 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
405
406 .phy_reset = true,
407 .reset_gpio_port[0] = 16,
408 .reset_gpio_port[1] = -EINVAL,
409 .reset_gpio_port[2] = -EINVAL
410};
411
400static void __init omap3pandora_init(void) 412static void __init omap3pandora_init(void)
401{ 413{
402 omap3pandora_i2c_init(); 414 omap3pandora_i2c_init();
@@ -406,6 +418,7 @@ static void __init omap3pandora_init(void)
406 spi_register_board_info(omap3pandora_spi_board_info, 418 spi_register_board_info(omap3pandora_spi_board_info,
407 ARRAY_SIZE(omap3pandora_spi_board_info)); 419 ARRAY_SIZE(omap3pandora_spi_board_info));
408 omap3pandora_ads7846_init(); 420 omap3pandora_ads7846_init();
421 usb_ehci_init(&ehci_pdata);
409 pandora_keys_gpio_init(); 422 pandora_keys_gpio_init();
410 usb_musb_init(); 423 usb_musb_init();
411 424
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 59d0dfa0eae8..52dfd51a938e 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -394,6 +394,18 @@ static struct platform_device *overo_devices[] __initdata = {
394 &overo_lcd_device, 394 &overo_lcd_device,
395}; 395};
396 396
397static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
398 .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN,
399 .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
400 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
401
402 .phy_reset = true,
403 .reset_gpio_port[0] = -EINVAL,
404 .reset_gpio_port[1] = OVERO_GPIO_USBH_NRESET,
405 .reset_gpio_port[2] = -EINVAL
406};
407
408
397static void __init overo_init(void) 409static void __init overo_init(void)
398{ 410{
399 overo_i2c_init(); 411 overo_i2c_init();
@@ -401,6 +413,7 @@ static void __init overo_init(void)
401 omap_serial_init(); 413 omap_serial_init();
402 overo_flash_init(); 414 overo_flash_init();
403 usb_musb_init(); 415 usb_musb_init();
416 usb_ehci_init(&ehci_pdata);
404 overo_ads7846_init(); 417 overo_ads7846_init();
405 overo_init_smsc911x(); 418 overo_init_smsc911x();
406 419
@@ -443,14 +456,6 @@ static void __init overo_init(void)
443 else 456 else
444 printk(KERN_ERR "could not obtain gpio for " 457 printk(KERN_ERR "could not obtain gpio for "
445 "OVERO_GPIO_USBH_CPEN\n"); 458 "OVERO_GPIO_USBH_CPEN\n");
446
447 if ((gpio_request(OVERO_GPIO_USBH_NRESET,
448 "OVERO_GPIO_USBH_NRESET") == 0) &&
449 (gpio_direction_output(OVERO_GPIO_USBH_NRESET, 1) == 0))
450 gpio_export(OVERO_GPIO_USBH_NRESET, 0);
451 else
452 printk(KERN_ERR "could not obtain gpio for "
453 "OVERO_GPIO_USBH_NRESET\n");
454} 459}
455 460
456static void __init overo_map_io(void) 461static void __init overo_map_io(void)
diff --git a/arch/arm/mach-omap2/usb-ehci.c b/arch/arm/mach-omap2/usb-ehci.c
new file mode 100644
index 000000000000..e448abd5ec5d
--- /dev/null
+++ b/arch/arm/mach-omap2/usb-ehci.c
@@ -0,0 +1,192 @@
1/*
2 * linux/arch/arm/mach-omap2/usb-ehci.c
3 *
4 * This file will contain the board specific details for the
5 * Synopsys EHCI host controller on OMAP3430
6 *
7 * Copyright (C) 2007 Texas Instruments
8 * Author: Vikram Pandita <vikram.pandita@ti.com>
9 *
10 * Generalization by:
11 * Felipe Balbi <felipe.balbi@nokia.com>
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
16 */
17
18#include <linux/types.h>
19#include <linux/errno.h>
20#include <linux/delay.h>
21#include <linux/platform_device.h>
22#include <linux/clk.h>
23#include <asm/io.h>
24#include <plat/mux.h>
25
26#include <mach/hardware.h>
27#include <mach/irqs.h>
28#include <plat/usb.h>
29
30#if defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_EHCI_HCD_MODULE)
31
32static struct resource ehci_resources[] = {
33 {
34 .start = OMAP34XX_EHCI_BASE,
35 .end = OMAP34XX_EHCI_BASE + SZ_1K - 1,
36 .flags = IORESOURCE_MEM,
37 },
38 {
39 .start = OMAP34XX_UHH_CONFIG_BASE,
40 .end = OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1,
41 .flags = IORESOURCE_MEM,
42 },
43 {
44 .start = OMAP34XX_USBTLL_BASE,
45 .end = OMAP34XX_USBTLL_BASE + SZ_4K - 1,
46 .flags = IORESOURCE_MEM,
47 },
48 { /* general IRQ */
49 .start = INT_34XX_EHCI_IRQ,
50 .flags = IORESOURCE_IRQ,
51 }
52};
53
54static u64 ehci_dmamask = ~(u32)0;
55static struct platform_device ehci_device = {
56 .name = "ehci-omap",
57 .id = 0,
58 .dev = {
59 .dma_mask = &ehci_dmamask,
60 .coherent_dma_mask = 0xffffffff,
61 .platform_data = NULL,
62 },
63 .num_resources = ARRAY_SIZE(ehci_resources),
64 .resource = ehci_resources,
65};
66
67/* MUX settings for EHCI pins */
68/*
69 * setup_ehci_io_mux - initialize IO pad mux for USBHOST
70 */
71static void setup_ehci_io_mux(enum ehci_hcd_omap_mode *port_mode)
72{
73 switch (port_mode[0]) {
74 case EHCI_HCD_OMAP_MODE_PHY:
75 omap_cfg_reg(Y9_3430_USB1HS_PHY_STP);
76 omap_cfg_reg(Y8_3430_USB1HS_PHY_CLK);
77 omap_cfg_reg(AA14_3430_USB1HS_PHY_DIR);
78 omap_cfg_reg(AA11_3430_USB1HS_PHY_NXT);
79 omap_cfg_reg(W13_3430_USB1HS_PHY_DATA0);
80 omap_cfg_reg(W12_3430_USB1HS_PHY_DATA1);
81 omap_cfg_reg(W11_3430_USB1HS_PHY_DATA2);
82 omap_cfg_reg(Y11_3430_USB1HS_PHY_DATA3);
83 omap_cfg_reg(W9_3430_USB1HS_PHY_DATA4);
84 omap_cfg_reg(Y12_3430_USB1HS_PHY_DATA5);
85 omap_cfg_reg(W8_3430_USB1HS_PHY_DATA6);
86 omap_cfg_reg(Y13_3430_USB1HS_PHY_DATA7);
87 break;
88 case EHCI_HCD_OMAP_MODE_TLL:
89 omap_cfg_reg(Y9_3430_USB1HS_TLL_STP);
90 omap_cfg_reg(Y8_3430_USB1HS_TLL_CLK);
91 omap_cfg_reg(AA14_3430_USB1HS_TLL_DIR);
92 omap_cfg_reg(AA11_3430_USB1HS_TLL_NXT);
93 omap_cfg_reg(W13_3430_USB1HS_TLL_DATA0);
94 omap_cfg_reg(W12_3430_USB1HS_TLL_DATA1);
95 omap_cfg_reg(W11_3430_USB1HS_TLL_DATA2);
96 omap_cfg_reg(Y11_3430_USB1HS_TLL_DATA3);
97 omap_cfg_reg(W9_3430_USB1HS_TLL_DATA4);
98 omap_cfg_reg(Y12_3430_USB1HS_TLL_DATA5);
99 omap_cfg_reg(W8_3430_USB1HS_TLL_DATA6);
100 omap_cfg_reg(Y13_3430_USB1HS_TLL_DATA7);
101 break;
102 case EHCI_HCD_OMAP_MODE_UNKNOWN:
103 /* FALLTHROUGH */
104 default:
105 break;
106 }
107
108 switch (port_mode[1]) {
109 case EHCI_HCD_OMAP_MODE_PHY:
110 omap_cfg_reg(AA10_3430_USB2HS_PHY_STP);
111 omap_cfg_reg(AA8_3430_USB2HS_PHY_CLK);
112 omap_cfg_reg(AA9_3430_USB2HS_PHY_DIR);
113 omap_cfg_reg(AB11_3430_USB2HS_PHY_NXT);
114 omap_cfg_reg(AB10_3430_USB2HS_PHY_DATA0);
115 omap_cfg_reg(AB9_3430_USB2HS_PHY_DATA1);
116 omap_cfg_reg(W3_3430_USB2HS_PHY_DATA2);
117 omap_cfg_reg(T4_3430_USB2HS_PHY_DATA3);
118 omap_cfg_reg(T3_3430_USB2HS_PHY_DATA4);
119 omap_cfg_reg(R3_3430_USB2HS_PHY_DATA5);
120 omap_cfg_reg(R4_3430_USB2HS_PHY_DATA6);
121 omap_cfg_reg(T2_3430_USB2HS_PHY_DATA7);
122 break;
123 case EHCI_HCD_OMAP_MODE_TLL:
124 omap_cfg_reg(AA10_3430_USB2HS_TLL_STP);
125 omap_cfg_reg(AA8_3430_USB2HS_TLL_CLK);
126 omap_cfg_reg(AA9_3430_USB2HS_TLL_DIR);
127 omap_cfg_reg(AB11_3430_USB2HS_TLL_NXT);
128 omap_cfg_reg(AB10_3430_USB2HS_TLL_DATA0);
129 omap_cfg_reg(AB9_3430_USB2HS_TLL_DATA1);
130 omap_cfg_reg(W3_3430_USB2HS_TLL_DATA2);
131 omap_cfg_reg(T4_3430_USB2HS_TLL_DATA3);
132 omap_cfg_reg(T3_3430_USB2HS_TLL_DATA4);
133 omap_cfg_reg(R3_3430_USB2HS_TLL_DATA5);
134 omap_cfg_reg(R4_3430_USB2HS_TLL_DATA6);
135 omap_cfg_reg(T2_3430_USB2HS_TLL_DATA7);
136 break;
137 case EHCI_HCD_OMAP_MODE_UNKNOWN:
138 /* FALLTHROUGH */
139 default:
140 break;
141 }
142
143 switch (port_mode[2]) {
144 case EHCI_HCD_OMAP_MODE_PHY:
145 printk(KERN_WARNING "Port3 can't be used in PHY mode\n");
146 break;
147 case EHCI_HCD_OMAP_MODE_TLL:
148 omap_cfg_reg(AB3_3430_USB3HS_TLL_STP);
149 omap_cfg_reg(AA6_3430_USB3HS_TLL_CLK);
150 omap_cfg_reg(AA3_3430_USB3HS_TLL_DIR);
151 omap_cfg_reg(Y3_3430_USB3HS_TLL_NXT);
152 omap_cfg_reg(AA5_3430_USB3HS_TLL_DATA0);
153 omap_cfg_reg(Y4_3430_USB3HS_TLL_DATA1);
154 omap_cfg_reg(Y5_3430_USB3HS_TLL_DATA2);
155 omap_cfg_reg(W5_3430_USB3HS_TLL_DATA3);
156 omap_cfg_reg(AB12_3430_USB3HS_TLL_DATA4);
157 omap_cfg_reg(AB13_3430_USB3HS_TLL_DATA5);
158 omap_cfg_reg(AA13_3430_USB3HS_TLL_DATA6);
159 omap_cfg_reg(AA12_3430_USB3HS_TLL_DATA7);
160 break;
161 case EHCI_HCD_OMAP_MODE_UNKNOWN:
162 /* FALLTHROUGH */
163 default:
164 break;
165 }
166
167 return;
168}
169
170void __init usb_ehci_init(struct ehci_hcd_omap_platform_data *pdata)
171{
172 platform_device_add_data(&ehci_device, pdata, sizeof(*pdata));
173
174 /* Setup Pin IO MUX for EHCI */
175 if (cpu_is_omap34xx())
176 setup_ehci_io_mux(pdata->port_mode);
177
178 if (platform_device_register(&ehci_device) < 0) {
179 printk(KERN_ERR "Unable to register HS-USB (EHCI) device\n");
180 return;
181 }
182}
183
184#else
185
186void __init usb_ehci_init(struct ehci_hcd_omap_platform_data *pdata)
187
188{
189}
190
191#endif /* CONFIG_USB_EHCI_HCD */
192
diff --git a/arch/arm/plat-omap/include/plat/omap34xx.h b/arch/arm/plat-omap/include/plat/omap34xx.h
index f8d186a73712..46557075facb 100644
--- a/arch/arm/plat-omap/include/plat/omap34xx.h
+++ b/arch/arm/plat-omap/include/plat/omap34xx.h
@@ -74,8 +74,12 @@
74 74
75#define OMAP34XX_IVA_INTC_BASE 0x40000000 75#define OMAP34XX_IVA_INTC_BASE 0x40000000
76#define OMAP34XX_HSUSB_OTG_BASE (L4_34XX_BASE + 0xAB000) 76#define OMAP34XX_HSUSB_OTG_BASE (L4_34XX_BASE + 0xAB000)
77#define OMAP34XX_HSUSB_HOST_BASE (L4_34XX_BASE + 0x64000)
78#define OMAP34XX_USBTLL_BASE (L4_34XX_BASE + 0x62000) 77#define OMAP34XX_USBTLL_BASE (L4_34XX_BASE + 0x62000)
78#define OMAP34XX_UHH_CONFIG_BASE (L4_34XX_BASE + 0x64000)
79#define OMAP34XX_OHCI_BASE (L4_34XX_BASE + 0x64400)
80#define OMAP34XX_EHCI_BASE (L4_34XX_BASE + 0x64800)
81#define OMAP34XX_SR1_BASE 0x480C9000
82#define OMAP34XX_SR2_BASE 0x480CB000
79 83
80#define OMAP34XX_MAILBOX_BASE (L4_34XX_BASE + 0x94000) 84#define OMAP34XX_MAILBOX_BASE (L4_34XX_BASE + 0x94000)
81 85