Re: [PATCH 07/18] usb: dwc2: Reorder AHBIDLE and CSFTRST in dwc2_core_reset()

2015-12-09 Thread Doug Anderson
John,

On Wed, Dec 2, 2015 at 11:13 AM, John Youn  wrote:
> According to the databook, the core soft reset should be done before
> checking for AHBIDLE. The gadget version of core reset had it correct
> but the hcd version did not. This fixes the hcd version.
>
> Signed-off-by: John Youn 
> ---
>  drivers/usb/dwc2/core.c | 17 +
>  1 file changed, 9 insertions(+), 8 deletions(-)

Seems fine to me and works across many reboots on a farm of
rk3288-based devices on a 3.14 kernel.  Doesn't fix any problems that
I've seen, though.

Reviewed-by: Douglas Anderson 
Tested-by: Douglas Anderson 
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/18] usb: dwc2: Reorder AHBIDLE and CSFTRST in dwc2_core_reset()

2015-12-02 Thread John Youn
According to the databook, the core soft reset should be done before
checking for AHBIDLE. The gadget version of core reset had it correct
but the hcd version did not. This fixes the hcd version.

Signed-off-by: John Youn 
---
 drivers/usb/dwc2/core.c | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
index c4af353..2d2b538 100644
--- a/drivers/usb/dwc2/core.c
+++ b/drivers/usb/dwc2/core.c
@@ -489,32 +489,33 @@ int dwc2_core_reset(struct dwc2_hsotg *hsotg)
 
dev_vdbg(hsotg->dev, "%s()\n", __func__);
 
-   /* Wait for AHB master IDLE state */
+   /* Core Soft Reset */
+   greset = dwc2_readl(hsotg->regs + GRSTCTL);
+   greset |= GRSTCTL_CSFTRST;
+   dwc2_writel(greset, hsotg->regs + GRSTCTL);
do {
udelay(1);
greset = dwc2_readl(hsotg->regs + GRSTCTL);
if (++count > 50) {
dev_warn(hsotg->dev,
-"%s() HANG! AHB Idle GRSTCTL=%0x\n",
+"%s() HANG! Soft Reset GRSTCTL=%0x\n",
 __func__, greset);
return -EBUSY;
}
-   } while (!(greset & GRSTCTL_AHBIDLE));
+   } while (greset & GRSTCTL_CSFTRST);
 
-   /* Core Soft Reset */
+   /* Wait for AHB master IDLE state */
count = 0;
-   greset |= GRSTCTL_CSFTRST;
-   dwc2_writel(greset, hsotg->regs + GRSTCTL);
do {
udelay(1);
greset = dwc2_readl(hsotg->regs + GRSTCTL);
if (++count > 50) {
dev_warn(hsotg->dev,
-"%s() HANG! Soft Reset GRSTCTL=%0x\n",
+"%s() HANG! AHB Idle GRSTCTL=%0x\n",
 __func__, greset);
return -EBUSY;
}
-   } while (greset & GRSTCTL_CSFTRST);
+   } while (!(greset & GRSTCTL_AHBIDLE));
 
if (hsotg->dr_mode == USB_DR_MODE_HOST) {
gusbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
-- 
2.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html