usb: dwc2: gadget: do not reset during core phy init 45/308445/2
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Tue, 9 Jun 2020 10:34:27 +0000 (19:34 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Tue, 26 Mar 2024 00:21:50 +0000 (00:21 +0000)
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.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
(cherry picked from commit a8cc687cf40f5c3781b23b08b3dd1ef978895449)
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: I6c4850983a4f397ebc7b10191bf293e1c4eeebba

drivers/usb/dwc2/core.c

index 5635e4d..81f6843 100644 (file)
@@ -992,13 +992,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;
+                               }
                        }
                }
 
@@ -1090,12 +1093,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;
+                       }
                }
        }