Skip to contentSkip to conversation

usb: dwc2: fix unnecessary USB overcurrent condition

PATCH In review [email protected] 2 participants 2 messages May 27, 2015 – Jun 10, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: dwc2: fix unnecessary USB overcurrent condition

From: Dinh Nguyen <[email protected]>

For platforms that use a ULPI phy, we should enable the external VbusValid signal instead.

Cc Gregory Herrero <[email protected]>
Cc Mian Yousaf Kaukab <[email protected]>
Cc Felipe Balbi <[email protected]>
---
 drivers/usb/dwc2/core.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/usb/dwc2/core.c +5 -0
index e5b546f..08ffdc6 100644
@@ -807,6 +807,11 @@ int dwc2_core_init(struct dwc2_hsotg *hsotg, bool select_phy, int irq)
 	if (hsotg->core_params->ts_dline > 0)
 		usbcfg |= GUSBCFG_TERMSELDLPULSE;
 
+	/* Set external VBUS indicator as needed. */
+	if (hsotg->core_params->phy_type == DWC2_PHY_TYPE_PARAM_ULPI)
+		usbcfg |= (GUSBCFG_ULPI_INT_VBUS_IND |
+			   GUSBCFG_INDICATORPASSTHROUGH);
+
 	writel(usbcfg, hsotg->regs + GUSBCFG);
 
 	/* Reset the Controller */
Signature · 1 line
2.2.1
#1 lore raw

Hi Dinh,

Responding again to the proper message to add linux-usb. And also added more comments.

Quoted 4 lines · On 5/26/2015 7:32 PM, [email protected] wrote:

From: Dinh Nguyen <[email protected]>

For platforms that use a ULPI phy, we should enable the external VbusValid signal instead.

I don't think it should be for all ULPI phys. Though I'm not that familiar with ULPI.

Quoted 14 lines
Cc Gregory Herrero <[email protected]>
Cc Mian Yousaf Kaukab <[email protected]>
Cc Felipe Balbi <[email protected]>
---
 drivers/usb/dwc2/core.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/usb/dwc2/core.c +0 -0
index e5b546f..08ffdc6 100644

drivers/usb/dwc2/core.c int dwc2_core_init(struct dwc2_hsotg *hsotg, bool select_phy, int irq) · line 814

Quoted 8 lines
drivers/usb/dwc2/core.c +5 -0
@@ -807,6 +807,11 @@ int dwc2_core_init(struct dwc2_hsotg *hsotg, bool select_phy, int irq)
 	if (hsotg->core_params->ts_dline > 0)
 		usbcfg |= GUSBCFG_TERMSELDLPULSE;
 
+	/* Set external VBUS indicator as needed. */
+	if (hsotg->core_params->phy_type == DWC2_PHY_TYPE_PARAM_ULPI)
+		usbcfg |= (GUSBCFG_ULPI_INT_VBUS_IND |
+			   GUSBCFG_INDICATORPASSTHROUGH);
+

I think these should all be conditional on using the external vbus, and probably also on the features themselves since it will depend on the PHY and platform how you want to set these bits.

John