mmc_env.c 670 B

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