浏览代码

ARM: mx3/mx35_3ds: Add USB OTG Host mode

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Fabio Estevam 14 年之前
父节点
当前提交
130a0ddad9
共有 1 个文件被更改,包括 26 次插入1 次删除
  1. 26 1
      arch/arm/mach-mx3/mach-mx35_3ds.c

+ 26 - 1
arch/arm/mach-mx3/mach-mx35_3ds.c

@@ -26,6 +26,7 @@
 #include <linux/platform_device.h>
 #include <linux/platform_device.h>
 #include <linux/memory.h>
 #include <linux/memory.h>
 #include <linux/gpio.h>
 #include <linux/gpio.h>
+#include <linux/usb/otg.h>
 
 
 #include <linux/mtd/physmap.h>
 #include <linux/mtd/physmap.h>
 
 
@@ -125,6 +126,11 @@ static const struct fsl_usb2_platform_data usb_otg_pdata __initconst = {
 	.phy_mode	= FSL_USB2_PHY_UTMI_WIDE,
 	.phy_mode	= FSL_USB2_PHY_UTMI_WIDE,
 };
 };
 
 
+static struct mxc_usbh_platform_data otg_pdata __initdata = {
+	.portsc	= MXC_EHCI_MODE_UTMI,
+	.flags	= MXC_EHCI_INTERNAL_PHY,
+};
+
 /* USB HOST config */
 /* USB HOST config */
 static const struct mxc_usbh_platform_data usb_host_pdata __initconst = {
 static const struct mxc_usbh_platform_data usb_host_pdata __initconst = {
 	.portsc		= MXC_EHCI_MODE_SERIAL,
 	.portsc		= MXC_EHCI_MODE_SERIAL,
@@ -132,6 +138,21 @@ static const struct mxc_usbh_platform_data usb_host_pdata __initconst = {
 			  MXC_EHCI_INTERNAL_PHY,
 			  MXC_EHCI_INTERNAL_PHY,
 };
 };
 
 
+static int otg_mode_host;
+
+static int __init mx35_3ds_otg_mode(char *options)
+{
+	if (!strcmp(options, "host"))
+		otg_mode_host = 1;
+	else if (!strcmp(options, "device"))
+		otg_mode_host = 0;
+	else
+		pr_info("otg_mode neither \"host\" nor \"device\". "
+			"Defaulting to device\n");
+	return 0;
+}
+__setup("otg_mode=", mx35_3ds_otg_mode);
+
 /*
 /*
  * Board specific initialization.
  * Board specific initialization.
  */
  */
@@ -145,10 +166,14 @@ static void __init mxc_board_init(void)
 
 
 	imx35_add_imx_uart0(&uart_pdata);
 	imx35_add_imx_uart0(&uart_pdata);
 
 
-	imx35_add_fsl_usb2_udc(&usb_otg_pdata);
+	if (otg_mode_host)
+		imx35_add_mxc_ehci_otg(&otg_pdata);
 
 
 	imx35_add_mxc_ehci_hs(&usb_host_pdata);
 	imx35_add_mxc_ehci_hs(&usb_host_pdata);
 
 
+	if (!otg_mode_host)
+		imx35_add_fsl_usb2_udc(&usb_otg_pdata);
+
 	imx35_add_mxc_nand(&mx35pdk_nand_board_info);
 	imx35_add_mxc_nand(&mx35pdk_nand_board_info);
 	imx35_add_sdhci_esdhc_imx(0, NULL);
 	imx35_add_sdhci_esdhc_imx(0, NULL);