summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDouglas Anderson <dianders@chromium.org>2015-12-17 19:14:54 (GMT)
committerFelipe Balbi <balbi@ti.com>2015-12-22 17:53:01 (GMT)
commitf619473140df4e1a10f4c10f693d214807ebdb03 (patch)
tree2544da8288077d9547ae5a4d749692440411511a /drivers
parent0fe239bc190453fe82252c6d41a74e685730cd93 (diff)
downloadlinux-f619473140df4e1a10f4c10f693d214807ebdb03.tar.xz
usb: dwc2: Speed dwc2_get_hwparams() on some host-only ports
On some host-only DWC2 ports (like the one in rk3288) when we set GUSBCFG_FORCEHOSTMODE in GUSBCFG and then read back, we don't see the bit set. Presumably that's because the port is always forced to HOST mode so there's no reason to implement these status bits. Since we know dwc2_core_reset() is always called before dwc2_get_hwparams() and we know dwc2_core_reset() should have set GUSBCFG_FORCEHOSTMODE whenever hsotg->dr_mode == USB_DR_MODE_HOST, we can just check hsotg->dr_mode to decide that we can skip the delays in dwc2_get_hwparams(). Signed-off-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/dwc2/core.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
index af12778..c143ac4 100644
--- a/drivers/usb/dwc2/core.c
+++ b/drivers/usb/dwc2/core.c
@@ -3102,7 +3102,7 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
unsigned width;
u32 hwcfg1, hwcfg2, hwcfg3, hwcfg4;
u32 hptxfsiz, grxfsiz, gnptxfsiz;
- u32 gusbcfg;
+ u32 gusbcfg = 0;
/*
* Attempt to ensure this device is really a DWC_otg Controller.
@@ -3135,8 +3135,8 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
dev_dbg(hsotg->dev, "grxfsiz=%08x\n", grxfsiz);
/* Force host mode to get HPTXFSIZ / GNPTXFSIZ exact power on value */
- gusbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
- if (!(gusbcfg & GUSBCFG_FORCEHOSTMODE)) {
+ if (hsotg->dr_mode != USB_DR_MODE_HOST) {
+ gusbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
dwc2_writel(gusbcfg | GUSBCFG_FORCEHOSTMODE,
hsotg->regs + GUSBCFG);
usleep_range(100000, 150000);
@@ -3146,7 +3146,7 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
hptxfsiz = dwc2_readl(hsotg->regs + HPTXFSIZ);
dev_dbg(hsotg->dev, "gnptxfsiz=%08x\n", gnptxfsiz);
dev_dbg(hsotg->dev, "hptxfsiz=%08x\n", hptxfsiz);
- if (!(gusbcfg & GUSBCFG_FORCEHOSTMODE)) {
+ if (hsotg->dr_mode != USB_DR_MODE_HOST) {
dwc2_writel(gusbcfg, hsotg->regs + GUSBCFG);
usleep_range(100000, 150000);
}