aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2023-04-13 22:57:49 +0200
committerStefan Roese <sr@denx.de>2023-05-03 08:39:23 +0200
commit2e9009e874640feec9e01ffa59c305bba085058c (patch)
treecb4148eb057de5013c2a78b74a262759ecca3b98
parent461fa17970de418a93832f734a595031c0b72128 (diff)
downloadu-boot-2e9009e874640feec9e01ffa59c305bba085058c.zip
u-boot-2e9009e874640feec9e01ffa59c305bba085058c.tar.gz
u-boot-2e9009e874640feec9e01ffa59c305bba085058c.tar.bz2
arm: mvebu: spl: Load proper U-Boot from correct eMMC partition
A38x BootROM completely ignores EXT_CSD_PART_CONF eMMC register and tries to load SPL from any partition in defined order. Chosen partition can be determined from the access bits in EXT_CSD_PART_CONF eMMC register. So implement custom spl_mmc_emmc_boot_partition() function to always returns eMMC partition from which BootROM loaded SPL. So this partition would be used for loading proper U-Boot too. Fixes: 2f27db2fbd6e ("arm: mvebu: spl: Load proper U-Boot from selected eMMC boot partition") Signed-off-by: Pali Rohár <pali@kernel.org>
-rw-r--r--arch/arm/mach-mvebu/spl.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c
index 379daa8..0688601 100644
--- a/arch/arm/mach-mvebu/spl.c
+++ b/arch/arm/mach-mvebu/spl.c
@@ -11,6 +11,7 @@
#include <image.h>
#include <init.h>
#include <log.h>
+#include <mmc.h>
#include <spl.h>
#include <asm/global_data.h>
#include <asm/io.h>
@@ -34,8 +35,9 @@
/*
* 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 on some HW/boot partition. Choice of HW partition depends on what is
+ * set in PART_ACCESS_MASK bits of EXT_CSD_PART_CONF eMMC register. Partition
+ * access bits into EXT_CSD_PART_CONF are set by the BootROM.
* 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
@@ -123,6 +125,10 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
{
return IS_SD(mmc) ? MMCSD_MODE_RAW : MMCSD_MODE_EMMCBOOT;
}
+int spl_mmc_emmc_boot_partition(struct mmc *mmc)
+{
+ return EXT_CSD_EXTRACT_PARTITION_ACCESS(mmc->part_config);
+}
unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc,
unsigned long raw_sect)
{