[PATCH] USB: OHCI/UHCI: Add soft dependencies on ehci_hcd
Huacai Chen
chenhuacai at kernel.org
Fri Jan 9 20:05:19 PST 2026
On Sun, Jan 4, 2026 at 12:41 AM Alan Stern <stern at rowland.harvard.edu> wrote:
>
> On Sat, Jan 03, 2026 at 11:57:47AM +0800, Huacai Chen wrote:
> > On Sat, Jan 3, 2026 at 11:33 AM Alan Stern <stern at rowland.harvard.edu> wrote:
> > > Since these systems don't use PCI, the question I raised earlier still
> > > needs to be answered: How do they route connections between the ports
> > > and the two controllers?
> > >
> > > There may be some exceptions, but for the most part, the code in
> > > ehci-hcd was written assuming that only PCI-based controllers will have
> > > companions. If you want to make an exception for loongson-2k0500, you
> > > will need to figure out how to get it to work.
> > Loongson-2K0500 use EHCI/OHCI with platform bus, while
> > Loongson-2K1000/2000 use EHCI/OHCI with PCI bus. They use the same USB
> > IP cores, so the route connections are probably the same.
>
> With PCI we know exactly which companion controller each port is
> connected to. Is that true in your situation?
>
> Or do you have only one companion controller?
>
> For that matter, how many USB ports do these systems have? Are some of
> them USB-1 only or USB-2 only?
>
> > > Have you tested any of those systems to see how they behave if a USB-1
> > > device is already plugged in and running when the ehci-hcd driver gets
> > > loaded?
>
> You did not answer this question.
On Loongson-2K0500 (OHCI/EHCI with platform bus).
If ohci-platform loaded before ehci-platform:
[ 30.530103] ohci-platform 1f058000.usb: Generic Platform OHCI controller
[ 30.555362] ohci-platform 1f058000.usb: new USB bus registered,
assigned bus number 1
[ 30.583586] ohci-platform 1f058000.usb: irq 28, io mem 0x1f058000
[ 30.671500] hub 1-0:1.0: USB hub found
[ 30.687929] hub 1-0:1.0: 4 ports detected
[ 30.798553] Warning! ehci_hcd should always be loaded before
uhci_hcd and ohci_hcd, not after
[ 31.015178] usb 1-4: new low-speed USB device number 2 using ohci-platform
[ 31.090527] ehci-platform 1f050000.usb: EHCI Host Controller
[ 31.107968] ehci-platform 1f050000.usb: new USB bus registered,
assigned bus number 2
[ 31.143813] ehci-platform 1f050000.usb: irq 29, io mem 0x1f050000
[ 31.227286] ehci-platform 1f050000.usb: USB 2.0 started, EHCI 1.00
[ 31.248271] usb 1-4: device descriptor read/all, error -62
[ 31.256845] hub 2-0:1.0: USB hub found
[ 31.279310] hub 2-0:1.0: 4 ports detected
[ 31.915149] usb 1-4: new low-speed USB device number 3 using ohci-platform
[ 32.264765] input: YSPRINGTECH USB OPTICAL MOUSE as
/devices/platform/bus at 10000000/1f058000.usb/usb1/1-4/1-4:1.0/0003:10C4:8105.0001/input/input0
[ 32.374306] hid-generic 0003:10C4:8105.0001: input,hidraw0: USB HID
v1.11 Mouse [YSPRINGTECH USB OPTICAL MOUSE] on
usb-1f058000.usb-4/input0
If ehci-platform loaded before ohci-platform:
[ 30.724394] ehci-platform 1f050000.usb: EHCI Host Controller
[ 30.743839] ehci-platform 1f050000.usb: new USB bus registered,
assigned bus number 1
[ 30.775857] ehci-platform 1f050000.usb: irq 28, io mem 0x1f050000
[ 30.811297] ehci-platform 1f050000.usb: USB 2.0 started, EHCI 1.00
[ 30.829172] hub 1-0:1.0: USB hub found
[ 30.847397] hub 1-0:1.0: 4 ports detected
[ 30.934190] ohci-platform 1f058000.usb: Generic Platform OHCI controller
[ 30.959877] ohci-platform 1f058000.usb: new USB bus registered,
assigned bus number 2
[ 30.987617] ohci-platform 1f058000.usb: irq 29, io mem 0x1f058000
[ 31.080419] hub 2-0:1.0: USB hub found
[ 31.092038] hub 2-0:1.0: 4 ports detected
[ 31.407288] usb 2-4: new low-speed USB device number 2 using ohci-platform
[ 31.741276] input: YSPRINGTECH USB OPTICAL MOUSE as
/devices/platform/bus at 10000000/1f058000.usb/usb2/2-4/2-4:1.0/0003:10C4:8105.0001/input/input0
[ 31.815422] hid-generic 0003:10C4:8105.0001: input,hidraw0: USB HID
v1.11 Mouse [YSPRINGTECH USB OPTICAL MOUSE] on
usb-1f058000.usb-4/input0
"new low-speed USB device number 3 using ohci-platform" only displayed
once and "usb 1-4: device descriptor read/all, error -62" disappears
in this case.
So I think we need a softdep between ohci-platform/uhci-platform and
ehci-platform, which is similar to the PCI case.
>
> There are other issues involving companion controllers, connected with
> hibernation. You should take a look at commit 6d19c009cc78 ("USB:
> implement non-tree resume ordering constraints for PCI host
> controllers"), which was later modified by commit 05768918b9a1 ("USB:
> improve port transitions when EHCI starts up") and a few others.
>
> Also, read through the current code in hcd-pci.c (for_each_companion(),
> ehci_pre_add(), ehci_post_add(), non_ehci_add(), ehci_remove(), and
> ehci_wait_for_companions()). Your non-PCI system will need to implement
> some sort of equivalent to all these things.
At least for the device probe, a softdep seems enough.
Huacai
>
> Alan Stern
More information about the Linux-rockchip
mailing list