usb: dwc3: pci: Enable ULPI Refclk on platforms where the firmware doesnot
PATCH 2/3 usb: dwc3: pci: Enable ULPI Refclk on platforms where the firmware doesnot
Hi,
Quoted 43 lines · Sergei Shtylyov
Hello!
Quoted 15 lines · Hans de Goede
On some Bay Trail (BYT) systems the firmware does not enable the ULPI Refclk.
This commit adds a helper which checks and if necessary enabled the Refclk and calls this helper for BYT machines.
Signed-off-by Hans de Goede <[email protected]>--- drivers/usb/dwc3/dwc3-pci.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)drivers/usb/dwc3/dwc3-pci.c +0
-0[...]
Quoted 9 lines
drivers/usb/dwc3/dwc3-pci.c +5
-0@@ -78,6 +81,34 @@ static struct gpiod_lookup_table platform_bytcr_gpios = { }, }; +static void dwc3_pci_enable_ulpi_refclock (struct pci_dev *pci) +{ +void __iomem *reg; +struct resource res; +struct device *dev = &pci->dev;drivers/usb/dwc3/dwc3-pci.c static struct gpiod_lookup_table platform_bytcr_gpios = { · line 98
Quoted 10 lines
drivers/usb/dwc3/dwc3-pci.c +10
-0+u32 value; + + res.start =pci_resource_start (pci,1 ); + res.end =pci_resource_end (pci,1 ); + res.name ="dwc_usb3_bar1" ; + res.flags =IORESOURCE_MEM ; + + reg =devm_ioremap_resource (dev, &res); +if (IS_ERR (reg)) { +dev_err (dev,"cannot check GP_RWREG1 to assert ulpi refclock\n" );Eh?
BTW,devm_ioremap_resource()prints the error cause already...
Quoted 7 lines
drivers/usb/dwc3/dwc3-pci.c static struct gpiod_lookup_table platform_bytcr_gpios = { · line 103
Quoted 5 lines
drivers/usb/dwc3/dwc3-pci.c +5
-0+return ; + } + + value =readl (reg +GP_RWREG1 ); +if (!(value &GP_RWREG1_ULPI_REFCLK_DISABLE ))I guess that
dev_err()belongs here...
Nope the error is that GP_RWREG1 cannot be read because the remap fails. I agree that this is a bit silly and I will fix for v2, but returning here without printing anything is correct.
Regards,
Hans
Quoted 14 lines
Quoted 12 lines
drivers/usb/dwc3/dwc3-pci.c +8
-0+return ;/* ULPI refclk already enabled */ + +dev_warn (dev,"ULPI refclock is disabled from the BIOS, enabling it\n" ); + value &= ~GP_RWREG1_ULPI_REFCLK_DISABLE ; +writel (value, reg +GP_RWREG1 ); +msleep (100 ); +} +static int dwc3_pci_quirks (struct dwc3_pci *dwc) {struct platform_device *dwc3 = dwc->dwc3;[...]
Quoted 2 lines
MBR, Sergei
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html