[PATCH 2/2] usb: imx: add overcurrent polarity handling on i.MX6

Michael Grzeschik m.grzeschik at pengutronix.de
Tue Feb 2 13:54:13 EST 2021


Signed-off-by: Michael Grzeschik <m.grzeschik at pengutronix.de>
---
 drivers/usb/imx/imx-usb-misc.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/imx/imx-usb-misc.c b/drivers/usb/imx/imx-usb-misc.c
index 660ebecd78..c16b4cf0ab 100644
--- a/drivers/usb/imx/imx-usb-misc.c
+++ b/drivers/usb/imx/imx-usb-misc.c
@@ -379,8 +379,15 @@ static __maybe_unused int mx6_initialize_usb_hw(void __iomem *base, int port,
 	case 0:
 	case 1:
 		val = readl(base + MX6_USB_CTRL(port));
-		if (flags & MXC_EHCI_DISABLE_OVERCURRENT)
+		if (flags & MXC_EHCI_DISABLE_OVERCURRENT) {
 			val |= MX6_USB_CTRL_OVER_CUR_DIS;
+		} else {
+			val &= ~MX6_USB_CTRL_OVER_CUR_DIS;
+			if (flags & MXC_EHCI_OC_PIN_ACTIVE_LOW)
+				val |= MX6_USB_CTRL_OVER_CUR_ACT_LOW;
+			else
+				val &= ~MX6_USB_CTRL_OVER_CUR_ACT_LOW;
+		}
 		if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH)
 			val |= MX6_USB_CTRL_PWR_POLARITY;
 		writel(val, base + MX6_USB_CTRL(port));
-- 
2.30.0




More information about the barebox mailing list