summaryrefslogtreecommitdiff
path: root/board/st/stm32mp2/stm32mp2.c
diff options
context:
space:
mode:
authorPatrice Chotard <patrice.chotard@foss.st.com>2025-04-01 18:08:44 +0200
committerPatrice Chotard <patrice.chotard@foss.st.com>2025-04-25 16:00:22 +0200
commit1b343e2603e46baca914a5adb49144f47fb5d39d (patch)
tree79de7ccc2fb2c851e7337518853fbb7b52286fd7 /board/st/stm32mp2/stm32mp2.c
parentf9fc24899573943d265ea6ffada7d5f8d195731b (diff)
board: st: stm32mp2: add env_get_location()
In case of several environment location support, env_get_location is needed to select the correct location depending of the boot device . Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Diffstat (limited to 'board/st/stm32mp2/stm32mp2.c')
-rw-r--r--board/st/stm32mp2/stm32mp2.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/board/st/stm32mp2/stm32mp2.c b/board/st/stm32mp2/stm32mp2.c
index aa7dd31996e..c70ffaf5dbd 100644
--- a/board/st/stm32mp2/stm32mp2.c
+++ b/board/st/stm32mp2/stm32mp2.c
@@ -6,7 +6,7 @@
#define LOG_CATEGORY LOGC_BOARD
#include <config.h>
-#include <env.h>
+#include <env_internal.h>
#include <fdt_support.h>
#include <log.h>
#include <misc.h>
@@ -59,6 +59,25 @@ int board_init(void)
return 0;
}
+enum env_location env_get_location(enum env_operation op, int prio)
+{
+ u32 bootmode = get_bootmode();
+
+ if (prio)
+ return ENVL_UNKNOWN;
+
+ switch (bootmode & TAMP_BOOT_DEVICE_MASK) {
+ case BOOT_FLASH_SD:
+ case BOOT_FLASH_EMMC:
+ if (CONFIG_IS_ENABLED(ENV_IS_IN_MMC))
+ return ENVL_MMC;
+ else
+ return ENVL_NOWHERE;
+ default:
+ return ENVL_NOWHERE;
+ }
+}
+
int board_late_init(void)
{
const void *fdt_compat;