MLK-14947-5 chipidea: imx: add usb vbus power polarity setting
authorLi Jun <jun.li@nxp.com>
Thu, 18 May 2017 16:07:42 +0000 (00:07 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:22:24 +0000 (15:22 -0500)
If the vbus is controlled by ehci port power bit, we need set power
polarity of vbus enable signal according to the vbus power supply
chip on board.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
drivers/usb/chipidea/ci_hdrc_imx.c
drivers/usb/chipidea/ci_hdrc_imx.h
drivers/usb/chipidea/usbmisc_imx.c

index 6c410be..428a05a 100644 (file)
@@ -204,6 +204,9 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev)
        if (of_find_property(np, "over-current-active-high", NULL))
                data->oc_polarity = 1;
 
+       if (of_find_property(np, "power-polarity-active-high", NULL))
+               data->pwr_polarity = 1;
+
        if (of_find_property(np, "external-vbus-divider", NULL))
                data->evdo = 1;
 
index 5ab88b5..9ae6844 100644 (file)
@@ -46,6 +46,7 @@ struct imx_usbmisc_data {
 
        unsigned int disable_oc:1; /* over current detect disabled */
        unsigned int oc_polarity:1; /* over current polarity if oc enabled */
+       unsigned int pwr_polarity:1; /* polarity of enable vbus from pmic */
        unsigned int evdo:1; /* set external vbus divider option */
        /*
         * Specifies the delay between powering up the xtal 24MHz clock
index ba0e71c..4e3b31c 100644 (file)
@@ -60,6 +60,7 @@
 #define MX6_BM_NON_BURST_SETTING       BIT(1)
 #define MX6_BM_OVER_CUR_DIS            BIT(7)
 #define MX6_BM_OVER_CUR_POLARITY       BIT(8)
+#define MX6_BM_PRW_POLARITY            BIT(9)
 #define MX6_BM_WAKEUP_ENABLE           BIT(10)
 #define MX6_BM_UTMI_ON_CLOCK           BIT(13)
 #define MX6_BM_ID_WAKEUP               BIT(16)
@@ -530,6 +531,10 @@ static int usbmisc_imx7d_init(struct imx_usbmisc_data *data)
                /* High active */
                reg &= ~(MX6_BM_OVER_CUR_DIS | MX6_BM_OVER_CUR_POLARITY);
        }
+
+       if (data->pwr_polarity)
+               reg |= MX6_BM_PRW_POLARITY;
+
        writel(reg, usbmisc->base);
 
        /* SoC non-burst setting */