Hi Christopher, On 2024-03-05 10:36, Christopher Obbard wrote: > Hi Jonas & Trevor, > > On Tue, 2024-03-05 at 10:31 +0100, Jonas Karlman wrote: >> Hi Trevor, >> >> On 2024-03-05 03:10, Trevor Woerner wrote: >>> Following the pattern of other Rockchip devices, enable the U-Boot >>> environment to be stored in MMC. This patch specifically assumes the >>> environment will be stored on the SDcard. >> >> This board has SPI flash, so storing env in SPI flash is probably a >> better default. > > I agree with that. > >> However, preferably the env should be stored/loaded from >> the same device that TPL/SPL was loaded from. > > Do you know if there is some mechanism in U-Boot to do this already ? > > It could be useful to enable autodetection on many boards which can boot U- > Boot from either SPI flash / eMMC / SD card. >
I think it should be possible with a combo of env_get_location(), arch_env_get_location() and mmc_get_env_dev(). board/theobroma-systems/common/common.c does something like this already, other arch also have these functions defined, for inspiration. Regards, Jonas > > Cheers! > > Chris > >> >> Regards, >> Jonas >> >>> >>> Signed-off-by: Trevor Woerner <twoer...@gmail.com> >>> --- >>> configs/rock5b-rk3588_defconfig | 2 ++ >>> 1 file changed, 2 insertions(+) >>> >>> diff --git a/configs/rock5b-rk3588_defconfig b/configs/rock5b- >>> rk3588_defconfig >>> index 0595325e8107..64a242003aa1 100644 >>> --- a/configs/rock5b-rk3588_defconfig >>> +++ b/configs/rock5b-rk3588_defconfig >>> @@ -60,6 +60,8 @@ CONFIG_CMD_REGULATOR=y >>> CONFIG_SPL_OF_CONTROL=y >>> CONFIG_OF_LIVE=y >>> CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks >>> assigned-clock-rates assigned-clock-parents" >>> +CONFIG_ENV_IS_IN_MMC=y >>> +CONFIG_SYS_MMC_ENV_DEV=1 >>> CONFIG_SPL_DM_SEQ_ALIAS=y >>> CONFIG_SPL_REGMAP=y >>> CONFIG_SPL_SYSCON=y >>