diff options
author | Tom Rini <trini@konsulko.com> | 2021-07-16 09:15:05 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-07-16 09:15:05 -0400 |
commit | 7533f80bec2e76f98df32e031ba5fe37927cd89f (patch) | |
tree | b83b37c93196238fce4ab1410f65bd44d014026b /board/st/stm32mp1/stm32mp1.c | |
parent | d3fc3da9a4fb98104d004b025149ec6dadccc2cd (diff) | |
parent | db1ab52e15135eb1efab512bc30d4e1b4789b434 (diff) |
Merge tag 'u-boot-stm32-20210715' of https://source.denx.de/u-boot/custodians/u-boot-stm
- DTS: alignment with Linux kernel v5.13 for stm32mp15 boards
- STM32MP1: update the stm32key command
- STM32MP1: activate the rng command
- STM32MP1: fix the stm32prog command (help, parttition size)
- STM32MP1: add fdtoverlay_addr_r variable
- STM32MP1: correctly managed SYSCON/SYSCFG clock
- STM32MP1: remove mmc alias and directly use device instance in boot_instance variable
Diffstat (limited to 'board/st/stm32mp1/stm32mp1.c')
-rw-r--r-- | board/st/stm32mp1/stm32mp1.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index 18b8870269f..2faf5c81b45 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -841,6 +841,31 @@ const char *env_ext4_get_intf(void) } } +int mmc_get_boot(void) +{ + struct udevice *dev; + u32 boot_mode = get_bootmode(); + unsigned int instance = (boot_mode & TAMP_BOOT_INSTANCE_MASK) - 1; + char cmd[20]; + const u32 sdmmc_addr[] = { + STM32_SDMMC1_BASE, + STM32_SDMMC2_BASE, + STM32_SDMMC3_BASE + }; + + if (instance > ARRAY_SIZE(sdmmc_addr)) + return 0; + + /* search associated sdmmc node in devicetree */ + snprintf(cmd, sizeof(cmd), "mmc@%x", sdmmc_addr[instance]); + if (uclass_get_device_by_name(UCLASS_MMC, cmd, &dev)) { + log_err("mmc%d = %s not found in device tree!\n", instance, cmd); + return 0; + } + + return dev_seq(dev); +}; + const char *env_ext4_get_dev_part(void) { static char *const env_dev_part = @@ -854,22 +879,16 @@ const char *env_ext4_get_dev_part(void) if (strlen(env_dev_part) > 0) return env_dev_part; - u32 bootmode = get_bootmode(); - - return dev_part[(bootmode & TAMP_BOOT_INSTANCE_MASK) - 1]; + return dev_part[mmc_get_boot()]; } int mmc_get_env_dev(void) { - 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; + return mmc_get_boot(); } #if defined(CONFIG_OF_BOARD_SETUP) |