All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Pengpeng Hou <pengpeng@iscas.ac.cn>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] usb: dwc3: am62: Propagate USB2 refclk enable failures
Date: Fri, 26 Jun 2026 22:16:54 +0000	[thread overview]
Message-ID: <aj76Sf3nYJyHECAM@vbox> (raw)
In-Reply-To: <20260624055612.43319-1-pengpeng@iscas.ac.cn>

On Wed, Jun 24, 2026, Pengpeng Hou wrote:
> The AM62 wrapper requires the USB2 ref clock, but dwc3_ti_init() ignores
> clk_prepare_enable() failures before marking the mode valid.  Probe can
> then populate the child DWC3 device even though the wrapper clock
> transition failed.
> 
> Resume has the same issue after context loss or direct refclk re-enable.
> Check and propagate the refclk enable errors so the wrapper does not
> publish or resume a child provider without parent readiness.
> 
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---
>  drivers/usb/dwc3/dwc3-am62.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/dwc3-am62.c b/drivers/usb/dwc3/dwc3-am62.c
> index e11d7643f966..632634d6e81e 100644
> --- a/drivers/usb/dwc3/dwc3-am62.c
> +++ b/drivers/usb/dwc3/dwc3-am62.c
> @@ -205,7 +205,9 @@ static int dwc3_ti_init(struct dwc3_am62 *am62)
>  
>  	dwc3_ti_writel(am62, USBSS_PHY_CONFIG, reg);
>  
> -	clk_prepare_enable(am62->usb2_refclk);
> +	ret = clk_prepare_enable(am62->usb2_refclk);
> +	if (ret)
> +		return ret;
>  
>  	/* Set mode valid bit to indicate role is valid */
>  	reg = dwc3_ti_readl(am62, USBSS_MODE_CONTROL);
> @@ -361,14 +363,19 @@ static int dwc3_ti_resume_common(struct device *dev)
>  {
>  	struct dwc3_am62 *am62 = dev_get_drvdata(dev);
>  	u32 reg;
> +	int ret;
>  
>  	reg = dwc3_ti_readl(am62, USBSS_DEBUG_CFG);
>  	if (reg != USBSS_DEBUG_CFG_DISABLED) {
>  		/* lost power/context */
> -		dwc3_ti_init(am62);
> +		ret = dwc3_ti_init(am62);
> +		if (ret)
> +			return ret;
>  	} else {
>  		dwc3_ti_writel(am62, USBSS_DEBUG_CFG, USBSS_DEBUG_CFG_OFF);
> -		clk_prepare_enable(am62->usb2_refclk);
> +		ret = clk_prepare_enable(am62->usb2_refclk);
> +		if (ret)
> +			return ret;
>  	}
>  
>  	if (device_may_wakeup(dev)) {
> -- 
> 2.50.1 (Apple Git-155)
> 

Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>

Thanks,
Thinh

      reply	other threads:[~2026-06-26 22:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-24  5:56 [PATCH] usb: dwc3: am62: Propagate USB2 refclk enable failures Pengpeng Hou
2026-06-26 22:16 ` Thinh Nguyen [this message]

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=aj76Sf3nYJyHECAM@vbox \
    --to=thinh.nguyen@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pengpeng@iscas.ac.cn \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.