aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSughosh Ganu <sughosh.ganu@linaro.org>2021-08-31 17:07:00 +0530
committerSughosh Ganu <sughosh.ganu@linaro.org>2022-02-13 17:23:05 +0530
commit1cfbf3f81081d78e33cbb5d9b9ddbf8817779b24 (patch)
treef886c695f2ddc528abd200bcbeccab637f2128c0
parent3ea800fb41ec5b17d172d3d5922dd26368b649aa (diff)
FWU: STM32MP1: Add support to read boot index from backup register
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>
-rw-r--r--board/st/stm32mp1/stm32mp1.c6
-rw-r--r--include/fwu.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index e60e3fd1c107..0d092c1b47f6 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -1021,4 +1021,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 90578f56b343..f767f12c2eb9 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_ */