summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorPatrice Chotard <patrice.chotard@st.com>2019-05-02 18:28:05 +0200
committerPatrice Chotard <patrice.chotard@st.com>2019-06-06 17:40:14 +0200
commit8f24b1a4a97cbeb8f2756be62bd524f166423406 (patch)
tree75fee149c446b992c4bddbb062723f095d08c8b2 /board
parentdf23da59184a04cf2f937d8f80d43ff44d6f1e6d (diff)
stm32mp1: 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@st.com>
Diffstat (limited to 'board')
-rw-r--r--board/st/stm32mp1/stm32mp1.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 316cd48195..4f7d24acaa 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -7,6 +7,7 @@
#include <config.h>
#include <clk.h>
#include <dm.h>
+#include <environment.h>
#include <g_dnl.h>
#include <generic-phy.h>
#include <i2c.h>
@@ -506,6 +507,28 @@ void board_quiesce_devices(void)
setup_led(LEDST_OFF);
}
+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) {
+#ifdef CONFIG_ENV_IS_IN_EXT4
+ case BOOT_FLASH_SD:
+ case BOOT_FLASH_EMMC:
+ return ENVL_EXT4;
+#endif
+#ifdef CONFIG_ENV_IS_IN_UBI
+ case BOOT_FLASH_NAND:
+ return ENVL_UBI;
+#endif
+ default:
+ return ENVL_NOWHERE;
+ }
+}
+
#if defined(CONFIG_ENV_IS_IN_EXT4)
const char *env_ext4_get_intf(void)
{