arm-trusted-firmware-mediatek: add ram-download bl2 images
authorFelix Fietkau <nbd@nbd.name>
Tue, 7 May 2024 17:40:43 +0000 (19:40 +0200)
committerFelix Fietkau <nbd@nbd.name>
Tue, 7 May 2024 20:02:55 +0000 (22:02 +0200)
Support for MT7981-MT7988. Can be used for mtk_uartboot recovery

Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/boot/arm-trusted-firmware-mediatek/Makefile

index c065c7e67d3019fcf32021a8f1f0c0410f5057b7..37d71e183c33904f90b235ccebf2263f00e82f65 100644 (file)
@@ -33,6 +33,7 @@ define Trusted-Firmware-A/Default
   NAND_TYPE:=
   BOARD_QFN:=
   DRAM_USE_COMB:=
+  RAM_BOOT_UART_DL:=
   USE_UBI:=
 endef
 
@@ -113,6 +114,17 @@ define Trusted-Firmware-A/mt7622-sdmmc-2ddr
   DDR3_FLYBY:=1
 endef
 
+define Trusted-Firmware-A/mt7981-ram-ddr4
+  NAME:=MediaTek MT7981 (RAM, DDR4)
+  BOOT_DEVICE:=ram
+  BUILD_SUBTARGET:=filogic
+  PLAT:=mt7981
+  DDR_TYPE:=ddr4
+  RAM_BOOT_UART_DL:=1
+  HIDDEN:=
+  DEFAULT:=TARGET_mediatek_filogic
+endef
+
 define Trusted-Firmware-A/mt7981-emmc-ddr4
   NAME:=MediaTek MT7981 (eMMC, DDR4)
   BOOT_DEVICE:=emmc
@@ -137,6 +149,17 @@ define Trusted-Firmware-A/mt7981-nor-ddr3
   DDR_TYPE:=ddr3
 endef
 
+define Trusted-Firmware-A/mt7981-ram-ddr3
+  NAME:=MediaTek MT7981 (RAM, DDR3)
+  BOOT_DEVICE:=ram
+  BUILD_SUBTARGET:=filogic
+  PLAT:=mt7981
+  DDR_TYPE:=ddr3
+  RAM_BOOT_UART_DL:=1
+  HIDDEN:=
+  DEFAULT:=TARGET_mediatek_filogic
+endef
+
 define Trusted-Firmware-A/mt7981-emmc-ddr3
   NAME:=MediaTek MT7981 (eMMC, DDR3)
   BOOT_DEVICE:=emmc
@@ -169,6 +192,17 @@ define Trusted-Firmware-A/mt7981-spim-nand-ddr3
   DDR_TYPE:=ddr3
 endef
 
+define Trusted-Firmware-A/mt7986-ram-ddr4
+  NAME:=MediaTek MT7986 (RAM, DDR4)
+  BOOT_DEVICE:=ram
+  BUILD_SUBTARGET:=filogic
+  PLAT:=mt7986
+  DDR_TYPE:=ddr4
+  RAM_BOOT_UART_DL:=1
+  HIDDEN:=
+  DEFAULT:=TARGET_mediatek_filogic
+endef
+
 define Trusted-Firmware-A/mt7986-nor-ddr4
   NAME:=MediaTek MT7986 (SPI-NOR, DDR4)
   BOOT_DEVICE:=nor
@@ -229,6 +263,17 @@ define Trusted-Firmware-A/mt7986-spim-nand-4k-ddr4
   NAND_TYPE:=spim:4k+256
 endef
 
+define Trusted-Firmware-A/mt7986-ram-ddr3
+  NAME:=MediaTek MT7986 (RAM, DDR3)
+  BOOT_DEVICE:=ram
+  BUILD_SUBTARGET:=filogic
+  PLAT:=mt7986
+  DDR_TYPE:=ddr3
+  RAM_BOOT_UART_DL:=1
+  HIDDEN:=
+  DEFAULT:=TARGET_mediatek_filogic
+endef
+
 define Trusted-Firmware-A/mt7986-nor-ddr3
   NAME:=MediaTek MT7986 (SPI-NOR, DDR3)
   BOOT_DEVICE:=nor
@@ -349,6 +394,17 @@ define Trusted-Firmware-A/mt7988-spim-nand-ddr4
   DDR_TYPE:=ddr4
 endef
 
+define Trusted-Firmware-A/mt7988-ram-comb
+  NAME:=MediaTek MT7988 (RAM)
+  BOOT_DEVICE:=ram
+  BUILD_SUBTARGET:=filogic
+  PLAT:=mt7988
+  DRAM_USE_COMB:=1
+  RAM_BOOT_UART_DL:=1
+  HIDDEN:=
+  DEFAULT:=TARGET_mediatek_filogic
+endef
+
 define Trusted-Firmware-A/mt7988-nor-comb
   NAME:=MediaTek MT7988 (SPI-NOR)
   BOOT_DEVICE:=nor
@@ -418,18 +474,22 @@ TFA_TARGETS:= \
        mt7622-emmc-2ddr \
        mt7622-sdmmc-1ddr \
        mt7622-sdmmc-2ddr \
+       mt7981-ram-ddr3 \
        mt7981-emmc-ddr3 \
        mt7981-nor-ddr3 \
        mt7981-sdmmc-ddr3 \
        mt7981-snand-ddr3 \
        mt7981-spim-nand-ddr3 \
+       mt7981-ram-ddr4 \
        mt7981-emmc-ddr4 \
        mt7981-spim-nand-ddr4 \
+       mt7986-ram-ddr3 \
        mt7986-emmc-ddr3 \
        mt7986-nor-ddr3 \
        mt7986-sdmmc-ddr3 \
        mt7986-snand-ddr3 \
        mt7986-spim-nand-ddr3 \
+       mt7986-ram-ddr4 \
        mt7986-emmc-ddr4 \
        mt7986-nor-ddr4 \
        mt7986-sdmmc-ddr4 \
@@ -447,6 +507,7 @@ TFA_TARGETS:= \
        mt7988-sdmmc-ddr4 \
        mt7988-snand-ddr4 \
        mt7988-spim-nand-ddr4 \
+       mt7988-ram-comb \
        mt7988-emmc-comb \
        mt7988-nor-comb \
        mt7988-sdmmc-comb \
@@ -464,9 +525,20 @@ TFA_MAKE_FLAGS += \
        HAVE_DRAM_OBJ_FILE=yes \
        $(if $(DDR3_FLYBY),DDR3_FLYBY=1) \
        $(if $(DRAM_USE_COMB),DRAM_USE_COMB=1) \
+       $(if $(RAM_BOOT_UART_DL),RAM_BOOT_UART_DL=1) \
        $(if $(USE_UBI),UBI=1 $(if $(findstring mt7622,$(PLAT)),OVERRIDE_UBI_START_ADDR=0x80000)) \
        all
 
+define Package/trusted-firmware-a-ram/install
+       $(INSTALL_DIR) $(STAGING_DIR_IMAGE)
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/build/$(PLAT)/release/bl2.bin $(BIN_DIR)/$(BUILD_VARIANT)-bl2.bin
+endef
+Package/trusted-firmware-a-mt7981-ram-ddr3/install = $(Package/trusted-firmware-a-ram/install)
+Package/trusted-firmware-a-mt7981-ram-ddr4/install = $(Package/trusted-firmware-a-ram/install)
+Package/trusted-firmware-a-mt7986-ram-ddr3/install = $(Package/trusted-firmware-a-ram/install)
+Package/trusted-firmware-a-mt7986-ram-ddr4/install = $(Package/trusted-firmware-a-ram/install)
+Package/trusted-firmware-a-mt7988-ram-comb/install = $(Package/trusted-firmware-a-ram/install)
+
 define Package/trusted-firmware-a/install
        $(INSTALL_DIR) $(STAGING_DIR_IMAGE)
        $(INSTALL_DATA) $(PKG_BUILD_DIR)/build/$(PLAT)/release/bl2.img $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-bl2.img