[PATCH v4 04/11] FWU: STM32MP1: Add support to read boot index from backup register
Sughosh Ganu
sughosh.ganu at linaro.org
Mon Feb 7 19:19:54 CET 2022
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 at linaro.org>
---
Changes since V3: None
board/st/stm32mp1/stm32mp1.c | 6 ++++++
include/fwu.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 5e8cb29067..5525b69392 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -1015,4 +1015,10 @@ int fwu_plat_get_update_index(u32 *update_idx)
return ret;
}
+void fwu_plat_get_bootidx(void *boot_idx)
+{
+ u32 *bootidx = boot_idx;
+
+ *bootidx = readl(TAMP_BOOTCOUNT);
+}
#endif /* CONFIG_FWU_MULTI_BANK_UPDATE */
diff --git a/include/fwu.h b/include/fwu.h
index b746e616b2..90b8cd41e5 100644
--- a/include/fwu.h
+++ b/include/fwu.h
@@ -52,5 +52,6 @@ int fwu_clear_accept_image(efi_guid_t *img_type_id, u32 bank);
int fwu_plat_get_update_index(u32 *update_idx);
int fwu_plat_get_alt_num(struct udevice *dev, void *identifier);
+void fwu_plat_get_bootidx(void *boot_idx);
#endif /* _FWU_H_ */
--
2.17.1
More information about the U-Boot
mailing list