On 9/23/26 4:17 PM, Carlo Caione wrote:
> Prefer fastboot in U-Boot proper when the complete download agent fits
> the BootROM SRAM limit. Its shell and boot commands support provisioning
> and recovery beyond the SPL agent's flashing operations, without relying
> on the installed firmware.
>
> This variant requires BL31 and an external DDR loader.
>
...
> diff --git a/arch/arm/mach-mediatek/spl.c b/arch/arm/mach-mediatek/spl.c
> index 6f1ec052b95..120a94c6598 100644
> --- a/arch/arm/mach-mediatek/spl.c
> +++ b/arch/arm/mach-mediatek/spl.c
> @@ -33,15 +33,17 @@ void board_init_f(ulong dummy)
>
> u32 spl_boot_device(void)
> {
> -#if defined(CONFIG_SPL_SPI)
> - return BOOT_DEVICE_SPI;
> -#elif defined(CONFIG_SPL_MMC)
> - return BOOT_DEVICE_MMC1;
> -#elif defined(CONFIG_SPL_NAND_SUPPORT)
> - return BOOT_DEVICE_NAND;
> -#elif defined(CONFIG_SPL_NOR_SUPPORT)
> - return BOOT_DEVICE_NOR;
> -#else
> + if (IS_ENABLED(CONFIG_MTK_BROM_DOWNLOAD_AGENT_UBOOT_FASTBOOT))
> + return BOOT_DEVICE_RAM;
> +
> + if (CONFIG_IS_ENABLED(SPI))
> + return BOOT_DEVICE_SPI;
> + if (CONFIG_IS_ENABLED(MMC))
> + return BOOT_DEVICE_MMC1;
> + if (CONFIG_IS_ENABLED(NAND_SUPPORT))
> + return BOOT_DEVICE_NAND;
> + if (CONFIG_IS_ENABLED(NOR_SUPPORT))
> + return BOOT_DEVICE_NOR;
> +
> return BOOT_DEVICE_NONE;
> -#endif
> }
Could be nice to do the CONFIG_IS_ENABLED() conversion as a separate patch
so it is easier to see what is added here.
> diff --git a/configs/mt8370-genio-da-uboot-fastboot.config
> b/configs/mt8370-genio-da-uboot-fastboot.config
> new file mode 100644
> index 00000000000..5a85b26df0d
> --- /dev/null
> +++ b/configs/mt8370-genio-da-uboot-fastboot.config
> @@ -0,0 +1,28 @@
> +#include <configs/mt8370-genio-da.config>
> +
> +CONFIG_MTK_BROM_DOWNLOAD_AGENT_UBOOT_FASTBOOT=y
> +CONFIG_SYS_MALLOC_LEN=0x9000000
What is driving the need for such large allocations?
> +CONFIG_CMD_FASTBOOT=y
> +CONFIG_USB_FUNCTION_FASTBOOT=y
> +CONFIG_FASTBOOT_FLASH=y
> +CONFIG_FASTBOOT_FLASH_MMC=y
> +CONFIG_FASTBOOT_FLASH_MMC_DEV=0
> +CONFIG_FASTBOOT_MMC_BOOT_SUPPORT=y
> +CONFIG_FASTBOOT_MMC_USER_SUPPORT=y
Do we need to enable FASTBOOT_CMD_OEM_PARTCONF and FASTBOOT_CMD_OEM_BOOTBUS
to allow flashing a blank eMMC?
> +CONFIG_SPL_RAM_DEVICE=y
> +CONFIG_SPL_LOAD_FIT_ADDRESS=0x41000000
> +CONFIG_SPL_MAX_SIZE=0x25000
> +CONFIG_SPL_CRC32=y
> +CONFIG_SPL_GZIP=y
> +# CONFIG_SPL_MMC is not set
> +# CONFIG_SPL_LIBDISK_SUPPORT is not set
> +# CONFIG_SPL_EFI_PARTITION is not set
> +# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
> +CONFIG_BOOTDELAY=0
> +CONFIG_USE_BOOTCOMMAND=y
> +CONFIG_BOOTCOMMAND="fastboot usb 0"
> +CONFIG_ENV_IS_NOWHERE=y
> +# CONFIG_ENV_IS_IN_MMC is not set
> +# CONFIG_BOOTSTD_FULL is not set
> +# CONFIG_CMD_BOOTFLOW is not set
> +# CONFIG_EFI_LOADER is not set