cypress-nvram: use symlink to provide NVRAM for some RPis
authorKuan-Yi Li <kyli@abysm.org>
Sat, 22 Oct 2022 15:09:19 +0000 (23:09 +0800)
committerÁlvaro Fernández Rojas <noltari@gmail.com>
Tue, 15 Nov 2022 19:47:54 +0000 (20:47 +0100)
This is to align the implementation with upstream `linux-firmware`.

Some Raspberry Pi boards do not have dedicated NVRAM in `linux-firmware`
source repository, their NVRAM is provided through a symbolic link to
NVRAM of another board with an identical wireless design.

Signed-off-by: Kuan-Yi Li <kyli@abysm.org>
package/firmware/cypress-nvram/Makefile
target/linux/bcm27xx/image/Makefile

index 2bf71cd8895c58f3cac62bc8af2d1774923e75df..7c999540ca702aaed8fbf33b4899cbbf552e1cc8 100644 (file)
@@ -11,7 +11,7 @@ PKG_NAME:=cypress-nvram
 PKG_SOURCE_DATE:=2019-09-03
 PKG_SOURCE_VERSION:=e7b78df22f2a0c5f56abb7b5880661611de35e5f
 PKG_MIRROR_HASH:=1cb20a749696852be0a512d51961365dd9c031362af0af1a2b9f5a3fb894885f
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=https://github.com/openwrt/cypress-nvram.git
@@ -44,7 +44,7 @@ define Package/cypress-nvram-43430-sdio-rpi-3b/install
        $(INSTALL_DIR) $(1)/lib/firmware/brcm
        $(INSTALL_DATA) \
                $(PKG_BUILD_DIR)/brcmfmac43430-sdio.raspberrypi,3-model-b.txt \
-               $(1)/lib/firmware/brcm/brcmfmac43430-sdio.raspberrypi,3-model-b.txt
+               $(1)/lib/firmware/brcm/
 endef
 
 $(eval $(call BuildPackage,cypress-nvram-43430-sdio-rpi-3b))
@@ -53,14 +53,14 @@ $(eval $(call BuildPackage,cypress-nvram-43430-sdio-rpi-3b))
 define Package/cypress-nvram-43430-sdio-rpi-zero-w
   $(Package/cypress-nvram-default)
   TITLE:=CYW43430 NVRAM for Raspberry Pi Zero W
-  DEPENDS:=@TARGET_bcm27xx
+  DEPENDS:=@TARGET_bcm27xx +cypress-nvram-43430-sdio-rpi-3b
   CONFLICTS:=brcmfmac-firmware-43430-sdio-rpi-zero-w
 endef
 
 define Package/cypress-nvram-43430-sdio-rpi-zero-w/install
        $(INSTALL_DIR) $(1)/lib/firmware/brcm
-       $(INSTALL_DATA) \
-               $(PKG_BUILD_DIR)/brcmfmac43430-sdio.raspberrypi,model-zero-w.txt \
+       $(LN) \
+               brcmfmac43430-sdio.raspberrypi,3-model-b.txt \
                $(1)/lib/firmware/brcm/brcmfmac43430-sdio.raspberrypi,model-zero-w.txt
 endef
 
@@ -78,7 +78,7 @@ define Package/cypress-nvram-43455-sdio-rpi-3b-plus/install
        $(INSTALL_DIR) $(1)/lib/firmware/brcm
        $(INSTALL_DATA) \
                $(PKG_BUILD_DIR)/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt \
-               $(1)/lib/firmware/brcm/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt
+               $(1)/lib/firmware/brcm/
 endef
 
 $(eval $(call BuildPackage,cypress-nvram-43455-sdio-rpi-3b-plus))
@@ -95,14 +95,28 @@ define Package/cypress-nvram-43455-sdio-rpi-4b/install
        $(INSTALL_DIR) $(1)/lib/firmware/brcm
        $(INSTALL_DATA) \
                $(PKG_BUILD_DIR)/brcmfmac43455-sdio.raspberrypi,4-model-b.txt \
-               $(1)/lib/firmware/brcm/brcmfmac43455-sdio.raspberrypi,4-model-b.txt
-       $(INSTALL_DATA) \
-               $(PKG_BUILD_DIR)/brcmfmac43455-sdio.raspberrypi,4-model-b.txt \
-               $(1)/lib/firmware/brcm/brcmfmac43455-sdio.raspberrypi,4-compute-module.txt
+               $(1)/lib/firmware/brcm/
 endef
 
 $(eval $(call BuildPackage,cypress-nvram-43455-sdio-rpi-4b))
 
+# Cypress 43455 SDIO Raspberry Pi CM4 NVRAM
+define Package/cypress-nvram-43455-sdio-rpi-cm4
+  $(Package/cypress-nvram-default)
+  TITLE:=CYW43455 NVRAM for Raspberry Pi CM4
+  DEPENDS:=@TARGET_bcm27xx +cypress-nvram-43455-sdio-rpi-4b
+  CONFLICTS:=brcmfmac-firmware-43455-sdio-rpi-cm4
+endef
+
+define Package/cypress-nvram-43455-sdio-rpi-cm4/install
+       $(INSTALL_DIR) $(1)/lib/firmware/brcm
+       $(LN) \
+               brcmfmac43455-sdio.raspberrypi,4-model-b.txt \
+               $(1)/lib/firmware/brcm/brcmfmac43455-sdio.raspberrypi,4-compute-module.txt
+endef
+
+$(eval $(call BuildPackage,cypress-nvram-43455-sdio-rpi-cm4))
+
 # Cypress 4339 SDIO PICO-PI-IMX7D
 define Package/cypress-nvram-4339-pico-pi-imx7d
   $(Package/cypress-nvram-default)
@@ -115,7 +129,7 @@ define Package/cypress-nvram-4339-pico-pi-imx7d/install
        $(INSTALL_DIR) $(1)/lib/firmware/brcm
        $(INSTALL_DATA) \
                ./files/brcmfmac4339-sdio.technexion,imx7d-pico-pi.txt \
-               $(1)/lib/firmware/brcm/brcmfmac4339-sdio.technexion,imx7d-pico-pi.txt
+               $(1)/lib/firmware/brcm/
 endef
 
 $(eval $(call BuildPackage,cypress-nvram-4339-pico-pi-imx7d))
index 4cd1052941cc745e7da81087a9ef91989cb26e0e..650d6730253fb5ae71cdaa182980909d08851828 100644 (file)
@@ -87,10 +87,10 @@ define Device/rpi-2
   DEVICE_MODEL := 2B/2B 1.2
   DEVICE_VARIANT := (32bit)
   DEVICE_ALT0_VENDOR := Raspberry Pi
-  DEVICE_ALT0_MODEL := 3B/3B+/3CM
+  DEVICE_ALT0_MODEL := 3B/3B+/CM3
   DEVICE_ALT0_VARIANT := (32bit)
   DEVICE_ALT1_VENDOR := Raspberry Pi
-  DEVICE_ALT1_MODEL := 4B/400/4CM
+  DEVICE_ALT1_MODEL := 4B/400/CM4
   DEVICE_ALT1_VARIANT := (32bit)
   DEVICE_DTS := \
        bcm2709-rpi-2-b bcm2710-rpi-2-b \
@@ -109,7 +109,9 @@ define Device/rpi-2
        cypress-firmware-43430-sdio \
        cypress-nvram-43430-sdio-rpi-3b \
        cypress-firmware-43455-sdio \
-       cypress-nvram-43455-sdio-rpi-3b-plus cypress-nvram-43455-sdio-rpi-4b \
+       cypress-nvram-43455-sdio-rpi-3b-plus \
+       cypress-nvram-43455-sdio-rpi-4b \
+       cypress-nvram-43455-sdio-rpi-cm4 \
        kmod-brcmfmac wpad-basic-wolfssl
   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
@@ -119,7 +121,7 @@ ifeq ($(SUBTARGET),bcm2709)
 endif
 
 define Device/rpi-3
-  DEVICE_MODEL := 3B/3B+/3CM
+  DEVICE_MODEL := 3B/3B+/CM3
   DEVICE_VARIANT := (64bit)
   DEVICE_ALT0_VENDOR := Raspberry Pi
   DEVICE_ALT0_MODEL := 2B-1.2
@@ -148,7 +150,7 @@ ifeq ($(SUBTARGET),bcm2710)
 endif
 
 define Device/rpi-4
-  DEVICE_MODEL := 4B/400/4CM
+  DEVICE_MODEL := 4B/400/CM4
   DEVICE_VARIANT := (64bit)
   KERNEL_IMG := kernel8.img
   DEVICE_DTS := \
@@ -162,6 +164,7 @@ define Device/rpi-4
   DEVICE_PACKAGES := \
        cypress-firmware-43455-sdio \
        cypress-nvram-43455-sdio-rpi-4b \
+       cypress-nvram-43455-sdio-rpi-cm4 \
        kmod-brcmfmac wpad-basic-wolfssl \
        kmod-usb-net-lan78xx
   IMAGE/sysupgrade.img.gz := boot-common | boot-2711 | sdcard-img | gzip | append-metadata