Files
u-boot/include/configs/stm32mp15_st_common.h
Dario Binacchi 560d8f3270 board: st: stm32mp15: support dynamic A/B bank bootup
Following commit 4300f9f4c5 ("board: st: stm32mp25: support dynamic
A/B bank bootup"), this patch enables automatic detection of the active
A/B bank on STM32MP15 platforms by retrieving partition GUIDs from FWU
metadata.

This ensures the system correctly identifies the bootable partitions
even in multi-bank scenarios, falling back to a standard bootable flag
scan if the UUIDs are missing.

To enable A/B bank bootup on STM32MP15 boards, add the following Kconfig
options to the  stm32mp15[_basic]_defconfig:

 CONFIG_FWU_MULTI_BANK_UPDATE=y
 CONFIG_FWU_MDATA=y
 CONFIG_FWU_NUM_BANKS=2
 CONFIG_FWU_NUM_IMAGES_PER_BANK=3
 CONFIG_CMD_FWU_METADATA=y
 CONFIG_FWU_MDATA_V2=y

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2026-05-26 13:46:30 +02:00

73 lines
2.1 KiB
C

/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */
/*
* Copyright (C) 2021, STMicroelectronics - All Rights Reserved
*
* Configuration settings for the STMicroelectronics STM32MP15x boards
*/
#ifndef __CONFIG_STM32MP15_ST_COMMON_H__
#define __CONFIG_STM32MP15_ST_COMMON_H__
#ifdef CONFIG_FWU_MULTI_BANK_UPDATE
#define SCAN_DEV_FOR_BOOT_PARTS \
"setenv devplist; " \
"env exists boot_partuuid && " \
"part number ${devtype} ${devnum} ${boot_partuuid} devplist; " \
"env exists devplist || " \
"part list ${devtype} ${devnum} -bootable devplist; "
#define ST_STM32MP15_FWU_ENV \
"altbootcmd=${bootcmd}\0"
#else
#define ST_STM32MP15_FWU_ENV
#endif
#define STM32MP_BOARD_EXTRA_ENV \
ST_STM32MP15_FWU_ENV \
"usb_pgood_delay=2000\0" \
"console=ttySTM0\0" \
"splashimage=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
"splashpos=m,m\0"
#include <configs/stm32mp15_common.h>
/* uart with on-board st-link */
#define CFG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, \
230400, 460800, 921600, \
1000000, 2000000 }
#ifdef CFG_EXTRA_ENV_SETTINGS
/*
* default bootcmd for stm32mp1 STMicroelectronics boards:
* for serial/usb: execute the stm32prog command
* for mmc boot (eMMC, SD card), distro boot on the same mmc device
* for nand or spi-nand boot, distro boot with ubifs on UBI partition
* for nor boot, distro boot on SD card = mmc0 ONLY !
*/
#define ST_STM32MP1_BOOTCMD "bootcmd_stm32mp=" \
"echo \"Boot over ${boot_device}${boot_instance}!\";" \
"if test ${boot_device} = serial || test ${boot_device} = usb;" \
"then stm32prog ${boot_device} ${boot_instance}; " \
"else " \
"run env_check;" \
"if test ${boot_device} = mmc;" \
"then env set boot_targets \"mmc${boot_instance}\"; fi;" \
"if test ${boot_device} = nand ||" \
" test ${boot_device} = spi-nand ;" \
"then env set boot_targets ubifs0; fi;" \
"if test ${boot_device} = nor;" \
"then env set boot_targets mmc0; fi;" \
"run distro_bootcmd;" \
"fi;\0"
#undef CFG_EXTRA_ENV_SETTINGS
#define CFG_EXTRA_ENV_SETTINGS \
STM32MP_MEM_LAYOUT \
ST_STM32MP1_BOOTCMD \
BOOTENV \
STM32MP_EXTRA \
STM32MP_BOARD_EXTRA_ENV
#endif
#endif