diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 1fbfdd82041..ff6f490cbf0 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -372,6 +372,17 @@ static int __devinit dwc3_core_init(struct dwc3 *dwc) dwc3_writel(dwc->regs, DWC3_GCTL, reg); + /* + * The default value of GUCTL[31:22] should be 0x8. But on cores + * revision < 2.30a, the default value is mistakenly overridden + * with 0x0. Restore the correct default value. + */ + if (dwc->revision < DWC3_REVISION_230A) { + reg = dwc3_readl(dwc->regs, DWC3_GUCTL); + reg &= ~DWC3_GUCTL_REFCLKPER; + reg |= 0x8 << __ffs(DWC3_GUCTL_REFCLKPER); + dwc3_writel(dwc->regs, DWC3_GUCTL, reg); + } /* * Currently, the default and the recommended value for GUSB3PIPECTL * [21:19] in the RTL is 3'b100 or 32 consecutive errors. Based on diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 98adff70d07..d5839f097f8 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -180,6 +180,9 @@ #define DWC3_GCTL_DISSCRAMBLE (1 << 3) #define DWC3_GCTL_DSBLCLKGTNG (1 << 0) +/* Global User Control Register */ +#define DWC3_GUCTL_REFCLKPER (0x3FF << 22) + /* Global USB2 PHY Configuration Register */ #define DWC3_GUSB2PHYCFG_PHYSOFTRST (1 << 31) #define DWC3_GUSB2PHYCFG_SUSPHY (1 << 6)