From: Joshua Covington Date: Thu, 16 Jul 2026 19:25:18 +0000 (+0000) Subject: bcm27xx: add bcm27xx-i2c/spi meta-packages, drop hardcoded kmods X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=73b19f90c2322722be1ede3bcd037df9644c6046;p=thirdparty%2Fopenwrt.git bcm27xx: add bcm27xx-i2c/spi meta-packages, drop hardcoded kmods Each bcm27xx generation needs a different combination of I2C/SPI kernel modules -- bcm2708/2709/2710 use only the classic BCM2835 controllers, bcm2711 adds i2c-brcmstb, and bcm2712 additionally needs the RP1-attached DesignWare controllers (i2c-designware-platform, spi-dw-mmio) while lacking the classic Aux SPI block entirely. Rather than requiring users to know which specific driver combination their board needs, or baking that combination into every device's default image regardless of whether I2C/SPI is actually used, add two small meta-packages that resolve the correct set automatically based on the selected subtarget: - kmod-bcm27xx-i2c, added to target/linux/bcm27xx/modules/i2c.mk - kmod-bcm27xx-spi, added to target/linux/bcm27xx/modules/spi.mk Installing either pulls in exactly the right underlying kmods for whichever bcm27xx board is being built. Remove the now-redundant hardcoded i2c/spi kmod-* entries from Device/rpi, Device/rpi-2, Device/rpi-3, Device/rpi-4 and Device/rpi-5 in image/Makefile. Signed-off-by: Joshua Covington Link: https://github.com/openwrt/openwrt/pull/24244 Signed-off-by: Jonas Jelonek --- diff --git a/target/linux/bcm27xx/image/Makefile b/target/linux/bcm27xx/image/Makefile index 011e129ca66..f1da8284731 100644 --- a/target/linux/bcm27xx/image/Makefile +++ b/target/linux/bcm27xx/image/Makefile @@ -92,9 +92,7 @@ define Device/rpi DEVICE_PACKAGES := \ cypress-firmware-43430-sdio \ brcmfmac-nvram-43430-sdio \ - kmod-brcmfmac wpad-basic-mbedtls \ - kmod-i2c-bcm2835 kmod-spi-bcm2835 \ - kmod-spi-bcm2835-aux + kmod-brcmfmac wpad-basic-mbedtls endef ifeq ($(SUBTARGET),bcm2708) TARGET_DEVICES += rpi @@ -135,9 +133,7 @@ define Device/rpi-2 brcmfmac-nvram-43430-sdio \ cypress-firmware-43455-sdio \ brcmfmac-nvram-43455-sdio \ - kmod-brcmfmac wpad-basic-mbedtls \ - kmod-i2c-bcm2835 kmod-spi-bcm2835 \ - kmod-spi-bcm2835-aux + kmod-brcmfmac wpad-basic-mbedtls IMAGE/sysupgrade.img.gz := boot-common | boot-2708 | boot-2711 | sdcard-img | gzip | append-metadata IMAGE/factory.img.gz := boot-common | boot-2708 | boot-2711 | sdcard-img | gzip endef @@ -171,9 +167,7 @@ define Device/rpi-3 brcmfmac-nvram-43430-sdio \ cypress-firmware-43455-sdio \ brcmfmac-nvram-43455-sdio \ - kmod-brcmfmac wpad-basic-mbedtls \ - kmod-i2c-bcm2835 kmod-spi-bcm2835 \ - kmod-spi-bcm2835-aux + kmod-brcmfmac wpad-basic-mbedtls endef ifeq ($(SUBTARGET),bcm2710) TARGET_DEVICES += rpi-3 @@ -198,9 +192,6 @@ define Device/rpi-4 cypress-firmware-43455-sdio \ brcmfmac-nvram-43455-sdio \ kmod-brcmfmac wpad-basic-mbedtls \ - kmod-i2c-bcm2835 kmod-spi-bcm2835 \ - kmod-spi-bcm2835-aux \ - kmod-i2c-brcmstb \ kmod-usb-net-lan78xx \ kmod-usb-net-rtl8152 \ kmod-r8169 @@ -231,9 +222,6 @@ define Device/rpi-5 cypress-firmware-43455-sdio \ brcmfmac-nvram-43455-sdio \ kmod-brcmfmac wpad-basic-mbedtls \ - kmod-i2c-bcm2835 kmod-spi-bcm2835 \ - kmod-i2c-brcmstb \ - kmod-i2c-designware-platform kmod-spi-dw-mmio \ kmod-hwmon-pwmfan kmod-thermal \ kmod-usb-net-lan78xx \ kmod-usb-net-rtl8152 \ diff --git a/target/linux/bcm27xx/modules/i2c.mk b/target/linux/bcm27xx/modules/i2c.mk index 0d44f1febcf..c6e9ab59011 100644 --- a/target/linux/bcm27xx/modules/i2c.mk +++ b/target/linux/bcm27xx/modules/i2c.mk @@ -32,3 +32,21 @@ define KernelPackage/i2c-brcmstb/description endef $(eval $(call KernelPackage,i2c-brcmstb)) + + +define KernelPackage/bcm27xx-i2c + SUBMENU:=$(I2C_MENU) + TITLE:=I2C support for bcm27xx boards + DEPENDS:=@TARGET_bcm27xx +kmod-i2c-bcm2835 \ + +TARGET_bcm27xx_bcm2711:kmod-i2c-brcmstb \ + +TARGET_bcm27xx_bcm2712:kmod-i2c-brcmstb \ + +TARGET_bcm27xx_bcm2712:kmod-i2c-designware-platform +endef + +define KernelPackage/bcm27xx-i2c/description + Pulls in the correct I2C kernel modules for whichever bcm27xx + board you're building for, without needing to know which specific + driver combination your particular Pi/CM generation requires. +endef + +$(eval $(call KernelPackage,bcm27xx-i2c)) diff --git a/target/linux/bcm27xx/modules/spi.mk b/target/linux/bcm27xx/modules/spi.mk index 948978dd448..3b136c7a41d 100644 --- a/target/linux/bcm27xx/modules/spi.mk +++ b/target/linux/bcm27xx/modules/spi.mk @@ -38,3 +38,20 @@ define KernelPackage/spi-bcm2835-aux/description endef $(eval $(call KernelPackage,spi-bcm2835-aux)) + + +define KernelPackage/bcm27xx-spi + SUBMENU:=$(SPI_MENU) + TITLE:=SPI support for bcm27xx boards + DEPENDS:=@TARGET_bcm27xx +kmod-spi-bcm2835 \ + +!TARGET_bcm27xx_bcm2712:kmod-spi-bcm2835-aux \ + +TARGET_bcm27xx_bcm2712:kmod-spi-dw-mmio +endef + +define KernelPackage/bcm27xx-spi/description + Pulls in the correct SPI kernel modules for whichever bcm27xx + board you're building for, without needing to know which specific + driver combination your particular Pi/CM generation requires. +endef + +$(eval $(call KernelPackage,bcm27xx-spi))