As all usb power supply use low active for over current flag on imx6 imx7 boards, and the default register setting(0) is for high active, this patch is to correct it. Signed-off-by: Li Jun <jun.li@xxxxxxx> --- drivers/usb/chipidea/usbmisc_imx.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c index ab8b027..16e834b 100644 --- a/drivers/usb/chipidea/usbmisc_imx.c +++ b/drivers/usb/chipidea/usbmisc_imx.c @@ -56,6 +56,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_WAKEUP_ENABLE BIT(10) #define MX6_BM_ID_WAKEUP BIT(16) #define MX6_BM_VBUS_WAKEUP BIT(17) @@ -266,10 +267,15 @@ static int usbmisc_imx6q_init(struct imx_usbmisc_data *data) spin_lock_irqsave(&usbmisc->lock, flags); + reg = readl(usbmisc->base + data->index * 4); if (data->disable_oc) { - reg = readl(usbmisc->base + data->index * 4); writel(reg | MX6_BM_OVER_CUR_DIS, usbmisc->base + data->index * 4); + } else { + reg &= ~MX6_BM_OVER_CUR_DIS; + /* OC flag is active low */ + writel(reg | MX6_BM_OVER_CUR_POLARITY, + usbmisc->base + data->index * 4); } /* SoC non-burst setting */ @@ -365,9 +371,13 @@ static int usbmisc_imx7d_init(struct imx_usbmisc_data *data) return -EINVAL; spin_lock_irqsave(&usbmisc->lock, flags); + reg = readl(usbmisc->base); if (data->disable_oc) { - reg = readl(usbmisc->base); writel(reg | MX6_BM_OVER_CUR_DIS, usbmisc->base); + } else { + reg &= ~MX6_BM_OVER_CUR_DIS; + /* OC flag is active low */ + writel(reg | MX6_BM_OVER_CUR_POLARITY, usbmisc->base); } reg = readl(usbmisc->base + MX7D_USBNC_USB_CTRL2); @@ -492,6 +502,10 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = { .compatible = "fsl,imx6ul-usbmisc", .data = &imx6sx_usbmisc_ops, }, + { + .compatible = "fsl,imx7d-usbmisc", + .data = &imx7d_usbmisc_ops, + }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, usbmisc_imx_dt_ids); -- 2.6.6 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html