R-Car/xhci-rcar-driver-waits-for-firmware-loading

From eLinux.org
< R-Car
Revision as of 18:48, 15 June 2021 by Shimoda (talk | contribs) (Created page with "== Overview == From v5.4, since the following commit has been applied, CONFIG_FW_LOADER_USER_HELPER and CONFIG_FW_LOADER_USER_HELPER_FALLBACK has been enabled on the defconfi...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Overview

From v5.4, since the following commit has been applied, CONFIG_FW_LOADER_USER_HELPER and CONFIG_FW_LOADER_USER_HELPER_FALLBACK has been enabled on the defconfig.

7f4e4afa140c arm64: defconfig: Enable SDMA on i.mx8mq/8mm

So, when we use defconfig, xhci-rcar driver takes 60 seconds in kernel booting like the following.

[    2.128762] xhci-hcd ee000000.usb: xHCI Host Controller
[    2.134026] xhci-hcd ee000000.usb: new USB bus registered, assigned bus number 7
[    2.141477] xhci-hcd ee000000.usb: Direct firmware load for r8a779x_usb3_v3.dlmem failed with error -2
[    2.150810] xhci-hcd ee000000.usb: Falling back to sysfs fallback for: r8a779x_usb3_v3.dlmem
[   62.429670] xhci-hcd ee000000.usb: can't setup: -11
[   62.434559] xhci-hcd ee000000.usb: USB bus 7 deregistered
[   62.440002] xhci-hcd: probe of ee000000.usb failed with error -11

How to avoid this issue?

We have some options to avoid this issue.

  • Disable CONFIG_FW_LOADER_USER_HELPER{,_FALLBACK}
  • Use kernel module of xhci driver instead of built-in
  • Use request_firmware_direct() instead of request_firmware()

Disable CONFIG_FW_LOADER_USER_HELPER{,_FALLBACK}

Just disable CONFIG_FW_LOADER_USER_HELPER and CONFIG_FW_LOADER_USER_HELPER_FALLBACK.

Location on v5.12:
-> Device Drivers
 -> Generic Driver Options
  -> Firmware loader
   -> Firmware loading facility (FW_LOADER [=y])

     [ ]   Enable the firmware sysfs fallback mechanism
     [ ]     Force the firmware sysfs fallback mechanism when possible

Use kernel module of xhci driver instead of built-in

In v5.12, CONFIG_USB_XHCI_HCD is changed from built-in (=y) to kernel module (=m). And then, xhci-hcd.ko and xhc-plat-hcd are generated.

Location on v5.12:
-> Device Drivers
 -> USB support (USB_SUPPORT [=y])

    <M>   xHCI HCD (USB 3.0) support
    [ ]     xHCI support for debug capability
    < >     Support for additional Renesas xHCI controller with firmw
    -M-     Generic xHCI driver for a platform device
    < >       xHCI support for HiSilicon STB SoCs
    < >     xHCI support for MediaTek SoCs
    < >     xHCI support for Marvell Armada 375/38x/37xx
    -M-     xHCI support for Renesas R-Car SoCs

And then, we can use the xhci rcar driver by using the following commands.

# modprobe xhci-plat-hcd
# lsmod
Module                  Size  Used by
xhci_plat_hcd          24576  0
xhci_hcd              249856  1 xhci_plat_hcd

Use request_firmware_direct() instead of request_firmware()

If we change the xhci-rcar.c like below, we can avoid the issue even if we use defconfig.

diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c
index 1bc4fe7b8c75..5d53517c1112 100644
--- a/drivers/usb/host/xhci-rcar.c
+++ b/drivers/usb/host/xhci-rcar.c
@@ -146,7 +146,7 @@ static int xhci_rcar_download_firmware(struct usb_hcd *hcd)
                firmware_name = priv->firmware_name;

        /* request R-Car USB3.0 firmware */
-       retval = request_firmware(&fw, firmware_name, dev);
+       retval = request_firmware_direct(&fw, firmware_name, dev);
        if (retval)
                return retval;