linux-yocto/drivers/usb
Mathias Nyman 2521106fc7 usb: hub: Don't try to recover devices lost during warm reset.
Hub driver warm-resets ports in SS.Inactive or Compliance mode to
recover a possible connected device. The port reset code correctly
detects if a connection is lost during reset, but hub driver
port_event() fails to take this into account in some cases.
port_event() ends up using stale values and assumes there is a
connected device, and will try all means to recover it, including
power-cycling the port.

Details:
This case was triggered when xHC host was suspended with DbC (Debug
Capability) enabled and connected. DbC turns one xHC port into a simple
usb debug device, allowing debugging a system with an A-to-A USB debug
cable.

xhci DbC code disables DbC when xHC is system suspended to D3, and
enables it back during resume.
We essentially end up with two hosts connected to each other during
suspend, and, for a short while during resume, until DbC is enabled back.
The suspended xHC host notices some activity on the roothub port, but
can't train the link due to being suspended, so xHC hardware sets a CAS
(Cold Attach Status) flag for this port to inform xhci host driver that
the port needs to be warm reset once xHC resumes.

CAS is xHCI specific, and not part of USB specification, so xhci driver
tells usb core that the port has a connection and link is in compliance
mode. Recovery from complinace mode is similar to CAS recovery.

xhci CAS driver support that fakes a compliance mode connection was added
in commit 8bea2bd37d ("usb: Add support for root hub port status CAS")

Once xHCI resumes and DbC is enabled back, all activity on the xHC
roothub host side port disappears. The hub driver will anyway think
port has a connection and link is in compliance mode, and hub driver
will try to recover it.

The port power-cycle during recovery seems to cause issues to the active
DbC connection.

Fix this by clearing connect_change flag if hub_port_reset() returns
-ENOTCONN, thus avoiding the whole unnecessary port recovery and
initialization attempt.

Cc: stable@vger.kernel.org
Fixes: 8bea2bd37d ("usb: Add support for root hub port status CAS")
Tested-by: Łukasz Bartosik <ukaszb@chromium.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/20250623133947.3144608-1-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-07-16 09:48:11 +02:00
..
atm treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
c67x00
cdns3 usb: cdnsp: Fix issue with CV Bad Descriptor test 2025-06-24 15:42:39 +01:00
chipidea usb: chipidea: udc: disconnect/reconnect from host when do suspend/resume 2025-06-19 12:36:43 +02:00
class usb: usbtmc: Fix timeout value in get_stb 2025-05-21 15:01:09 +02:00
common usb: common: usb-conn-gpio: use a unique name for usb connector device 2025-04-11 16:08:34 +02:00
core usb: hub: Don't try to recover devices lost during warm reset. 2025-07-16 09:48:11 +02:00
dwc2 usb: dwc2: gadget: Fix enter to hibernation for UTMI+ PHY 2025-07-13 17:31:04 +02:00
dwc3 usb: dwc3: qcom: Don't leave BCR asserted 2025-07-13 17:30:59 +02:00
early
fotg210 usb: fotg210-hcd: Switch to use hrtimer_setup() 2025-02-18 11:19:02 +01:00
gadget usb: gadget: configfs: Fix OOB read on empty string write 2025-07-09 12:10:52 +02:00
host xhci: dbc: Flush queued requests before stopping dbc 2025-06-28 17:20:25 +02:00
image scsi: Rename .slave_alloc() and .slave_destroy() 2024-12-04 15:34:28 -05:00
isp1760 treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
misc treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
mon drivers/usb/mon: refactor min with min_t 2024-11-13 15:09:51 +01:00
mtu3 Driver core and debugfs updates 2025-01-28 12:25:12 -08:00
musb usb: musb: fix gadget state on disconnect 2025-07-07 10:58:15 +02:00
phy usb: Remove orphaned UDC drivers 2025-04-11 16:11:25 +02:00
renesas_usbhs usb: renesas_usbhs: Reorder clock handling and power management in probe 2025-04-11 16:08:34 +02:00
roles usb: roles: set switch registered flag early on 2025-02-14 09:26:25 +01:00
serial USB: serial: option: add Telit Cinterion FE910C04 (ECM) composition 2025-07-10 16:13:51 +02:00
storage treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
typec usb: typec: displayport: Fix potential deadlock 2025-06-24 15:43:15 +01:00
usbip treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
Kconfig usb: pci-quirks: handle HAS_IOPORT dependency for AMD quirk 2023-10-02 16:19:12 +02:00
Makefile
usb-skeleton.c