]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00209480-1 mx6sl_usb bring up
authorTony LIU <junjie.liu@freescale.com>
Sat, 28 Apr 2012 02:47:21 +0000 (10:47 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 24 May 2013 06:34:37 +0000 (08:34 +0200)
- add usb otg power gpio control
- change cpu_is_mx6x() to cpu_is_mx6
- enable usb hsic support

Signed-off-by: Tony LIU <junjie.liu@freescale.com>
arch/arm/mach-mx6/board-mx6sl_arm2.c
arch/arm/mach-mx6/board-mx6sl_arm2.h
arch/arm/mach-mx6/usb_h2.c
arch/arm/plat-mxc/usb_common.c

index 2298e17315d82fac56805fd0be9f61dfeea06625..3879b8d3fb7963d0f49b902c91612df8c3a368d9 100755 (executable)
@@ -73,6 +73,8 @@
 #include "cpu_op-mx6.h"
 #include "board-mx6sl_arm2.h"
 
+#define MX6_ARM2_USBOTG1_PWR    IMX_GPIO_NR(4, 0)       /* KEY_COL4 */
+#define MX6_ARM2_USBOTG2_PWR    IMX_GPIO_NR(4, 2)       /* KEY_COL5 */
 #define MX6_ARM2_SD1_WP                IMX_GPIO_NR(4, 6)       /* KEY_COL7 */
 #define MX6_ARM2_SD1_CD                IMX_GPIO_NR(4, 7)       /* KEY_ROW7 */
 #define MX6_ARM2_SD2_WP                IMX_GPIO_NR(4, 29)      /* SD2_DAT6 */
@@ -111,6 +113,46 @@ static inline void mx6_arm2_init_uart(void)
        imx6q_add_sdhci_usdhc_imx(2, &mx6_arm2_sd3_data);
 }
 
+static void imx6_arm2_usbotg_vbus(bool on)
+{
+       if (on)
+               gpio_set_value(MX6_ARM2_USBOTG1_PWR, 1);
+       else
+               gpio_set_value(MX6_ARM2_USBOTG1_PWR, 0);
+}
+
+static void __init mx6_arm2_init_usb(void)
+{
+       int ret = 0;
+
+       imx_otg_base = MX6_IO_ADDRESS(MX6Q_USB_OTG_BASE_ADDR);
+
+       /* disable external charger detect,
+        * or it will affect signal quality at dp.
+        */
+
+       ret = gpio_request(MX6_ARM2_USBOTG1_PWR, "usbotg-pwr");
+       if (ret) {
+               pr_err("failed to get GPIO MX6_ARM2_USBOTG1_PWR:%d\n", ret);
+               return;
+       }
+       gpio_direction_output(MX6_ARM2_USBOTG1_PWR, 0);
+
+       ret = gpio_request(MX6_ARM2_USBOTG2_PWR, "usbh1-pwr");
+       if (ret) {
+               pr_err("failed to get GPIO MX6_ARM2_USBOTG2_PWR:%d\n", ret);
+               return;
+       }
+       gpio_direction_output(MX6_ARM2_USBOTG2_PWR, 1);
+
+       mx6_set_otghost_vbus_func(imx6_arm2_usbotg_vbus);
+       mx6_usb_dr_init();
+       mx6_usb_h1_init();
+#ifdef CONFIG_USB_EHCI_ARC_HSIC
+       mx6_usb_h2_init();
+#endif
+}
+
 /*!
  * Board specific initialization.
  */
@@ -119,6 +161,7 @@ static void __init mx6_arm2_init(void)
        mxc_iomux_v3_setup_multiple_pads(mx6sl_arm2_pads, ARRAY_SIZE(mx6sl_arm2_pads));
 
        mx6_arm2_init_uart();
+       mx6_arm2_init_usb();
 }
 
 extern void __iomem *twd_base;
index c2e6a28aa3676fe8b245f9c95a44226353c1b218..aa25d76ae615c9f1e49a13553abd25be08f08d11 100755 (executable)
@@ -25,6 +25,19 @@ static iomux_v3_cfg_t mx6sl_arm2_pads[] = {
        MX6SL_PAD_UART1_RXD__UART1_RXD,
        MX6SL_PAD_UART1_TXD__UART1_TXD,
 
+       /* USBOTG ID pin */
+       MX6SL_PAD_EPDC_PWRCOM__ANATOP_USBOTG1_ID,
+
+       /* USBOTG POWER GPIO */
+       MX6SL_PAD_KEY_COL4__GPIO_4_0,
+       MX6SL_PAD_KEY_COL5__GPIO_4_2,
+       /* USB OC pin */
+       MX6SL_PAD_KEY_ROW4__USB_USBOTG1_OC,
+       MX6SL_PAD_ECSPI2_SCLK__USB_USBOTG2_OC,
+       /* USB HSIC pin */
+       MX6SL_PAD_HSIC_STROBE__USB_H_STROBE,
+       MX6SL_PAD_HSIC_DAT__USB_H_DATA,
+
        /* SD1 */
        MX6SL_PAD_SD1_CLK__USDHC1_CLK,
        MX6SL_PAD_SD1_CMD__USDHC1_CMD,
index a671a958da759013191adb123bd28f027a46aa37..24083fd52d723d974eb2e22d1208b8922880c5d4 100644 (file)
@@ -31,6 +31,7 @@
 #include <mach/hardware.h>
 #include <mach/iomux-mx6q.h>
 #include <mach/iomux-mx6dl.h>
+#include <mach/iomux-mx6sl.h>
 #include "devices-imx6q.h"
 #include "regs-anadig.h"
 #include "usb.h"
@@ -185,6 +186,9 @@ static void hsic_start(void)
        else if (cpu_is_mx6dl())
                mxc_iomux_v3_setup_pad(
                                MX6DL_PAD_RGMII_TX_CTL__USBOH3_H2_STROBE_START);
+       else if (cpu_is_mx6sl())
+               mxc_iomux_v3_setup_pad(
+                               MX6SL_PAD_HSIC_STROBE__USB_H_STROBE_START);
 }
 
 static void hsic_device_connected(void)
index a4a3721246f8f8e1df9a485b03cae6d66a8d7ec8..6cf2fa8fb682d2200c596e34bab1361bd113415e 100755 (executable)
@@ -88,7 +88,7 @@ static int fsl_check_usbclk(void)
 
        usb_ahb_clk = clk_get(NULL, "usb_ahb_clk");
        if (clk_enable(usb_ahb_clk)) {
-               if (cpu_is_mx6q() || cpu_is_mx6dl())
+               if (cpu_is_mx6())
                        return 0; /* there is no ahb clock at mx6 */
                printk(KERN_ERR "clk_enable(usb_ahb_clk) failed\n");
                return -EINVAL;
@@ -97,7 +97,7 @@ static int fsl_check_usbclk(void)
 
        usb_clk = clk_get(NULL, "usb_clk");
        if (clk_enable(usb_clk)) {
-               if (cpu_is_mx6q() || cpu_is_mx6dl())
+               if (cpu_is_mx6())
                        return 0; /* there is usb_clk at mx6 */
                printk(KERN_ERR "clk_enable(usb_clk) failed\n");
                return -EINVAL;
@@ -502,7 +502,7 @@ int fsl_usb_host_init(struct platform_device *pdev)
 
        if (usb_register_remote_wakeup(pdev))
                pr_debug("%s port is not a wakeup source.\n", pdata->name);
-       if (!(cpu_is_mx6q() || cpu_is_mx6dl())) {
+       if (!(cpu_is_mx6())) {
                if (xops->xcvr_type == PORTSC_PTS_SERIAL) {
                        if (cpu_is_mx35()) {
                                usbh2_set_serial_xcvr();
@@ -814,7 +814,7 @@ int usbotg_init(struct platform_device *pdev)
                        return -EINVAL;
                if (xops->init)
                        xops->init(xops);
-               if (!((cpu_is_mx6q() || cpu_is_mx6dl()))) {
+               if (!(cpu_is_mx6())) {
                        UOG_PORTSC1 = UOG_PORTSC1 & ~PORTSC_PHCD;