linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>Thinh Nguyen
	<Thinh.Nguyen@synopsys.com>,
	linux-usb@vger.kernel.org
Cc: John Youn <John.Youn@synopsys.com>
Subject: [01/15] usb: dwc3: Device SoftReset PHY synchonization delay
Date: Mon, 08 Jan 2018 13:59:50 +0200	[thread overview]
Message-ID: <871sj0lfwp.fsf@linux.intel.com> (raw)

Hi,

Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:
> From DWC_usb31 databook section 1.3.2, once DWC3_DCTL_CSFTRST bit is
> cleared, we must wait at least 50ms before accessing the PHY domain
> (synchronization delay).
>
> Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
> ---
>  drivers/usb/dwc3/core.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 07832509584f..7d21f21707f5 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -228,12 +228,23 @@ static int dwc3_core_soft_reset(struct dwc3 *dwc)
>  	do {
>  		reg = dwc3_readl(dwc->regs, DWC3_DCTL);
>  		if (!(reg & DWC3_DCTL_CSFTRST))
> -			return 0;
> +			goto done;
>  
>  		udelay(1);
>  	} while (--retries);
>  
>  	return -ETIMEDOUT;
> +
> +done:
> +	/*
> +	 * For DWC_usb31 controller, once DWC3_DCTL_CSFTRST bit is cleared,
> +	 * we must wait at least 50ms before accessing the PHY domain
> +	 * (synchronization delay). DWC_usb31 Databook section 1.3.2.
> +	 */
> +	if (dwc3_is_usb31(dwc))
> +		mdelay(50);

we don't have any locks held. Why are you busy looping for an entire
50ms? Why don't you msleep() here?

             reply	other threads:[~2018-01-08 11:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-08 11:59 Felipe Balbi [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-01-08 23:22 [01/15] usb: dwc3: Device SoftReset PHY synchonization delay Thinh Nguyen
2018-01-05 20:13 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=871sj0lfwp.fsf@linux.intel.com \
    --to=balbi@kernel.org \
    --cc=John.Youn@synopsys.com \
    --cc=Thinh.Nguyen@synopsys.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).