On 9/6/26 10:30 AM, Carlo Caione wrote:
> Genio 510 and Genio 700 use an external DDR loader before SPL, then load
> the remaining firmware from a FIT. Keep packaging optional because this
> platform firmware is built outside U-Boot.
> 
> Separate the container, loader/SPL payload and firmware FIT descriptions
> so their layouts can be reused independently. Generate the loadables list
> to include every OP-TEE segment.
> 
> Request AArch64 BootROM entry for the DDR loader. Disable SPL binman
> symbols since U-Boot proper lives in the separate FIT, not alongside SPL.
> 
> Signed-off-by: Vitor Sato Eschholz <[email protected]>
> Signed-off-by: Julien Stephan <[email protected]>
> Signed-off-by: Carlo Caione <[email protected]>
> ---
>  arch/arm/dts/mt8370-genio-510-evk-u-boot.dtsi      |  9 ++
>  arch/arm/dts/mt8390-genio-700-evk-u-boot.dtsi      |  9 ++
>  arch/arm/dts/mtk-genio-binman-u-boot.dtsi          | 12 +++
>  .../dts/mtk-genio-bootloaders-binman-u-boot.dtsi   | 98 
> ++++++++++++++++++++++
>  .../dts/mtk-genio-loader-spl-binman-u-boot.dtsi    | 17 ++++
>  arch/arm/dts/mtk-genio-mtk-boot-binman-u-boot.dtsi | 26 ++++++
>  arch/arm/mach-mediatek/Kconfig                     | 41 ++++++++-
>  board/mediatek/MAINTAINERS                         |  2 +
>  common/spl/Kconfig                                 |  1 +
>  9 files changed, 214 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/dts/mt8370-genio-510-evk-u-boot.dtsi 
> b/arch/arm/dts/mt8370-genio-510-evk-u-boot.dtsi
> index 223f1371b9e..10b9a142f37 100644
> --- a/arch/arm/dts/mt8370-genio-510-evk-u-boot.dtsi
> +++ b/arch/arm/dts/mt8370-genio-510-evk-u-boot.dtsi
> @@ -4,4 +4,13 @@
>   * Author: Julien Stephan <[email protected]>
>   */
>  
> +#include <config.h>
>  #include "mt8390-genio-common-u-boot.dtsi"
> +
> +#ifdef CONFIG_MTK_GENIO_BOOT_IMAGES
> +#define MTK_BOOTLOADERS_DESCRIPTION "MediaTek Genio 510 bootloaders"
> +#define MTK_BOOT_CHAIN_DESCRIPTION "Genio 510 boot chain"
> +#include "mtk-genio-binman-u-boot.dtsi"
> +#include "mtk-genio-mtk-boot-binman-u-boot.dtsi"
> +#include "mtk-genio-bootloaders-binman-u-boot.dtsi"
> +#endif
> diff --git a/arch/arm/dts/mt8390-genio-700-evk-u-boot.dtsi 
> b/arch/arm/dts/mt8390-genio-700-evk-u-boot.dtsi
> index 223f1371b9e..6230b016ca0 100644
> --- a/arch/arm/dts/mt8390-genio-700-evk-u-boot.dtsi
> +++ b/arch/arm/dts/mt8390-genio-700-evk-u-boot.dtsi
> @@ -4,4 +4,13 @@
>   * Author: Julien Stephan <[email protected]>
>   */
>  
> +#include <config.h>
>  #include "mt8390-genio-common-u-boot.dtsi"
> +
> +#ifdef CONFIG_MTK_GENIO_BOOT_IMAGES
> +#define MTK_BOOTLOADERS_DESCRIPTION "MediaTek Genio 700 bootloaders"
> +#define MTK_BOOT_CHAIN_DESCRIPTION "Genio 700 boot chain"
> +#include "mtk-genio-binman-u-boot.dtsi"
> +#include "mtk-genio-mtk-boot-binman-u-boot.dtsi"
> +#include "mtk-genio-bootloaders-binman-u-boot.dtsi"
> +#endif
> diff --git a/arch/arm/dts/mtk-genio-binman-u-boot.dtsi 
> b/arch/arm/dts/mtk-genio-binman-u-boot.dtsi
> new file mode 100644
> index 00000000000..ff4557e5072
> --- /dev/null
> +++ b/arch/arm/dts/mtk-genio-binman-u-boot.dtsi
> @@ -0,0 +1,12 @@
> +// SPDX-License-Identifier: (GPL-2.0-only OR MIT)
> +/*
> + * Copyright (c) 2026 BayLibre SAS
> + * Author: Julien Stephan <[email protected]>
> + * Author: Carlo Caione <[email protected]>
> + */
> +
> +/ {
> +     binman: binman {
> +             multiple-images;
> +     };
> +};
> diff --git a/arch/arm/dts/mtk-genio-bootloaders-binman-u-boot.dtsi 
> b/arch/arm/dts/mtk-genio-bootloaders-binman-u-boot.dtsi
> new file mode 100644
> index 00000000000..d8aea85f47e
> --- /dev/null
> +++ b/arch/arm/dts/mtk-genio-bootloaders-binman-u-boot.dtsi
> @@ -0,0 +1,98 @@
> +// SPDX-License-Identifier: (GPL-2.0-only OR MIT)
> +/*
> + * Copyright (c) 2026 BayLibre SAS
> + * Author: Julien Stephan <[email protected]>
> + * Author: Carlo Caione <[email protected]>
> + */
> +
> +&binman {
> +     bootloaders {
> +             filename = "bootloaders.img";
> +
> +             fit {
> +                     description = MTK_BOOTLOADERS_DESCRIPTION;
> +                     #address-cells = <1>;
> +                     fit,fdt-list-val = "u-boot";
> +
> +                     images {
> +                             uboot {
> +                                     description = "U-Boot";
> +                                     type = "firmware";
> +                                     os = "u-boot";
> +                                     arch = "arm64";
> +                                     compression = "none";
> +                                     load = <CONFIG_TEXT_BASE>;
> +                                     entry = <CONFIG_TEXT_BASE>;
> +
> +                                     u-boot-nodtb {
> +                                     };
> +
> +                                     hash {
> +                                             algo = "sha256";
> +                                     };
> +                             };
> +
> +                             atf {
> +                                     description = "ARM Trusted Firmware 
> BL31";
> +                                     type = "firmware";
> +                                     os = "arm-trusted-firmware";
> +                                     arch = "arm64";
> +                                     compression = "none";
> +                                     load = 
> <CONFIG_MTK_GENIO_BL31_LOAD_ADDR>;
> +                                     entry = 
> <CONFIG_MTK_GENIO_BL31_LOAD_ADDR>;
> +
> +                                     atf-bl31 {
> +                                     };
> +
> +                                     hash {
> +                                             algo = "sha256";
> +                                     };
> +                             };
> +
> +                             @optee-SEQ {
> +                                     fit,operation = "split-elf";
> +                                     description = "OP-TEE";
> +                                     type = "firmware";
> +                                     os = "tee";
> +                                     arch = "arm64";
> +                                     compression = "none";
> +                                     fit,load;
> +                                     fit,entry;
> +                                     fit,data;
> +
> +                                     tee-os {
> +                                     };
> +
> +                                     hash {
> +                                             algo = "sha256";
> +                                     };
> +                             };
> +
> +                             uboot-fdt {
> +                                     description = "U-Boot control 
> devicetree";
> +                                     type = "flat_dt";
> +                                     arch = "arm64";
> +                                     compression = "none";
> +
> +                                     u-boot-dtb {
> +                                     };
> +
> +                                     hash {
> +                                             algo = "sha256";
> +                                     };
> +                             };
> +                     };
> +
> +                     configurations {
> +                             default = "conf";
> +
> +                             @conf {
> +                                     description = 
> MTK_BOOT_CHAIN_DESCRIPTION;
> +                                     fit,firmware = "atf", "uboot";
> +                                     fit,loadables;
> +                                     fdt = "uboot-fdt";
> +                             };
> +                     };
> +             };
> +     };
> +};
> diff --git a/arch/arm/dts/mtk-genio-loader-spl-binman-u-boot.dtsi 
> b/arch/arm/dts/mtk-genio-loader-spl-binman-u-boot.dtsi
> new file mode 100644
> index 00000000000..c97797405b7
> --- /dev/null
> +++ b/arch/arm/dts/mtk-genio-loader-spl-binman-u-boot.dtsi
> @@ -0,0 +1,17 @@
> +// SPDX-License-Identifier: (GPL-2.0-only OR MIT)
> +/*
> + * Copyright (c) 2026 BayLibre SAS
> + * Author: Julien Stephan <[email protected]>
> + * Author: Carlo Caione <[email protected]>
> + */
> +
> +/* Include within a section: the loader and SPL form one contiguous payload. 
> */
> +ddr-loader {
> +     type = "blob-ext";
> +     filename = "ddr-loader.bin";
> +     size = <CONFIG_MTK_GENIO_DDR_LOADER_SIZE>;
> +};
> +
> +u-boot-spl {
> +     size = <CONFIG_SPL_MAX_SIZE>;
> +};
> diff --git a/arch/arm/dts/mtk-genio-mtk-boot-binman-u-boot.dtsi 
> b/arch/arm/dts/mtk-genio-mtk-boot-binman-u-boot.dtsi
> new file mode 100644
> index 00000000000..a7ee09feba0
> --- /dev/null
> +++ b/arch/arm/dts/mtk-genio-mtk-boot-binman-u-boot.dtsi
> @@ -0,0 +1,26 @@
> +// SPDX-License-Identifier: (GPL-2.0-only OR MIT)
> +/*
> + * Copyright (c) 2026 BayLibre SAS
> + * Author: Julien Stephan <[email protected]>
> + * Author: Carlo Caione <[email protected]>
> + */
> +
> +#include <linux/stringify.h>
> +
> +&binman {
> +     mtk-boot {
> +             filename = "mtk-boot.bin";
> +
> +             mkimage {
> +                     args = "-T", "mtk_image",
> +                            "-a", 
> __stringify(CONFIG_MTK_GENIO_BROM_LOAD_ADDR),
> +                            "-e", 
> __stringify(CONFIG_MTK_GENIO_BROM_LOAD_ADDR),
> +                            "-n", CONFIG_MTK_BROM_HEADER_INFO;
> +
> +                     section {
> +                             pad-byte = <0>;
> +#include "mtk-genio-loader-spl-binman-u-boot.dtsi"
> +                     };
> +             };
> +     };
> +};
> diff --git a/arch/arm/mach-mediatek/Kconfig b/arch/arm/mach-mediatek/Kconfig
> index 5e6c50ca64d..e572cfe8571 100644
> --- a/arch/arm/mach-mediatek/Kconfig
> +++ b/arch/arm/mach-mediatek/Kconfig
> @@ -207,9 +207,48 @@ config SYS_CONFIG_NAME
>  config MTK_BROM_HEADER_INFO
>       string
>       default "media=nor" if TARGET_MT8518 || TARGET_MT8512 || TARGET_MT7629
> -     default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 || TARGET_MT8183 
> || TARGET_MT8188 || TARGET_MT8189 || TARGET_MT8195
> +     default "media=emmc;arm64=1" if TARGET_MT8188
> +     default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 || TARGET_MT8183 
> || TARGET_MT8189 || TARGET_MT8195
>       default "lk=1" if TARGET_MT7623
>  
> +config MTK_GENIO_BOOT_IMAGES
> +     bool "Build MediaTek firmware images"
> +     depends on TARGET_MT8188 && SPL
> +     select BINMAN
> +     select MTK_GENIO_IMAGE_CONTRACT
> +     help
> +       Enable binman to assemble the MediaTek BootROM image and firmware
> +       FIT from U-Boot and external platform firmware components.
> +
> +config MTK_GENIO_IMAGE_CONTRACT
> +     bool

Do we actually need this separate option since only MTK_GENIO_BOOT_IMAGES
selects it? Seems like we could just use MTK_GENIO_BOOT_IMAGES instead.

> +
> +if MTK_GENIO_IMAGE_CONTRACT
> +
> +config MTK_GENIO_BROM_LOAD_ADDR
> +     hex "BootROM payload load address"
> +     default 0x201000 if TARGET_MT8188
> +     help
> +       Address at which the MediaTek BootROM loads and enters the external
> +       DDR loader.
> +
> +config MTK_GENIO_DDR_LOADER_SIZE
> +     hex "DDR-loader image region size"
> +     default 0x4b000 if TARGET_MT8188
> +     help
> +       Size reserved for the external DDR loader at the start of the
> +       BootROM payload. This is also the offset of U-Boot SPL and must match
> +       the offset used by the loader when copying SPL to DRAM.
> +
> +config MTK_GENIO_BL31_LOAD_ADDR
> +     hex "BL31 load and entry address"
> +     default 0x54601000 if TARGET_MT8188
> +     help
> +       Address at which SPL loads and enters BL31. This must match the
> +       platform firmware's link address and secure-memory layout.
> +
> +endif
> +
>  config MTK_TZ_MOVABLE
>       select ARCH_MISC_INIT
>       select OF_SYSTEM_SETUP
> diff --git a/board/mediatek/MAINTAINERS b/board/mediatek/MAINTAINERS
> index d0d25b096e5..57bb3095305 100644
> --- a/board/mediatek/MAINTAINERS
> +++ b/board/mediatek/MAINTAINERS
> @@ -24,6 +24,8 @@ S:  Maintained
>  F:   arch/arm/dts/mt8188-u-boot.dtsi
>  F:   arch/arm/dts/mt8390-genio-common-u-boot.dtsi
>  F:   arch/arm/dts/mt8370-genio-510-evk-u-boot.dtsi
> +F:   arch/arm/dts/mtk-genio-*-binman-u-boot.dtsi
> +F:   arch/arm/dts/mtk-genio-binman-u-boot.dtsi

These look out of order. I would go with a mechanical sort order here.

>  F:   arch/arm/dts/mt8390-genio-700-evk-u-boot.dtsi
>  F:   configs/mt8188.config
>  F:   configs/mt8370_genio_510_evk_defconfig
> diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> index 0618f42c941..f9b453df766 100644
> --- a/common/spl/Kconfig
> +++ b/common/spl/Kconfig
> @@ -194,6 +194,7 @@ config SPL_SHOW_ERRORS
>  config SPL_BINMAN_SYMBOLS
>       bool "Declare binman symbols in SPL"
>       depends on SPL_FRAMEWORK && BINMAN
> +     default n if MTK_GENIO_BOOT_IMAGES
>       default y
>       help
>         This enables use of symbols in SPL which refer to other entries in
> 

Reply via email to