mmc-boot-mode.c 1.0 KB

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