Linux USB
 help / color / mirror / Atom feed
* [PATCH] usb: xhci: Handle USB3 port events when there is one roothub
@ 2026-08-03 11:07 Semih Baskan
  2026-08-03 13:13 ` Mathias Nyman
  0 siblings, 1 reply; 3+ messages in thread
From: Semih Baskan @ 2026-08-03 11:07 UTC (permalink / raw)
  To: mathias.nyman, gregkh, hkallweit1; +Cc: linux-usb, linux-kernel, mathias.nyman

handle_port_status() drops every USB3 port event when xhci->shared_hcd is
NULL. The check dates from a time when xhci-plat always created a shared
hcd, so a NULL one could only mean the hcd had been removed.

Since commit 4736ebd7fcaf ("usb: host: xhci-plat: omit shared hcd if
either root hub has no ports") that is no longer true. A controller whose
USB2 root hub has no ports gets a single roothub, the USB3 rhub is served
by the main hcd, and shared_hcd stays NULL for the lifetime of the device.
Every SuperSpeed port event is then thrown away as bogus behind a debug
message, so devices never enumerate even though the port sees the device
and its change bits stay set:

  0x006a1203 Powered Connected Enabled Link:U0 PortSpeed:4
  Change: CSC WRC PRC PLC

Broadcom Northstar is such a controller. USB3 works there up to 5.15 and
stops working from 5.19 onwards.

Ask xhci_get_usb3_hcd() instead. It returns the shared hcd when there is
one, the main hcd when the USB2 root hub has no ports, and NULL once the
shared hcd is gone, which keeps the original meaning of the check.

Tested on an Asus RT-N18U (BCM47081), which has a single roothub. Before
the change nothing enumerates on the USB3 port; after it SuperSpeed
devices enumerate normally over repeated connect and disconnect cycles,
the change bits shown above clear, and USB2 is unaffected on both ports.

Fixes: 4736ebd7fcaf ("usb: host: xhci-plat: omit shared hcd if either root hub has no ports")
Cc: stable@vger.kernel.org
Signed-off-by: Semih Baskan <strst.gs@gmail.com>
---
 drivers/usb/host/xhci-ring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 4f98d8269625..829f3e8db26a 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -2025,7 +2025,7 @@ static void handle_port_status(struct xhci_hcd *xhci, union xhci_trb *event)
 		vdev = xhci->devs[port->slot_id];
 
 	/* We might get interrupts after shared_hcd is removed */
-	if (port->rhub == &xhci->usb3_rhub && xhci->shared_hcd == NULL) {
+	if (port->rhub == &xhci->usb3_rhub && xhci_get_usb3_hcd(xhci) == NULL) {
 		xhci_dbg(xhci, "ignore port event for removed USB3 hcd\n");
 		bogus_port_status = true;
 		goto cleanup;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: xhci: Handle USB3 port events when there is one roothub
  2026-08-03 11:07 [PATCH] usb: xhci: Handle USB3 port events when there is one roothub Semih Baskan
@ 2026-08-03 13:13 ` Mathias Nyman
  2026-08-03 13:35   ` Semih Baskan
  0 siblings, 1 reply; 3+ messages in thread
From: Mathias Nyman @ 2026-08-03 13:13 UTC (permalink / raw)
  To: Semih Baskan, mathias.nyman, gregkh, hkallweit1; +Cc: linux-usb, linux-kernel

On 8/3/26 14:07, Semih Baskan wrote:
> handle_port_status() drops every USB3 port event when xhci->shared_hcd is
> NULL. The check dates from a time when xhci-plat always created a shared
> hcd, so a NULL one could only mean the hcd had been removed.
> 
> Since commit 4736ebd7fcaf ("usb: host: xhci-plat: omit shared hcd if
> either root hub has no ports") that is no longer true. A controller whose
> USB2 root hub has no ports gets a single roothub, the USB3 rhub is served
> by the main hcd, and shared_hcd stays NULL for the lifetime of the device.
> Every SuperSpeed port event is then thrown away as bogus behind a debug
> message, so devices never enumerate even though the port sees the device
> and its change bits stay set:
> 
>    0x006a1203 Powered Connected Enabled Link:U0 PortSpeed:4
>    Change: CSC WRC PRC PLC
> 
> Broadcom Northstar is such a controller. USB3 works there up to 5.15 and
> stops working from 5.19 onwards.
> 

Interesting, I remember discussing USB3 only xHC hosts a couple years ago
when we got a USB2 only xHC.

We assumed a USB3 only xHC host is unlikely as connectors need to be backwards
compatible and support USB2 devices.

Is some other host controller (xHCI/EHCI) handling USB2 traffic in this
Broadcom Northstar case?

> Ask xhci_get_usb3_hcd() instead. It returns the shared hcd when there is
> one, the main hcd when the USB2 root hub has no ports, and NULL once the
> shared hcd is gone, which keeps the original meaning of the check.
> 
> Tested on an Asus RT-N18U (BCM47081), which has a single roothub. Before
> the change nothing enumerates on the USB3 port; after it SuperSpeed
> devices enumerate normally over repeated connect and disconnect cycles,
> the change bits shown above clear, and USB2 is unaffected on both ports.
> 
> Fixes: 4736ebd7fcaf ("usb: host: xhci-plat: omit shared hcd if either root hub has no ports")
> Cc: stable@vger.kernel.org
> Signed-off-by: Semih Baskan <strst.gs@gmail.com>

Adding, no reason to not support USB3 only hosts

Thanks
Mathias


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: xhci: Handle USB3 port events when there is one roothub
  2026-08-03 13:13 ` Mathias Nyman
@ 2026-08-03 13:35   ` Semih Baskan
  0 siblings, 0 replies; 3+ messages in thread
From: Semih Baskan @ 2026-08-03 13:35 UTC (permalink / raw)
  To: Mathias Nyman; +Cc: mathias.nyman, gregkh, hkallweit1, linux-usb, linux-kernel

On 8/3/26 16:13, Mathias Nyman wrote:
> Is some other host controller (xHCI/EHCI) handling USB2 traffic in this
> Broadcom Northstar case?

Yes. The SoC has three separate host controllers, each with its own node
and its own driver instance:

  ehci-platform 18021000.usb: new USB bus registered, assigned bus number 1
  ohci-platform 18022000.usb: new USB bus registered, assigned bus number 2
  xhci-hcd 18023000.usb: new USB bus registered, assigned bus number 3
  xhci-hcd 18023000.usb: USB2 root hub has no ports

The USB2 pins of the physical connectors go to the EHCI and OHCI
controllers rather than to the xHC, so the connectors stay backwards
compatible and the xHC never sees that half of them:

  usb 1-1: new high-speed USB device number 2 using ehci-platform
  usb 1-2: new high-speed USB device number 5 using ehci-platform
  usb 3-1: new SuperSpeed USB device number 2 using xhci-hcd

Both EHCI root ports are in use there, one per connector.

The layout comes from bcm-ns.dtsi, so it is every Northstar board
(BCM4708, BCM4709, BCM47081, BCM47094), not just this router.

Thanks for picking it up.

Semih

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-03 13:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-03 11:07 [PATCH] usb: xhci: Handle USB3 port events when there is one roothub Semih Baskan
2026-08-03 13:13 ` Mathias Nyman
2026-08-03 13:35   ` Semih Baskan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox