All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: "fabricioakio@gmail.com" <fabricioakio@gmail.com>
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>,
	"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>
Subject: Re: [PATCH] usb: dwc3: qcom: Check for L2 only when suspending a host with wakeup
Date: Fri, 2 Oct 2026 23:55:53 +0000	[thread overview]
Message-ID: <asBCjr6vlkQSe1jN@vbox> (raw)
In-Reply-To: <20260928-dwc3-qcom-l2-check-v1-1-43c5c6e97922@gmail.com>

On Mon, Sep 28, 2026, Fabricio Akio via B4 Relay wrote:
> From: Fabricio Akio <fabricioakio@gmail.com>
> 
> In peripheral mode the core disconnects and powers the PHY off before
> the glue suspends, so the link never enters L2 and every system
> suspend logs "HS-PHY not in L2". Check only for a host with wakeup,
> the one case that parks the PHY in L2.
> 
> Signed-off-by: Fabricio Akio <fabricioakio@gmail.com>
> ---
> Tested on a Motorola Moto X4 (XT1900-6, SDM630) with the sdm660-mainline
> 7.2.3 tree, in peripheral mode with the cable attached: the "HS-PHY not
> in L2" message appears on every system suspend without this patch, and
> not over three consecutive cycles with it. Host mode is untested, since
> this board runs the controller in peripheral mode. The board binds
> dwc3-qcom-legacy, so the same change in dwc3-qcom.c is build-tested
> only. Applies unchanged to next-20260928.
> ---
>  drivers/usb/dwc3/dwc3-qcom-legacy.c | 16 ++++++++++++----
>  drivers/usb/dwc3/dwc3-qcom.c        | 16 ++++++++++++----
>  2 files changed, 24 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/dwc3-qcom-legacy.c b/drivers/usb/dwc3/dwc3-qcom-legacy.c
> index d3fad0fcfdac..ba3f70dea4ab 100644
> --- a/drivers/usb/dwc3/dwc3-qcom-legacy.c
> +++ b/drivers/usb/dwc3/dwc3-qcom-legacy.c
> @@ -431,10 +431,18 @@ static int dwc3_qcom_suspend(struct dwc3_qcom *qcom, bool wakeup)
>  	if (qcom->is_suspended)
>  		return 0;
>  
> -	for (i = 0; i < qcom->num_ports; i++) {
> -		val = readl(qcom->qscratch_base + pwr_evnt_irq_stat_reg[i]);
> -		if (!(val & PWR_EVNT_LPM_IN_L2_MASK))
> -			dev_err(qcom->dev, "port-%d HS-PHY not in L2\n", i + 1);
> +	/*
> +	 * Only a host with wakeup enabled keeps the HS PHY powered and parks
> +	 * it in L2 across suspend. A peripheral disconnects from the bus and
> +	 * powers the PHY off first, so its link never enters L2.
> +	 */
> +	if (dwc3_qcom_is_host(qcom) && wakeup) {
> +		for (i = 0; i < qcom->num_ports; i++) {
> +			val = readl(qcom->qscratch_base + pwr_evnt_irq_stat_reg[i]);
> +			if (!(val & PWR_EVNT_LPM_IN_L2_MASK))
> +				dev_err(qcom->dev, "port-%d HS-PHY not in L2\n",
> +					i + 1);
> +		}
>  	}
>  
>  	for (i = qcom->num_clocks - 1; i >= 0; i--)
> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
> index ac68b4218b56..e0920da280ce 100644
> --- a/drivers/usb/dwc3/dwc3-qcom.c
> +++ b/drivers/usb/dwc3/dwc3-qcom.c
> @@ -343,10 +343,18 @@ static int dwc3_qcom_suspend(struct dwc3_qcom *qcom, bool wakeup)
>  	if (qcom->is_suspended)
>  		return 0;
>  
> -	for (i = 0; i < qcom->num_ports; i++) {
> -		val = readl(qcom->qscratch_base + pwr_evnt_irq_stat_reg[i]);
> -		if (!(val & PWR_EVNT_LPM_IN_L2_MASK))
> -			dev_err(qcom->dev, "port-%d HS-PHY not in L2\n", i + 1);
> +	/*
> +	 * Only a host with wakeup enabled keeps the HS PHY powered and parks
> +	 * it in L2 across suspend. A peripheral disconnects from the bus and
> +	 * powers the PHY off first, so its link never enters L2.
> +	 */
> +	if (dwc3_qcom_is_host(qcom) && wakeup) {
> +		for (i = 0; i < qcom->num_ports; i++) {
> +			val = readl(qcom->qscratch_base + pwr_evnt_irq_stat_reg[i]);
> +			if (!(val & PWR_EVNT_LPM_IN_L2_MASK))
> +				dev_err(qcom->dev, "port-%d HS-PHY not in L2\n",
> +					i + 1);
> +		}
>  	}
>  	clk_bulk_disable_unprepare(qcom->num_clocks, qcom->clks);
>  
> 
> ---
> base-commit: 6375e61c01e93e35ee7acd336a689ac1fae4b509
> change-id: 20260928-dwc3-qcom-l2-check-e3b55acefb62
> 
> Best regards,
> --  
> Fabricio Akio <fabricioakio@gmail.com>
> 
> 

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

Thanks,
Thinh

  parent reply	other threads:[~2026-10-02 23:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28 18:16 [PATCH] usb: dwc3: qcom: Check for L2 only when suspending a host with wakeup Fabricio Akio via B4 Relay
2026-09-28 18:16 ` Fabricio Akio
2026-09-29 17:16 ` Huang Wei
2026-10-02 23:55 ` Thinh Nguyen [this message]
2026-10-04  9:31 ` Joonhoe Kim
2026-10-04  9:34 ` Joonhoe Kim
2026-10-05  9:58 ` Pankaj Patil

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=asBCjr6vlkQSe1jN@vbox \
    --to=thinh.nguyen@synopsys.com \
    --cc=fabricioakio@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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.