From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Peng Fan <peng.fan@oss.nxp.com>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Xu Yang <xu.yang_2@nxp.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>, Frank Li <frank.li@nxp.com>,
Li Jun <jun.li@nxp.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"imx@lists.linux.dev" <imx@lists.linux.dev>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/3] usb: dwc3: add may_lose_power flag
Date: Wed, 4 Feb 2026 01:52:15 +0000 [thread overview]
Message-ID: <20260204015208.rpgp623pj37nldbm@synopsys.com> (raw)
In-Reply-To: <aYFMfPeeQusS1UR4@shlinux89>
On Tue, Feb 03, 2026, Peng Fan wrote:
> On Tue, Feb 03, 2026 at 12:24:08AM +0000, Thinh Nguyen wrote:
> >On Mon, Feb 02, 2026, Xu Yang wrote:
> >> The current design assumes that the controller remains powered
> >> when wakeup is enabled. However, some SoCs provide wakeup
> >> capability even when the controller itself is powered down, using
> >> separate dedicated wakeup logic. This allows additional power
> >> savings, but requires the controller to be fully re‑initialized
> >> after system resume.
> >>
> >> To support these SoCs, introduce a flag to track the controller’s
> >> power state and use it throughout the suspend/resume flow.
> >>
> >> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> >> ---
> >> drivers/usb/dwc3/core.c | 9 +++++++--
> >> drivers/usb/dwc3/core.h | 2 ++
> >> drivers/usb/dwc3/glue.h | 3 +++
> >> 3 files changed, 12 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> >> index c07ffe82c85049364c38c7ba152aab0ff764d95e..9d4326da5ec7669fa714707fb24556723cab51b8 100644
> >> --- a/drivers/usb/dwc3/core.c
> >> +++ b/drivers/usb/dwc3/core.c
> >> @@ -2314,6 +2314,9 @@ int dwc3_core_probe(const struct dwc3_probe_data *data)
> >> goto err_exit_debugfs;
> >> }
> >>
> >> + if (data->core_may_lose_power)
> >
> >Can this be passed down as part of the dwc3_properties within the
> >probe_data? I'm trying to consolidate all the dwc3 properties to one
> >place.
> >
> >> + dwc->may_lose_power = true;
> >> +
> >> pm_runtime_put(dev);
> >>
> >> dma_set_max_seg_size(dev, UINT_MAX);
> >> @@ -2462,7 +2465,8 @@ static int dwc3_suspend_common(struct dwc3 *dwc, pm_message_t msg)
> >> dwc3_core_exit(dwc);
> >> break;
> >> case DWC3_GCTL_PRTCAP_HOST:
> >> - if (!PMSG_IS_AUTO(msg) && !device_may_wakeup(dwc->dev)) {
> >> + if (!PMSG_IS_AUTO(msg) &&
> >> + (!device_may_wakeup(dwc->dev) || dwc->may_lose_power)) {
> >> dwc3_core_exit(dwc);
> >> break;
> >> }
> >> @@ -2525,7 +2529,8 @@ static int dwc3_resume_common(struct dwc3 *dwc, pm_message_t msg)
> >> dwc3_gadget_resume(dwc);
> >> break;
> >> case DWC3_GCTL_PRTCAP_HOST:
> >> - if (!PMSG_IS_AUTO(msg) && !device_may_wakeup(dwc->dev)) {
> >> + if (!PMSG_IS_AUTO(msg) &&
> >> + (!device_may_wakeup(dwc->dev) || dwc->may_lose_power)) {
> >> ret = dwc3_core_init_for_resume(dwc);
> >> if (ret)
> >> return ret;
> >> diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
> >> index 08cc6f2b5c23631a752c77fd7394e5876c929f0a..5b1358f36490a001bc9e68139224f7be70a57995 100644
> >> --- a/drivers/usb/dwc3/core.h
> >> +++ b/drivers/usb/dwc3/core.h
> >> @@ -1117,6 +1117,7 @@ struct dwc3_glue_ops {
> >> * @usb3_lpm_capable: set if hadrware supports Link Power Management
> >> * @usb2_lpm_disable: set to disable usb2 lpm for host
> >> * @usb2_gadget_lpm_disable: set to disable usb2 lpm for gadget
> >> + * @may_lose_power: set to indicate the core may lose power during pm suspend
> >> * @disable_scramble_quirk: set if we enable the disable scramble quirk
> >> * @u2exit_lfps_quirk: set if we enable u2exit lfps quirk
> >> * @u2ss_inp3_quirk: set if we enable P3 OK for U2/SS Inactive quirk
> >> @@ -1369,6 +1370,7 @@ struct dwc3 {
> >> unsigned usb3_lpm_capable:1;
> >> unsigned usb2_lpm_disable:1;
> >> unsigned usb2_gadget_lpm_disable:1;
> >> + unsigned may_lose_power:1;
> >
> >This name sounds like a quirk of a broken SoC.
> >
> >Perhaps rename this to something such as power_lost_on_suspend or
> >needs_full_reinit?
>
> How about out_band_wakeup?
>
IMHO, it's not as clear. It doesn't describe the problem or the action
to take. Can we use needs_full_reinit?
Thanks,
Thinh
next prev parent reply other threads:[~2026-02-04 1:53 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-02 10:27 [PATCH 0/3] add DWC3 i.MX driver based on flatten devicetree Xu Yang
2026-02-02 10:27 ` [PATCH 1/3] dt-bindings: usb: introduce fsl,imx-dwc3 Xu Yang
2026-02-03 7:19 ` Alexander Stein
2026-02-04 5:41 ` Xu Yang
2026-02-02 10:27 ` [PATCH 2/3] usb: dwc3: add may_lose_power flag Xu Yang
2026-02-02 15:36 ` Frank Li
2026-02-04 5:44 ` Xu Yang
2026-02-03 0:24 ` Thinh Nguyen
2026-02-03 1:16 ` Peng Fan
2026-02-04 1:52 ` Thinh Nguyen [this message]
2026-02-04 5:55 ` Xu Yang
2026-02-04 5:47 ` Xu Yang
2026-02-02 10:27 ` [PATCH 3/3] usb: dwc3: introduce flatten model driver of i.MX Soc Xu Yang
2026-02-02 15:42 ` Frank Li
2026-02-03 0:44 ` Thinh Nguyen
2026-02-04 6:19 ` Xu Yang
2026-02-04 6:16 ` Xu Yang
2026-02-03 1:38 ` Peng Fan
2026-02-04 2:27 ` Thinh Nguyen
2026-02-04 6:30 ` Xu Yang
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=20260204015208.rpgp623pj37nldbm@synopsys.com \
--to=thinh.nguyen@synopsys.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=frank.li@nxp.com \
--cc=gregkh@linuxfoundation.org \
--cc=imx@lists.linux.dev \
--cc=jun.li@nxp.com \
--cc=kernel@pengutronix.de \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=peng.fan@oss.nxp.com \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=xu.yang_2@nxp.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