MLK-16594-0: imx8qm/qxp: Use SCFW API instead of info from ROM_SW
authorAdriana Reus <adriana.reus@nxp.com>
Mon, 16 Oct 2017 13:08:00 +0000 (16:08 +0300)
committerJason Liu <jason.hui.liu@nxp.com>
Thu, 2 Nov 2017 18:37:24 +0000 (02:37 +0800)
In B0 there is no AP-ROM, and the ROM_SW address can no longer be used
to extract data about the boot device.
Use the scfw api in mmc_get_env_dev similarly to the change also made
in get_boot_device: 'commit 0851f23b5d4b ("MLK-16587-2 imx8qm/qxp:
Change to use SCFW API to get boot device")'

Signed-off-by: Adriana Reus <adriana.reus@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
arch/arm/cpu/armv8/imx8/cpu.c

index 9f29025..f0c8a5f 100644 (file)
@@ -806,14 +806,27 @@ __weak int board_mmc_get_env_dev(int devno)
 
 int mmc_get_env_dev(void)
 {
-       struct rom_sw_info_t **p = (struct rom_sw_info_t **)ROM_SW_INFO_ADDR;
+       sc_ipc_t ipcHndl = 0;
+       sc_rsrc_t dev_rsrc;
+       int devno;
 
-       int devno = (*p)->boot_dev_info.instance;
-       uint8_t boot_type = (*p)->boot_dev_info.dev_type;
+       ipcHndl = gd->arch.ipc_channel_handle;
+       sc_misc_get_boot_dev(ipcHndl, &dev_rsrc);
 
-       /* If not boot from sd/mmc, use default value */
-       if ((boot_type != FLASH_TYPE_SD) && (boot_type != FLASH_TYPE_MMC))
+       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);
 }