summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Muellner <christoph.muellner@theobroma-systems.com>2019-10-12 22:36:50 +0200
committerChristoph Muellner <christoph.muellner@theobroma-systems.com>2019-10-13 10:41:02 +0200
commit5362a8379dfb58707525403f6417049bf4dd0f7e (patch)
tree6e1ddf51f9578e24d30a1a7f712ab385c84b8023
parent975efe90f4df52d5e62f6f95cd7d9a5a37b8346b (diff)
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 <christoph.muellner@theobroma-systems.com>
-rw-r--r--arch/arm/mach-rockchip/rk3399/rk3399.c18
1 files changed, 18 insertions, 0 deletions
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 <asm/armv8/mmu.h>
#include <asm/io.h>
#include <asm/arch/hardware.h>
+#include <asm/arch/bootrom.h>
+#include <dm/ofnode.h>
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 */