From: Frank Li <Frank.li@nxp.com>
To: Xu Yang <xu.yang_2@nxp.com>
Cc: 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>, Li Jun <jun.li@nxp.com>,
Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/3] usb: dwc3: add needs_full_reinit flag
Date: Fri, 6 Feb 2026 10:57:40 -0500 [thread overview]
Message-ID: <aYYPdGKdMdVgfm6x@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20260206-add-flatten-dts-based-dwc3-imx-driver-v3-2-ebd9b9b77049@nxp.com>
On Fri, Feb 06, 2026 at 06:18:50PM +0800, 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 needs_full_reinit for the purpose.
> And the glue layer needs to indicate if the controller needs this behavior
> by setting a flag core_may_lose_power in dwc3_properties.
>
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
>
> ---
> Changes in v3:
> - no changes
> Changes in v2:
> - put core_may_lose_power into dwc3_properties and check it in
> dwc3_get_software_properties()
> - rename may_lose_power to needs_full_reinit
> ---
> drivers/usb/dwc3/core.c | 9 +++++++--
> drivers/usb/dwc3/core.h | 3 +++
> drivers/usb/dwc3/glue.h | 3 +++
> 3 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index c07ffe82c850..c5e0a1705b6f 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -1675,6 +1675,9 @@ static void dwc3_get_software_properties(struct dwc3 *dwc,
> u16 gsbuscfg0_reqinfo;
> int ret;
>
> + if (properties->core_may_lose_power)
> + dwc->needs_full_reinit = true;
> +
> dwc->gsbuscfg0_reqinfo = DWC3_GSBUSCFG0_REQINFO_UNSPECIFIED;
>
> if (properties->gsbuscfg0_reqinfo !=
> @@ -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->needs_full_reinit)) {
> 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->needs_full_reinit)) {
> 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 08cc6f2b5c23..01d92d680ba4 100644
> --- a/drivers/usb/dwc3/core.h
> +++ b/drivers/usb/dwc3/core.h
> @@ -1117,6 +1117,8 @@ 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
> + * @needs_full_reinit: set to indicate the core may lose power and need full
> + initialization during system pm
> * @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 +1371,7 @@ struct dwc3 {
> unsigned usb3_lpm_capable:1;
> unsigned usb2_lpm_disable:1;
> unsigned usb2_gadget_lpm_disable:1;
> + unsigned needs_full_reinit:1;
>
> unsigned disable_scramble_quirk:1;
> unsigned u2exit_lfps_quirk:1;
> diff --git a/drivers/usb/dwc3/glue.h b/drivers/usb/dwc3/glue.h
> index df86e14cb706..d4ea635c92fb 100644
> --- a/drivers/usb/dwc3/glue.h
> +++ b/drivers/usb/dwc3/glue.h
> @@ -12,9 +12,12 @@
> /**
> * dwc3_properties: DWC3 core properties
> * @gsbuscfg0_reqinfo: Value to be programmed in the GSBUSCFG0.REQINFO field
> + * @core_may_lose_power: indicate the controller may not remain power during
> + * system pm
> */
> struct dwc3_properties {
> u32 gsbuscfg0_reqinfo;
> + bool core_may_lose_power;
> };
>
> #define DWC3_DEFAULT_PROPERTIES ((struct dwc3_properties){ \
>
> --
> 2.34.1
>
next prev parent reply other threads:[~2026-02-06 15:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-06 10:18 [PATCH v3 0/3] add DWC3 i.MX driver based on flatten devicetree Xu Yang
2026-02-06 10:18 ` [PATCH v3 1/3] dt-bindings: usb: introduce nxp,imx-dwc3 Xu Yang
2026-02-10 2:24 ` Rob Herring (Arm)
2026-02-06 10:18 ` [PATCH v3 2/3] usb: dwc3: add needs_full_reinit flag Xu Yang
2026-02-06 15:57 ` Frank Li [this message]
2026-02-10 0:39 ` Thinh Nguyen
2026-02-11 10:30 ` Xu Yang
2026-02-06 10:18 ` [PATCH v3 3/3] usb: dwc3: introduce flatten model driver of i.MX Soc Xu Yang
2026-02-06 16:03 ` Frank Li
2026-02-11 10:31 ` Xu Yang
2026-02-10 2:34 ` Thinh Nguyen
2026-02-11 10:33 ` 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=aYYPdGKdMdVgfm6x@lizhi-Precision-Tower-5810 \
--to=frank.li@nxp.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.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=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
all inboxes | Powered by JetHome®