On Mon, Sep 28, 2026 at 17:43:26 +0100, David Lechner wrote:
> 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.

Ok, I'll split it.
 
> > 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?

Yeah, this was actually fixed in the previous SPL patchset but not in
this one. 8MB are enough, I'll fix this.

> > +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?

This is actually a very, very good point. Now, we have two ways of doing
this: either we add the fastboot commands and let the host issue these
commands or we just do this in the code. The first solution would imply
modifying the genio-flash tools to issue the command during provisioning
and this is something I'd like to avoid, so I'm going to do this
programmatically the same way we do for the SPL DA version.

Cheers,

--
Carlo Caione

Reply via email to