MLK-15323-3 imx8m: implement mmc_get_env_dev
authorPeng Fan <peng.fan@nxp.com>
Mon, 3 Jul 2017 07:40:28 +0000 (15:40 +0800)
committerJason Liu <jason.hui.liu@nxp.com>
Thu, 2 Nov 2017 18:36:59 +0000 (02:36 +0800)
Implement mmc_get_env_dev

Signed-off-by: Peng Fan <peng.fan@nxp.com>
arch/arm/cpu/armv8/imx8m/soc.c

index d692d3f..2c7dc1b 100644 (file)
@@ -225,6 +225,27 @@ 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)
+{
+       struct bootrom_sw_info **p =
+               (struct bootrom_sw_info **)ROM_SW_INFO_ADDR;
+       int devno = (*p)->boot_dev_instance;
+       u8 boot_type = (*p)->boot_dev_type;
+
+       /* If not boot from sd/mmc, use default value */
+       if ((boot_type != BOOT_TYPE_SD) && (boot_type != BOOT_TYPE_MMC))
+               return CONFIG_SYS_MMC_ENV_DEV;
+
+       return board_mmc_get_env_dev(devno);
+}
+#endif
+
 #ifdef CONFIG_SERIAL_TAG
 void get_board_serial(struct tag_serialnr *serialnr)
 {