@@ -97,6 +97,7 @@ enum boot_device {
#define TAMP_BACKUP_REGISTER(x) (STM32_TAMP_BASE + 0x100 + 4 * x)
#define TAMP_BACKUP_MAGIC_NUMBER TAMP_BACKUP_REGISTER(4)
#define TAMP_BACKUP_BRANCH_ADDRESS TAMP_BACKUP_REGISTER(5)
+#define TAMP_FWU_BOOT_IDX TAMP_BACKUP_REGISTER(10)
#define TAMP_COPRO_RSC_TBL_ADDRESS TAMP_BACKUP_REGISTER(17)
#define TAMP_COPRO_STATE TAMP_BACKUP_REGISTER(18)
#define TAMP_BOOT_CONTEXT TAMP_BACKUP_REGISTER(20)
@@ -990,6 +990,13 @@ int fwu_plat_get_blk_desc(struct blk_desc **desc)
return 0;
}
+void fwu_plat_get_bootidx(void *boot_idx)
+{
+ u32 *bootidx = boot_idx;
+
+ *bootidx = readl(TAMP_FWU_BOOT_IDX);
+}
+
struct fwu_metadata_ops *get_plat_fwu_metadata_ops(void)
{
if (CONFIG_IS_ENABLED(TARGET_ST_STM32MP15x) &&
@@ -124,5 +124,6 @@ int fwu_get_metadata(struct fwu_metadata **metadata);
int fwu_plat_get_update_index(u32 *update_idx);
int fwu_plat_get_blk_desc(struct blk_desc **desc);
+void fwu_plat_get_bootidx(void *boot_idx);
#endif /* _FWU_METADATA_H_ */
The FWU Multi Bank Update feature allows the platform to boot the firmware images from one of the partitions(banks). The first stage bootloader(fsbl) passes the value of the boot index, i.e. the bank from which the firmware images were booted from to U-Boot. On the STM32MP157C-DK2 board, this value is passed through one of the SoC's backup register. Add a function to read the boot index value from the backup register. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> --- arch/arm/mach-stm32mp/include/mach/stm32.h | 1 + board/st/stm32mp1/stm32mp1.c | 7 +++++++ include/fwu_metadata.h | 1 + 3 files changed, 9 insertions(+)