diff options
author | Peng Fan | 2018-10-18 14:28:20 +0200 |
---|---|---|
committer | Stefano Babic | 2018-10-22 12:59:01 +0200 |
commit | c1aae21d89108adcfc4316a5a073e3ff1f972a2c (patch) | |
tree | 15ef4e378c6f0964e62d190d9a96bb46223e0ec0 /arch/arm | |
parent | 8aa1505b59159cf8f52ba7441dd9e71c3caf1ded (diff) |
imx8: implement mmc_get_env_dev
Implement mmc_get_env_dev for i.MX8.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-imx/imx8/cpu.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/imx8/cpu.c b/arch/arm/mach-imx/imx8/cpu.c index 90b6ea42116..0cacaa895c4 100644 --- a/arch/arm/mach-imx/imx8/cpu.c +++ b/arch/arm/mach-imx/imx8/cpu.c @@ -176,3 +176,35 @@ enum boot_device get_boot_device(void) return boot_dev; } + +#ifdef CONFIG_ENV_IS_IN_MMC +__weak int board_mmc_get_env_dev(int devno) +{ + return CONFIG_SYS_MMC_ENV_DEV; +} + +int mmc_get_env_dev(void) +{ + sc_rsrc_t dev_rsrc; + int devno; + + sc_misc_get_boot_dev(-1, &dev_rsrc); + + switch (dev_rsrc) { + case SC_R_SDHC_0: + devno = 0; + break; + case SC_R_SDHC_1: + devno = 1; + break; + case SC_R_SDHC_2: + devno = 2; + break; + default: + /* If not boot from sd/mmc, use default value */ + return CONFIG_SYS_MMC_ENV_DEV; + } + + return board_mmc_get_env_dev(devno); +} +#endif |