aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc2/core.c
diff options
context:
space:
mode:
authorDouglas Anderson <dianders@chromium.org>2015-12-17 14:14:12 -0500
committerFelipe Balbi <balbi@ti.com>2015-12-22 12:51:30 -0500
commit991824677fe0a555394d8093b64647dbd08b89b0 (patch)
tree8ee3fd2723ebab4498418af9c2704f99e2131d51 /drivers/usb/dwc2/core.c
parent3be99cd0e882dd2127b8cfe3942f5e464915aeba (diff)
usb: dwc2: Restore GUSBCFG in dwc2_get_hwparams()
Previously dwc2_get_hwparams() was changing GUSBCFG and not putting it back the way it was (specifically it set and cleared FORCEHOSTMODE). Since we want to move dwc2_core_reset() _before_ dwc2_get_hwparams() we should make sure dwc2_get_hwparams() isn't messing with things in a permanent way. Since we're now looking at GUSBCFG, it's obvious that we shouldn't need all the extra delays if FORCEHOSTMODE was already set. This will avoid some delays for any ports that have forced host mode. 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/usb/dwc2/core.c')
-rw-r--r--drivers/usb/dwc2/core.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
index 0a9ebe00fbcc..0bc1c0ed12eb 100644
--- a/drivers/usb/dwc2/core.c
+++ b/drivers/usb/dwc2/core.c
@@ -3129,18 +3129,20 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
3129 3129
3130 /* Force host mode to get HPTXFSIZ / GNPTXFSIZ exact power on value */ 3130 /* Force host mode to get HPTXFSIZ / GNPTXFSIZ exact power on value */
3131 gusbcfg = dwc2_readl(hsotg->regs + GUSBCFG); 3131 gusbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
3132 gusbcfg |= GUSBCFG_FORCEHOSTMODE; 3132 if (!(gusbcfg & GUSBCFG_FORCEHOSTMODE)) {
3133 dwc2_writel(gusbcfg, hsotg->regs + GUSBCFG); 3133 dwc2_writel(gusbcfg | GUSBCFG_FORCEHOSTMODE,
3134 usleep_range(100000, 150000); 3134 hsotg->regs + GUSBCFG);
3135 usleep_range(100000, 150000);
3136 }
3135 3137
3136 gnptxfsiz = dwc2_readl(hsotg->regs + GNPTXFSIZ); 3138 gnptxfsiz = dwc2_readl(hsotg->regs + GNPTXFSIZ);
3137 hptxfsiz = dwc2_readl(hsotg->regs + HPTXFSIZ); 3139 hptxfsiz = dwc2_readl(hsotg->regs + HPTXFSIZ);
3138 dev_dbg(hsotg->dev, "gnptxfsiz=%08x\n", gnptxfsiz); 3140 dev_dbg(hsotg->dev, "gnptxfsiz=%08x\n", gnptxfsiz);
3139 dev_dbg(hsotg->dev, "hptxfsiz=%08x\n", hptxfsiz); 3141 dev_dbg(hsotg->dev, "hptxfsiz=%08x\n", hptxfsiz);
3140 gusbcfg = dwc2_readl(hsotg->regs + GUSBCFG); 3142 if (!(gusbcfg & GUSBCFG_FORCEHOSTMODE)) {
3141 gusbcfg &= ~GUSBCFG_FORCEHOSTMODE; 3143 dwc2_writel(gusbcfg, hsotg->regs + GUSBCFG);
3142 dwc2_writel(gusbcfg, hsotg->regs + GUSBCFG); 3144 usleep_range(100000, 150000);
3143 usleep_range(100000, 150000); 3145 }
3144 3146
3145 /* hwcfg2 */ 3147 /* hwcfg2 */
3146 hw->op_mode = (hwcfg2 & GHWCFG2_OP_MODE_MASK) >> 3148 hw->op_mode = (hwcfg2 & GHWCFG2_OP_MODE_MASK) >>