mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: "20231116174206.1a823aa3@synopsys.com" 
	<20231116174206.1a823aa3@synopsys.com>
Cc: Jisheng Zhang <jszhang@kernel.org>,
	Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Lu jicong <jiconglu58@gmail.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH] usb: dwc3: don't reset device side if dwc3 was configured as host-only
Date: Fri, 17 Nov 2023 01:40:46 +0000	[thread overview]
Message-ID: <20231117014038.kbcfnpiefferqomk@synopsys.com> (raw)
In-Reply-To: <20231116175959.71f5d060@kmaincent-XPS-13-7390>

Hi,

On Thu, Nov 16, 2023, Köry Maincent wrote:
> On Thu, 16 Nov 2023 17:42:06 +0100
> Köry Maincent <kory.maincent@bootlin.com> wrote:
> 
> > Hello,
> > 
> > Similar issue with ZynqMP board related to that patch:
> > 
> > xilinx-psgtr fd400000.phy: lane 3 (type 1, protocol 3): PLL lock timeout
> > phy phy-fd400000.phy.3: phy poweron failed --> -110
> > dwc3 fe300000.usb: error -ETIMEDOUT: failed to initialize core
> > 
> > With CONFIG_USB_DWC3_DUAL_ROLE and dr_mode = "host";
> > 
> > It may not be the correct fix.
> 
> Just figured out there was a patch (357191036889 usb: dwc3: Soft reset phy on
> probe for host) from Thinh aimed to fix it but the issue is still here on
> ZynqMP.
> 

How many ports do you use? Can you try this:

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 0328c86ef806..9921c2737829 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -296,23 +296,28 @@ int dwc3_core_soft_reset(struct dwc3 *dwc)
 	if (dwc->dr_mode == USB_DR_MODE_HOST) {
 		u32 usb3_port;
 		u32 usb2_port;
+		int i;
 
-		usb3_port = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0));
-		usb3_port |= DWC3_GUSB3PIPECTL_PHYSOFTRST;
-		dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), usb3_port);
+		for (i = 0; i < 16; i++) {
+			usb3_port = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(i));
+			usb3_port |= DWC3_GUSB3PIPECTL_PHYSOFTRST;
+			dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(i), usb3_port);
 
-		usb2_port = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
-		usb2_port |= DWC3_GUSB2PHYCFG_PHYSOFTRST;
-		dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), usb2_port);
+			usb2_port = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(i));
+			usb2_port |= DWC3_GUSB2PHYCFG_PHYSOFTRST;
+			dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(i), usb2_port);
+		}
 
 		/* Small delay for phy reset assertion */
 		usleep_range(1000, 2000);
 
-		usb3_port &= ~DWC3_GUSB3PIPECTL_PHYSOFTRST;
-		dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), usb3_port);
+		for (i = 0; i < 16; i++) {
+			usb3_port &= ~DWC3_GUSB3PIPECTL_PHYSOFTRST;
+			dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(i), usb3_port);
 
-		usb2_port &= ~DWC3_GUSB2PHYCFG_PHYSOFTRST;
-		dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), usb2_port);
+			usb2_port &= ~DWC3_GUSB2PHYCFG_PHYSOFTRST;
+			dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(i), usb2_port);
+		}
 
 		/* Wait for clock synchronization */
 		msleep(50);
---

BR,
Thinh

  reply	other threads:[~2023-11-17  1:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-16 16:42 Köry Maincent
2023-11-16 16:59 ` Köry Maincent
2023-11-17  1:40   ` Thinh Nguyen [this message]
2023-11-17  1:55     ` Thinh Nguyen
2023-11-17  9:22       ` Köry Maincent
2023-11-21  9:49       ` Köry Maincent
2023-12-01  9:09         ` Köry Maincent
2023-12-02  0:26           ` Thinh Nguyen
2023-12-05  1:27             ` Thinh Nguyen
2023-12-05 13:56               ` Jisheng Zhang
2023-12-05 14:19             ` Köry Maincent
  -- strict thread matches above, loose matches on Subject: below --
2023-06-27 16:20 Jisheng Zhang
2023-06-30 22:23 ` Thinh Nguyen
2023-09-30  7:43 ` Lu jicong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231117014038.kbcfnpiefferqomk@synopsys.com \
    --to=thinh.nguyen@synopsys.com \
    --cc=20231116174206.1a823aa3@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jiconglu58@gmail.com \
    --cc=jszhang@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome