aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorEric Bénard <eric@eukrea.com>2010-05-19 12:46:02 -0400
committerSascha Hauer <s.hauer@pengutronix.de>2010-07-26 08:17:43 -0400
commit9f2270da95aa0d19889d5511b1bb39465669b6aa (patch)
treec8c3b9c7a2754ec671279a5a2823527f1a4e98d0 /arch
parent62d725b1d38856c50aebc5542707c6f5ea07a451 (diff)
mach-cpuimx27: add USB Host2 and OTG support
support copied from mach-pca100.c Signed-off-by: Eric Bénard <eric@eukrea.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-mx2/Kconfig1
-rw-r--r--arch/arm/mach-mx2/mach-cpuimx27.c77
2 files changed, 78 insertions, 0 deletions
diff --git a/arch/arm/mach-mx2/Kconfig b/arch/arm/mach-mx2/Kconfig
index 9d3a9091dd74..3f756f4ad050 100644
--- a/arch/arm/mach-mx2/Kconfig
+++ b/arch/arm/mach-mx2/Kconfig
@@ -59,6 +59,7 @@ endchoice
59config MACH_CPUIMX27 59config MACH_CPUIMX27
60 bool "Eukrea CPUIMX27 module" 60 bool "Eukrea CPUIMX27 module"
61 depends on MACH_MX27 61 depends on MACH_MX27
62 select MXC_ULPI if USB_ULPI
62 help 63 help
63 Include support for Eukrea CPUIMX27 platform. This includes 64 Include support for Eukrea CPUIMX27 platform. This includes
64 specific configurations for the module and its peripherals. 65 specific configurations for the module and its peripherals.
diff --git a/arch/arm/mach-mx2/mach-cpuimx27.c b/arch/arm/mach-mx2/mach-cpuimx27.c
index a3449ed7c45c..19877f13b89b 100644
--- a/arch/arm/mach-mx2/mach-cpuimx27.c
+++ b/arch/arm/mach-mx2/mach-cpuimx27.c
@@ -26,6 +26,9 @@
26#include <linux/mtd/physmap.h> 26#include <linux/mtd/physmap.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/serial_8250.h> 28#include <linux/serial_8250.h>
29#include <linux/usb/otg.h>
30#include <linux/usb/ulpi.h>
31#include <linux/fsl_devices.h>
29 32
30#include <asm/mach-types.h> 33#include <asm/mach-types.h>
31#include <asm/mach/arch.h> 34#include <asm/mach/arch.h>
@@ -39,6 +42,8 @@
39#include <mach/iomux-mx27.h> 42#include <mach/iomux-mx27.h>
40#include <mach/imx-uart.h> 43#include <mach/imx-uart.h>
41#include <mach/mxc_nand.h> 44#include <mach/mxc_nand.h>
45#include <mach/mxc_ehci.h>
46#include <mach/ulpi.h>
42 47
43#include "devices.h" 48#include "devices.h"
44 49
@@ -93,6 +98,32 @@ static int eukrea_cpuimx27_pins[] = {
93 GPIO_PORTB | 27 | GPIO_GPIO | GPIO_IN, 98 GPIO_PORTB | 27 | GPIO_GPIO | GPIO_IN,
94 GPIO_PORTB | 30 | GPIO_GPIO | GPIO_IN, 99 GPIO_PORTB | 30 | GPIO_GPIO | GPIO_IN,
95#endif 100#endif
101 /* OTG */
102 PC7_PF_USBOTG_DATA5,
103 PC8_PF_USBOTG_DATA6,
104 PC9_PF_USBOTG_DATA0,
105 PC10_PF_USBOTG_DATA2,
106 PC11_PF_USBOTG_DATA1,
107 PC12_PF_USBOTG_DATA4,
108 PC13_PF_USBOTG_DATA3,
109 PE0_PF_USBOTG_NXT,
110 PE1_PF_USBOTG_STP,
111 PE2_PF_USBOTG_DIR,
112 PE24_PF_USBOTG_CLK,
113 PE25_PF_USBOTG_DATA7,
114 /* USBH2 */
115 PA0_PF_USBH2_CLK,
116 PA1_PF_USBH2_DIR,
117 PA2_PF_USBH2_DATA7,
118 PA3_PF_USBH2_NXT,
119 PA4_PF_USBH2_STP,
120 PD19_AF_USBH2_DATA4,
121 PD20_AF_USBH2_DATA3,
122 PD21_AF_USBH2_DATA6,
123 PD22_AF_USBH2_DATA0,
124 PD23_AF_USBH2_DATA2,
125 PD24_AF_USBH2_DATA1,
126 PD26_AF_USBH2_DATA5,
96}; 127};
97 128
98static struct physmap_flash_data eukrea_cpuimx27_flash_data = { 129static struct physmap_flash_data eukrea_cpuimx27_flash_data = {
@@ -186,6 +217,36 @@ static struct platform_device serial_device = {
186}; 217};
187#endif 218#endif
188 219
220static struct mxc_usbh_platform_data otg_pdata = {
221 .portsc = MXC_EHCI_MODE_ULPI,
222 .flags = MXC_EHCI_INTERFACE_DIFF_UNI,
223};
224
225static struct mxc_usbh_platform_data usbh2_pdata = {
226 .portsc = MXC_EHCI_MODE_ULPI,
227 .flags = MXC_EHCI_INTERFACE_DIFF_UNI,
228};
229
230static struct fsl_usb2_platform_data otg_device_pdata = {
231 .operating_mode = FSL_USB2_DR_DEVICE,
232 .phy_mode = FSL_USB2_PHY_ULPI,
233};
234
235static int otg_mode_host;
236
237static int __init eukrea_cpuimx27_otg_mode(char *options)
238{
239 if (!strcmp(options, "host"))
240 otg_mode_host = 1;
241 else if (!strcmp(options, "device"))
242 otg_mode_host = 0;
243 else
244 pr_info("otg_mode neither \"host\" nor \"device\". "
245 "Defaulting to device\n");
246 return 0;
247}
248__setup("otg_mode=", eukrea_cpuimx27_otg_mode);
249
189static void __init eukrea_cpuimx27_init(void) 250static void __init eukrea_cpuimx27_init(void)
190{ 251{
191 mxc_gpio_setup_multiple_pins(eukrea_cpuimx27_pins, 252 mxc_gpio_setup_multiple_pins(eukrea_cpuimx27_pins,
@@ -216,6 +277,22 @@ static void __init eukrea_cpuimx27_init(void)
216 platform_device_register(&serial_device); 277 platform_device_register(&serial_device);
217#endif 278#endif
218 279
280#if defined(CONFIG_USB_ULPI)
281 if (otg_mode_host) {
282 otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
283 USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT);
284
285 mxc_register_device(&mxc_otg_host, &otg_pdata);
286 }
287
288 usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
289 USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT);
290
291 mxc_register_device(&mxc_usbh2, &usbh2_pdata);
292#endif
293 if (!otg_mode_host)
294 mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata);
295
219#ifdef CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD 296#ifdef CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD
220 eukrea_mbimx27_baseboard_init(); 297 eukrea_mbimx27_baseboard_init();
221#endif 298#endif