[openwrt/openwrt] kernel: fix kmod-usb3 dependencies

LEDE Commits lede-commits at lists.infradead.org
Sat Mar 6 02:47:49 GMT 2021


dangole pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/7bda2e9aba58eaed4519fa2ec0f78dd1ab58594f

commit 7bda2e9aba58eaed4519fa2ec0f78dd1ab58594f
Author: Ilya Lipnitskiy <ilya.lipnitskiy at gmail.com>
AuthorDate: Fri Mar 5 18:06:02 2021 -0800

    kernel: fix kmod-usb3 dependencies
    
    Adding CONFIG_USB_XHCI_PCI_RENESAS to KCONFIG made it so it was set
    for all targets that included kmod-usb3, not just the intended
    apm821xx/nand. xhci-pci has a dependency on xhci-pci-renesas if
    CONFIG_USB_XHCI_PCI_RENESAS is set, breaking kmod-usb3 builds on
    Linux 5.10 on all other targets.
    
    Rework the dependencies by breaking out xhci-hcd, xhci-mtk, and
    xhci-pci-renesas into new hidden kernel modules and setting kmod-usb3
    dependencies properly.
    
    Tested by building mt7621 and apm821xx/nand with kmod-usb3 on Linux 5.10
    
    Fixes: be23f981 ("apm821xx: add support for kernel 5.10")
    Cc: Christian Lamparter <chunkeey at gmail.com>
    Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy at gmail.com>
---
 package/kernel/linux/modules/usb.mk | 82 ++++++++++++++++++++++++++++---------
 1 file changed, 62 insertions(+), 20 deletions(-)

diff --git a/package/kernel/linux/modules/usb.mk b/package/kernel/linux/modules/usb.mk
index 1f72d89512..1a45fb3670 100644
--- a/package/kernel/linux/modules/usb.mk
+++ b/package/kernel/linux/modules/usb.mk
@@ -1649,34 +1649,22 @@ endef
 
 $(eval $(call KernelPackage,usbmon))
 
-XHCI_MODULES := xhci-hcd xhci-pci xhci-plat-hcd
-ifdef CONFIG_TARGET_ramips_mt7621
-  XHCI_MODULES += xhci-mtk
-endif
-ifndef CONFIG_LINUX_5_4
-  ifdef CONFIG_TARGET_apm821xx_nand
-    XHCI_MODULES += xhci-pci-renesas
-  endif
-endif
-XHCI_FILES := $(wildcard $(patsubst %,$(LINUX_DIR)/drivers/usb/host/%.ko,$(XHCI_MODULES)))
-XHCI_AUTOLOAD := $(patsubst $(LINUX_DIR)/drivers/usb/host/%.ko,%,$(XHCI_FILES))
-
 define KernelPackage/usb3
   TITLE:=Support for USB3 controllers
   DEPENDS:= \
+	+kmod-usb-xhci-hcd \
 	+TARGET_bcm53xx:kmod-usb-bcma \
-	+TARGET_bcm53xx:kmod-phy-bcm-ns-usb3
+	+TARGET_bcm53xx:kmod-phy-bcm-ns-usb3 \
+	+TARGET_ramips_mt7621:kmod-usb-xhci-mtk \
+	+(TARGET_apm821xx_nand&&LINUX_5_10):kmod-usb-xhci-pci-renesas
   KCONFIG:= \
 	CONFIG_USB_PCI=y \
-	CONFIG_USB_XHCI_HCD \
 	CONFIG_USB_XHCI_PCI \
-	CONFIG_USB_XHCI_PLATFORM \
-	CONFIG_USB_XHCI_MTK \
-	CONFIG_USB_XHCI_PCI_RENESAS \
-	CONFIG_USB_XHCI_HCD_DEBUGGING=n
+	CONFIG_USB_XHCI_PLATFORM
   FILES:= \
-	$(XHCI_FILES)
-  AUTOLOAD:=$(call AutoLoad,54,$(XHCI_AUTOLOAD),1)
+	$(LINUX_DIR)/drivers/usb/host/xhci-pci.ko \
+	$(LINUX_DIR)/drivers/usb/host/xhci-plat-hcd.ko
+  AUTOLOAD:=$(call AutoLoad,54,xhci-pci xhci-plat-hcd,1)
   $(call AddDepends/usb)
 endef
 
@@ -1719,6 +1707,60 @@ endef
 $(eval $(call KernelPackage,usb-roles))
 
 
+define KernelPackage/usb-xhci-hcd
+  TITLE:=xHCI HCD (USB 3.0) support
+  KCONFIG:= \
+	  CONFIG_USB_XHCI_HCD \
+	  CONFIG_USB_XHCI_HCD_DEBUGGING=n
+  HIDDEN:=1
+  FILES:=$(LINUX_DIR)/drivers/usb/host/xhci-hcd.ko
+  AUTOLOAD:=$(call AutoLoad,54,xhci-hcd,1)
+  $(call AddDepends/usb)
+endef
+
+define KernelPackage/usb-xhci-hcd/description
+  The eXtensible Host Controller Interface (xHCI) is standard for USB 3.0
+  "SuperSpeed" host controller hardware.
+endef
+
+$(eval $(call KernelPackage,usb-xhci-hcd))
+
+
+define KernelPackage/usb-xhci-mtk
+  TITLE:=xHCI support for MediaTek SoCs
+  DEPENDS:=+kmod-usb-xhci-hcd
+  KCONFIG:=CONFIG_USB_XHCI_MTK
+  HIDDEN:=1
+  FILES:=$(LINUX_DIR)/drivers/usb/host/xhci-mtk.ko
+  AUTOLOAD:=$(call AutoLoad,54,xhci-mtk,1)
+  $(call AddDepends/usb)
+endef
+
+define KernelPackage/usb-xhci-mtk/description
+  Kernel support for the xHCI host controller found in MediaTek SoCs.
+endef
+
+$(eval $(call KernelPackage,usb-xhci-mtk))
+
+
+define KernelPackage/usb-xhci-pci-renesas
+  TITLE:=Support for additional Renesas xHCI controller with firmware
+  DEPENDS:=@LINUX_5_10
+  KCONFIG:=CONFIG_USB_XHCI_PCI_RENESAS
+  HIDDEN:=1
+  FILES:=$(LINUX_DIR)/drivers/usb/host/xhci-pci-renesas.ko
+  AUTOLOAD:=$(call AutoLoad,54,xhci-pci-renesas,1)
+  $(call AddDepends/usb)
+endef
+
+define KernelPackage/usb-xhci-pci-renesas/description
+  Kernel support for the Renesas xHCI controller with firmware. Make sure you have
+  the firwmare for the device and installed on your system for this device to work.
+endef
+
+$(eval $(call KernelPackage,usb-xhci-pci-renesas))
+
+
 define KernelPackage/chaoskey
   SUBMENU:=$(USB_MENU)
   TITLE:=Chaoskey hardware RNG support



More information about the lede-commits mailing list