u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Martin Rowe <martin.p.rowe@gmail.com>
Cc: u-boot@lists.denx.de
Subject: [PATCH RFC u-boot-mvebu 2/2] arm: mvebu: spl: Load proper U-Boot from eMMC Boot 0 partition
Date: Sat,  4 Mar 2023 11:38:51 +0100	[thread overview]
Message-ID: <20230304103851.18965-3-pali@kernel.org> (raw)
In-Reply-To: <20230304103851.18965-1-pali@kernel.org>

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@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


  parent reply	other threads:[~2023-03-04 10:40 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-04 10:38 [PATCH RFC u-boot-mvebu 0/2] arm: mvebu: Fix eMMC boot Pali Rohár
2023-03-04 10:38 ` [PATCH RFC u-boot-mvebu 1/2] tools: kwboot: Fix MMC HW boot partitions info Pali Rohár
2023-03-04 10:38 ` Pali Rohár [this message]
2023-03-05  2:24 ` [PATCH RFC u-boot-mvebu 0/2] arm: mvebu: Fix eMMC boot Martin Rowe
2023-03-05 11:46   ` Pali Rohár
2023-03-05 16:04     ` Pali Rohár
2023-03-06 11:15       ` Martin Rowe
2023-03-06 11:53         ` Pali Rohár
2023-03-10 17:53           ` Pali Rohár
2023-03-19  0:32           ` Martin Rowe
2023-03-19 16:22             ` Pali Rohár
2023-03-20 11:48               ` Martin Rowe
2023-03-20 17:33                 ` Pali Rohár
2023-03-21  8:01                   ` Martin Rowe
2023-03-21  8:07                     ` Pali Rohár
2023-03-22 12:38                       ` Martin Rowe
2023-03-22 13:45                         ` Martin Rowe
2023-03-22 17:59                           ` Pali Rohár
2023-03-22 19:09                             ` Pali Rohár
2023-03-23 12:24                               ` Martin Rowe
2023-03-23 19:00                                 ` Pali Rohár
2023-03-24  2:55                                   ` Martin Rowe
2023-03-25 12:25                                     ` A38x BootROM MMC_CMD_SEND_STATUS timeouts (Was: Re: [PATCH RFC u-boot-mvebu 0/2] arm: mvebu: Fix eMMC boot) Pali Rohár
2023-04-01 16:43                                       ` A38x BootROM MMC_CMD_SEND_STATUS timeouts Pali Rohár
2023-04-26 23:45                                         ` Pali Rohár
2023-04-28  7:39                                         ` Peng Fan
2023-04-28  8:30                                           ` Pali Rohár
2023-06-11 22:46                                             ` Pali Rohár
2023-03-06 18:40         ` [PATCH RFC u-boot-mvebu 0/2] arm: mvebu: Fix eMMC boot Pali Rohár
2023-03-19  2:30           ` Martin Rowe
2023-03-19 16:41             ` Pali Rohár

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=20230304103851.18965-3-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=martin.p.rowe@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).