[U-Boot] [PATCH 12/41] imx8: implement mmc_get_env_dev
Peng Fan
peng.fan at nxp.com
Mon May 28 12:24:57 UTC 2018
Implement mmc_get_env_dev for i.MX8.
Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
arch/arm/mach-imx/imx8/cpu.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/arch/arm/mach-imx/imx8/cpu.c b/arch/arm/mach-imx/imx8/cpu.c
index 7aecaac356..fa32a9362c 100644
--- a/arch/arm/mach-imx/imx8/cpu.c
+++ b/arch/arm/mach-imx/imx8/cpu.c
@@ -163,3 +163,37 @@ 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_ipc_t ipchndl;
+ sc_rsrc_t dev_rsrc;
+ int devno;
+
+ ipchndl = gd->arch.ipc_channel_handle;
+ sc_misc_get_boot_dev(ipchndl, &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
--
2.14.1
More information about the U-Boot
mailing list