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