From: sashiko-bot@kernel.org
To: "Fabrice Gasnier" <fabrice.gasnier@foss.st.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH 4/5] usb: dwc2: hcd: don't disable/enable external vbus by system suspend/resume
Date: Thu, 08 Oct 2026 14:04:06 +0000 [thread overview]
Message-ID: <sashiko-outbox-164261@kernel.org> (raw)
In-Reply-To: <20261008-dwc2-low-power-fixes-stm32-v1-4-5b303df762e6@foss.st.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] usb: dwc2: port power state desync causing VBUS loss
--
commit 54bc47ce99a8e233efd17f79eba5998d68323c1d
Author: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
usb: dwc2: hcd: don't disable/enable external vbus by system suspend/resume
This commit removes the dwc2_vbus_supply_exit and dwc2_vbus_supply_init
calls during system suspend and resume. It aims to prevent incorrectly
increasing the regulator enable count when no device is connected to the
port.
Cc: stable@vger.kernel.org
> diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
> --- a/drivers/usb/dwc2/hcd.c
> +++ b/drivers/usb/dwc2/hcd.c
[ ... ]
> @@ -4499,10 +4495,7 @@ static int _dwc2_hcd_resume(struct usb_hcd *hcd)
> spin_lock_irqsave(&hsotg->lock, flags);
> }
>
> - /* Enable external vbus supply after resuming the port. */
> spin_unlock_irqrestore(&hsotg->lock, flags);
> - dwc2_vbus_supply_init(hsotg);
> -
> /* Wait for controller to correctly update D+/D- level */
> usleep_range(3000, 5000);
> spin_lock_irqsave(&hsotg->lock, flags);
[Severity: High]
Does removing the physical regulator initialization here cause a state
desynchronization with the HPRT0_PWR bit?
Later in _dwc2_hcd_resume(), the HPRT0_PWR bit is unconditionally set to 1:
dwc2_writel(hsotg, HPRT0_PWR | HPRT0_CONNDET |
HPRT0_ENACHG, HPRT0);
If the port is unpowered prior to this (e.g. at boot before the hub driver
powers it on), HPRT0_PWR becomes 1 without the physical regulator being
turned on.
When the hub driver subsequently tries to power on the port in
dwc2_hcd_hub_control(), it checks the prior state of HPRT0_PWR:
pwr = hprt0 & HPRT0_PWR;
hprt0 |= HPRT0_PWR;
dwc2_writel(hsotg, hprt0, HPRT0);
if (!pwr)
dwc2_vbus_supply_init(hsotg);
Since _dwc2_hcd_resume() already forced HPRT0_PWR to 1, the condition (!pwr)
is false and dwc2_vbus_supply_init() is incorrectly skipped.
Could this leave the physical VBUS permanently off and prevent USB device
detection from functioning?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261008-dwc2-low-power-fixes-stm32-v1-0-5b303df762e6@foss.st.com?part=4
next prev parent reply other threads:[~2026-10-08 14:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-08 13:33 [PATCH 0/5] usb: dwc2: fix low power issues found on stm32mp1 Fabrice Gasnier
2026-10-08 13:33 ` [PATCH 1/5] usb: dwc2: fix recovery after PM domain off Fabrice Gasnier
2026-10-08 13:53 ` sashiko-bot
2026-10-08 13:33 ` [PATCH 2/5] usb: dwc2: fix a possible interrupt storm on stm32mp1 Fabrice Gasnier
2026-10-08 13:49 ` sashiko-bot
2026-10-08 13:33 ` [PATCH 3/5] usb: dwc2: hcd: fix possible successive vbus supply enables Fabrice Gasnier
2026-10-08 14:01 ` sashiko-bot
2026-10-08 13:33 ` [PATCH 4/5] usb: dwc2: hcd: don't disable/enable external vbus by system suspend/resume Fabrice Gasnier
2026-10-08 14:04 ` sashiko-bot [this message]
2026-10-08 13:33 ` [PATCH 5/5] usb: dwc2: platform: fix stm32mp15 detection logic power management Fabrice Gasnier
2026-10-08 14:13 ` sashiko-bot
2026-10-08 16:43 ` [PATCH 0/5] usb: dwc2: fix low power issues found on stm32mp1 Stefan Wahren
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=sashiko-outbox-164261@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=fabrice.gasnier@foss.st.com \
--cc=linux-usb@vger.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 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.