summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorPatrice Chotard <patrice.chotard@st.com>2019-05-02 18:36:01 +0200
committerPatrice Chotard <patrice.chotard@st.com>2019-06-06 17:40:13 +0200
commit7f90cd6150efd0bcf6293bbf35293d19d5e17a41 (patch)
tree60fb14bab52e9b70da7f3c9a14a0d5e398e891d2 /board
parentd319edcaeef07bc36ba70a7084860f443bf953e5 (diff)
downloadu-boot-7f90cd6150efd0bcf6293bbf35293d19d5e17a41.tar.gz
u-boot-7f90cd6150efd0bcf6293bbf35293d19d5e17a41.tar.bz2
u-boot-7f90cd6150efd0bcf6293bbf35293d19d5e17a41.zip
board: stm32mp1: Add env_ext4_get_dev_part() and env_ext4_get_intf()
This allows to : - select the current device to save the environment file - select the correct EXT4 boot device instance and partition to save the environment file. For EXT4, device is mmc, device instance is 0 for sdcard or 1 for eMMC. The partition is set to "auto" to select the first partition with bootable flag. Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Diffstat (limited to 'board')
-rw-r--r--board/st/stm32mp1/stm32mp1.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 360b0df9f6..316cd48195 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -19,6 +19,7 @@
#include <asm/io.h>
#include <asm/gpio.h>
#include <asm/arch/stm32.h>
+#include <asm/arch/sys_proto.h>
#include <power/regulator.h>
#include <usb/dwc2_udc.h>
@@ -505,6 +506,29 @@ void board_quiesce_devices(void)
setup_led(LEDST_OFF);
}
+#if defined(CONFIG_ENV_IS_IN_EXT4)
+const char *env_ext4_get_intf(void)
+{
+ u32 bootmode = get_bootmode();
+
+ switch (bootmode & TAMP_BOOT_DEVICE_MASK) {
+ case BOOT_FLASH_SD:
+ case BOOT_FLASH_EMMC:
+ return "mmc";
+ default:
+ return "";
+ }
+}
+
+const char *env_ext4_get_dev_part(void)
+{
+ static char *const dev_part[] = {"0:auto", "1:auto", "2:auto"};
+ u32 bootmode = get_bootmode();
+
+ return dev_part[(bootmode & TAMP_BOOT_INSTANCE_MASK) - 1];
+}
+#endif
+
#ifdef CONFIG_SYS_MTDPARTS_RUNTIME
#define MTDPARTS_LEN 256