Skip to contentSkip to conversation

arm: mvebu: Fix eMMC boot

PATCH In review Pali Rohár 4 participants 14 messages Apr 13, 2023 – May 3, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover arm: mvebu: Fix eMMC boot

Boot configuration stored in EXT_CSD[179] register is completely ignored by BootROM:
https://lore.kernel.org/u-boot/CAOAjy5SYPPzWKok-BSGYwZwcKOQt_aZPgh6FTbrFd3F=8DM5ZQ@mail.gmail.com/

Instead eMMC partition use for booting has to be extracted from Partition access bits:
https://lore.kernel.org/u-boot/CAOAjy5SNrLJ=JAKf96Nf7HkFBXWbZLmWAhEs6nEEHS6UEhQbJw@mail.gmail.com/

Reflect this eMMC booting in documentation and in the code.

This patch series does not address 5 minutes timeout as nobody reacted to the email:
https://lore.kernel.org/u-boot/20230401164345.iwfu7nd5jgbjtpzl@pali/

Pali Rohár (4):
tools: kwboot: Fix MMC partitions documentation
mmc: Read eMMC partition access bits before card reset
arm: mvebu: spl: Load proper U-Boot from correct eMMC partition
arm: mvebu: clearfog: Update eMMC/SD/SATA instructions

 arch/arm/mach-mvebu/spl.c      | 10 ++++++++--
 board/solidrun/clearfog/README | 20 ++++++++++----------
 drivers/mmc/mmc.c              | 31 ++++++++++++++++++++++++++++---
 tools/kwboot.c                 |  9 ++++++---
 4 files changed, 52 insertions(+), 18 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH v2 1/4 tools: kwboot: Fix MMC partitions documentation

Boot configuration stored in EXT_CSD_PART_CONF register is completely ignored by BootROM.

Fixes fa03279e198d ("tools: kwboot: Add image type documentation")
---
 tools/kwboot.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
tools/kwboot.c +6 -3
index 6bef4610ff8f..550d2494ff68 100644
@@ -119,9 +119,12 @@
  *   1024 bytes long sector sizes and also can be changed at runtime.
  *
  *   For MMC-compatible devices, image can be stored at offset 0 or at offset
- *   2 MB. If MMC device supports HW boot partitions then image must be stored
- *   on the HW partition as is configured in the EXT_CSC register (it can be
- *   either boot or user data).
+ *   2 MB. If eMMC device supports HW/boot partitions then image is read from
+ *   partitions in following order: Boot 1, Boot 2, RPMB, GP 1, GP 2, GP 3,
+ *   GP 4, User Data, Boot 1, Boot 2. (Boot 1 and Boot 2 are really repeated).
+ *   Boot configuration stored in EXT_CSD_PART_CONF eMMC register is completely
+ *   ignored by the BootROM. But it sets PARTITION_ACCESS bits of that register
+ *   to the selected partition from which it loaded image.
  *
  *   Note that source address for SDIO image is stored in byte unit, like for
  *   any other images (except SATA). Marvell Functional Specifications for
Signature · 1 line
2.20.1
#4 lore raw

PATCH v2 4/4 arm: mvebu: clearfog: Update eMMC/SD/SATA instructions

In reply to Pali Rohár

BootROM and neither SPL does not use eMMC boot acknowledgement or boot enable bits in EXT_CSD_PART_CONF eMMC register. And also fixed SATA disk sector 0x141 is not used at all.

---
 board/solidrun/clearfog/README | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
board/solidrun/clearfog/README +10 -10
index ed4a712c5aa2..c86b37061a30 100644
@@ -1,7 +1,7 @@
 Update from original Marvell U-Boot to mainline U-Boot:
 -------------------------------------------------------
 
-Generate the U-Boot image with these commands:
+Generate the U-Boot image for eMMC/SD with these commands:
 
 $ make clearfog_defconfig
 $ make
@@ -9,7 +9,7 @@ $ make
 The resulting image including the SPL binary with the
 full DDR setup is "u-boot-with-spl.kwb".
 
-Now all you need to do is copy this image on a SD card.
+Now all you need to do is copy this image on a SD card's sector 1.
 For example with this command:
 
 $ sudo dd if=u-boot-with-spl.kwb of=/dev/sdX bs=512 seek=1
@@ -20,12 +20,6 @@ of "/dev/sdX" here!
 Install U-Boot on eMMC:
 -----------------------
 
-To make SPL load the main U-Boot image from the eMMC boot partition enable
-eMMC boot acknowledgement and boot partition with the following U-Boot
-command:
-
-  mmc partconf 0 1 1 0
-
 Install U-Boot on eMMC boot partition from Linux running on Clearfog:
 
   echo 0 > /sys/block/mmcblk0boot0/force_ro
@@ -37,8 +31,14 @@ Consider initial boot from UART (see below).
 Install U-Boot on SATA:
 -----------------------
 
-When loading the main U-Boot image from raw SATA sector, set
-CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR to 0x141.
+Generate the U-Boot image for SATA with these commands:
+
+$ make clearfog_sata_defconfig
+$ make
+
+Copy image on a SATA disk's sector 1:
+
+$ sudo dd if=u-boot-with-spl.kwb of=/dev/sdX bs=512 seek=1
 
 Boot selection:
 ---------------
Signature · 1 line
2.20.1
#2 lore raw

PATCH v2 2/4 mmc: Read eMMC partition access bits before card reset

In reply to Pali Rohár

eMMC specification in section "Access partitions" says that all reset events will restore the access bits in PARTITION_CONFIG CSD register to default User Data Area value (0b000).

So read partition access bits from PARTITION_CONFIG CSD register before issuing card reset. This allows SPL/U-Boot to get information which eMMC partition was in use before SPL/U-Boot was booted. For some platforms this is the way how to determinate boot partition from which BootROM loaded SPL.

---
 drivers/mmc/mmc.c | 31 ++++++++++++++++++++++++++++---
 1 file changed, 28 insertions(+), 3 deletions(-)
drivers/mmc/mmc.c +28 -3
index dde251c87bc7..771432de354d 100644
@@ -2329,8 +2329,17 @@ static int mmc_startup_v4(struct mmc *mmc)
 	/* store the partition info of emmc */
 	mmc->part_support = ext_csd[EXT_CSD_PARTITIONING_SUPPORT];
 	if ((ext_csd[EXT_CSD_PARTITIONING_SUPPORT] & PART_SUPPORT) ||
-	    ext_csd[EXT_CSD_BOOT_MULT])
-		mmc->part_config = ext_csd[EXT_CSD_PART_CONF];
+	    ext_csd[EXT_CSD_BOOT_MULT]) {
+		/*
+		 * At this stage PART_ACCESS_MASK bits in ext_csd[] are already cleared.
+		 * But it is possible that they were already filled into mmc->part_config.
+		 */
+		if (mmc->part_config == MMCPART_NOAVAILABLE)
+			mmc->part_config = ext_csd[EXT_CSD_PART_CONF];
+		else
+			mmc->part_config = (ext_csd[EXT_CSD_PART_CONF] & ~PART_ACCESS_MASK) |
+					   (mmc->part_config & PART_ACCESS_MASK);
+	}
 	if (part_completed &&
 	    (ext_csd[EXT_CSD_PARTITIONING_SUPPORT] & ENHNCD_SUPPORT))
 		mmc->part_attr = ext_csd[EXT_CSD_PARTITIONS_ATTRIBUTE];
@@ -2600,7 +2609,6 @@ static int mmc_startup(struct mmc *mmc)
 #if CONFIG_IS_ENABLED(MMC_WRITE)
 	mmc->erase_grp_size = 1;
 #endif
-	mmc->part_config = MMCPART_NOAVAILABLE;
 
 	err = mmc_startup_v4(mmc);
 	if (err)
@@ -2848,9 +2856,26 @@ int mmc_get_op_cond(struct mmc *mmc, bool quiet)
 		return err;
 	mmc->ddr_mode = 0;
 
+	mmc->part_config = MMCPART_NOAVAILABLE;
+
 retry:
 	mmc_set_initial_state(mmc);
 
+	/*
+	 * Read partition access bits from partition config register before card reset command
+	 * because these bits are reset to default value (User Data Area) during card reset.
+	 * This allows us to preserve original value of partition access bits used by the code
+	 * which loaded us (for example BootROM) and use it for board specific boot purposes.
+	 */
+	if (mmc->part_config == MMCPART_NOAVAILABLE) {
+		ALLOC_CACHE_ALIGN_BUFFER(u8, ext_csd, MMC_MAX_BLOCK_LEN);
+		err = mmc_send_ext_csd(mmc, ext_csd);
+		if (err == 0 &&
+		    ((ext_csd[EXT_CSD_PARTITIONING_SUPPORT] & PART_SUPPORT) ||
+		     ext_csd[EXT_CSD_BOOT_MULT]))
+			mmc->part_config = ext_csd[EXT_CSD_PART_CONF] & PART_ACCESS_MASK;
+	}
+
 	/* Reset the Card */
 	err = mmc_go_idle(mmc);
 
Signature · 1 line
2.20.1
#3 lore raw

PATCH v2 3/4 arm: mvebu: spl: Load proper U-Boot from correct eMMC partition

In reply to Pali Rohár

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")
---
 arch/arm/mach-mvebu/spl.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
arch/arm/mach-mvebu/spl.c +8 -2
index 379daa88a4d8..0688601699f0 100644
@@ -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)
 {
Signature · 1 line
2.20.1
Tested-by on v2 4/4
#5 lore raw

Re: [PATCH v2 u-boot-mvebu 4/4] arm: mvebu: clearfog: Update eMMC/SD/SATA instructions

In reply to Pali Rohár
Quoted 6 lines · Pali Rohár

BootROM and neither SPL does not use eMMC boot acknowledgement or boot enable bits in EXT_CSD_PART_CONF eMMC register. And also fixed SATA disk sector 0x141 is not used at all.

SPL successfully loads u-boot from the same partition as SPL. SD card and UART continue to boot.

Thanks Pali!

Quoted 59 lines
---
 board/solidrun/clearfog/README | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
board/solidrun/clearfog/README +10 -11
index ed4a712c5aa2..c86b37061a30 100644
@@ -1,7 +1,7 @@
 Update from original Marvell U-Boot to mainline U-Boot:
 -------------------------------------------------------
 
-Generate the U-Boot image with these commands:
+Generate the U-Boot image for eMMC/SD with these commands:
 
 $ make clearfog_defconfig
 $ make
@@ -9,7 +9,7 @@ $ make
 The resulting image including the SPL binary with the
 full DDR setup is "u-boot-with-spl.kwb".
 
-Now all you need to do is copy this image on a SD card.
+Now all you need to do is copy this image on a SD card's sector 1.
 For example with this command:
 
 $ sudo dd if=u-boot-with-spl.kwb of=/dev/sdX bs=512 seek=1
@@ -20,12 +20,6 @@ of "/dev/sdX" here!
 Install U-Boot on eMMC:
 -----------------------
 
-To make SPL load the main U-Boot image from the eMMC boot partition enable
-eMMC boot acknowledgement and boot partition with the following U-Boot
-command:
-
-  mmc partconf 0 1 1 0
-
 Install U-Boot on eMMC boot partition from Linux running on Clearfog:
 
   echo 0 > /sys/block/mmcblk0boot0/force_ro
@@ -37,8 +31,14 @@ Consider initial boot from UART (see below).
 Install U-Boot on SATA:
 -----------------------
 
-When loading the main U-Boot image from raw SATA sector, set
-CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR to 0x141.
+Generate the U-Boot image for SATA with these commands:
+
+$ make clearfog_sata_defconfig
+$ make
+
+Copy image on a SATA disk's sector 1:
+
+$ sudo dd if=u-boot-with-spl.kwb of=/dev/sdX bs=512 seek=1
 
 Boot selection:
 ---------------
--

2.20.1

#6 lore raw

Re: [PATCH v2 u-boot-mvebu 4/4] arm: mvebu: clearfog: Update eMMC/SD/SATA instructions

Quoted 6 lines · On Thursday 13 April 2023 22:43:25 Martin Rowe wrote:
Quoted 5 lines · Pali Rohár

BootROM and neither SPL does not use eMMC boot acknowledgement or boot enable bits in EXT_CSD_PART_CONF eMMC register. And also fixed SATA disk sector 0x141 is not used at all.

Quoted 8 lines
Quoted 1 line

SPL successfully loads u-boot from the same partition as SPL. SD card and UART continue to boot.

Thanks Pali!

Ok, is something more needed for this patch series?

Quoted 59 lines
Quoted 59 lines
---
 board/solidrun/clearfog/README | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
board/solidrun/clearfog/README +10 -11
index ed4a712c5aa2..c86b37061a30 100644
@@ -1,7 +1,7 @@
 Update from original Marvell U-Boot to mainline U-Boot:
 -------------------------------------------------------
 
-Generate the U-Boot image with these commands:
+Generate the U-Boot image for eMMC/SD with these commands:
 
 $ make clearfog_defconfig
 $ make
@@ -9,7 +9,7 @@ $ make
 The resulting image including the SPL binary with the
 full DDR setup is "u-boot-with-spl.kwb".
 
-Now all you need to do is copy this image on a SD card.
+Now all you need to do is copy this image on a SD card's sector 1.
 For example with this command:
 
 $ sudo dd if=u-boot-with-spl.kwb of=/dev/sdX bs=512 seek=1
@@ -20,12 +20,6 @@ of "/dev/sdX" here!
 Install U-Boot on eMMC:
 -----------------------
 
-To make SPL load the main U-Boot image from the eMMC boot partition enable
-eMMC boot acknowledgement and boot partition with the following U-Boot
-command:
-
-  mmc partconf 0 1 1 0
-
 Install U-Boot on eMMC boot partition from Linux running on Clearfog:
 
   echo 0 > /sys/block/mmcblk0boot0/force_ro
@@ -37,8 +31,14 @@ Consider initial boot from UART (see below).
 Install U-Boot on SATA:
 -----------------------
 
-When loading the main U-Boot image from raw SATA sector, set
-CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR to 0x141.
+Generate the U-Boot image for SATA with these commands:
+
+$ make clearfog_sata_defconfig
+$ make
+
+Copy image on a SATA disk's sector 1:
+
+$ sudo dd if=u-boot-with-spl.kwb of=/dev/sdX bs=512 seek=1
 
 Boot selection:
 ---------------
--

2.20.1

#7 lore raw

Re: [PATCH v2 u-boot-mvebu 4/4] arm: mvebu: clearfog: Update eMMC/SD/SATA instructions

Hi Pali,

Quoted 9 lines · Pali Rohár
Quoted 8 lines · On Thursday 13 April 2023 22:43:25 Martin Rowe wrote:
Quoted 6 lines · Pali Rohár

BootROM and neither SPL does not use eMMC boot acknowledgement or boot enable bits in EXT_CSD_PART_CONF eMMC register. And also fixed SATA disk sector 0x141 is not used at all.

Quoted 8 lines
Quoted 6 lines

SPL successfully loads u-boot from the same partition as SPL. SD card and UART continue to boot.

Thanks Pali!

Ok, is something more needed for this patch series?

Unfortunately yes. As at least this board breaks with this patchset added:

$ make sama5d2_icp_mmc_defconfig
$ make -sj
/opt/kernel.org/gcc-12.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld.bfd: u-boot-spl section `__u_boot_list' will not fit in region `.sram'
/opt/kernel.org/gcc-12.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld.bfd: region `.sram' overflowed by 32 bytes
make[1]: *** [scripts/Makefile.spl:527: spl/u-boot-spl] Error 1
make: *** [Makefile:2049: spl/u-boot-spl] Error 2

So CI build fails and I can't send a pull request. I'm sending a patch though, to fix this image overflow by enabling LTO. Stay tuned...

Thanks,
Stefan

Quoted 54 lines
Quoted 54 lines
Quoted 54 lines
---
  board/solidrun/clearfog/README | 20 ++++++++++----------
  1 file changed, 10 insertions(+), 10 deletions(-)
board/solidrun/clearfog/README +10 -10
index ed4a712c5aa2..c86b37061a30 100644
@@ -1,7 +1,7 @@
  Update from original Marvell U-Boot to mainline U-Boot:
  -------------------------------------------------------
 
-Generate the U-Boot image with these commands:
+Generate the U-Boot image for eMMC/SD with these commands:
 
  $ make clearfog_defconfig
  $ make
@@ -9,7 +9,7 @@ $ make
  The resulting image including the SPL binary with the
  full DDR setup is "u-boot-with-spl.kwb".
 
-Now all you need to do is copy this image on a SD card.
+Now all you need to do is copy this image on a SD card's sector 1.
  For example with this command:
 
  $ sudo dd if=u-boot-with-spl.kwb of=/dev/sdX bs=512 seek=1
@@ -20,12 +20,6 @@ of "/dev/sdX" here!
  Install U-Boot on eMMC:
  -----------------------
 
-To make SPL load the main U-Boot image from the eMMC boot partition enable
-eMMC boot acknowledgement and boot partition with the following U-Boot
-command:
-
-  mmc partconf 0 1 1 0
-
  Install U-Boot on eMMC boot partition from Linux running on Clearfog:
 
    echo 0 > /sys/block/mmcblk0boot0/force_ro
@@ -37,8 +31,14 @@ Consider initial boot from UART (see below).
  Install U-Boot on SATA:
  -----------------------
 
-When loading the main U-Boot image from raw SATA sector, set
-CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR to 0x141.
+Generate the U-Boot image for SATA with these commands:
+
+$ make clearfog_sata_defconfig
+$ make
+
+Copy image on a SATA disk's sector 1:
+
+$ sudo dd if=u-boot-with-spl.kwb of=/dev/sdX bs=512 seek=1
 
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
board/solidrun/clearfog/README +0 -1
  Boot selection:
  ---------------
--

2.20.1

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#8 lore raw

Re: [PATCH v2 u-boot-mvebu 4/4] arm: mvebu: clearfog: Update eMMC/SD/SATA instructions

Quoted 33 lines · On Thursday 27 April 2023 10:56:17 Stefan Roese wrote:

Hi Pali,

Quoted 9 lines · Pali Rohár
Quoted 8 lines · On Thursday 13 April 2023 22:43:25 Martin Rowe wrote:
Quoted 6 lines · Pali Rohár

BootROM and neither SPL does not use eMMC boot acknowledgement or boot enable bits in EXT_CSD_PART_CONF eMMC register. And also fixed SATA disk sector 0x141 is not used at all.

Quoted 8 lines
Quoted 6 lines

SPL successfully loads u-boot from the same partition as SPL. SD card and UART continue to boot.

Thanks Pali!

Ok, is something more needed for this patch series?

Unfortunately yes. As at least this board breaks with this patchset added:

$ make sama5d2_icp_mmc_defconfig
$ make -sj
/opt/kernel.org/gcc-12.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld.bfd:
u-boot-spl section `__u_boot_list' will not fit in region `.sram'
/opt/kernel.org/gcc-12.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld.bfd:
region `.sram' overflowed by 32 bytes
make[1]: *** [scripts/Makefile.spl:527: spl/u-boot-spl] Error 1
make: *** [Makefile:2049: spl/u-boot-spl] Error 2
Quoted 2 lines

So CI build fails and I can't send a pull request. I'm sending a patch though, to fix this image overflow by enabling LTO. Stay tuned...

I see... LTO helped. So can be this patch series now applied?

Quoted 70 lines

Thanks,
Stefan

Quoted 54 lines
Quoted 54 lines
Quoted 54 lines
---
  board/solidrun/clearfog/README | 20 ++++++++++----------
  1 file changed, 10 insertions(+), 10 deletions(-)
board/solidrun/clearfog/README +10 -10
index ed4a712c5aa2..c86b37061a30 100644
@@ -1,7 +1,7 @@
  Update from original Marvell U-Boot to mainline U-Boot:
  -------------------------------------------------------
 
-Generate the U-Boot image with these commands:
+Generate the U-Boot image for eMMC/SD with these commands:
 
  $ make clearfog_defconfig
  $ make
@@ -9,7 +9,7 @@ $ make
  The resulting image including the SPL binary with the
  full DDR setup is "u-boot-with-spl.kwb".
 
-Now all you need to do is copy this image on a SD card.
+Now all you need to do is copy this image on a SD card's sector 1.
  For example with this command:
 
  $ sudo dd if=u-boot-with-spl.kwb of=/dev/sdX bs=512 seek=1
@@ -20,12 +20,6 @@ of "/dev/sdX" here!
  Install U-Boot on eMMC:
  -----------------------
 
-To make SPL load the main U-Boot image from the eMMC boot partition enable
-eMMC boot acknowledgement and boot partition with the following U-Boot
-command:
-
-  mmc partconf 0 1 1 0
-
  Install U-Boot on eMMC boot partition from Linux running on Clearfog:
 
    echo 0 > /sys/block/mmcblk0boot0/force_ro
@@ -37,8 +31,14 @@ Consider initial boot from UART (see below).
  Install U-Boot on SATA:
  -----------------------
 
-When loading the main U-Boot image from raw SATA sector, set
-CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR to 0x141.
+Generate the U-Boot image for SATA with these commands:
+
+$ make clearfog_sata_defconfig
+$ make
+
+Copy image on a SATA disk's sector 1:
+
+$ sudo dd if=u-boot-with-spl.kwb of=/dev/sdX bs=512 seek=1
 
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
board/solidrun/clearfog/README +0 -1
  Boot selection:
  ---------------
--

2.20.1

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#9 lore raw

Re: [PATCH v2 u-boot-mvebu 4/4] arm: mvebu: clearfog: Update eMMC/SD/SATA instructions

Quoted 34 lines · Pali Rohár
Quoted 33 lines · On Thursday 27 April 2023 10:56:17 Stefan Roese wrote:

Hi Pali,

Quoted 9 lines · Pali Rohár
Quoted 8 lines · On Thursday 13 April 2023 22:43:25 Martin Rowe wrote:
Quoted 6 lines · Pali Rohár

BootROM and neither SPL does not use eMMC boot acknowledgement or boot enable bits in EXT_CSD_PART_CONF eMMC register. And also fixed SATA disk sector 0x141 is not used at all.

Quoted 8 lines
Quoted 6 lines

SPL successfully loads u-boot from the same partition as SPL. SD card and UART continue to boot.

Thanks Pali!

Ok, is something more needed for this patch series?

Unfortunately yes. As at least this board breaks with this patchset added:

$ make sama5d2_icp_mmc_defconfig
$ make -sj
/opt/kernel.org/gcc-12.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld.bfd:
u-boot-spl section `__u_boot_list' will not fit in region `.sram'
/opt/kernel.org/gcc-12.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld.bfd:
region `.sram' overflowed by 32 bytes
make[1]: *** [scripts/Makefile.spl:527: spl/u-boot-spl] Error 1
make: *** [Makefile:2049: spl/u-boot-spl] Error 2
Quoted 4 lines
Quoted 2 lines

So CI build fails and I can't send a pull request. I'm sending a patch though, to fix this image overflow by enabling LTO. Stay tuned...

I see... LTO helped. So can be this patch series now applied?

No problems with this series now in master, so:

Applied to u-boot-marvell/master

Thanks,
Stefan

Quoted 66 lines
Quoted 66 lines

Thanks,
Stefan

Quoted 54 lines
Quoted 54 lines
Quoted 54 lines
---
   board/solidrun/clearfog/README | 20 ++++++++++----------
   1 file changed, 10 insertions(+), 10 deletions(-)
board/solidrun/clearfog/README +10 -10
index ed4a712c5aa2..c86b37061a30 100644
@@ -1,7 +1,7 @@
   Update from original Marvell U-Boot to mainline U-Boot:
   -------------------------------------------------------
 
-Generate the U-Boot image with these commands:
+Generate the U-Boot image for eMMC/SD with these commands:
 
   $ make clearfog_defconfig
   $ make
@@ -9,7 +9,7 @@ $ make
   The resulting image including the SPL binary with the
   full DDR setup is "u-boot-with-spl.kwb".
 
-Now all you need to do is copy this image on a SD card.
+Now all you need to do is copy this image on a SD card's sector 1.
   For example with this command:
 
   $ sudo dd if=u-boot-with-spl.kwb of=/dev/sdX bs=512 seek=1
@@ -20,12 +20,6 @@ of "/dev/sdX" here!
   Install U-Boot on eMMC:
   -----------------------
 
-To make SPL load the main U-Boot image from the eMMC boot partition enable
-eMMC boot acknowledgement and boot partition with the following U-Boot
-command:
-
-  mmc partconf 0 1 1 0
-
   Install U-Boot on eMMC boot partition from Linux running on Clearfog:
 
     echo 0 > /sys/block/mmcblk0boot0/force_ro
@@ -37,8 +31,14 @@ Consider initial boot from UART (see below).
   Install U-Boot on SATA:
   -----------------------
 
-When loading the main U-Boot image from raw SATA sector, set
-CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR to 0x141.
+Generate the U-Boot image for SATA with these commands:
+
+$ make clearfog_sata_defconfig
+$ make
+
+Copy image on a SATA disk's sector 1:
+
+$ sudo dd if=u-boot-with-spl.kwb of=/dev/sdX bs=512 seek=1
 
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
board/solidrun/clearfog/README +0 -1
   Boot selection:
   ---------------
--

2.20.1

Viele Grüße,
Stefan Roese

Quoted 4 lines
Quoted 4 lines
Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#10 lore raw

Re: [PATCH v2 u-boot-mvebu 4/4] arm: mvebu: clearfog: Update eMMC/SD/SATA instructions

Quoted 35 lines · Stefan Roese
Quoted 34 lines · Pali Rohár
Quoted 33 lines · On Thursday 27 April 2023 10:56:17 Stefan Roese wrote:

Hi Pali,

Quoted 9 lines · Pali Rohár
Quoted 8 lines · On Thursday 13 April 2023 22:43:25 Martin Rowe wrote:
Quoted 6 lines · Pali Rohár

BootROM and neither SPL does not use eMMC boot acknowledgement or boot enable bits in EXT_CSD_PART_CONF eMMC register. And also fixed SATA disk sector 0x141 is not used at all.

Quoted 8 lines
Quoted 6 lines

SPL successfully loads u-boot from the same partition as SPL. SD card and UART continue to boot.

Thanks Pali!

Ok, is something more needed for this patch series?

Unfortunately yes. As at least this board breaks with this patchset added:

$ make sama5d2_icp_mmc_defconfig
$ make -sj
/opt/kernel.org/gcc-12.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld.bfd:
u-boot-spl section `__u_boot_list' will not fit in region `.sram'
/opt/kernel.org/gcc-12.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld.bfd:
region `.sram' overflowed by 32 bytes
make[1]: *** [scripts/Makefile.spl:527: spl/u-boot-spl] Error 1
make: *** [Makefile:2049: spl/u-boot-spl] Error 2
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

So CI build fails and I can't send a pull request. I'm sending a patch though, to fix this image overflow by enabling LTO. Stay tuned...

I see... LTO helped. So can be this patch series now applied?

No problems with this series now in master, so:

Applied to u-boot-marvell/master

Hi Stefan,

This patch is still pending as it was not tested by anyone yet :

https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

so , this series still breaks the sama5d2_icp board ?

Thanks,
Eugen

Quoted 80 lines

Thanks,
Stefan

Quoted 68 lines
Quoted 68 lines

Thanks,
Stefan

Quoted 56 lines
Quoted 56 lines
Quoted 56 lines

---
   board/solidrun/clearfog/README | 20 ++++++++++----------

   1 file changed, 10 insertions(+), 10 deletions(-)
board/solidrun/clearfog/README +0 -0
index ed4a712c5aa2..c86b37061a30 100644
@@ -1,7 +1,7 @@

   Update from original Marvell U-Boot to mainline U-Boot:
   -------------------------------------------------------

board/solidrun/clearfog/README +1 -1
-Generate the U-Boot image with these commands:
+Generate the U-Boot image for eMMC/SD with these commands:
   $ make clearfog_defconfig
   $ make
board/solidrun/clearfog/README +0 -0
@@ -9,7 +9,7 @@ $ make

   The resulting image including the SPL binary with the full DDR setup is "u-boot-with-spl.kwb".

board/solidrun/clearfog/README +1 -1
-Now all you need to do is copy this image on a SD card.
+Now all you need to do is copy this image on a SD card's sector 1.

   For example with this command:

   $ sudo dd if=u-boot-with-spl.kwb of=/dev/sdX bs=512 seek=1
board/solidrun/clearfog/README +0 -0
@@ -20,12 +20,6 @@ of "/dev/sdX" here!

   Install U-Boot on eMMC:
   -----------------------

-To make SPL load the main U-Boot image from the eMMC boot partition enable
-eMMC boot acknowledgement and boot partition with the following U-Boot

board/solidrun/clearfog/README +0 -4
-command:
-
-  mmc partconf 0 1 1 0
-

   Install U-Boot on eMMC boot partition from Linux running on Clearfog:

     echo 0 > /sys/block/mmcblk0boot0/force_ro

board/solidrun/clearfog/README +0 -0
@@ -37,8 +31,14 @@ Consider initial boot from UART (see below).

   Install U-Boot on SATA:
   -----------------------

board/solidrun/clearfog/README +8 -2
-When loading the main U-Boot image from raw SATA sector, set
-CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR to 0x141.
+Generate the U-Boot image for SATA with these commands:
+
+$ make clearfog_sata_defconfig
+$ make
+
+Copy image on a SATA disk's sector 1:
+
+$ sudo dd if=u-boot-with-spl.kwb of=/dev/sdX bs=512 seek=1
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

   Boot selection:
   ---------------

Signature · 1 line
2.20.1

Viele Grüße,
Stefan Roese

Quoted 4 lines
Quoted 4 lines
Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]

Viele Grüße,
Stefan Roese

#11 lore raw

Re: [PATCH v2 u-boot-mvebu 4/4] arm: mvebu: clearfog: Update eMMC/SD/SATA instructions

Hi Eugen,

Quoted 45 lines · Eugen Hristev
Quoted 35 lines · Stefan Roese
Quoted 34 lines · Pali Rohár
Quoted 33 lines · On Thursday 27 April 2023 10:56:17 Stefan Roese wrote:

Hi Pali,

Quoted 9 lines · Pali Rohár
Quoted 8 lines · On Thursday 13 April 2023 22:43:25 Martin Rowe wrote:
Quoted 6 lines · Pali Rohár

BootROM and neither SPL does not use eMMC boot acknowledgement or boot enable bits in EXT_CSD_PART_CONF eMMC register. And also fixed SATA disk sector 0x141 is not used at all.

Quoted 8 lines
Quoted 6 lines

SPL successfully loads u-boot from the same partition as SPL. SD card and UART continue to boot.

Thanks Pali!

Ok, is something more needed for this patch series?

Unfortunately yes. As at least this board breaks with this patchset added:

$ make sama5d2_icp_mmc_defconfig
$ make -sj
/opt/kernel.org/gcc-12.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld.bfd:
u-boot-spl section `__u_boot_list' will not fit in region `.sram'
/opt/kernel.org/gcc-12.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld.bfd:
region `.sram' overflowed by 32 bytes
make[1]: *** [scripts/Makefile.spl:527: spl/u-boot-spl] Error 1
make: *** [Makefile:2049: spl/u-boot-spl] Error 2
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

So CI build fails and I can't send a pull request. I'm sending a patch though, to fix this image overflow by enabling LTO. Stay tuned...

I see... LTO helped. So can be this patch series now applied?

No problems with this series now in master, so:

Applied to u-boot-marvell/master

Quoted 7 lines

Hi Stefan,

This patch is still pending as it was not tested by anyone yet :

https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

so , this series still breaks the sama5d2_icp board ?

No. Azure CI build has run w/o any problems. Otherwise I would not have been able to send a pull request for these patches.

Thanks,
Stefan

Quoted 84 lines

Thanks,
Eugen

Quoted 80 lines

Thanks,
Stefan

Quoted 68 lines
Quoted 68 lines

Thanks,
Stefan

Quoted 56 lines
Quoted 56 lines
Quoted 56 lines

---
   board/solidrun/clearfog/README | 20 ++++++++++----------

   1 file changed, 10 insertions(+), 10 deletions(-)
board/solidrun/clearfog/README +0 -0
index ed4a712c5aa2..c86b37061a30 100644
@@ -1,7 +1,7 @@

   Update from original Marvell U-Boot to mainline U-Boot:
   -------------------------------------------------------

board/solidrun/clearfog/README +1 -1
-Generate the U-Boot image with these commands:
+Generate the U-Boot image for eMMC/SD with these commands:
   $ make clearfog_defconfig
   $ make
board/solidrun/clearfog/README +0 -0
@@ -9,7 +9,7 @@ $ make

   The resulting image including the SPL binary with the full DDR setup is "u-boot-with-spl.kwb".

board/solidrun/clearfog/README +1 -1
-Now all you need to do is copy this image on a SD card.
+Now all you need to do is copy this image on a SD card's sector 1.

   For example with this command:

   $ sudo dd if=u-boot-with-spl.kwb of=/dev/sdX bs=512 seek=1
board/solidrun/clearfog/README +0 -0
@@ -20,12 +20,6 @@ of "/dev/sdX" here!

   Install U-Boot on eMMC:
   -----------------------

-To make SPL load the main U-Boot image from the eMMC boot partition enable
-eMMC boot acknowledgement and boot partition with the following U-Boot

board/solidrun/clearfog/README +0 -4
-command:
-
-  mmc partconf 0 1 1 0
-

   Install U-Boot on eMMC boot partition from Linux running on Clearfog:

     echo 0 > /sys/block/mmcblk0boot0/force_ro

board/solidrun/clearfog/README +0 -0
@@ -37,8 +31,14 @@ Consider initial boot from UART (see below).

   Install U-Boot on SATA:
   -----------------------

board/solidrun/clearfog/README +8 -2
-When loading the main U-Boot image from raw SATA sector, set
-CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR to 0x141.
+Generate the U-Boot image for SATA with these commands:
+
+$ make clearfog_sata_defconfig
+$ make
+
+Copy image on a SATA disk's sector 1:
+
+$ sudo dd if=u-boot-with-spl.kwb of=/dev/sdX bs=512 seek=1
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

   Boot selection:
   ---------------

Signature · 1 line
2.20.1

Viele Grüße,
Stefan Roese

Quoted 4 lines
Quoted 4 lines
Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]

Viele Grüße,
Stefan Roese

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#12 lore raw

Re: [PATCH v2 u-boot-mvebu 4/4] arm: mvebu: clearfog: Update eMMC/SD/SATA instructions

Quoted 50 lines · Stefan Roese

Hi Eugen,

Quoted 47 lines · Eugen Hristev
Quoted 35 lines · Stefan Roese
Quoted 34 lines · Pali Rohár
Quoted 33 lines · On Thursday 27 April 2023 10:56:17 Stefan Roese wrote:

Hi Pali,

Quoted 9 lines · Pali Rohár
Quoted 8 lines · On Thursday 13 April 2023 22:43:25 Martin Rowe wrote:
Quoted 6 lines · Pali Rohár

BootROM and neither SPL does not use eMMC boot acknowledgement or boot enable bits in EXT_CSD_PART_CONF eMMC register. And also fixed SATA disk sector 0x141 is not used at all.

Quoted 8 lines
Quoted 6 lines

SPL successfully loads u-boot from the same partition as SPL. SD card and UART continue to boot.

Thanks Pali!

Ok, is something more needed for this patch series?

Unfortunately yes. As at least this board breaks with this patchset added:

$ make sama5d2_icp_mmc_defconfig
$ make -sj
/opt/kernel.org/gcc-12.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld.bfd:
u-boot-spl section `__u_boot_list' will not fit in region `.sram'
/opt/kernel.org/gcc-12.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld.bfd:
region `.sram' overflowed by 32 bytes
make[1]: *** [scripts/Makefile.spl:527: spl/u-boot-spl] Error 1
make: *** [Makefile:2049: spl/u-boot-spl] Error 2
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

So CI build fails and I can't send a pull request. I'm sending a patch though, to fix this image overflow by enabling LTO. Stay tuned...

I see... LTO helped. So can be this patch series now applied?

No problems with this series now in master, so:

Applied to u-boot-marvell/master

Hi Stefan,

Quoted 8 lines
Quoted 5 lines

This patch is still pending as it was not tested by anyone yet :

https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

so , this series still breaks the sama5d2_icp board ?

No. Azure CI build has run w/o any problems. Otherwise I would not have been able to send a pull request for these patches.

Nice, but, how was the SRAM problem solved ? Anything changed in the patches ?

Quoted 92 lines

Thanks,
Stefan

Quoted 84 lines

Thanks,
Eugen

Quoted 80 lines

Thanks,
Stefan

Quoted 68 lines
Quoted 68 lines

Thanks,
Stefan

Quoted 56 lines
Quoted 56 lines
Quoted 56 lines

---
   board/solidrun/clearfog/README | 20 ++++++++++----------

   1 file changed, 10 insertions(+), 10 deletions(-)
board/solidrun/clearfog/README +0 -0
index ed4a712c5aa2..c86b37061a30 100644
@@ -1,7 +1,7 @@

   Update from original Marvell U-Boot to mainline U-Boot:
   -------------------------------------------------------

board/solidrun/clearfog/README +1 -1
-Generate the U-Boot image with these commands:
+Generate the U-Boot image for eMMC/SD with these commands:
   $ make clearfog_defconfig
   $ make
board/solidrun/clearfog/README +0 -0
@@ -9,7 +9,7 @@ $ make

   The resulting image including the SPL binary with the full DDR setup is "u-boot-with-spl.kwb".

board/solidrun/clearfog/README +1 -1
-Now all you need to do is copy this image on a SD card.
+Now all you need to do is copy this image on a SD card's sector 1.

   For example with this command:

   $ sudo dd if=u-boot-with-spl.kwb of=/dev/sdX bs=512 seek=1
board/solidrun/clearfog/README +0 -0
@@ -20,12 +20,6 @@ of "/dev/sdX" here!

   Install U-Boot on eMMC:
   -----------------------

-To make SPL load the main U-Boot image from the eMMC boot partition enable
-eMMC boot acknowledgement and boot partition with the following U-Boot

board/solidrun/clearfog/README +0 -4
-command:
-
-  mmc partconf 0 1 1 0
-

   Install U-Boot on eMMC boot partition from Linux running on Clearfog:

     echo 0 > /sys/block/mmcblk0boot0/force_ro

board/solidrun/clearfog/README +0 -0
@@ -37,8 +31,14 @@ Consider initial boot from UART (see below).

   Install U-Boot on SATA:
   -----------------------

board/solidrun/clearfog/README +8 -2
-When loading the main U-Boot image from raw SATA sector, set
-CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR to 0x141.
+Generate the U-Boot image for SATA with these commands:
+
+$ make clearfog_sata_defconfig
+$ make
+
+Copy image on a SATA disk's sector 1:
+
+$ sudo dd if=u-boot-with-spl.kwb of=/dev/sdX bs=512 seek=1
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

   Boot selection:
   ---------------

Signature · 1 line
2.20.1

Viele Grüße,
Stefan Roese

Quoted 4 lines
Quoted 4 lines
Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]

Viele Grüße,
Stefan Roese

Viele Grüße,
Stefan Roese

#13 lore raw

Re: [PATCH v2 u-boot-mvebu 4/4] arm: mvebu: clearfog: Update eMMC/SD/SATA instructions

On 5/3/23 12:01, Eugen Hristev wrote:

<snip>

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

So CI build fails and I can't send a pull request. I'm sending a patch though, to fix this image overflow by enabling LTO. Stay tuned...

I see... LTO helped. So can be this patch series now applied?

No problems with this series now in master, so:

Applied to u-boot-marvell/master

Hi Stefan,

This patch is still pending as it was not tested by anyone yet :

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

so , this series still breaks the sama5d2_icp board ?

No. Azure CI build has run w/o any problems. Otherwise I would not have been able to send a pull request for these patches.

Nice, but, how was the SRAM problem solved ? Anything changed in the patches ?

No, the patches are the same.

So how is this problem solved? Frankly, I have no idea. My best guess is that the common code has shrunken a bit in the meantime. So the few bytes more of these patches would fit now.

Thanks,
Stefan