]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
imx8: implement mmc_get_env_dev
authorPeng Fan <peng.fan@nxp.com>
Thu, 18 Oct 2018 12:28:20 +0000 (14:28 +0200)
committerStefano Babic <sbabic@denx.de>
Mon, 22 Oct 2018 10:59:01 +0000 (12:59 +0200)
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>
arch/arm/mach-imx/imx8/cpu.c

index 90b6ea42116ec2826ea794e7641f55be71d07a17..0cacaa895c43d22d5d7dbbe0d7bbeba1662b293a 100644 (file)
@@ -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