]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
usb: dwc3: Add SoftReset PHY synchonization delay
authorThinh Nguyen <Thinh.Nguyen@synopsys.com>
Fri, 16 Mar 2018 22:33:48 +0000 (15:33 -0700)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 14 Aug 2018 10:28:40 +0000 (12:28 +0200)
BugLink: http://bugs.launchpad.net/bugs/1783418
[ Upstream commit fab3833338779e1e668bd58d1f76d601657304b8 ]

>From DWC_usb31 programming guide section 1.3.2, once DWC3_DCTL_CSFTRST
bit is cleared, we must wait at least 50ms before accessing the PHY
domain (synchronization delay).

Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/usb/dwc3/core.c

index 9160375f33e7b3f26ac682fea2a66091828acee4..64135dad9d35068665477035701de393d017ea4a 100644 (file)
@@ -231,7 +231,7 @@ static int dwc3_core_soft_reset(struct dwc3 *dwc)
        do {
                reg = dwc3_readl(dwc->regs, DWC3_DCTL);
                if (!(reg & DWC3_DCTL_CSFTRST))
-                       return 0;
+                       goto done;
 
                udelay(1);
        } while (--retries);
@@ -240,6 +240,17 @@ static int dwc3_core_soft_reset(struct dwc3 *dwc)
        phy_exit(dwc->usb2_generic_phy);
 
        return -ETIMEDOUT;
+
+done:
+       /*
+        * For DWC_usb31 controller, once DWC3_DCTL_CSFTRST bit is cleared,
+        * we must wait at least 50ms before accessing the PHY domain
+        * (synchronization delay). DWC_usb31 programming guide section 1.3.2.
+        */
+       if (dwc3_is_usb31(dwc))
+               msleep(50);
+
+       return 0;
 }
 
 /*