From b8b28497f9b5569dbc35c5e3275a5f011110672c Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Tue, 9 Jun 2020 19:34:27 +0900 Subject: [PATCH] usb: dwc2: gadget: do not reset during core phy init 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 --- drivers/usb/dwc2/core.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index 92b9ca4..fce678c 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c @@ -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; + } } } -- 2.7.4