[PATCH u-boot-mvebu 21/31] arm: mvebu: Use U-Boot's SPL BootROM framework for booting from NAND/UART

Stefan Roese sr at denx.de
Thu Jul 15 10:48:44 CEST 2021


On 08.07.21 19:30, Marek Behún wrote:
> From: Pali Rohár <pali at kernel.org>
> 
> Current code uses hack in board_init_f() which calls return_to_bootrom()
> to skip U-Boot SPL code and return back to BootROM to load U-Boot via
> UART or from NAND.
> 
> This change migrates that hack from the board_init_f() function and
> changes it to return BOOT_DEVICE_BOOTROM instead of returning to BootROM
> directly, so that U-Boot's SPL framework is used for returning to
> BootROM.
> 
> Signed-off-by: Pali Rohár <pali at kernel.org>
> Reviewed-by: Marek Behún <marek.behun at nic.cz>
> ---
>   arch/arm/mach-mvebu/spl.c | 48 ++++++++++++++++++++-------------------
>   1 file changed, 25 insertions(+), 23 deletions(-)
> 
> diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c
> index 836eb18889..3551c9de42 100644
> --- a/arch/arm/mach-mvebu/spl.c
> +++ b/arch/arm/mach-mvebu/spl.c
> @@ -76,7 +76,31 @@ static u32 get_boot_device(void)
>   
>   u32 spl_boot_device(void)
>   {
> -	return get_boot_device();
> +	u32 boot_device = get_boot_device();
> +
> +	/*
> +	 * Return to the BootROM to continue the Marvell xmodem
> +	 * UART boot protocol. As initiated by the kwboot tool.
> +	 *
> +	 * This can only be done by the BootROM and not by the
> +	 * U-Boot SPL infrastructure, since the beginning of the
> +	 * image is already read and interpreted by the BootROM.
> +	 * SPL has no chance to receive this information. So we
> +	 * need to return to the BootROM to enable this xmodem
> +	 * UART download.

The comment needs some updates as the SPL infrastructure is now used.
Could you please update it accordingly in v2?

Other than this:

Reviewed-by: Stefan Roese <sr at denx.de>

Thanks,
Stefan


> +	 *
> +	 * If booting from NAND lets let the BootROM load the
> +	 * rest of the bootloader.
> +	 */
> +	switch (boot_device) {
> +		case BOOT_DEVICE_UART:
> +#if defined(CONFIG_ARMADA_38X)
> +		case BOOT_DEVICE_NAND:
> +#endif
> +			return BOOT_DEVICE_BOOTROM;
> +		default:
> +			return boot_device;
> +	}
>   }
>   
>   int board_return_to_bootrom(struct spl_image_info *spl_image,
> @@ -147,26 +171,4 @@ void board_init_f(ulong dummy)
>   
>   	/* Update read timing control for PCIe */
>   	mv_rtc_config();
> -
> -	/*
> -	 * Return to the BootROM to continue the Marvell xmodem
> -	 * UART boot protocol. As initiated by the kwboot tool.
> -	 *
> -	 * This can only be done by the BootROM and not by the
> -	 * U-Boot SPL infrastructure, since the beginning of the
> -	 * image is already read and interpreted by the BootROM.
> -	 * SPL has no chance to receive this information. So we
> -	 * need to return to the BootROM to enable this xmodem
> -	 * UART download.
> -	 *
> -	 * If booting from NAND lets let the BootROM load the
> -	 * rest of the bootloader.
> -	 */
> -	switch (get_boot_device()) {
> -		case BOOT_DEVICE_UART:
> -#if defined(CONFIG_ARMADA_38X)
> -		case BOOT_DEVICE_NAND:
> -#endif
> -			return_to_bootrom();
> -	}
>   }
> 


Viele Grüße,
Stefan

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de


More information about the U-Boot mailing list