From 5362a8379dfb58707525403f6417049bf4dd0f7e Mon Sep 17 00:00:00 2001 From: Christoph Muellner Date: Sat, 12 Oct 2019 22:36:50 +0200 Subject: rk3399: Take environment from boot device via mmc_get_env_dev(). This patch uses the boot device detection code to set the environment device to the one, which is currently booted from. Signed-off-by: Christoph Muellner --- arch/arm/mach-rockchip/rk3399/rk3399.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c index d8467d7333..a5d93329b4 100644 --- a/arch/arm/mach-rockchip/rk3399/rk3399.c +++ b/arch/arm/mach-rockchip/rk3399/rk3399.c @@ -7,6 +7,8 @@ #include #include #include +#include +#include DECLARE_GLOBAL_DATA_PTR; @@ -54,3 +56,19 @@ int arch_cpu_init(void) return 0; } + +#ifdef CONFIG_ENV_IS_IN_MMC + +int mmc_get_env_dev(void) +{ + const char *boot_device = + ofnode_get_chosen_prop("u-boot,spl-boot-device"); + if (!strcmp(boot_device, "/dwmmc@fe320000")) + return 1; + else if (!strcmp(boot_device, "/sdhci@fe330000")) + return 0; + + return CONFIG_SYS_MMC_ENV_DEV; +} + +#endif /* CONFIG_ENV_IS_IN_MMC */ -- cgit v1.2.3