2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00
linux/drivers/usb/chipidea
Xu Yang 31a6afbe86 usb: chipidea: udc: disconnect/reconnect from host when do suspend/resume
Shawn and John reported a hang issue during system suspend as below:

 - USB gadget is enabled as Ethernet
 - There is data transfer over USB Ethernet (scp a big file between host
                                             and device)
 - Device is going in/out suspend (echo mem > /sys/power/state)

The root cause is the USB device controller is suspended but the USB bus
is still active which caused the USB host continues to transfer data with
device and the device continues to queue USB requests (in this case, a
delayed TCP ACK packet trigger the issue) after controller is suspended,
however the USB controller clock is already gated off. Then if udc driver
access registers after that point, the system will hang.

The correct way to avoid such issue is to disconnect device from host when
the USB bus is not at suspend state. Then the host will receive disconnect
event and stop data transfer in time. To continue make USB gadget device
work after system resume, this will reconnect device automatically.

To make usb wakeup work if USB bus is already at suspend state, this will
keep connection for it only when USB device controller has enabled wakeup
capability.

Reported-by: Shawn Guo <shawnguo@kernel.org>
Reported-by: John Ernberg <john.ernberg@actia.se>
Closes: https://lore.kernel.org/linux-usb/aEZxmlHmjeWcXiF3@dragon/
Tested-by: John Ernberg <john.ernberg@actia.se> # iMX8QXP
Fixes: 235ffc17d0 ("usb: chipidea: udc: add suspend/resume support for device controller")
Cc: stable <stable@kernel.org>
Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Acked-by: Peter Chen <peter.chen@kernel.org>
Link: https://lore.kernel.org/r/20250614124914.207540-1-xu.yang_2@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-06-19 12:36:43 +02:00
..
bits.h USB: chipidea: Use the correct style for SPDX License Identifier 2020-03-16 11:13:47 +08:00
ci_hdrc_imx.c Linux 6.15-rc4 2025-04-28 10:32:58 +02:00
ci_hdrc_imx.h usb: chipidea: imx: add one fsl picophy parameter tuning implementation 2023-07-25 18:21:52 +02:00
ci_hdrc_msm.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ci_hdrc_npcm.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ci_hdrc_pci.c usb: chipidea: ci_hdrc_pci: Fix improper use of kerneldoc format 2020-07-09 17:19:56 +02:00
ci_hdrc_tegra.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ci_hdrc_usb2.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ci.h usb: chipidea: udc: limit usb request length to max 16KB 2024-10-04 15:13:58 +02:00
core.c usb: Use (of|device)_property_present() for non-boolean properties 2024-11-05 13:29:26 +01:00
debug.c usb: chipidea: debug: remove redundant 'role' debug file 2023-03-23 17:27:46 +01:00
host.c USB: Use str_enable_disable-like helpers 2025-01-15 18:28:13 +01:00
host.h usb: chipidea: add inline for ci_hdrc_host_driver_init if host is not defined 2020-01-22 07:54:27 +01:00
Kconfig usb: chipidea: Add support for NPCM 2023-10-21 12:46:00 +02:00
Makefile usb: chipidea: Add support for NPCM 2023-10-21 12:46:00 +02:00
otg_fsm.c USB: chipidea: Switch to use hrtimer_setup() 2025-02-18 11:19:01 +01:00
otg_fsm.h USB: chipidea: Use the correct style for SPDX License Identifier 2020-03-16 11:13:47 +08:00
otg.c usb: chipidea: add CI_HDRC_FORCE_VBUS_ACTIVE_ALWAYS flag 2023-10-21 12:45:45 +02:00
otg.h usb: chipidea: core: add controller resume support when controller is powered off 2022-10-23 14:34:53 +02:00
trace.c usb: chipidea: add tracepoint support for udc 2020-12-10 08:45:26 +08:00
trace.h tracing/treewide: Remove second parameter of __assign_str() 2024-05-22 20:14:47 -04:00
udc.c usb: chipidea: udc: disconnect/reconnect from host when do suspend/resume 2025-06-19 12:36:43 +02:00
udc.h usb: chipidea: udc: create bounce buffer for problem sglist entries if possible 2024-10-04 15:13:58 +02:00
ulpi.c Revert "usb: chipidea: move ci_ulpi_init after the phy initialization" 2024-06-04 14:51:09 +02:00
usbmisc_imx.c usb: chipidea: imx: add HSIO Block Control wakeup setting 2025-04-11 16:08:34 +02:00