aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorFelipe Balbi <felipe.balbi@nokia.com>2009-03-23 21:34:06 -0400
committerTony Lindgren <tony@atomide.com>2009-03-23 21:51:24 -0400
commit18cb7aca6f94357d78d99970ec0bd5933ac4495d (patch)
tree1aa3d785809dda5ca492c862868ac2704cc0b18f /arch/arm
parent828c707e6dbd0ca7882f721a466ff28729376ff0 (diff)
ARM: OMAP3: MUSB initialization for omap hw, v2
Create a generic board-file for initializing usb on omap2430 and omap3 boards. Patch modified by Tony to build the module based on CONFIG_USB_MUSB_SOC. Also merged in a patch adding the nop xceiv from Ajay Kumar Gupta <ajay.gupta@ti.com>. Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com> Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-omap2/Makefile4
-rw-r--r--arch/arm/mach-omap2/board-2430sdp.c2
-rw-r--r--arch/arm/mach-omap2/board-ldp.c2
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c2
-rw-r--r--arch/arm/mach-omap2/board-omap3pandora.c2
-rw-r--r--arch/arm/mach-omap2/board-overo.c2
-rw-r--r--arch/arm/mach-omap2/usb-musb.c187
-rw-r--r--arch/arm/plat-omap/include/mach/usb.h8
8 files changed, 209 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index bbd12bc10fdc..29f6ca94c360 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -39,3 +39,7 @@ obj-$(CONFIG_MACH_OVERO) += board-overo.o \
39obj-$(CONFIG_MACH_OMAP3_PANDORA) += board-omap3pandora.o \ 39obj-$(CONFIG_MACH_OMAP3_PANDORA) += board-omap3pandora.o \
40 mmc-twl4030.o 40 mmc-twl4030.o
41 41
42# Platform specific device init code
43ifeq ($(CONFIG_USB_MUSB_SOC),y)
44obj-y += usb-musb.o
45endif
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
index c8abe6a8dfe9..21ee2195eb53 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -35,6 +35,7 @@
35#include <mach/board.h> 35#include <mach/board.h>
36#include <mach/common.h> 36#include <mach/common.h>
37#include <mach/gpmc.h> 37#include <mach/gpmc.h>
38#include <mach/usb.h>
38 39
39#include "mmc-twl4030.h" 40#include "mmc-twl4030.h"
40 41
@@ -254,6 +255,7 @@ static void __init omap_2430sdp_init(void)
254 omap_board_config_size = ARRAY_SIZE(sdp2430_config); 255 omap_board_config_size = ARRAY_SIZE(sdp2430_config);
255 omap_serial_init(); 256 omap_serial_init();
256 twl4030_mmc_init(mmc); 257 twl4030_mmc_init(mmc);
258 usb_musb_init();
257} 259}
258 260
259static void __init omap_2430sdp_map_io(void) 261static void __init omap_2430sdp_map_io(void)
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index f035d7836e55..92661e5df93e 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -37,6 +37,7 @@
37#include <asm/io.h> 37#include <asm/io.h>
38#include <asm/delay.h> 38#include <asm/delay.h>
39#include <mach/control.h> 39#include <mach/control.h>
40#include <mach/usb.h>
40 41
41#include "mmc-twl4030.h" 42#include "mmc-twl4030.h"
42 43
@@ -164,6 +165,7 @@ static void __init omap_ldp_init(void)
164 omap_board_config_size = ARRAY_SIZE(ldp_config); 165 omap_board_config_size = ARRAY_SIZE(ldp_config);
165 omap_serial_init(); 166 omap_serial_init();
166 twl4030_mmc_init(mmc); 167 twl4030_mmc_init(mmc);
168 usb_musb_init();
167} 169}
168 170
169static void __init omap_ldp_map_io(void) 171static void __init omap_ldp_map_io(void)
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index e3c862866b76..2f3d821e6346 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -41,6 +41,7 @@
41#include <mach/gpmc.h> 41#include <mach/gpmc.h>
42#include <mach/nand.h> 42#include <mach/nand.h>
43#include <mach/mux.h> 43#include <mach/mux.h>
44#include <mach/usb.h>
44 45
45#include "mmc-twl4030.h" 46#include "mmc-twl4030.h"
46 47
@@ -313,6 +314,7 @@ static void __init omap3_beagle_init(void)
313 /* REVISIT leave DVI powered down until it's needed ... */ 314 /* REVISIT leave DVI powered down until it's needed ... */
314 gpio_direction_output(170, true); 315 gpio_direction_output(170, true);
315 316
317 usb_musb_init();
316 omap3beagle_flash_init(); 318 omap3beagle_flash_init();
317} 319}
318 320
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index 6e17180c1a51..16e2128daa12 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -34,6 +34,7 @@
34#include <mach/gpio.h> 34#include <mach/gpio.h>
35#include <mach/hardware.h> 35#include <mach/hardware.h>
36#include <mach/mcspi.h> 36#include <mach/mcspi.h>
37#include <mach/usb.h>
37 38
38#include "mmc-twl4030.h" 39#include "mmc-twl4030.h"
39 40
@@ -200,6 +201,7 @@ static void __init omap3pandora_init(void)
200 spi_register_board_info(omap3pandora_spi_board_info, 201 spi_register_board_info(omap3pandora_spi_board_info,
201 ARRAY_SIZE(omap3pandora_spi_board_info)); 202 ARRAY_SIZE(omap3pandora_spi_board_info));
202 omap3pandora_ads7846_init(); 203 omap3pandora_ads7846_init();
204 usb_musb_init();
203} 205}
204 206
205static void __init omap3pandora_map_io(void) 207static void __init omap3pandora_map_io(void)
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 9c14324d8c68..d3ceed398e0b 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -43,6 +43,7 @@
43#include <mach/gpmc.h> 43#include <mach/gpmc.h>
44#include <mach/hardware.h> 44#include <mach/hardware.h>
45#include <mach/nand.h> 45#include <mach/nand.h>
46#include <mach/usb.h>
46 47
47#include "mmc-twl4030.h" 48#include "mmc-twl4030.h"
48 49
@@ -228,6 +229,7 @@ static void __init overo_init(void)
228 omap_serial_init(); 229 omap_serial_init();
229 twl4030_mmc_init(mmc); 230 twl4030_mmc_init(mmc);
230 overo_flash_init(); 231 overo_flash_init();
232 usb_musb_init();
231 233
232 if ((gpio_request(OVERO_GPIO_W2W_NRESET, 234 if ((gpio_request(OVERO_GPIO_W2W_NRESET,
233 "OVERO_GPIO_W2W_NRESET") == 0) && 235 "OVERO_GPIO_W2W_NRESET") == 0) &&
diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
new file mode 100644
index 000000000000..fc74e913c415
--- /dev/null
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -0,0 +1,187 @@
1/*
2 * linux/arch/arm/mach-omap2/usb-musb.c
3 *
4 * This file will contain the board specific details for the
5 * MENTOR USB OTG controller on OMAP3430
6 *
7 * Copyright (C) 2007-2008 Texas Instruments
8 * Copyright (C) 2008 Nokia Corporation
9 * Author: Vikram Pandita
10 *
11 * Generalization by:
12 * Felipe Balbi <felipe.balbi@nokia.com>
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17 */
18
19#include <linux/types.h>
20#include <linux/errno.h>
21#include <linux/delay.h>
22#include <linux/platform_device.h>
23#include <linux/clk.h>
24#include <linux/dma-mapping.h>
25#include <linux/io.h>
26
27#include <linux/usb/musb.h>
28
29#include <mach/hardware.h>
30#include <mach/irqs.h>
31#include <mach/pm.h>
32#include <mach/mux.h>
33#include <mach/usb.h>
34
35static struct resource musb_resources[] = {
36 [0] = { /* start and end set dynamically */
37 .flags = IORESOURCE_MEM,
38 },
39 [1] = { /* general IRQ */
40 .start = INT_243X_HS_USB_MC,
41 .flags = IORESOURCE_IRQ,
42 },
43 [2] = { /* DMA IRQ */
44 .start = INT_243X_HS_USB_DMA,
45 .flags = IORESOURCE_IRQ,
46 },
47};
48
49static int clk_on;
50
51static int musb_set_clock(struct clk *clk, int state)
52{
53 if (state) {
54 if (clk_on > 0)
55 return -ENODEV;
56
57 clk_enable(clk);
58 clk_on = 1;
59 } else {
60 if (clk_on == 0)
61 return -ENODEV;
62
63 clk_disable(clk);
64 clk_on = 0;
65 }
66
67 return 0;
68}
69
70static struct musb_hdrc_eps_bits musb_eps[] = {
71 { "ep1_tx", 10, },
72 { "ep1_rx", 10, },
73 { "ep2_tx", 9, },
74 { "ep2_rx", 9, },
75 { "ep3_tx", 3, },
76 { "ep3_rx", 3, },
77 { "ep4_tx", 3, },
78 { "ep4_rx", 3, },
79 { "ep5_tx", 3, },
80 { "ep5_rx", 3, },
81 { "ep6_tx", 3, },
82 { "ep6_rx", 3, },
83 { "ep7_tx", 3, },
84 { "ep7_rx", 3, },
85 { "ep8_tx", 2, },
86 { "ep8_rx", 2, },
87 { "ep9_tx", 2, },
88 { "ep9_rx", 2, },
89 { "ep10_tx", 2, },
90 { "ep10_rx", 2, },
91 { "ep11_tx", 2, },
92 { "ep11_rx", 2, },
93 { "ep12_tx", 2, },
94 { "ep12_rx", 2, },
95 { "ep13_tx", 2, },
96 { "ep13_rx", 2, },
97 { "ep14_tx", 2, },
98 { "ep14_rx", 2, },
99 { "ep15_tx", 2, },
100 { "ep15_rx", 2, },
101};
102
103static struct musb_hdrc_config musb_config = {
104 .multipoint = 1,
105 .dyn_fifo = 1,
106 .soft_con = 1,
107 .dma = 1,
108 .num_eps = 16,
109 .dma_channels = 7,
110 .dma_req_chan = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3),
111 .ram_bits = 12,
112 .eps_bits = musb_eps,
113};
114
115static struct musb_hdrc_platform_data musb_plat = {
116#ifdef CONFIG_USB_MUSB_OTG
117 .mode = MUSB_OTG,
118#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
119 .mode = MUSB_HOST,
120#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
121 .mode = MUSB_PERIPHERAL,
122#endif
123 /* .clock is set dynamically */
124 .set_clock = musb_set_clock,
125 .config = &musb_config,
126
127 /* REVISIT charge pump on TWL4030 can supply up to
128 * 100 mA ... but this value is board-specific, like
129 * "mode", and should be passed to usb_musb_init().
130 */
131 .power = 50, /* up to 100 mA */
132};
133
134static u64 musb_dmamask = DMA_32BIT_MASK;
135
136static struct platform_device musb_device = {
137 .name = "musb_hdrc",
138 .id = -1,
139 .dev = {
140 .dma_mask = &musb_dmamask,
141 .coherent_dma_mask = DMA_32BIT_MASK,
142 .platform_data = &musb_plat,
143 },
144 .num_resources = ARRAY_SIZE(musb_resources),
145 .resource = musb_resources,
146};
147
148#ifdef CONFIG_NOP_USB_XCEIV
149static u64 nop_xceiv_dmamask = DMA_32BIT_MASK;
150
151static struct platform_device nop_xceiv_device = {
152 .name = "nop_usb_xceiv",
153 .id = -1,
154 .dev = {
155 .dma_mask = &nop_xceiv_dmamask,
156 .coherent_dma_mask = DMA_32BIT_MASK,
157 .platform_data = NULL,
158 },
159};
160#endif
161
162void __init usb_musb_init(void)
163{
164 if (cpu_is_omap243x())
165 musb_resources[0].start = OMAP243X_HS_BASE;
166 else
167 musb_resources[0].start = OMAP34XX_HSUSB_OTG_BASE;
168 musb_resources[0].end = musb_resources[0].start + SZ_8K - 1;
169
170 /*
171 * REVISIT: This line can be removed once all the platforms using
172 * musb_core.c have been converted to use use clkdev.
173 */
174 musb_plat.clock = "ick";
175
176#ifdef CONFIG_NOP_USB_XCEIV
177 if (platform_device_register(&nop_xceiv_device) < 0) {
178 printk(KERN_ERR "Unable to register NOP-XCEIV device\n");
179 return;
180 }
181#endif
182
183 if (platform_device_register(&musb_device) < 0) {
184 printk(KERN_ERR "Unable to register HS-USB (MUSB) device\n");
185 return;
186 }
187}
diff --git a/arch/arm/plat-omap/include/mach/usb.h b/arch/arm/plat-omap/include/mach/usb.h
index e033e51d4bad..69f0ceed500b 100644
--- a/arch/arm/plat-omap/include/mach/usb.h
+++ b/arch/arm/plat-omap/include/mach/usb.h
@@ -27,6 +27,14 @@
27#define UDC_BASE OMAP2_UDC_BASE 27#define UDC_BASE OMAP2_UDC_BASE
28#define OMAP_OHCI_BASE OMAP2_OHCI_BASE 28#define OMAP_OHCI_BASE OMAP2_OHCI_BASE
29 29
30#ifdef CONFIG_USB_MUSB_SOC
31extern void usb_musb_init(void);
32#else
33static inline void usb_musb_init(void)
34{
35}
36#endif
37
30#endif 38#endif
31 39
32void omap_usb_init(struct omap_usb_config *pdata); 40void omap_usb_init(struct omap_usb_config *pdata);