diff options
author | Guennadi Liakhovetski <lg@denx.de> | 2009-05-04 07:13:52 -0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2009-05-07 10:19:50 -0400 |
commit | eb05bbeb65cc1015bdd5c4cb72fd1694a3288e97 (patch) | |
tree | 7427033c21d9d7f0723ede4a3ce44e7ab79828bb /arch/arm/mach-mx3/pcm037.c | |
parent | bff0b53bd77df7e44a1d6b1a13162e26def5d17a (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/pcm037.c')
-rw-r--r-- | arch/arm/mach-mx3/pcm037.c | 51 |
1 files changed, 51 insertions, 0 deletions
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 | ||
135 | static 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 */ | ||
151 | static 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 */ | ||
178 | static struct fsl_usb2_platform_data usb_pdata = { | ||
179 | .operating_mode = FSL_USB2_DR_DEVICE, | ||
180 | .phy_mode = FSL_USB2_PHY_ULPI, | ||
181 | }; | ||
182 | |||
134 | static struct platform_device pcm037_flash = { | 183 | static 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 | ||
350 | static void __init pcm037_timer_init(void) | 401 | static void __init pcm037_timer_init(void) |