Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Faisal Hassan" <faisal.hassan@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 6/7] usb: dwc3: qcom: Support broken suspend for SA8255P
Date: Thu, 03 Sep 2026 16:13:47 +0000	[thread overview]
Message-ID: <20260903161347.DD92A1F00A3E@smtp.kernel.org> (raw)
In-Reply-To: <20260903153827.3463313-7-faisal.hassan@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Qscratch programming is not restored during system resume if device wakeup is enabled, leaving the controller broken.
- [High] Flawed boolean logic enables device-mode VBUS override during host mode operations.
--

commit 62abc776630f8d66e2fc8e0f35ca6edc55d04a4d
Author: Faisal Hassan <faisal.hassan@oss.qualcomm.com>

usb: dwc3: qcom: Support broken suspend for SA8255P

This commit addresses Qscratch programming loss on SA8255P during APPS Suspend
by restoring UTMI clock selection and VBUS valid signals after system resume.
It also ensures the controller is properly reset from the POR state.

> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
> index 6d25f81800a7f..e58a9ca23b009 100644
> --- a/drivers/usb/dwc3/dwc3-qcom.c
> +++ b/drivers/usb/dwc3/dwc3-qcom.c

[ ... ]

> @@ -388,6 +416,28 @@ static int dwc3_qcom_resume(struct dwc3_qcom *qcom, pm_message_t msg)
>  	if (!qcom->is_suspended)
>  		return 0;
>  
> +	if (qcom->broken_suspend && !PMSG_IS_AUTO(msg)) {
> +		/*
> +		 * Only system suspend fully powers off the controller and
> +		 * puts it into POR state. Runtime suspend does not, so skip
> +		 * the reset on runtime resume to avoid needlessly clobbering
> +		 * state that was never lost.
> +		 */
> +		ret = reset_control_assert(qcom->resets);

[Severity: High]
Does this unconditionally reset the controller during system resume,
destroying Qscratch state regardless of whether device wakeup is enabled?

[ ... ]

> @@ -415,6 +465,14 @@ static int dwc3_qcom_resume(struct dwc3_qcom *qcom, pm_message_t msg)
>  				  PWR_EVNT_LPM_IN_L2_MASK | PWR_EVNT_LPM_OUT_L2_MASK);
>  	}
>  
> +	if (qcom->broken_suspend) {
> +		if (!wakeup && qcom->ignore_pipe_clk)
> +			dwc3_qcom_select_utmi_clk(qcom);

[Severity: High]
Could this logic improperly skip required Qscratch reprogramming after the
controller reset if wakeup is enabled? Since the reset wiped the state above,
the clock configuration shouldn't be skipped when wakeup is true, as it
breaks USB operations on resume.

> +		/* Make sure vbus valid is set for PHYs after PM resume */
> +		if (!(dwc3_qcom_is_host(qcom) && wakeup))
> +			dwc3_qcom_vbus_override_enable(qcom, true);

[Severity: High]
Will this boolean logic accidentally enable device-mode VBUS override during
host mode operations? By De Morgan's laws, if dwc3_qcom_is_host() is true
and wakeup is false, this evaluates to true. Putting the PHY into device
mode VBUS override disrupts normal host mode operations.

> +	}
> +
>  	qcom->is_suspended = false;
>  
>  	return 0;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260903153827.3463313-1-faisal.hassan@oss.qualcomm.com?part=6

  reply	other threads:[~2026-09-03 16:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-03 15:38 [PATCH v2 0/7] usb: dwc3: qcom: Add firmware-managed resource support for SA8255P Faisal Hassan
2026-09-03 15:38 ` [PATCH v2 1/7] usb: dwc3: qcom: re-enable wakeup interrupts on failed resume Faisal Hassan
2026-09-03 15:53   ` sashiko-bot
2026-09-03 15:38 ` [PATCH v2 2/7] usb: dwc3: qcom: Distinguish PM and runtime suspend/resume paths Faisal Hassan
2026-09-03 15:38 ` [PATCH v2 3/7] dt-bindings: usb: Add qcom,sa8255p-dwc3 for firmware-managed resources Faisal Hassan
2026-09-03 15:56   ` sashiko-bot
2026-09-03 15:38 ` [PATCH v2 4/7] usb: host: xhci-plat: Support XHCI_RESET_ON_RESUME via device property Faisal Hassan
2026-09-03 15:38 ` [PATCH v2 5/7] usb: dwc3: add xhci-reset-on-resume property for power-loss resume Faisal Hassan
2026-09-03 16:08   ` sashiko-bot
2026-09-04  6:09   ` Krishna Kurapati
2026-09-03 15:38 ` [PATCH v2 6/7] usb: dwc3: qcom: Support broken suspend for SA8255P Faisal Hassan
2026-09-03 16:13   ` sashiko-bot [this message]
2026-09-03 15:38 ` [PATCH v2 7/7] usb: dwc3: qcom: Support firmware-managed resource states for power management Faisal Hassan
2026-09-03 16:14   ` sashiko-bot

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=20260903161347.DD92A1F00A3E@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=faisal.hassan@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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