aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mx3
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@freescale.com>2010-12-21 13:38:21 -0500
committerSascha Hauer <s.hauer@pengutronix.de>2011-01-03 04:18:06 -0500
commit1c50e67263a6ab8abb9234e2357bd02134fb4b99 (patch)
treebd0a4d4dddf94ed4f50de68e97d89e7896fae4b7 /arch/arm/mach-mx3
parent460d30a329a4186192598131505d9f75e6c5e2bc (diff)
ARM: mx3/mx31_3ds: Add support for OTG host mode
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mx3')
-rw-r--r--arch/arm/mach-mx3/Kconfig2
-rw-r--r--arch/arm/mach-mx3/mach-mx31_3ds.c36
2 files changed, 37 insertions, 1 deletions
diff --git a/arch/arm/mach-mx3/Kconfig b/arch/arm/mach-mx3/Kconfig
index 9037c4e9bd34..0717f887cba0 100644
--- a/arch/arm/mach-mx3/Kconfig
+++ b/arch/arm/mach-mx3/Kconfig
@@ -96,8 +96,10 @@ config MACH_MX31_3DS
96 select IMX_HAVE_PLATFORM_IMX2_WDT 96 select IMX_HAVE_PLATFORM_IMX2_WDT
97 select IMX_HAVE_PLATFORM_IMX_KEYPAD 97 select IMX_HAVE_PLATFORM_IMX_KEYPAD
98 select IMX_HAVE_PLATFORM_IMX_UART 98 select IMX_HAVE_PLATFORM_IMX_UART
99 select IMX_HAVE_PLATFORM_MXC_EHCI
99 select IMX_HAVE_PLATFORM_MXC_NAND 100 select IMX_HAVE_PLATFORM_MXC_NAND
100 select IMX_HAVE_PLATFORM_SPI_IMX 101 select IMX_HAVE_PLATFORM_SPI_IMX
102 select MXC_ULPI if USB_ULPI
101 help 103 help
102 Include support for MX31PDK (3DS) platform. This includes specific 104 Include support for MX31PDK (3DS) platform. This includes specific
103 configurations for the board and its peripherals. 105 configurations for the board and its peripherals.
diff --git a/arch/arm/mach-mx3/mach-mx31_3ds.c b/arch/arm/mach-mx3/mach-mx31_3ds.c
index c488491bf938..fd7b722dff63 100644
--- a/arch/arm/mach-mx3/mach-mx31_3ds.c
+++ b/arch/arm/mach-mx3/mach-mx31_3ds.c
@@ -22,6 +22,8 @@
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/usb/otg.h>
26#include <linux/usb/ulpi.h>
25 27
26#include <mach/hardware.h> 28#include <mach/hardware.h>
27#include <asm/mach-types.h> 29#include <asm/mach-types.h>
@@ -32,6 +34,7 @@
32#include <mach/common.h> 34#include <mach/common.h>
33#include <mach/iomux-mx3.h> 35#include <mach/iomux-mx3.h>
34#include <mach/3ds_debugboard.h> 36#include <mach/3ds_debugboard.h>
37#include <mach/ulpi.h>
35 38
36#include "devices-imx31.h" 39#include "devices-imx31.h"
37#include "devices.h" 40#include "devices.h"
@@ -212,11 +215,33 @@ usbotg_free_reset:
212 return err; 215 return err;
213} 216}
214 217
218#if defined(CONFIG_USB_ULPI)
219static struct mxc_usbh_platform_data otg_pdata __initdata = {
220 .portsc = MXC_EHCI_MODE_ULPI,
221 .flags = MXC_EHCI_POWER_PINS_ENABLED,
222};
223#endif
224
215static const struct fsl_usb2_platform_data usbotg_pdata __initconst = { 225static const struct fsl_usb2_platform_data usbotg_pdata __initconst = {
216 .operating_mode = FSL_USB2_DR_DEVICE, 226 .operating_mode = FSL_USB2_DR_DEVICE,
217 .phy_mode = FSL_USB2_PHY_ULPI, 227 .phy_mode = FSL_USB2_PHY_ULPI,
218}; 228};
219 229
230static int otg_mode_host;
231
232static int __init mx31_3ds_otg_mode(char *options)
233{
234 if (!strcmp(options, "host"))
235 otg_mode_host = 1;
236 else if (!strcmp(options, "device"))
237 otg_mode_host = 0;
238 else
239 pr_info("otg_mode neither \"host\" nor \"device\". "
240 "Defaulting to device\n");
241 return 0;
242}
243__setup("otg_mode=", mx31_3ds_otg_mode);
244
220static const struct imxuart_platform_data uart_pdata __initconst = { 245static const struct imxuart_platform_data uart_pdata __initconst = {
221 .flags = IMXUART_HAVE_RTSCTS, 246 .flags = IMXUART_HAVE_RTSCTS,
222}; 247};
@@ -247,7 +272,16 @@ static void __init mxc_board_init(void)
247 imx31_add_imx_keypad(&mx31_3ds_keymap_data); 272 imx31_add_imx_keypad(&mx31_3ds_keymap_data);
248 273
249 mx31_3ds_usbotg_init(); 274 mx31_3ds_usbotg_init();
250 imx31_add_fsl_usb2_udc(&usbotg_pdata); 275#if defined(CONFIG_USB_ULPI)
276 if (otg_mode_host) {
277 otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
278 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
279
280 imx31_add_mxc_ehci_otg(&otg_pdata);
281 }
282#endif
283 if (!otg_mode_host)
284 imx31_add_fsl_usb2_udc(&usbotg_pdata);
251 285
252 if (mxc_expio_init(MX31_CS5_BASE_ADDR, EXPIO_PARENT_INT)) 286 if (mxc_expio_init(MX31_CS5_BASE_ADDR, EXPIO_PARENT_INT))
253 printk(KERN_WARNING "Init of the debug board failed, all " 287 printk(KERN_WARNING "Init of the debug board failed, all "