[PATCH 09/11] board: stm32mp1: support boot from spi-nand

Patrice CHOTARD patrice.chotard at st.com
Tue Apr 14 11:33:56 CEST 2020


Hi

On 3/18/20 9:22 AM, Patrick Delaunay wrote:
> Manage BOOT_FLASH_SPINAND, with boot_device="spi-nand"
> and treat this value in bootcmd_stm32mp.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>
> ---
>
>  arch/arm/mach-stm32mp/cpu.c                | 4 ++++
>  arch/arm/mach-stm32mp/include/mach/stm32.h | 3 +++
>  arch/arm/mach-stm32mp/spl.c                | 2 ++
>  board/st/stm32mp1/stm32mp1.c               | 2 ++
>  include/configs/stm32mp1.h                 | 5 +++--
>  5 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c
> index 9aa5794334..e14e3e47f2 100644
> --- a/arch/arm/mach-stm32mp/cpu.c
> +++ b/arch/arm/mach-stm32mp/cpu.c
> @@ -435,6 +435,10 @@ static void setup_boot_mode(void)
>  		env_set("boot_device", "nand");
>  		env_set("boot_instance", "0");
>  		break;
> +	case BOOT_FLASH_SPINAND:
> +		env_set("boot_device", "spi-nand");
> +		env_set("boot_instance", "0");
> +		break;
>  	case BOOT_FLASH_NOR:
>  		env_set("boot_device", "nor");
>  		env_set("boot_instance", "0");
> diff --git a/arch/arm/mach-stm32mp/include/mach/stm32.h b/arch/arm/mach-stm32mp/include/mach/stm32.h
> index 6daf9f7121..a9bd5bdc1b 100644
> --- a/arch/arm/mach-stm32mp/include/mach/stm32.h
> +++ b/arch/arm/mach-stm32mp/include/mach/stm32.h
> @@ -79,6 +79,9 @@ enum boot_device {
>  
>  	BOOT_SERIAL_USB = 0x60,
>  	BOOT_SERIAL_USB_OTG = 0x62,
> +
> +	BOOT_FLASH_SPINAND = 0x70,
> +	BOOT_FLASH_SPINAND_1 = 0x71,
>  };
>  
>  /* TAMP registers */
> diff --git a/arch/arm/mach-stm32mp/spl.c b/arch/arm/mach-stm32mp/spl.c
> index ca4231cd0d..9cd7b418a4 100644
> --- a/arch/arm/mach-stm32mp/spl.c
> +++ b/arch/arm/mach-stm32mp/spl.c
> @@ -39,6 +39,8 @@ u32 spl_boot_device(void)
>  		return BOOT_DEVICE_NAND;
>  	case BOOT_FLASH_NOR_QSPI:
>  		return BOOT_DEVICE_SPI;
> +	case BOOT_FLASH_SPINAND_1:
> +		return BOOT_DEVICE_NONE; /* SPINAND not supported in SPL */
>  	}
>  
>  	return BOOT_DEVICE_MMC1;
> diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
> index 14c56a0f24..423be23555 100644
> --- a/board/st/stm32mp1/stm32mp1.c
> +++ b/board/st/stm32mp1/stm32mp1.c
> @@ -789,6 +789,7 @@ enum env_location env_get_location(enum env_operation op, int prio)
>  #endif
>  #ifdef CONFIG_ENV_IS_IN_UBI
>  	case BOOT_FLASH_NAND:
> +	case BOOT_FLASH_SPINAND:
>  		return ENVL_UBI;
>  #endif
>  #ifdef CONFIG_ENV_IS_IN_SPI_FLASH
> @@ -829,6 +830,7 @@ int ft_board_setup(void *blob, bd_t *bd)
>  #ifdef CONFIG_FDT_FIXUP_PARTITIONS
>  	struct node_info nodes[] = {
>  		{ "st,stm32f469-qspi",		MTD_DEV_TYPE_NOR,  },
> +		{ "st,stm32f469-qspi",		MTD_DEV_TYPE_SPINAND},
>  		{ "st,stm32mp15-fmc2",		MTD_DEV_TYPE_NAND, },
>  	};
>  	fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
> diff --git a/include/configs/stm32mp1.h b/include/configs/stm32mp1.h
> index c5b09f1a2a..c34a720e0c 100644
> --- a/include/configs/stm32mp1.h
> +++ b/include/configs/stm32mp1.h
> @@ -127,7 +127,7 @@
>   * bootcmd for stm32mp1:
>   * for serial/usb: execute the stm32prog command
>   * for mmc boot (eMMC, SD card), boot only on the same device
> - * for nand boot, boot with on ubifs partition on nand
> + * for nand or spi-nand boot, boot with on ubifs partition on UBI partition
>   * for nor boot, use the default order
>   */
>  #define STM32MP_BOOTCMD "bootcmd_stm32mp=" \
> @@ -138,7 +138,8 @@
>  		"run env_check;" \
>  		"if test ${boot_device} = mmc;" \
>  		"then env set boot_targets \"mmc${boot_instance}\"; fi;" \
> -		"if test ${boot_device} = nand;" \
> +		"if test ${boot_device} = nand ||" \
> +		  " test ${boot_device} = spi-nand ;" \
>  		"then env set boot_targets ubifs0; fi;" \
>  		"run distro_bootcmd;" \
>  	"fi;\0"

Reviewed-by: Patrice Chotard <patrice.chotard at st.com>

Patrice


More information about the U-Boot mailing list