On 8/14/26 9:47 AM, Carlo Caione wrote:
> Genio 510 and Genio 700 use an external DDR loader before U-Boot SPL,
> then load the remaining firmware from a FIT. Add shared binman
> descriptions for both images so integration builds can assemble the
> complete boot chain.
> 
> Keep packaging optional because the required platform firmware is built
> outside U-Boot.
> 
> 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.dtsi             | 12 ++++
>  arch/arm/dts/mtk-genio-bootloaders-binman.dtsi | 95 
> ++++++++++++++++++++++++++
>  arch/arm/dts/mtk-genio-loader-spl-binman.dtsi  | 16 +++++
>  arch/arm/dts/mtk-genio-mtk-boot-binman.dtsi    | 26 +++++++
>  arch/arm/mach-mediatek/Kconfig                 | 43 ++++++++++++
>  board/mediatek/MAINTAINERS                     |  2 +
>  common/spl/Kconfig                             |  1 +
>  9 files changed, 213 insertions(+)
> 
> 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 1a5f45cba6b..e3cf1e306e9 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.dtsi"
> +#include "mtk-genio-mtk-boot-binman.dtsi"
> +#include "mtk-genio-bootloaders-binman.dtsi"

Would be nice if the commit message explained why we need 3 separate files
if we always include them all.

> +#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 1a5f45cba6b..cb50efab376 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.dtsi"
> +#include "mtk-genio-mtk-boot-binman.dtsi"
> +#include "mtk-genio-bootloaders-binman.dtsi"
> +#endif
> diff --git a/arch/arm/dts/mtk-genio-binman.dtsi 
> b/arch/arm/dts/mtk-genio-binman.dtsi
> new file mode 100644
> index 00000000000..7e718ddf8da
> --- /dev/null
> +++ b/arch/arm/dts/mtk-genio-binman.dtsi
> @@ -0,0 +1,12 @@
> +// SPDX-License-Identifier: (GPL-2.0 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.dtsi 
> b/arch/arm/dts/mtk-genio-bootloaders-binman.dtsi
> new file mode 100644
> index 00000000000..c43d8c32507
> --- /dev/null
> +++ b/arch/arm/dts/mtk-genio-bootloaders-binman.dtsi
> @@ -0,0 +1,95 @@
> +// SPDX-License-Identifier: (GPL-2.0 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>;
> +
> +                     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 {

Can we use `fit,operation = "split-elf";` here instead of requiring config
options for the load and entry address?

> +                                     description = "OP-TEE";
> +                                     type = "firmware";
> +                                     os = "tee";
> +                                     arch = "arm64";
> +                                     compression = "none";
> +                                     load = 
> <CONFIG_MTK_GENIO_OPTEE_LOAD_ADDR>;
> +                                     entry = 
> <CONFIG_MTK_GENIO_OPTEE_ENTRY_ADDR>;
> +
> +                                     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;
> +                                     firmware = "atf";
> +                                     loadables = "uboot", "optee";
> +                                     fdt = "uboot-fdt";
> +                             };
> +                     };
> +             };
> +     };
> +};
> diff --git a/arch/arm/dts/mtk-genio-loader-spl-binman.dtsi 
> b/arch/arm/dts/mtk-genio-loader-spl-binman.dtsi
> new file mode 100644
> index 00000000000..e49ad5c471f
> --- /dev/null
> +++ b/arch/arm/dts/mtk-genio-loader-spl-binman.dtsi
> @@ -0,0 +1,16 @@
> +// SPDX-License-Identifier: (GPL-2.0 OR MIT)
> +/*
> + * Copyright (c) 2026 BayLibre, SAS.
> + * Author: Julien Stephan <[email protected]>
> + * Author: Carlo Caione <[email protected]>
> + */
> +
> +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.dtsi 
> b/arch/arm/dts/mtk-genio-mtk-boot-binman.dtsi
> new file mode 100644
> index 00000000000..16ce9cacb66
> --- /dev/null
> +++ b/arch/arm/dts/mtk-genio-mtk-boot-binman.dtsi
> @@ -0,0 +1,26 @@
> +// SPDX-License-Identifier: (GPL-2.0 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", "media=emmc;arm64=1";

Should this be coming from CONFIG_MTK_BROM_HEADER_INFO?

We will probably eventually be adding ufs and nor boot support too.

> +
> +                     section {
> +                             pad-byte = <0>;
> +#include "mtk-genio-loader-spl-binman.dtsi"
> +                     };
> +             };
> +     };
> +};
> diff --git a/arch/arm/mach-mediatek/Kconfig b/arch/arm/mach-mediatek/Kconfig
> index 5e6c50ca64d..eb8d072e686 100644
> --- a/arch/arm/mach-mediatek/Kconfig
> +++ b/arch/arm/mach-mediatek/Kconfig
> @@ -210,6 +210,49 @@ config MTK_BROM_HEADER_INFO
>       default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 || TARGET_MT8183 
> || TARGET_MT8188 || 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
> +
> +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 loader's SPL_OFFSET value.
> +
> +config MTK_GENIO_BL31_LOAD_ADDR
> +     hex "BL31 load and entry address"
> +     default 0x54601000 if TARGET_MT8188
> +
> +config MTK_GENIO_OPTEE_LOAD_ADDR
> +     hex "OP-TEE load address"
> +     default 0x431fffe4 if TARGET_MT8188
> +
> +config MTK_GENIO_OPTEE_ENTRY_ADDR
> +     hex "OP-TEE entry address"
> +     default 0x43200000 if TARGET_MT8188
> +
> +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..2048cca22b2 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.dtsi
> +F:   arch/arm/dts/mtk-genio-binman.dtsi

Should these be -u-boot.dtsi? I know the won't actually match anything
but makes it clear that the are u-boot-specific additions rather than
something that hasn't been upstreamed yet.

>  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..e5d0aade7fc 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 TARGET_MT8188

I think it is unusual to add board/chip-specific things in this file as the
lists could grow very long. Maybe we can make a MTK_GENIO symbol so that we
don't have to keep adding more TARGETs here?

>       default y
>       help
>         This enables use of symbols in SPL which refer to other entries in
> 

Reply via email to