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>
Thu, 3 Aug 2023 08:46:02 +0000 (17:46 +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 396cef7..5708d8a 100644 (file)
@@ -1027,13 +1027,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;
+                               }
                        }
                }
 
@@ -1125,12 +1128,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;
+                       }
                }
        }