All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Stefan Roese <sr@denx.de>
Cc: Martin Rowe <martin.p.rowe@gmail.com>, u-boot@lists.denx.de
Subject: [PATCH v2 u-boot-mvebu 3/4] arm: mvebu: spl: Load proper U-Boot from correct eMMC partition
Date: Thu, 13 Apr 2023 22:57:49 +0200	[thread overview]
Message-ID: <20230413205750.10641-4-pali@kernel.org> (raw)
In-Reply-To: <20230413205750.10641-1-pali@kernel.org>

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>
---
 arch/arm/mach-mvebu/spl.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c
index 379daa88a4d8..0688601699f0 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)
 {
-- 
2.20.1


  parent reply	other threads:[~2023-04-13 20:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-13 20:57 [PATCH v2 u-boot-mvebu 0/4] arm: mvebu: Fix eMMC boot Pali Rohár
2023-04-13 20:57 ` [PATCH v2 u-boot-mvebu 1/4] tools: kwboot: Fix MMC partitions documentation Pali Rohár
2023-04-13 20:57 ` [PATCH v2 u-boot-mvebu 2/4] mmc: Read eMMC partition access bits before card reset Pali Rohár
2023-04-13 20:57 ` Pali Rohár [this message]
2023-04-13 20:57 ` [PATCH v2 u-boot-mvebu 4/4] arm: mvebu: clearfog: Update eMMC/SD/SATA instructions Pali Rohár
2023-04-13 22:43   ` Martin Rowe
2023-04-26 23:44     ` Pali Rohár
2023-04-27  8:56       ` Stefan Roese
2023-04-29 11:08         ` Pali Rohár
2023-05-03  9:17           ` Stefan Roese
2023-05-03  9:43             ` Eugen Hristev
2023-05-03  9:57               ` Stefan Roese
2023-05-03 10:01                 ` Eugen Hristev
2023-05-03 10:12                   ` Stefan Roese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230413205750.10641-4-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=martin.p.rowe@gmail.com \
    --cc=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.