aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mx3
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <lg@denx.de>2009-05-04 07:13:52 -0400
committerSascha Hauer <s.hauer@pengutronix.de>2009-05-07 10:19:50 -0400
commiteb05bbeb65cc1015bdd5c4cb72fd1694a3288e97 (patch)
tree7427033c21d9d7f0723ede4a3ce44e7ab79828bb /arch/arm/mach-mx3
parentbff0b53bd77df7e44a1d6b1a13162e26def5d17a (diff)
ARM: add USB device support to pcm037
Add OTG device definition and resources to i.MX31 and a pure USB device mode support to the pcm037 board. Signed-off-by: Guennadi Liakhovetski <lg@denx.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mx3')
-rw-r--r--arch/arm/mach-mx3/devices.c27
-rw-r--r--arch/arm/mach-mx3/devices.h1
-rw-r--r--arch/arm/mach-mx3/pcm037.c51
3 files changed, 79 insertions, 0 deletions
diff --git a/arch/arm/mach-mx3/devices.c b/arch/arm/mach-mx3/devices.c
index 227a538bb941..f55c9863ea42 100644
--- a/arch/arm/mach-mx3/devices.c
+++ b/arch/arm/mach-mx3/devices.c
@@ -17,6 +17,7 @@
17 * Boston, MA 02110-1301, USA. 17 * Boston, MA 02110-1301, USA.
18 */ 18 */
19 19
20#include <linux/dma-mapping.h>
20#include <linux/module.h> 21#include <linux/module.h>
21#include <linux/platform_device.h> 22#include <linux/platform_device.h>
22#include <linux/serial.h> 23#include <linux/serial.h>
@@ -349,6 +350,32 @@ struct platform_device mx3_fb = {
349 }, 350 },
350}; 351};
351 352
353static struct resource otg_resources[] = {
354 {
355 .start = OTG_BASE_ADDR,
356 .end = OTG_BASE_ADDR + 0x1ff,
357 .flags = IORESOURCE_MEM,
358 }, {
359 .start = MXC_INT_USB3,
360 .end = MXC_INT_USB3,
361 .flags = IORESOURCE_IRQ,
362 },
363};
364
365static u64 otg_dmamask = DMA_BIT_MASK(32);
366
367/* OTG gadget device */
368struct platform_device mxc_otg_udc_device = {
369 .name = "fsl-usb2-udc",
370 .id = -1,
371 .dev = {
372 .dma_mask = &otg_dmamask,
373 .coherent_dma_mask = DMA_BIT_MASK(32),
374 },
375 .resource = otg_resources,
376 .num_resources = ARRAY_SIZE(otg_resources),
377};
378
352#ifdef CONFIG_ARCH_MX35 379#ifdef CONFIG_ARCH_MX35
353static struct resource mxc_fec_resources[] = { 380static struct resource mxc_fec_resources[] = {
354 { 381 {
diff --git a/arch/arm/mach-mx3/devices.h b/arch/arm/mach-mx3/devices.h
index 88c04b296fab..27779c3e93e7 100644
--- a/arch/arm/mach-mx3/devices.h
+++ b/arch/arm/mach-mx3/devices.h
@@ -14,3 +14,4 @@ extern struct platform_device mx3_fb;
14extern struct platform_device mxc_fec_device; 14extern struct platform_device mxc_fec_device;
15extern struct platform_device mxcsdhc_device0; 15extern struct platform_device mxcsdhc_device0;
16extern struct platform_device mxcsdhc_device1; 16extern struct platform_device mxcsdhc_device1;
17extern struct platform_device mxc_otg_udc_device;
diff --git a/arch/arm/mach-mx3/pcm037.c b/arch/arm/mach-mx3/pcm037.c
index 5d7e0ca5c133..350cff5cc48a 100644
--- a/arch/arm/mach-mx3/pcm037.c
+++ b/arch/arm/mach-mx3/pcm037.c
@@ -31,6 +31,7 @@
31#include <linux/delay.h> 31#include <linux/delay.h>
32#include <linux/spi/spi.h> 32#include <linux/spi/spi.h>
33#include <linux/irq.h> 33#include <linux/irq.h>
34#include <linux/fsl_devices.h>
34 35
35#include <mach/hardware.h> 36#include <mach/hardware.h>
36#include <asm/mach-types.h> 37#include <asm/mach-types.h>
@@ -131,6 +132,54 @@ static struct resource pcm037_flash_resource = {
131 .flags = IORESOURCE_MEM, 132 .flags = IORESOURCE_MEM,
132}; 133};
133 134
135static int usbotg_pins[] = {
136 MX31_PIN_USBOTG_DATA0__USBOTG_DATA0,
137 MX31_PIN_USBOTG_DATA1__USBOTG_DATA1,
138 MX31_PIN_USBOTG_DATA2__USBOTG_DATA2,
139 MX31_PIN_USBOTG_DATA3__USBOTG_DATA3,
140 MX31_PIN_USBOTG_DATA4__USBOTG_DATA4,
141 MX31_PIN_USBOTG_DATA5__USBOTG_DATA5,
142 MX31_PIN_USBOTG_DATA6__USBOTG_DATA6,
143 MX31_PIN_USBOTG_DATA7__USBOTG_DATA7,
144 MX31_PIN_USBOTG_CLK__USBOTG_CLK,
145 MX31_PIN_USBOTG_DIR__USBOTG_DIR,
146 MX31_PIN_USBOTG_NXT__USBOTG_NXT,
147 MX31_PIN_USBOTG_STP__USBOTG_STP,
148};
149
150/* USB OTG HS port */
151static int __init gpio_usbotg_hs_activate(void)
152{
153 int ret = mxc_iomux_setup_multiple_pins(usbotg_pins,
154 ARRAY_SIZE(usbotg_pins), "usbotg");
155
156 if (ret < 0) {
157 printk(KERN_ERR "Cannot set up OTG pins\n");
158 return ret;
159 }
160
161 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
162 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
163 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
164 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
165 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
166 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
167 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
168 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
169 mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
170 mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
171 mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
172 mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
173
174 return 0;
175}
176
177/* OTG config */
178static struct fsl_usb2_platform_data usb_pdata = {
179 .operating_mode = FSL_USB2_DR_DEVICE,
180 .phy_mode = FSL_USB2_PHY_ULPI,
181};
182
134static struct platform_device pcm037_flash = { 183static struct platform_device pcm037_flash = {
135 .name = "physmap-flash", 184 .name = "physmap-flash",
136 .id = 0, 185 .id = 0,
@@ -345,6 +394,8 @@ static void __init mxc_board_init(void)
345 mxc_register_device(&mxcsdhc_device0, &sdhc_pdata); 394 mxc_register_device(&mxcsdhc_device0, &sdhc_pdata);
346 mxc_register_device(&mx3_ipu, &mx3_ipu_data); 395 mxc_register_device(&mx3_ipu, &mx3_ipu_data);
347 mxc_register_device(&mx3_fb, &mx3fb_pdata); 396 mxc_register_device(&mx3_fb, &mx3fb_pdata);
397 if (!gpio_usbotg_hs_activate())
398 mxc_register_device(&mxc_otg_udc_device, &usb_pdata);
348} 399}
349 400
350static void __init pcm037_timer_init(void) 401static void __init pcm037_timer_init(void)