Skip to contentSkip to conversation

usb: dwc2: awake rt305x USB controller

PATCH/RFC John Crispin 1 participant 1 message Jul 20, 2018

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

From: Serge Vasilugin <[email protected]>

The Ralink uboot sets the USB controller into sleep mode. This patch checks this condition and awakes controller before any register access.

---
Hi,
we have been carrying this patch inside OpenWrt for half a decade. The USB driver that is included in the Ralink SDK does a mdelay(25) after this call but it works without apparently.
John

 drivers/usb/dwc2/platform.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/usb/dwc2/platform.c +4 -0
index 4c0819554bcd..0bc9fd65e29e 100644
@@ -419,6 +419,10 @@ static int dwc2_driver_probe(struct platform_device *dev)
 	if (retval)
 		return retval;
 
+	/* Enable USB port before any regs access */
+	if (dwc2_readl(hsotg->regs + PCGCTL) & 0x0f)
+		dwc2_writel(0x00, hsotg->regs + PCGCTL);
+
 	retval = dwc2_get_dr_mode(hsotg);
 	if (retval)
 		goto error;