]>
Commit | Line | Data |
---|---|---|
323d1f9d MY |
1 | /* |
2 | * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com> | |
3 | * | |
4 | * SPDX-License-Identifier: GPL-2.0+ | |
5 | */ | |
6 | ||
7 | #include <common.h> | |
a55d9fee | 8 | #include <mmc.h> |
323d1f9d | 9 | #include <spl.h> |
107b3fb4 MY |
10 | |
11 | #include "../sbc/sbc-regs.h" | |
12 | #include "../soc-info.h" | |
13 | #include "boot-device.h" | |
323d1f9d | 14 | |
fec48163 | 15 | u32 spl_boot_device_raw(void) |
323d1f9d MY |
16 | { |
17 | if (boot_is_swapped()) | |
18 | return BOOT_DEVICE_NOR; | |
19 | ||
20 | switch (uniphier_get_soc_type()) { | |
21 | #if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD3) | |
22 | case SOC_UNIPHIER_PH1_SLD3: | |
23 | return ph1_sld3_boot_device(); | |
24 | #endif | |
25 | #if defined(CONFIG_ARCH_UNIPHIER_PH1_LD4) || \ | |
26 | defined(CONFIG_ARCH_UNIPHIER_PH1_PRO4) || \ | |
27 | defined(CONFIG_ARCH_UNIPHIER_PH1_SLD8) | |
28 | case SOC_UNIPHIER_PH1_LD4: | |
29 | case SOC_UNIPHIER_PH1_PRO4: | |
30 | case SOC_UNIPHIER_PH1_SLD8: | |
31 | return ph1_ld4_boot_device(); | |
28f40d4a MY |
32 | #endif |
33 | #if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO5) | |
34 | case SOC_UNIPHIER_PH1_PRO5: | |
35 | return ph1_pro5_boot_device(); | |
019df879 MY |
36 | #endif |
37 | #if defined(CONFIG_ARCH_UNIPHIER_PROXSTREAM2) || \ | |
38 | defined(CONFIG_ARCH_UNIPHIER_PH1_LD6B) | |
39 | case SOC_UNIPHIER_PROXSTREAM2: | |
40 | case SOC_UNIPHIER_PH1_LD6B: | |
41 | return proxstream2_boot_device(); | |
323d1f9d MY |
42 | #endif |
43 | default: | |
44 | return BOOT_DEVICE_NONE; | |
45 | } | |
46 | } | |
fec48163 MY |
47 | |
48 | u32 spl_boot_device(void) | |
49 | { | |
50 | u32 ret; | |
51 | ||
52 | ret = spl_boot_device_raw(); | |
53 | ||
54 | return ret == BOOT_DEVICE_USB ? BOOT_DEVICE_NOR : ret; | |
55 | } | |
a55d9fee MY |
56 | |
57 | u32 spl_boot_mode(void) | |
58 | { | |
59 | struct mmc *mmc; | |
60 | ||
61 | /* | |
62 | * work around a bug in the Boot ROM of PH1-sLD3, LD4, Pro4, and sLD8: | |
63 | * | |
64 | * The boot ROM in these SoCs breaks the PARTITION_CONFIG [179] of | |
65 | * Extended CSD register; when switching to the Boot Partition 1, the | |
66 | * Boot ROM should issue the SWITCH command (CMD6) with Set Bits for | |
67 | * the Access Bits, but in fact it uses Write Byte for the Access Bits. | |
68 | * As a result, the BOOT_PARTITION_ENABLE field of the PARTITION_CONFIG | |
69 | * is lost. This bug was fixed for PH1-Pro5 and later SoCs. | |
70 | * | |
71 | * Fixup mmc->part_config here because it is used to determine the | |
72 | * partition which the U-Boot image is read from. | |
73 | */ | |
74 | mmc = find_mmc_device(0); | |
75 | mmc->part_config &= ~EXT_CSD_BOOT_PART_NUM(PART_ACCESS_MASK); | |
76 | mmc->part_config |= EXT_CSD_BOOT_PARTITION_ENABLE; | |
77 | ||
78 | return MMCSD_MODE_EMMCBOOT; | |
79 | } |