From 9f97193616f1fa2a9983ef3f846d5e5b42bc97a6 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Mon, 1 Mar 2021 13:17:56 +0100 Subject: board: stm32mp1: use CONFIG_SYS_MMC_ENV_DEV when available Check whether user has explicitly defined the mmc device to use in mmc_get_env_dev() with CONFIG_SYS_MMC_ENV_DEV. On STMicroelectronics boards the used mmc device for environment is the instance of boot device provided by the ROM code; the mmc instance is configured by alias in device tree. The used partition is defined in device tree with u-boot,mmc-env-partition = "ssbl". This patch allows to override this selection for the support of customer boards without alias; for example when SDMMC1 is not used and ENV in mmc0=SDMMC2, user can force the value: CONFIG_SYS_MMC_ENV_DEV = 0. On STMicroelectronics boards, the current behavior is kept with CONFIG_SYS_MMC_ENV_DEV = -1. Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard --- board/st/stm32mp1/stm32mp1.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'board/st') diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index ab85d8ba68..759181fb5d 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -862,8 +862,14 @@ const char *env_ext4_get_dev_part(void) int mmc_get_env_dev(void) { - u32 bootmode = get_bootmode(); + u32 bootmode; + + if (CONFIG_SYS_MMC_ENV_DEV >= 0) + return CONFIG_SYS_MMC_ENV_DEV; + + bootmode = get_bootmode(); + /* use boot instance to select the correct mmc device identifier */ return (bootmode & TAMP_BOOT_INSTANCE_MASK) - 1; } -- cgit v1.2.3