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