mmc_env.c 673 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * Copyright (C) 2017 NXP
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  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. __weak int board_mmc_get_env_dev(int devno)
  12. {
  13. return CONFIG_SYS_MMC_ENV_DEV;
  14. }
  15. int mmc_get_env_dev(void)
  16. {
  17. struct bootrom_sw_info **p =
  18. (struct bootrom_sw_info **)(ulong)ROM_SW_INFO_ADDR;
  19. int devno = (*p)->boot_dev_instance;
  20. u8 boot_type = (*p)->boot_dev_type;
  21. /* If not boot from sd/mmc, use default value */
  22. if ((boot_type != BOOT_TYPE_SD) && (boot_type != BOOT_TYPE_MMC))
  23. return CONFIG_SYS_MMC_ENV_DEV;
  24. return board_mmc_get_env_dev(devno);
  25. }