blob: 9c822f721c600c1733e23fb6f6f59f7c84f0220f [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Peng Fanc131a382018-01-10 13:20:36 +08002/*
3 * Copyright (C) 2017 NXP
Peng Fanc131a382018-01-10 13:20:36 +08004 */
5
6#include <common.h>
7#include <asm/arch/imx-regs.h>
8#include <asm/arch/sys_proto.h>
9#include <asm/io.h>
10#include <asm/mach-imx/boot_mode.h>
11
12__weak int board_mmc_get_env_dev(int devno)
13{
14 return CONFIG_SYS_MMC_ENV_DEV;
15}
16
17int mmc_get_env_dev(void)
18{
19 struct bootrom_sw_info **p =
20 (struct bootrom_sw_info **)(ulong)ROM_SW_INFO_ADDR;
21 int devno = (*p)->boot_dev_instance;
22 u8 boot_type = (*p)->boot_dev_type;
23
24 /* If not boot from sd/mmc, use default value */
25 if ((boot_type != BOOT_TYPE_SD) && (boot_type != BOOT_TYPE_MMC))
26 return CONFIG_SYS_MMC_ENV_DEV;
27
28 return board_mmc_get_env_dev(devno);
29}