mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Mike Looijmans <mike.looijmans@topic.nl>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Michal Simek <michal.simek@amd.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] usb: dwc3: xilinx: Prevent spike in reset signal
Date: Tue, 18 Mar 2025 00:12:16 +0000	[thread overview]
Message-ID: <20250318001211.tnjwfckt5j4fbvjf@synopsys.com> (raw)
In-Reply-To: <8ee2ce74-dc6b-463a-ba95-ad25669a1179@topic.nl>

On Mon, Mar 17, 2025, Mike Looijmans wrote:
> On 14-03-2025 22:14, Thinh Nguyen wrote:
> > On Fri, Mar 14, 2025, Mike Looijmans wrote:
> > > Set the gpio to "high" on acquisition, instead of acquiring it in low
> > > state and then immediately setting it high again. This prevents a
> > > short "spike" on the reset signal.
> > How does this affect the current programming flow beside preventing a
> > spike to the reset signal?
> 
> I don't understand your question. What "programming flow" are you referring
> to?

It's not obvious to me if this is an error in Xilinx documentation, the
driver issue, or whether this is found through experiment. Since I don't
have the info of this platform, it would help to know where the source
of error is so we can document this in the code or change-log.

> 
> The reset sequence was just plain wrong, the issue is almost the same as the

Do we need a fix tag and add to stable then?

> one described in this commit:
> e0183b974d30 "net: mdiobus: Prevent spike on MDIO bus reset signal"
> 
> Note that I see this high-low-high-low double reset toggle in many Xilinx
> software drivers, they seem to teach that at the Xilinx academy or so.
> 
> 
> > > Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
> > > ---
> > > 
> > >   drivers/usb/dwc3/dwc3-xilinx.c | 3 +--
> > >   1 file changed, 1 insertion(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c
> > > index a33a42ba0249..a159a511483b 100644
> > > --- a/drivers/usb/dwc3/dwc3-xilinx.c
> > > +++ b/drivers/usb/dwc3/dwc3-xilinx.c
> > > @@ -207,7 +207,7 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
> > >   skip_usb3_phy:
> > >   	/* ulpi reset via gpio-modepin or gpio-framework driver */
> > > -	reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
> > > +	reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
> > >   	if (IS_ERR(reset_gpio)) {
> > >   		return dev_err_probe(dev, PTR_ERR(reset_gpio),
> > >   				     "Failed to request reset GPIO\n");
> > > @@ -215,7 +215,6 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
> > >   	if (reset_gpio) {
> > >   		/* Toggle ulpi to reset the phy. */
> > Does the comment above still apply?
> Now you mention it, the comment never made any sense anyway.
> 

Then can we remove it?

> 
> > > -		gpiod_set_value_cansleep(reset_gpio, 1);
> > >   		usleep_range(5000, 10000);
> > Do we still need this usleep_range here?
> 
> Yes, this is the "reset active" time.
> 

But why do we need 2 calls to usleep_range? From just looking at this
here, it appears that the first was intended for the removed
gpiod_set_value_cansleep(reset_gpio, 1). If this "reset active" time is
needed irrespective of the existent reset_gpio, then shouldn't it be set
outside of this if statement?

BR,
Thinh

> 
> 
> > 
> > BR,
> > Thinh
> > 
> > >   		gpiod_set_value_cansleep(reset_gpio, 0);
> > >   		usleep_range(5000, 10000);
> > > -- 
> > > 2.43.0
> > > 
> > > 
> > > Met vriendelijke groet / kind regards,
> > > 
> > > Mike Looijmans
> > > 
> > > 
> 
> -- 
> Mike Looijmans
> System Expert
> 
> TOPIC Embedded Products B.V.
> Materiaalweg 4, 5681 RJ Best
> The Netherlands
> 
> T: +31 (0) 499 33 69 69
> E: mike.looijmans@topic.nl
> W: https://urldefense.com/v3/__http://www.topic.nl__;!!A4F2R9G_pg!e45B0wD5dvB4NV8gz5JjIWaRTQrX9M2uE0ouoBVX4TQC8sKqtYRL8rJY3y2bb061gzSoGL0FOPJv-3-adkP1b3ldzRZnxdY$
> 
> 
> 

  reply	other threads:[~2025-03-18  0:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1b153bce-a66a-45ee-a5c6-963ea6fb1c82.949ef384-8293-46b8-903f-40a477c056ae.323aeebd-1577-4c21-85a6-ff9262fb6cb7@emailsignatures365.codetwo.com>
2025-03-14 15:56 ` Mike Looijmans
2025-03-14 21:14   ` Thinh Nguyen
2025-03-17  6:21     ` Mike Looijmans
2025-03-18  0:12       ` Thinh Nguyen [this message]
2025-03-18  6:21         ` Mike Looijmans
2025-03-18  7:36           ` Michal Simek
2025-03-21 21:24           ` Thinh Nguyen

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=20250318001211.tnjwfckt5j4fbvjf@synopsys.com \
    --to=thinh.nguyen@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=michal.simek@amd.com \
    --cc=mike.looijmans@topic.nl \
    /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

all inboxes | Powered by JetHome®