mmc-boot-mode.c 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2016 Socionext Inc.
  4. * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
  5. */
  6. #include <common.h>
  7. #include <mmc.h>
  8. #include <spl.h>
  9. u32 spl_mmc_boot_mode(const u32 boot_device)
  10. {
  11. struct mmc *mmc;
  12. /*
  13. * work around a bug in the Boot ROM of LD4, Pro4, and sLD8:
  14. *
  15. * The boot ROM in these SoCs breaks the PARTITION_CONFIG [179] of
  16. * Extended CSD register; when switching to the Boot Partition 1, the
  17. * Boot ROM should issue the SWITCH command (CMD6) with Set Bits for
  18. * the Access Bits, but in fact it uses Write Byte for the Access Bits.
  19. * As a result, the BOOT_PARTITION_ENABLE field of the PARTITION_CONFIG
  20. * is lost. This bug was fixed for PH1-Pro5 and later SoCs.
  21. *
  22. * Fixup mmc->part_config here because it is used to determine the
  23. * partition which the U-Boot image is read from.
  24. */
  25. mmc = find_mmc_device(0);
  26. mmc->part_config &= ~EXT_CSD_BOOT_PART_NUM(PART_ACCESS_MASK);
  27. mmc->part_config |= EXT_CSD_BOOT_PARTITION_ENABLE;
  28. return MMCSD_MODE_EMMCBOOT;
  29. }