aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-11-12 10:40:06 -0500
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-11-19 15:54:35 -0500
commit9e1dde33876ba83ad586c336647fff133d0f5472 (patch)
tree52aa4efe87f2f52234f2f55e3a2b29e61de683c9
parentfed3d35b06bf3f6a3383c2637d054823c563200b (diff)
ARM: mx3: dynamically allocate fsl-usb2-udc devices
While adapting the #defines for this I noticed that the offset used for USB HS on i.MX35 differs from the documented offset. I kept the working offset and commented that the documentation differs. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-rw-r--r--arch/arm/mach-mx3/Kconfig9
-rw-r--r--arch/arm/mach-mx3/devices-imx31.h4
-rw-r--r--arch/arm/mach-mx3/devices-imx35.h4
-rw-r--r--arch/arm/mach-mx3/devices.c52
-rw-r--r--arch/arm/mach-mx3/devices.h1
-rw-r--r--arch/arm/mach-mx3/mach-cpuimx35.c5
-rw-r--r--arch/arm/mach-mx3/mach-mx31_3ds.c5
-rw-r--r--arch/arm/mach-mx3/mach-mx35_3ds.c5
-rw-r--r--arch/arm/mach-mx3/mach-pcm037.c5
-rw-r--r--arch/arm/mach-mx3/mach-pcm043.c5
-rw-r--r--arch/arm/mach-mx3/mx31moboard-devboard.c5
-rw-r--r--arch/arm/mach-mx3/mx31moboard-marxbot.c5
-rw-r--r--arch/arm/mach-mx3/mx31moboard-smartbot.c5
-rw-r--r--arch/arm/plat-mxc/devices/platform-fsl-usb2-udc.c10
-rw-r--r--arch/arm/plat-mxc/include/mach/mx31.h12
-rw-r--r--arch/arm/plat-mxc/include/mach/mx35.h14
16 files changed, 78 insertions, 68 deletions
diff --git a/arch/arm/mach-mx3/Kconfig b/arch/arm/mach-mx3/Kconfig
index 17ae7d365729..120add4b7bb9 100644
--- a/arch/arm/mach-mx3/Kconfig
+++ b/arch/arm/mach-mx3/Kconfig
@@ -50,6 +50,7 @@ config MACH_MX31ADS_WM1133_EV1
50config MACH_PCM037 50config MACH_PCM037
51 bool "Support Phytec pcm037 (i.MX31) platforms" 51 bool "Support Phytec pcm037 (i.MX31) platforms"
52 select SOC_IMX31 52 select SOC_IMX31
53 select IMX_HAVE_PLATFORM_FSL_USB2_UDC
53 select IMX_HAVE_PLATFORM_IMX_I2C 54 select IMX_HAVE_PLATFORM_IMX_I2C
54 select IMX_HAVE_PLATFORM_IMX_UART 55 select IMX_HAVE_PLATFORM_IMX_UART
55 select IMX_HAVE_PLATFORM_MXC_MMC 56 select IMX_HAVE_PLATFORM_MXC_MMC
@@ -85,6 +86,7 @@ config MACH_MX31_3DS
85 bool "Support MX31PDK (3DS)" 86 bool "Support MX31PDK (3DS)"
86 select SOC_IMX31 87 select SOC_IMX31
87 select MXC_DEBUG_BOARD 88 select MXC_DEBUG_BOARD
89 select IMX_HAVE_PLATFORM_FSL_USB2_UDC
88 select IMX_HAVE_PLATFORM_IMX_UART 90 select IMX_HAVE_PLATFORM_IMX_UART
89 select IMX_HAVE_PLATFORM_MXC_NAND 91 select IMX_HAVE_PLATFORM_MXC_NAND
90 select IMX_HAVE_PLATFORM_SPI_IMX 92 select IMX_HAVE_PLATFORM_SPI_IMX
@@ -104,6 +106,7 @@ config MACH_MX31_3DS_MXC_NAND_USE_BBT
104config MACH_MX31MOBOARD 106config MACH_MX31MOBOARD
105 bool "Support mx31moboard platforms (EPFL Mobots group)" 107 bool "Support mx31moboard platforms (EPFL Mobots group)"
106 select SOC_IMX31 108 select SOC_IMX31
109 select IMX_HAVE_PLATFORM_FSL_USB2_UDC
107 select IMX_HAVE_PLATFORM_IMX_I2C 110 select IMX_HAVE_PLATFORM_IMX_I2C
108 select IMX_HAVE_PLATFORM_IMX_UART 111 select IMX_HAVE_PLATFORM_IMX_UART
109 select IMX_HAVE_PLATFORM_MXC_MMC 112 select IMX_HAVE_PLATFORM_MXC_MMC
@@ -135,6 +138,7 @@ config MACH_QONG
135config MACH_PCM043 138config MACH_PCM043
136 bool "Support Phytec pcm043 (i.MX35) platforms" 139 bool "Support Phytec pcm043 (i.MX35) platforms"
137 select SOC_IMX35 140 select SOC_IMX35
141 select IMX_HAVE_PLATFORM_FSL_USB2_UDC
138 select IMX_HAVE_PLATFORM_IMX_I2C 142 select IMX_HAVE_PLATFORM_IMX_I2C
139 select IMX_HAVE_PLATFORM_IMX_SSI 143 select IMX_HAVE_PLATFORM_IMX_SSI
140 select IMX_HAVE_PLATFORM_IMX_UART 144 select IMX_HAVE_PLATFORM_IMX_UART
@@ -162,10 +166,10 @@ config MACH_MX35_3DS
162 bool "Support MX35PDK platform" 166 bool "Support MX35PDK platform"
163 select SOC_IMX35 167 select SOC_IMX35
164 select MXC_DEBUG_BOARD 168 select MXC_DEBUG_BOARD
169 select IMX_HAVE_PLATFORM_ESDHC
170 select IMX_HAVE_PLATFORM_FSL_USB2_UDC
165 select IMX_HAVE_PLATFORM_IMX_UART 171 select IMX_HAVE_PLATFORM_IMX_UART
166 select IMX_HAVE_PLATFORM_MXC_NAND 172 select IMX_HAVE_PLATFORM_MXC_NAND
167 select IMX_HAVE_PLATFORM_ESDHC
168 default n
169 help 173 help
170 Include support for MX35PDK platform. This includes specific 174 Include support for MX35PDK platform. This includes specific
171 configurations for the board and its peripherals. 175 configurations for the board and its peripherals.
@@ -181,6 +185,7 @@ config MACH_KZM_ARM11_01
181config MACH_EUKREA_CPUIMX35 185config MACH_EUKREA_CPUIMX35
182 bool "Support Eukrea CPUIMX35 Platform" 186 bool "Support Eukrea CPUIMX35 Platform"
183 select SOC_IMX35 187 select SOC_IMX35
188 select IMX_HAVE_PLATFORM_FSL_USB2_UDC
184 select IMX_HAVE_PLATFORM_IMX_UART 189 select IMX_HAVE_PLATFORM_IMX_UART
185 select IMX_HAVE_PLATFORM_IMX_I2C 190 select IMX_HAVE_PLATFORM_IMX_I2C
186 select IMX_HAVE_PLATFORM_MXC_NAND 191 select IMX_HAVE_PLATFORM_MXC_NAND
diff --git a/arch/arm/mach-mx3/devices-imx31.h b/arch/arm/mach-mx3/devices-imx31.h
index 875e26f6cc77..0cefaca5d13d 100644
--- a/arch/arm/mach-mx3/devices-imx31.h
+++ b/arch/arm/mach-mx3/devices-imx31.h
@@ -9,6 +9,10 @@
9#include <mach/mx31.h> 9#include <mach/mx31.h>
10#include <mach/devices-common.h> 10#include <mach/devices-common.h>
11 11
12extern const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data __initconst;
13#define imx31_add_fsl_usb2_udc(pdata) \
14 imx_add_fsl_usb2_udc(&imx31_fsl_usb2_udc_data, pdata)
15
12extern const struct imx_imx_i2c_data imx31_imx_i2c_data[] __initconst; 16extern const struct imx_imx_i2c_data imx31_imx_i2c_data[] __initconst;
13#define imx31_add_imx_i2c(id, pdata) \ 17#define imx31_add_imx_i2c(id, pdata) \
14 imx_add_imx_i2c(&imx31_imx_i2c_data[id], pdata) 18 imx_add_imx_i2c(&imx31_imx_i2c_data[id], pdata)
diff --git a/arch/arm/mach-mx3/devices-imx35.h b/arch/arm/mach-mx3/devices-imx35.h
index a71ce68af9a1..36561ccdfbd6 100644
--- a/arch/arm/mach-mx3/devices-imx35.h
+++ b/arch/arm/mach-mx3/devices-imx35.h
@@ -13,6 +13,10 @@ extern const struct imx_fec_data imx35_fec_data __initconst;
13#define imx35_add_fec(pdata) \ 13#define imx35_add_fec(pdata) \
14 imx_add_fec(&imx35_fec_data, pdata) 14 imx_add_fec(&imx35_fec_data, pdata)
15 15
16extern const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data __initconst;
17#define imx35_add_fsl_usb2_udc(pdata) \
18 imx_add_fsl_usb2_udc(&imx35_fsl_usb2_udc_data, pdata)
19
16extern const struct imx_flexcan_data imx35_flexcan_data[] __initconst; 20extern const struct imx_flexcan_data imx35_flexcan_data[] __initconst;
17#define imx35_add_flexcan(id, pdata) \ 21#define imx35_add_flexcan(id, pdata) \
18 imx_add_flexcan(&imx35_flexcan_data[id], pdata) 22 imx_add_flexcan(&imx35_flexcan_data[id], pdata)
diff --git a/arch/arm/mach-mx3/devices.c b/arch/arm/mach-mx3/devices.c
index 202c06c552b2..3f859ae8b850 100644
--- a/arch/arm/mach-mx3/devices.c
+++ b/arch/arm/mach-mx3/devices.c
@@ -97,30 +97,18 @@ struct platform_device mx3_camera = {
97 97
98static struct resource otg_resources[] = { 98static struct resource otg_resources[] = {
99 { 99 {
100 .start = MX31_OTG_BASE_ADDR, 100 .start = MX31_USB_OTG_BASE_ADDR,
101 .end = MX31_OTG_BASE_ADDR + 0x1ff, 101 .end = MX31_USB_OTG_BASE_ADDR + 0x1ff,
102 .flags = IORESOURCE_MEM, 102 .flags = IORESOURCE_MEM,
103 }, { 103 }, {
104 .start = MX31_INT_USB3, 104 .start = MX31_INT_USB_OTG,
105 .end = MX31_INT_USB3, 105 .end = MX31_INT_USB_OTG,
106 .flags = IORESOURCE_IRQ, 106 .flags = IORESOURCE_IRQ,
107 }, 107 },
108}; 108};
109 109
110static u64 otg_dmamask = DMA_BIT_MASK(32); 110static u64 otg_dmamask = DMA_BIT_MASK(32);
111 111
112/* OTG gadget device */
113struct platform_device mxc_otg_udc_device = {
114 .name = "fsl-usb2-udc",
115 .id = -1,
116 .dev = {
117 .dma_mask = &otg_dmamask,
118 .coherent_dma_mask = DMA_BIT_MASK(32),
119 },
120 .resource = otg_resources,
121 .num_resources = ARRAY_SIZE(otg_resources),
122};
123
124/* OTG host */ 112/* OTG host */
125struct platform_device mxc_otg_host = { 113struct platform_device mxc_otg_host = {
126 .name = "mxc-ehci", 114 .name = "mxc-ehci",
@@ -139,12 +127,12 @@ static u64 usbh1_dmamask = ~(u32)0;
139 127
140static struct resource mxc_usbh1_resources[] = { 128static struct resource mxc_usbh1_resources[] = {
141 { 129 {
142 .start = MX31_OTG_BASE_ADDR + 0x200, 130 .start = MX31_USB_HS1_BASE_ADDR,
143 .end = MX31_OTG_BASE_ADDR + 0x3ff, 131 .end = MX31_USB_HS1_BASE_ADDR + 0x1ff,
144 .flags = IORESOURCE_MEM, 132 .flags = IORESOURCE_MEM,
145 }, { 133 }, {
146 .start = MX31_INT_USB1, 134 .start = MX31_INT_USB_HS1,
147 .end = MX31_INT_USB1, 135 .end = MX31_INT_USB_HS1,
148 .flags = IORESOURCE_IRQ, 136 .flags = IORESOURCE_IRQ,
149 }, 137 },
150}; 138};
@@ -166,12 +154,12 @@ static u64 usbh2_dmamask = ~(u32)0;
166 154
167static struct resource mxc_usbh2_resources[] = { 155static struct resource mxc_usbh2_resources[] = {
168 { 156 {
169 .start = MX31_OTG_BASE_ADDR + 0x400, 157 .start = MX31_USB_HS2_BASE_ADDR,
170 .end = MX31_OTG_BASE_ADDR + 0x5ff, 158 .end = MX31_USB_HS2_BASE_ADDR + 0x1ff,
171 .flags = IORESOURCE_MEM, 159 .flags = IORESOURCE_MEM,
172 }, { 160 }, {
173 .start = MX31_INT_USB2, 161 .start = MX31_INT_USB_HS2,
174 .end = MX31_INT_USB2, 162 .end = MX31_INT_USB_HS2,
175 .flags = IORESOURCE_IRQ, 163 .flags = IORESOURCE_IRQ,
176 }, 164 },
177}; 165};
@@ -249,14 +237,14 @@ static int __init mx3_devices_init(void)
249#endif 237#endif
250#if defined(CONFIG_ARCH_MX35) 238#if defined(CONFIG_ARCH_MX35)
251 if (cpu_is_mx35()) { 239 if (cpu_is_mx35()) {
252 otg_resources[0].start = MX35_OTG_BASE_ADDR; 240 otg_resources[0].start = MX35_USB_OTG_BASE_ADDR;
253 otg_resources[0].end = MX35_OTG_BASE_ADDR + 0x1ff; 241 otg_resources[0].end = MX35_USB_OTG_BASE_ADDR + 0x1ff;
254 otg_resources[1].start = MX35_INT_USBOTG; 242 otg_resources[1].start = MX35_INT_USB_OTG;
255 otg_resources[1].end = MX35_INT_USBOTG; 243 otg_resources[1].end = MX35_INT_USB_OTG;
256 mxc_usbh1_resources[0].start = MX35_OTG_BASE_ADDR + 0x400; 244 mxc_usbh1_resources[0].start = MX35_USB_HS_BASE_ADDR;
257 mxc_usbh1_resources[0].end = MX35_OTG_BASE_ADDR + 0x5ff; 245 mxc_usbh1_resources[0].end = MX35_USB_HS_BASE_ADDR + 0x1ff;
258 mxc_usbh1_resources[1].start = MX35_INT_USBHS; 246 mxc_usbh1_resources[1].start = MX35_INT_USB_HS;
259 mxc_usbh1_resources[1].end = MX35_INT_USBHS; 247 mxc_usbh1_resources[1].end = MX35_INT_USB_HS;
260 imx_wdt_resources[0].start = MX35_WDOG_BASE_ADDR; 248 imx_wdt_resources[0].start = MX35_WDOG_BASE_ADDR;
261 imx_wdt_resources[0].end = MX35_WDOG_BASE_ADDR + 0x3fff; 249 imx_wdt_resources[0].end = MX35_WDOG_BASE_ADDR + 0x3fff;
262 } 250 }
diff --git a/arch/arm/mach-mx3/devices.h b/arch/arm/mach-mx3/devices.h
index d472c459238c..eb3b990f60ff 100644
--- a/arch/arm/mach-mx3/devices.h
+++ b/arch/arm/mach-mx3/devices.h
@@ -1,7 +1,6 @@
1extern struct platform_device mx3_ipu; 1extern struct platform_device mx3_ipu;
2extern struct platform_device mx3_fb; 2extern struct platform_device mx3_fb;
3extern struct platform_device mx3_camera; 3extern struct platform_device mx3_camera;
4extern struct platform_device mxc_otg_udc_device;
5extern struct platform_device mxc_otg_host; 4extern struct platform_device mxc_otg_host;
6extern struct platform_device mxc_usbh1; 5extern struct platform_device mxc_usbh1;
7extern struct platform_device mxc_usbh2; 6extern struct platform_device mxc_usbh2;
diff --git a/arch/arm/mach-mx3/mach-cpuimx35.c b/arch/arm/mach-mx3/mach-cpuimx35.c
index 9fde873f5889..b8b619a0e07c 100644
--- a/arch/arm/mach-mx3/mach-cpuimx35.c
+++ b/arch/arm/mach-mx3/mach-cpuimx35.c
@@ -30,7 +30,6 @@
30#include <linux/i2c/tsc2007.h> 30#include <linux/i2c/tsc2007.h>
31#include <linux/usb/otg.h> 31#include <linux/usb/otg.h>
32#include <linux/usb/ulpi.h> 32#include <linux/usb/ulpi.h>
33#include <linux/fsl_devices.h>
34#include <linux/i2c-gpio.h> 33#include <linux/i2c-gpio.h>
35 34
36#include <asm/mach-types.h> 35#include <asm/mach-types.h>
@@ -128,7 +127,7 @@ static struct mxc_usbh_platform_data __maybe_unused usbh1_pdata = {
128 MXC_EHCI_IPPUE_DOWN, 127 MXC_EHCI_IPPUE_DOWN,
129}; 128};
130 129
131static struct fsl_usb2_platform_data otg_device_pdata = { 130static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
132 .operating_mode = FSL_USB2_DR_DEVICE, 131 .operating_mode = FSL_USB2_DR_DEVICE,
133 .phy_mode = FSL_USB2_PHY_UTMI, 132 .phy_mode = FSL_USB2_PHY_UTMI,
134 .workaround = FLS_USB2_WORKAROUND_ENGCM09152, 133 .workaround = FLS_USB2_WORKAROUND_ENGCM09152,
@@ -170,7 +169,7 @@ static void __init mxc_board_init(void)
170 if (otg_mode_host) 169 if (otg_mode_host)
171 mxc_register_device(&mxc_otg_host, &otg_pdata); 170 mxc_register_device(&mxc_otg_host, &otg_pdata);
172 else 171 else
173 mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata); 172 imx35_add_fsl_usb2_udc(&otg_device_pdata);
174 173
175 mxc_register_device(&mxc_usbh1, &usbh1_pdata); 174 mxc_register_device(&mxc_usbh1, &usbh1_pdata);
176 175
diff --git a/arch/arm/mach-mx3/mach-mx31_3ds.c b/arch/arm/mach-mx3/mach-mx31_3ds.c
index 0ad9e7821082..1b46f738b310 100644
--- a/arch/arm/mach-mx3/mach-mx31_3ds.c
+++ b/arch/arm/mach-mx3/mach-mx31_3ds.c
@@ -22,7 +22,6 @@
22#include <linux/mfd/mc13783.h> 22#include <linux/mfd/mc13783.h>
23#include <linux/spi/spi.h> 23#include <linux/spi/spi.h>
24#include <linux/regulator/machine.h> 24#include <linux/regulator/machine.h>
25#include <linux/fsl_devices.h>
26#include <linux/input/matrix_keypad.h> 25#include <linux/input/matrix_keypad.h>
27 26
28#include <mach/hardware.h> 27#include <mach/hardware.h>
@@ -214,7 +213,7 @@ usbotg_free_reset:
214 return err; 213 return err;
215} 214}
216 215
217static struct fsl_usb2_platform_data usbotg_pdata = { 216static const struct fsl_usb2_platform_data usbotg_pdata __initconst = {
218 .operating_mode = FSL_USB2_DR_DEVICE, 217 .operating_mode = FSL_USB2_DR_DEVICE,
219 .phy_mode = FSL_USB2_PHY_ULPI, 218 .phy_mode = FSL_USB2_PHY_ULPI,
220}; 219};
@@ -249,7 +248,7 @@ static void __init mxc_board_init(void)
249 mxc_register_device(&imx_kpp_device, &mx31_3ds_keymap_data); 248 mxc_register_device(&imx_kpp_device, &mx31_3ds_keymap_data);
250 249
251 mx31_3ds_usbotg_init(); 250 mx31_3ds_usbotg_init();
252 mxc_register_device(&mxc_otg_udc_device, &usbotg_pdata); 251 imx31_add_fsl_usb2_udc(&usbotg_pdata);
253 252
254 if (mxc_expio_init(MX31_CS5_BASE_ADDR, EXPIO_PARENT_INT)) 253 if (mxc_expio_init(MX31_CS5_BASE_ADDR, EXPIO_PARENT_INT))
255 printk(KERN_WARNING "Init of the debug board failed, all " 254 printk(KERN_WARNING "Init of the debug board failed, all "
diff --git a/arch/arm/mach-mx3/mach-mx35_3ds.c b/arch/arm/mach-mx3/mach-mx35_3ds.c
index b66a75aa2e88..6dfdf1746c76 100644
--- a/arch/arm/mach-mx3/mach-mx35_3ds.c
+++ b/arch/arm/mach-mx3/mach-mx35_3ds.c
@@ -26,7 +26,6 @@
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27#include <linux/memory.h> 27#include <linux/memory.h>
28#include <linux/gpio.h> 28#include <linux/gpio.h>
29#include <linux/fsl_devices.h>
30 29
31#include <linux/mtd/physmap.h> 30#include <linux/mtd/physmap.h>
32 31
@@ -122,7 +121,7 @@ static struct pad_desc mx35pdk_pads[] = {
122}; 121};
123 122
124/* OTG config */ 123/* OTG config */
125static struct fsl_usb2_platform_data usb_otg_pdata = { 124static const struct fsl_usb2_platform_data usb_otg_pdata __initconst = {
126 .operating_mode = FSL_USB2_DR_DEVICE, 125 .operating_mode = FSL_USB2_DR_DEVICE,
127 .phy_mode = FSL_USB2_PHY_UTMI_WIDE, 126 .phy_mode = FSL_USB2_PHY_UTMI_WIDE,
128}; 127};
@@ -146,7 +145,7 @@ static void __init mxc_board_init(void)
146 145
147 imx35_add_imx_uart0(&uart_pdata); 146 imx35_add_imx_uart0(&uart_pdata);
148 147
149 mxc_register_device(&mxc_otg_udc_device, &usb_otg_pdata); 148 imx35_add_fsl_usb2_udc(&usb_otg_pdata);
150 149
151 mxc_register_device(&mxc_usbh1, &usb_host_pdata); 150 mxc_register_device(&mxc_usbh1, &usb_host_pdata);
152 151
diff --git a/arch/arm/mach-mx3/mach-pcm037.c b/arch/arm/mach-mx3/mach-pcm037.c
index 2ba4f2b9480b..20f7f9485dc6 100644
--- a/arch/arm/mach-mx3/mach-pcm037.c
+++ b/arch/arm/mach-mx3/mach-pcm037.c
@@ -27,7 +27,6 @@
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <linux/spi/spi.h> 28#include <linux/spi/spi.h>
29#include <linux/irq.h> 29#include <linux/irq.h>
30#include <linux/fsl_devices.h>
31#include <linux/can/platform/sja1000.h> 30#include <linux/can/platform/sja1000.h>
32#include <linux/usb/otg.h> 31#include <linux/usb/otg.h>
33#include <linux/usb/ulpi.h> 32#include <linux/usb/ulpi.h>
@@ -550,7 +549,7 @@ static struct mxc_usbh_platform_data usbh2_pdata = {
550}; 549};
551#endif 550#endif
552 551
553static struct fsl_usb2_platform_data otg_device_pdata = { 552static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
554 .operating_mode = FSL_USB2_DR_DEVICE, 553 .operating_mode = FSL_USB2_DR_DEVICE,
555 .phy_mode = FSL_USB2_PHY_ULPI, 554 .phy_mode = FSL_USB2_PHY_ULPI,
556}; 555};
@@ -664,7 +663,7 @@ static void __init mxc_board_init(void)
664 mxc_register_device(&mxc_usbh2, &usbh2_pdata); 663 mxc_register_device(&mxc_usbh2, &usbh2_pdata);
665#endif 664#endif
666 if (!otg_mode_host) 665 if (!otg_mode_host)
667 mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata); 666 imx31_add_fsl_usb2_udc(&otg_device_pdata);
668 667
669} 668}
670 669
diff --git a/arch/arm/mach-mx3/mach-pcm043.c b/arch/arm/mach-mx3/mach-pcm043.c
index 4e1de87995d4..78159f073a41 100644
--- a/arch/arm/mach-mx3/mach-pcm043.c
+++ b/arch/arm/mach-mx3/mach-pcm043.c
@@ -27,7 +27,6 @@
27#include <linux/i2c/at24.h> 27#include <linux/i2c/at24.h>
28#include <linux/usb/otg.h> 28#include <linux/usb/otg.h>
29#include <linux/usb/ulpi.h> 29#include <linux/usb/ulpi.h>
30#include <linux/fsl_devices.h>
31 30
32#include <asm/mach-types.h> 31#include <asm/mach-types.h>
33#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
@@ -323,7 +322,7 @@ static struct mxc_usbh_platform_data usbh1_pdata = {
323}; 322};
324#endif 323#endif
325 324
326static struct fsl_usb2_platform_data otg_device_pdata = { 325static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
327 .operating_mode = FSL_USB2_DR_DEVICE, 326 .operating_mode = FSL_USB2_DR_DEVICE,
328 .phy_mode = FSL_USB2_PHY_UTMI, 327 .phy_mode = FSL_USB2_PHY_UTMI,
329}; 328};
@@ -392,7 +391,7 @@ static void __init mxc_board_init(void)
392 mxc_register_device(&mxc_usbh1, &usbh1_pdata); 391 mxc_register_device(&mxc_usbh1, &usbh1_pdata);
393#endif 392#endif
394 if (!otg_mode_host) 393 if (!otg_mode_host)
395 mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata); 394 imx35_add_fsl_usb2_udc(&otg_device_pdata);
396 395
397 imx35_add_flexcan1(NULL); 396 imx35_add_flexcan1(NULL);
398 imx35_add_esdhc(0, NULL); 397 imx35_add_esdhc(0, NULL);
diff --git a/arch/arm/mach-mx3/mx31moboard-devboard.c b/arch/arm/mach-mx3/mx31moboard-devboard.c
index 3b75929f83f0..331b5950c7a0 100644
--- a/arch/arm/mach-mx3/mx31moboard-devboard.c
+++ b/arch/arm/mach-mx3/mx31moboard-devboard.c
@@ -18,7 +18,6 @@
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/types.h> 20#include <linux/types.h>
21#include <linux/fsl_devices.h>
22 21
23#include <linux/usb/otg.h> 22#include <linux/usb/otg.h>
24 23
@@ -210,7 +209,7 @@ static int __init devboard_usbh1_init(void)
210} 209}
211 210
212 211
213static struct fsl_usb2_platform_data usb_pdata = { 212static const struct fsl_usb2_platform_data usb_pdata __initconst = {
214 .operating_mode = FSL_USB2_DR_DEVICE, 213 .operating_mode = FSL_USB2_DR_DEVICE,
215 .phy_mode = FSL_USB2_PHY_ULPI, 214 .phy_mode = FSL_USB2_PHY_ULPI,
216}; 215};
@@ -231,7 +230,7 @@ void __init mx31moboard_devboard_init(void)
231 230
232 devboard_init_sel_gpios(); 231 devboard_init_sel_gpios();
233 232
234 mxc_register_device(&mxc_otg_udc_device, &usb_pdata); 233 imx31_add_fsl_usb2_udc(&usb_pdata);
235 234
236 devboard_usbh1_init(); 235 devboard_usbh1_init();
237} 236}
diff --git a/arch/arm/mach-mx3/mx31moboard-marxbot.c b/arch/arm/mach-mx3/mx31moboard-marxbot.c
index 075c4fb8e74c..db79f744c301 100644
--- a/arch/arm/mach-mx3/mx31moboard-marxbot.c
+++ b/arch/arm/mach-mx3/mx31moboard-marxbot.c
@@ -21,7 +21,6 @@
21#include <linux/slab.h> 21#include <linux/slab.h>
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/types.h> 23#include <linux/types.h>
24#include <linux/fsl_devices.h>
25 24
26#include <linux/usb/otg.h> 25#include <linux/usb/otg.h>
27 26
@@ -326,7 +325,7 @@ static int __init marxbot_usbh1_init(void)
326 return mxc_register_device(&mxc_usbh1, &usbh1_pdata); 325 return mxc_register_device(&mxc_usbh1, &usbh1_pdata);
327} 326}
328 327
329static struct fsl_usb2_platform_data usb_pdata = { 328static const struct fsl_usb2_platform_data usb_pdata __initconst = {
330 .operating_mode = FSL_USB2_DR_DEVICE, 329 .operating_mode = FSL_USB2_DR_DEVICE,
331 .phy_mode = FSL_USB2_PHY_ULPI, 330 .phy_mode = FSL_USB2_PHY_ULPI,
332}; 331};
@@ -358,7 +357,7 @@ void __init mx31moboard_marxbot_init(void)
358 gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_LCS0)); 357 gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_LCS0));
359 gpio_export(IOMUX_TO_GPIO(MX31_PIN_LCS0), false); 358 gpio_export(IOMUX_TO_GPIO(MX31_PIN_LCS0), false);
360 359
361 mxc_register_device(&mxc_otg_udc_device, &usb_pdata); 360 imx31_add_fsl_usb2_udc(&usb_pdata);
362 361
363 marxbot_usbh1_init(); 362 marxbot_usbh1_init();
364} 363}
diff --git a/arch/arm/mach-mx3/mx31moboard-smartbot.c b/arch/arm/mach-mx3/mx31moboard-smartbot.c
index 417757e78c65..68e8ab55f4c7 100644
--- a/arch/arm/mach-mx3/mx31moboard-smartbot.c
+++ b/arch/arm/mach-mx3/mx31moboard-smartbot.c
@@ -19,7 +19,6 @@
19#include <linux/i2c.h> 19#include <linux/i2c.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/fsl_devices.h>
23 22
24#include <linux/usb/otg.h> 23#include <linux/usb/otg.h>
25#include <linux/usb/ulpi.h> 24#include <linux/usb/ulpi.h>
@@ -119,7 +118,7 @@ static int __init smartbot_cam_init(void)
119 return 0; 118 return 0;
120} 119}
121 120
122static struct fsl_usb2_platform_data usb_pdata = { 121static const struct fsl_usb2_platform_data usb_pdata __initconst = {
123 .operating_mode = FSL_USB2_DR_DEVICE, 122 .operating_mode = FSL_USB2_DR_DEVICE,
124 .phy_mode = FSL_USB2_PHY_ULPI, 123 .phy_mode = FSL_USB2_PHY_ULPI,
125}; 124};
@@ -183,7 +182,7 @@ void __init mx31moboard_smartbot_init(int board)
183 182
184 switch (board) { 183 switch (board) {
185 case MX31SMARTBOT: 184 case MX31SMARTBOT:
186 mxc_register_device(&mxc_otg_udc_device, &usb_pdata); 185 imx31_add_fsl_usb2_udc(&usb_pdata);
187 break; 186 break;
188 case MX31EYEBOT: 187 case MX31EYEBOT:
189 smartbot_otg_host_init(); 188 smartbot_otg_host_init();
diff --git a/arch/arm/plat-mxc/devices/platform-fsl-usb2-udc.c b/arch/arm/plat-mxc/devices/platform-fsl-usb2-udc.c
index 42c3923c4159..59c33f6e401c 100644
--- a/arch/arm/plat-mxc/devices/platform-fsl-usb2-udc.c
+++ b/arch/arm/plat-mxc/devices/platform-fsl-usb2-udc.c
@@ -25,6 +25,16 @@ const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data __initconst =
25 imx_fsl_usb2_udc_data_entry_single(MX27); 25 imx_fsl_usb2_udc_data_entry_single(MX27);
26#endif /* ifdef CONFIG_SOC_IMX27 */ 26#endif /* ifdef CONFIG_SOC_IMX27 */
27 27
28#ifdef CONFIG_SOC_IMX31
29const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data __initconst =
30 imx_fsl_usb2_udc_data_entry_single(MX31);
31#endif /* ifdef CONFIG_SOC_IMX31 */
32
33#ifdef CONFIG_SOC_IMX35
34const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data __initconst =
35 imx_fsl_usb2_udc_data_entry_single(MX35);
36#endif /* ifdef CONFIG_SOC_IMX35 */
37
28struct platform_device *__init imx_add_fsl_usb2_udc( 38struct platform_device *__init imx_add_fsl_usb2_udc(
29 const struct imx_fsl_usb2_udc_data *data, 39 const struct imx_fsl_usb2_udc_data *data,
30 const struct fsl_usb2_platform_data *pdata) 40 const struct fsl_usb2_platform_data *pdata)
diff --git a/arch/arm/plat-mxc/include/mach/mx31.h b/arch/arm/plat-mxc/include/mach/mx31.h
index d024c9c5dd3f..092323144e2b 100644
--- a/arch/arm/plat-mxc/include/mach/mx31.h
+++ b/arch/arm/plat-mxc/include/mach/mx31.h
@@ -24,7 +24,10 @@
24#define MX31_ECT_CTIO_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x18000) 24#define MX31_ECT_CTIO_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x18000)
25#define MX31_I2C1_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x80000) 25#define MX31_I2C1_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x80000)
26#define MX31_I2C3_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x84000) 26#define MX31_I2C3_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x84000)
27#define MX31_OTG_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x88000) 27#define MX31_USB_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x88000)
28#define MX31_USB_OTG_BASE_ADDR (MX31_USB_BASE_ADDR + 0x0000)
29#define MX31_USB_HS1_BASE_ADDR (MX31_USB_BASE_ADDR + 0x0200)
30#define MX31_USB_HS2_BASE_ADDR (MX31_USB_BASE_ADDR + 0x0400)
28#define MX31_ATA_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x8c000) 31#define MX31_ATA_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x8c000)
29#define MX31_UART1_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x90000) 32#define MX31_UART1_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x90000)
30#define MX31_UART2_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x94000) 33#define MX31_UART2_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x94000)
@@ -161,10 +164,9 @@ static inline void mx31_setup_weimcs(size_t cs,
161#define MX31_INT_UART2 32 164#define MX31_INT_UART2 32
162#define MX31_INT_NFC 33 165#define MX31_INT_NFC 33
163#define MX31_INT_SDMA 34 166#define MX31_INT_SDMA 34
164#define MX31_INT_USB1 35 167#define MX31_INT_USB_HS1 35
165#define MX31_INT_USB2 36 168#define MX31_INT_USB_HS2 36
166#define MX31_INT_USB3 37 169#define MX31_INT_USB_OTG 37
167#define MX31_INT_USB4 38
168#define MX31_INT_MSHC1 39 170#define MX31_INT_MSHC1 39
169#define MX31_INT_MSHC2 40 171#define MX31_INT_MSHC2 40
170#define MX31_INT_IPU_ERR 41 172#define MX31_INT_IPU_ERR 41
diff --git a/arch/arm/plat-mxc/include/mach/mx35.h b/arch/arm/plat-mxc/include/mach/mx35.h
index 906722593487..0fa3f6855349 100644
--- a/arch/arm/plat-mxc/include/mach/mx35.h
+++ b/arch/arm/plat-mxc/include/mach/mx35.h
@@ -65,8 +65,14 @@
65#define MX35_CAN2_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xe8000) 65#define MX35_CAN2_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xe8000)
66#define MX35_RTIC_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xec000) 66#define MX35_RTIC_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xec000)
67#define MX35_IIM_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xf0000) 67#define MX35_IIM_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xf0000)
68 68#define MX35_USB_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xf4000)
69#define MX35_OTG_BASE_ADDR 0x53ff4000 69#define MX35_USB_OTG_BASE_ADDR (MX35_USB_BASE_ADDR + 0x0000)
70/*
71 * The Reference Manual (IMX35RM, Rev. 2, 3/2009) claims an offset of 0x200 for
72 * HS. When host support was implemented only a preliminary document was
73 * available, which told 0x400. This works fine.
74 */
75#define MX35_USB_HS_BASE_ADDR (MX35_USB_BASE_ADDR + 0x0400)
70 76
71#define MX35_ROMP_BASE_ADDR 0x60000000 77#define MX35_ROMP_BASE_ADDR 0x60000000
72#define MX35_ROMP_SIZE SZ_1M 78#define MX35_ROMP_SIZE SZ_1M
@@ -143,8 +149,8 @@
143#define MX35_INT_UART2 32 149#define MX35_INT_UART2 32
144#define MX35_INT_NFC 33 150#define MX35_INT_NFC 33
145#define MX35_INT_SDMA 34 151#define MX35_INT_SDMA 34
146#define MX35_INT_USBHS 35 152#define MX35_INT_USB_HS 35
147#define MX35_INT_USBOTG 37 153#define MX35_INT_USB_OTG 37
148#define MX35_INT_MSHC1 39 154#define MX35_INT_MSHC1 39
149#define MX35_INT_ESAI 40 155#define MX35_INT_ESAI 40
150#define MX35_INT_IPU_ERR 41 156#define MX35_INT_IPU_ERR 41