]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
bcm27xx: add bcm27xx-i2c/spi meta-packages, drop hardcoded kmods
authorJoshua Covington <joshuacov@gmail.com>
Thu, 16 Jul 2026 19:25:18 +0000 (19:25 +0000)
committerJonas Jelonek <jelonek.jonas@gmail.com>
Fri, 31 Jul 2026 15:31:12 +0000 (17:31 +0200)
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 <joshuacov@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24244
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
target/linux/bcm27xx/image/Makefile
target/linux/bcm27xx/modules/i2c.mk
target/linux/bcm27xx/modules/spi.mk

index 011e129ca660512e603b1afc94dc1b75dd752454..f1da8284731d7ff071e01c42f44bcfc7011070d3 100644 (file)
@@ -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 \
index 0d44f1febcf49eb18139b272081a1ff2fa7ca10d..c6e9ab590116c0d83ef1bd070d2c2aa7b58a021e 100644 (file)
@@ -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))
index 948978dd44810c342c262403eb5b6ba213c1f78e..3b136c7a41d52d9237452ee1aa3b2b4fa64e4cce 100644 (file)
@@ -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))