usb: dwc2: gadget: do not reset during core phy init
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Tue, 9 Jun 2020 10:34:27 +0000 (19:34 +0900)
committerHoegeun Kwon <hoegeun.kwon@samsung.com>
Tue, 30 Mar 2021 01:40:01 +0000 (10:40 +0900)
After the commit 1e868545f2bb ("usb: dwc2: gadget: Move gadget phy
init into core phy init"), dwc2 gadget mode with f_fs enumeration
is blocked from recent host kernel. It is because, the commit adds
more usb reset for gadget case, so do not reset during core phy
init for gadget.

Change-Id: I389d56346430d5c27b775270a4cb05b608668c30
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
drivers/usb/dwc2/core.c

index 92b9ca4..fce678c 100644 (file)
@@ -1083,13 +1083,16 @@ static int dwc2_fs_phy_init(struct dwc2_hsotg *hsotg, bool select_phy)
                        usbcfg |= GUSBCFG_PHYSEL;
                        dwc2_writel(hsotg, usbcfg, GUSBCFG);
 
-                       /* Reset after a PHY select */
-                       retval = dwc2_core_reset(hsotg, false);
-
-                       if (retval) {
-                               dev_err(hsotg->dev,
-                                       "%s: Reset failed, aborting", __func__);
-                               return retval;
+                       if (dwc2_is_host_mode(hsotg)) {
+                               /* Reset after a PHY select */
+                               retval = dwc2_core_reset(hsotg, false);
+
+                               if (retval) {
+                                       dev_err(hsotg->dev,
+                                               "%s: Reset failed, aborting",
+                                               __func__);
+                                       return retval;
+                               }
                        }
                }
 
@@ -1190,12 +1193,14 @@ static int dwc2_hs_phy_init(struct dwc2_hsotg *hsotg, bool select_phy)
        if (usbcfg != usbcfg_old) {
                dwc2_writel(hsotg, usbcfg, GUSBCFG);
 
-               /* Reset after setting the PHY parameters */
-               retval = dwc2_core_reset(hsotg, false);
-               if (retval) {
-                       dev_err(hsotg->dev,
-                               "%s: Reset failed, aborting", __func__);
-                       return retval;
+               if (dwc2_is_host_mode(hsotg)) {
+                       /* Reset after setting the PHY parameters */
+                       retval = dwc2_core_reset(hsotg, false);
+                       if (retval) {
+                               dev_err(hsotg->dev,
+                                       "%s: Reset failed, aborting", __func__);
+                               return retval;
+                       }
                }
        }