linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Roman Kapl <rka@sysgo.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Felipe Balbi <balbi@kernel.org>
Subject: Re: [PATCH] usb: dwc3: reset the address and run_stop on init
Date: Thu, 5 Sep 2019 18:57:14 +0000	[thread overview]
Message-ID: <14b0d784-e172-7c22-8804-a9e7035d970f@synopsys.com> (raw)
In-Reply-To: <20190905095151.26590-1-rka@sysgo.com>

Hi,

Roman Kapl wrote:
> The address should be set to zero during reset according to the
> documentation.

That is for usb reset and not core soft reset, and dwc3 already handles 
that case.

> Clearing RunStop ensures that the host disconnects from
> the device (it was not cleared by CSFTRST, at least on ls1043).
>
> This allows the dwc3 to properly initialize even if the previous
> driver did not shutdown the device (e.g. when using virtualization).

This sounds like a workaround to some issue that the function driver did 
not handle.

> Signed-off-by: Roman Kapl <rka@sysgo.com>
> ---
>   drivers/usb/dwc3/core.c | 5 +++++
>   1 file changed, 5 insertions(+)
>
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index c9bb93a2c81e..c633f5e0621d 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -250,6 +250,7 @@ static int dwc3_core_soft_reset(struct dwc3 *dwc)
>   
>   	reg = dwc3_readl(dwc->regs, DWC3_DCTL);
>   	reg |= DWC3_DCTL_CSFTRST;
> +	reg &= ~DWC3_DCTL_RUN_STOP;
>   	dwc3_writel(dwc->regs, DWC3_DCTL, reg);
>   
>   	do {
> @@ -266,6 +267,10 @@ static int dwc3_core_soft_reset(struct dwc3 *dwc)
>   	return -ETIMEDOUT;
>   
>   done:
> +	reg = dwc3_readl(dwc->regs, DWC3_DCFG);
> +	reg &= ~(DWC3_DCFG_DEVADDR_MASK);
> +	dwc3_writel(dwc->regs, DWC3_DCFG, reg);
> +
>   	/*
>   	 * For DWC_usb31 controller, once DWC3_DCTL_CSFTRST bit is cleared,
>   	 * we must wait at least 50ms before accessing the PHY domain

BR,
Thinh

  reply	other threads:[~2019-09-05 18:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-05  9:51 [PATCH] usb: dwc3: reset the address and run_stop on init Roman Kapl
2019-09-05 18:57 ` Thinh Nguyen [this message]
2019-09-09  9:32   ` Roman Kapl
2019-09-09 17:54     ` 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=14b0d784-e172-7c22-8804-a9e7035d970f@synopsys.com \
    --to=thinh.nguyen@synopsys.com \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=rka@sysgo.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;
as well as URLs for NNTP newsgroup(s).