Some XHCI controllers may not have any USB 3.0 port, in this case, it
is not useful to create add hcd->shared_hcd, which has 2 main
downsides:
- A useless USB 3.0 root hub is created.
- A warning is thrown on boot:
hub 2-0:1.0: config failed, hub doesn't have any ports! (err -19)
The change is mostly about checking if hcd->shared_hcd is NULL before
accessing it. The one special case is in xhci_run, where we need to
call xhci_run_finished immediately, if there is no secondary hcd.
Signed-off-by: Nicolas Boichat <drinkcat@xxxxxxxxxxxx>
---
This is a respin of https://lore.kernel.org/patchwork/patch/863993/,
hopefully addressing the comments there. Note that I dropped the change
in xhci-plat.c, as I do not have a device to test it, but made a
similar change in xhci-mtk.c, in the next patch.
(the @apm.com addresses seem to bounce, so I added some
@amperecomputing.com instead, if somebody there can track back the
original issue, I'm happy to provide a patch for xhci-plat.c as well)
drivers/usb/host/xhci-hub.c | 7 ++++--
drivers/usb/host/xhci.c | 45 +++++++++++++++++++++++++++----------
2 files changed, 38 insertions(+), 14 deletions(-)
@@ -698,6 +703,10 @@ int xhci_run(struct usb_hcd *hcd)
xhci_debugfs_init(xhci);
+ /* There is no secondary HCD, start the host controller immediately. */
+ if (!xhci->shared_hcd)
+ return xhci_run_finished(xhci);
+