On i.MX6/7, VBUS enable and OC polarity is configured in the usbmisc; there is no PHY driver handling this. Always run usb_oc_config() when a fsl,usbmisc exists.
Signed-off-by: Nora Schiffer <[email protected]> --- drivers/usb/host/ehci-mx6.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c index 16a45b82399..84e2328a767 100644 --- a/drivers/usb/host/ehci-mx6.c +++ b/drivers/usb/host/ehci-mx6.c @@ -263,15 +263,16 @@ int usb_phy_mode(int port) } #endif -#if !defined(CONFIG_PHY) -/* Should be done in the MXS PHY driver */ +/* Should be done in the a imx-usbmisc driver */ static void usb_oc_config(struct usbnc_regs *usbnc, int index) { - void __iomem *ctrl = (void __iomem *)(&usbnc->ctrl[index]); + void __iomem *ctrl; - setbits_le32(ctrl, UCTRL_OVER_CUR_POL); + if (!usbnc) + return; - setbits_le32(ctrl, UCTRL_OVER_CUR_DIS); + ctrl = (void __iomem *)(&usbnc->ctrl[index]); + setbits_le32(ctrl, UCTRL_OVER_CUR_POL | UCTRL_OVER_CUR_DIS); /* Set power polarity to high active */ #ifdef CONFIG_MXC_USB_OTG_HACTIVE @@ -280,7 +281,6 @@ static void usb_oc_config(struct usbnc_regs *usbnc, int index) clrbits_le32(ctrl, UCTRL_PWR_POL); #endif } -#endif #if !CONFIG_IS_ENABLED(DM_USB) /** @@ -465,8 +465,6 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev) usb_power_config_mx6(priv->anatop_addr, priv->portnr); usb_power_config_mx7ulp(priv->phy_addr); - usb_oc_config(priv->misc_addr, priv->portnr); - #if defined(CONFIG_MX6) || defined(CONFIG_MX7ULP) usb_internal_phy_clock_gate(priv->phy_addr, 1); usb_phy_enable(ehci, priv->phy_addr); @@ -474,6 +472,7 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev) #endif usb_misc_config_mx7(priv->misc_addr); + usb_oc_config(priv->misc_addr, priv->portnr); #if CONFIG_IS_ENABLED(DM_REGULATOR) if (priv->vbus_supply) { @@ -695,8 +694,6 @@ static int ehci_usb_probe(struct udevice *dev) usb_power_config_mx6(priv->anatop_addr, priv->portnr); usb_power_config_mx7ulp(priv->phy_addr); - usb_oc_config(priv->misc_addr, priv->portnr); - #if defined(CONFIG_MX6) || defined(CONFIG_MX7ULP) || defined(CONFIG_IMXRT) usb_internal_phy_clock_gate(priv->phy_addr, 1); usb_phy_enable(ehci, priv->phy_addr); @@ -708,6 +705,7 @@ static int ehci_usb_probe(struct udevice *dev) #endif usb_misc_config_mx7(priv->misc_addr); + usb_oc_config(priv->misc_addr, priv->portnr); if (priv->init_type == USB_INIT_HOST) { setbits_le32(&ehci->usbmode, CM_HOST); -- 2.55.0
