Masahiro Yamada | 127f577 | 2017-02-14 01:24:25 +0900 | [diff] [blame] | 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 | |
| 8 | #include <common.h> |
| 9 | #include <mmc.h> |
| 10 | #include <spl.h> |
| 11 | |
| 12 | u32 spl_boot_mode(const u32 boot_device) |
| 13 | { |
| 14 | struct mmc *mmc; |
| 15 | |
| 16 | /* |
Masahiro Yamada | d3c1461 | 2017-08-13 09:01:13 +0900 | [diff] [blame] | 17 | * work around a bug in the Boot ROM of LD4, Pro4, and sLD8: |
Masahiro Yamada | 127f577 | 2017-02-14 01:24:25 +0900 | [diff] [blame] | 18 | * |
| 19 | * The boot ROM in these SoCs breaks the PARTITION_CONFIG [179] of |
| 20 | * Extended CSD register; when switching to the Boot Partition 1, the |
| 21 | * Boot ROM should issue the SWITCH command (CMD6) with Set Bits for |
| 22 | * the Access Bits, but in fact it uses Write Byte for the Access Bits. |
| 23 | * As a result, the BOOT_PARTITION_ENABLE field of the PARTITION_CONFIG |
| 24 | * is lost. This bug was fixed for PH1-Pro5 and later SoCs. |
| 25 | * |
| 26 | * Fixup mmc->part_config here because it is used to determine the |
| 27 | * partition which the U-Boot image is read from. |
| 28 | */ |
| 29 | mmc = find_mmc_device(0); |
| 30 | mmc->part_config &= ~EXT_CSD_BOOT_PART_NUM(PART_ACCESS_MASK); |
| 31 | mmc->part_config |= EXT_CSD_BOOT_PARTITION_ENABLE; |
| 32 | |
| 33 | return MMCSD_MODE_EMMCBOOT; |
| 34 | } |