[PATCH RFC u-boot-mvebu 2/2] arm: mvebu: spl: Load proper U-Boot from eMMC Boot 0 partition
Pali Rohár
pali at kernel.org
Sat Mar 4 11:38:51 CET 2023
Boot configuration stored in EXT_CSC register is completely ignored by
BootROM. So we should skip it too in SPL, to load proper U-Boot from the
same location as from which was loaded SPL by BootROM.
BootROM tries to boot from partitions in this order: Boot 0, Boot 1, User
Data Partition.
In case SPL+U-Boot is stored on Boot 1 or User Data partition then SPL code
skips MMC booting (nothing is valid on Boot 0) and fallback to BootROM
booting which loads proper U-Boot from correct partition (Boot 1 or User
Data).
Implement it via setting CONFIG_SUPPORT_EMMC_BOOT_OVERRIDE_PART_CONFIG and
CONFIG_SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION to fixed values for mvebu.
Fixes: 2f27db2fbd6e ("arm: mvebu: spl: Load proper U-Boot from selected eMMC boot partition")
Signed-off-by: Pali Rohár <pali at kernel.org>
---
arch/arm/mach-mvebu/Kconfig | 1 +
arch/arm/mach-mvebu/spl.c | 13 +++++++------
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index ba40c59f4a95..dfc50ec91350 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -336,6 +336,7 @@ config MVEBU_SPL_BOOT_DEVICE_MMC
imply SPL_LIBDISK_SUPPORT
imply SPL_MMC
select SUPPORT_EMMC_BOOT if SPL_MMC
+ select SUPPORT_EMMC_BOOT_OVERRIDE_PART_CONFIG if SPL_MMC
select SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR if SPL_MMC
select SPL_BOOTROM_SUPPORT
diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c
index 6b8c72a71dab..b20eac3dcd38 100644
--- a/arch/arm/mach-mvebu/spl.c
+++ b/arch/arm/mach-mvebu/spl.c
@@ -34,8 +34,7 @@
/*
* When loading U-Boot via SPL from eMMC, the kwbimage main header is stored at
- * sector 0 and either on HW boot partition or on data partition. Choice of HW
- * partition depends on what is configured in eMMC EXT_CSC register.
+ * sector 0 of Boot 0 HW partition.
* When loading U-Boot via SPL from SD card, the kwbimage main header is stored
* at sector 1.
* Therefore MBR/GPT partition booting, fixed sector number and fixed eMMC HW
@@ -46,6 +45,7 @@
* Runtime mvebu SPL sector calculation code expects:
* - CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET=0
* - CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0
+ * - CONFIG_SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION=1
*/
#ifdef CONFIG_SPL_MMC
#ifdef CONFIG_SYS_MMCSD_FS_BOOT
@@ -54,11 +54,12 @@
#ifdef CONFIG_SYS_MMCSD_FS_BOOT_PARTITION
#error CONFIG_SYS_MMCSD_FS_BOOT_PARTITION is unsupported
#endif
-#ifdef CONFIG_SUPPORT_EMMC_BOOT_OVERRIDE_PART_CONFIG
-#error CONFIG_SUPPORT_EMMC_BOOT_OVERRIDE_PART_CONFIG is unsupported
+#ifndef CONFIG_SUPPORT_EMMC_BOOT_OVERRIDE_PART_CONFIG
+#error CONFIG_SUPPORT_EMMC_BOOT_OVERRIDE_PART_CONFIG must be enabled for SD/eMMC boot support
#endif
-#ifdef CONFIG_SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION
-#error CONFIG_SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION is unsupported
+#if !defined(CONFIG_SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION) || \
+ CONFIG_SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION != 1
+#error CONFIG_SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION must be set to 1
#endif
#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
#error CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION is unsupported
--
2.20.1
More information about the U-Boot
mailing list