Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: dwc3: add needs_full_reinit flag

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 same flag needs_full_reinit in dwc3_properties.

Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://patch.msgid.link/20260212-add-flatten-dts-based-dwc3-imx-driver-v5-2-ff04a75ce221@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Xu Yang and committed by
Greg Kroah-Hartman
a717321a 9ac1befa

+13 -2
+7 -2
drivers/usb/dwc3/core.c
··· 1675 1675 u16 gsbuscfg0_reqinfo; 1676 1676 int ret; 1677 1677 1678 + if (properties->needs_full_reinit) 1679 + dwc->needs_full_reinit = true; 1680 + 1678 1681 dwc->gsbuscfg0_reqinfo = DWC3_GSBUSCFG0_REQINFO_UNSPECIFIED; 1679 1682 1680 1683 if (properties->gsbuscfg0_reqinfo != ··· 2482 2479 dwc3_core_exit(dwc); 2483 2480 break; 2484 2481 case DWC3_GCTL_PRTCAP_HOST: 2485 - if (!PMSG_IS_AUTO(msg) && !device_may_wakeup(dwc->dev)) { 2482 + if (!PMSG_IS_AUTO(msg) && 2483 + (!device_may_wakeup(dwc->dev) || dwc->needs_full_reinit)) { 2486 2484 dwc3_core_exit(dwc); 2487 2485 break; 2488 2486 } ··· 2546 2542 dwc3_gadget_resume(dwc); 2547 2543 break; 2548 2544 case DWC3_GCTL_PRTCAP_HOST: 2549 - if (!PMSG_IS_AUTO(msg) && !device_may_wakeup(dwc->dev)) { 2545 + if (!PMSG_IS_AUTO(msg) && 2546 + (!device_may_wakeup(dwc->dev) || dwc->needs_full_reinit)) { 2550 2547 ret = dwc3_core_init_for_resume(dwc); 2551 2548 if (ret) 2552 2549 return ret;
+3
drivers/usb/dwc3/core.h
··· 1119 1119 * @usb3_lpm_capable: set if hadrware supports Link Power Management 1120 1120 * @usb2_lpm_disable: set to disable usb2 lpm for host 1121 1121 * @usb2_gadget_lpm_disable: set to disable usb2 lpm for gadget 1122 + * @needs_full_reinit: set to indicate the core may lose power and need full 1123 + initialization during system pm 1122 1124 * @disable_scramble_quirk: set if we enable the disable scramble quirk 1123 1125 * @u2exit_lfps_quirk: set if we enable u2exit lfps quirk 1124 1126 * @u2ss_inp3_quirk: set if we enable P3 OK for U2/SS Inactive quirk ··· 1375 1373 unsigned usb3_lpm_capable:1; 1376 1374 unsigned usb2_lpm_disable:1; 1377 1375 unsigned usb2_gadget_lpm_disable:1; 1376 + unsigned needs_full_reinit:1; 1378 1377 1379 1378 unsigned disable_scramble_quirk:1; 1380 1379 unsigned u2exit_lfps_quirk:1;
+3
drivers/usb/dwc3/glue.h
··· 12 12 /** 13 13 * dwc3_properties: DWC3 core properties 14 14 * @gsbuscfg0_reqinfo: Value to be programmed in the GSBUSCFG0.REQINFO field 15 + * @needs_full_reinit: indicate the controller may not remain power during system 16 + * pm and need full initialization 15 17 */ 16 18 struct dwc3_properties { 17 19 u32 gsbuscfg0_reqinfo; 20 + unsigned needs_full_reinit:1; 18 21 }; 19 22 20 23 #define DWC3_DEFAULT_PROPERTIES ((struct dwc3_properties){ \