[PATCH v2 u-boot-mvebu 0/4] 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=...
Instead eMMC partition use for booting has to be extracted from Partition access bits: https://lore.kernel.org/u-boot/CAOAjy5SNrLJ=JAKf96Nf7HkFBXWbZLmWAhEs6nEEHS6U...
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(-)

Boot configuration stored in EXT_CSD_PART_CONF register is completely ignored by BootROM.
Fixes: fa03279e198d ("tools: kwboot: Add image type documentation") Signed-off-by: Pali Rohár pali@kernel.org --- tools/kwboot.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/tools/kwboot.c b/tools/kwboot.c index 6bef4610ff8f..550d2494ff68 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -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

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.
Signed-off-by: Pali Rohár pali@kernel.org --- drivers/mmc/mmc.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index dde251c87bc7..771432de354d 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -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);

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) {

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.
Signed-off-by: Pali Rohár pali@kernel.org --- board/solidrun/clearfog/README | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/board/solidrun/clearfog/README b/board/solidrun/clearfog/README index ed4a712c5aa2..c86b37061a30 100644 --- a/board/solidrun/clearfog/README +++ b/board/solidrun/clearfog/README @@ -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: ---------------

On Thu, 13 Apr 2023 at 20:58, Pali Rohár pali@kernel.org wrote:
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.
Signed-off-by: Pali Rohár pali@kernel.org
SPL successfully loads u-boot from the same partition as SPL. SD card and UART continue to boot.
Thanks Pali!
Tested-by: Martin Rowe martin.p.rowe@gmail.com
board/solidrun/clearfog/README | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/board/solidrun/clearfog/README b/board/solidrun/clearfog/README index ed4a712c5aa2..c86b37061a30 100644 --- a/board/solidrun/clearfog/README +++ b/board/solidrun/clearfog/README @@ -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

On Thursday 13 April 2023 22:43:25 Martin Rowe wrote:
On Thu, 13 Apr 2023 at 20:58, Pali Rohár pali@kernel.org wrote:
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.
Signed-off-by: Pali Rohár pali@kernel.org
SPL successfully loads u-boot from the same partition as SPL. SD card and UART continue to boot.
Thanks Pali!
Tested-by: Martin Rowe martin.p.rowe@gmail.com
Ok, is something more needed for this patch series?
board/solidrun/clearfog/README | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/board/solidrun/clearfog/README b/board/solidrun/clearfog/README index ed4a712c5aa2..c86b37061a30 100644 --- a/board/solidrun/clearfog/README +++ b/board/solidrun/clearfog/README @@ -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

Hi Pali,
On 4/27/23 01:44, Pali Rohár wrote:
On Thursday 13 April 2023 22:43:25 Martin Rowe wrote:
On Thu, 13 Apr 2023 at 20:58, Pali Rohár pali@kernel.org wrote:
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.
Signed-off-by: Pali Rohár pali@kernel.org
SPL successfully loads u-boot from the same partition as SPL. SD card and UART continue to boot.
Thanks Pali!
Tested-by: Martin Rowe martin.p.rowe@gmail.com
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
board/solidrun/clearfog/README | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/board/solidrun/clearfog/README b/board/solidrun/clearfog/README index ed4a712c5aa2..c86b37061a30 100644 --- a/board/solidrun/clearfog/README +++ b/board/solidrun/clearfog/README @@ -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
Viele Grüße, Stefan Roese

On Thursday 27 April 2023 10:56:17 Stefan Roese wrote:
Hi Pali,
On 4/27/23 01:44, Pali Rohár wrote:
On Thursday 13 April 2023 22:43:25 Martin Rowe wrote:
On Thu, 13 Apr 2023 at 20:58, Pali Rohár pali@kernel.org wrote:
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.
Signed-off-by: Pali Rohár pali@kernel.org
SPL successfully loads u-boot from the same partition as SPL. SD card and UART continue to boot.
Thanks Pali!
Tested-by: Martin Rowe martin.p.rowe@gmail.com
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...
I see... LTO helped. So can be this patch series now applied?
Thanks, Stefan
board/solidrun/clearfog/README | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/board/solidrun/clearfog/README b/board/solidrun/clearfog/README index ed4a712c5aa2..c86b37061a30 100644 --- a/board/solidrun/clearfog/README +++ b/board/solidrun/clearfog/README @@ -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
Viele Grüße, Stefan Roese
-- 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: sr@denx.de

On 4/29/23 13:08, Pali Rohár wrote:
On Thursday 27 April 2023 10:56:17 Stefan Roese wrote:
Hi Pali,
On 4/27/23 01:44, Pali Rohár wrote:
On Thursday 13 April 2023 22:43:25 Martin Rowe wrote:
On Thu, 13 Apr 2023 at 20:58, Pali Rohár pali@kernel.org wrote:
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.
Signed-off-by: Pali Rohár pali@kernel.org
SPL successfully loads u-boot from the same partition as SPL. SD card and UART continue to boot.
Thanks Pali!
Tested-by: Martin Rowe martin.p.rowe@gmail.com
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...
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
Thanks, Stefan
board/solidrun/clearfog/README | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/board/solidrun/clearfog/README b/board/solidrun/clearfog/README index ed4a712c5aa2..c86b37061a30 100644 --- a/board/solidrun/clearfog/README +++ b/board/solidrun/clearfog/README @@ -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
Viele Grüße, Stefan Roese
-- 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: sr@denx.de
Viele Grüße, Stefan Roese

On 5/3/23 12:17, Stefan Roese wrote:
On 4/29/23 13:08, Pali Rohár wrote:
On Thursday 27 April 2023 10:56:17 Stefan Roese wrote:
Hi Pali,
On 4/27/23 01:44, Pali Rohár wrote:
On Thursday 13 April 2023 22:43:25 Martin Rowe wrote:
On Thu, 13 Apr 2023 at 20:58, Pali Rohár pali@kernel.org wrote:
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.
Signed-off-by: Pali Rohár pali@kernel.org
SPL successfully loads u-boot from the same partition as SPL. SD card and UART continue to boot.
Thanks Pali!
Tested-by: Martin Rowe martin.p.rowe@gmail.com
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...
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/20230427085945.475619-1-sr@...
so , this series still breaks the sama5d2_icp board ?
Thanks, Eugen
Thanks, Stefan
Thanks, Stefan
board/solidrun/clearfog/README | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/board/solidrun/clearfog/README b/board/solidrun/clearfog/README index ed4a712c5aa2..c86b37061a30 100644 --- a/board/solidrun/clearfog/README +++ b/board/solidrun/clearfog/README @@ -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
Viele Grüße, Stefan Roese
-- 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: sr@denx.de
Viele Grüße, Stefan Roese

Hi Eugen,
On 5/3/23 11:43, Eugen Hristev wrote:
On 5/3/23 12:17, Stefan Roese wrote:
On 4/29/23 13:08, Pali Rohár wrote:
On Thursday 27 April 2023 10:56:17 Stefan Roese wrote:
Hi Pali,
On 4/27/23 01:44, Pali Rohár wrote:
On Thursday 13 April 2023 22:43:25 Martin Rowe wrote:
On Thu, 13 Apr 2023 at 20:58, Pali Rohár pali@kernel.org wrote: > > 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. > > Signed-off-by: Pali Rohár pali@kernel.org
SPL successfully loads u-boot from the same partition as SPL. SD card and UART continue to boot.
Thanks Pali!
Tested-by: Martin Rowe martin.p.rowe@gmail.com
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...
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/20230427085945.475619-1-sr@...
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
Thanks, Eugen
Thanks, Stefan
Thanks, Stefan
> --- > board/solidrun/clearfog/README | 20 ++++++++++---------- > 1 file changed, 10 insertions(+), 10 deletions(-) > > diff --git a/board/solidrun/clearfog/README > b/board/solidrun/clearfog/README > index ed4a712c5aa2..c86b37061a30 100644 > --- a/board/solidrun/clearfog/README > +++ b/board/solidrun/clearfog/README > @@ -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 >
Viele Grüße, Stefan Roese
-- 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: sr@denx.de
Viele Grüße, Stefan Roese
Viele Grüße, Stefan Roese

On 5/3/23 12:57, Stefan Roese wrote:
Hi Eugen,
On 5/3/23 11:43, Eugen Hristev wrote:
On 5/3/23 12:17, Stefan Roese wrote:
On 4/29/23 13:08, Pali Rohár wrote:
On Thursday 27 April 2023 10:56:17 Stefan Roese wrote:
Hi Pali,
On 4/27/23 01:44, Pali Rohár wrote:
On Thursday 13 April 2023 22:43:25 Martin Rowe wrote: > On Thu, 13 Apr 2023 at 20:58, Pali Rohár pali@kernel.org wrote: >> >> 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. >> >> Signed-off-by: Pali Rohár pali@kernel.org > > SPL successfully loads u-boot from the same partition as SPL. SD > card > and UART continue to boot. > > Thanks Pali! > > Tested-by: Martin Rowe martin.p.rowe@gmail.com
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...
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/20230427085945.475619-1-sr@...
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 ?
Thanks, Stefan
Thanks, Eugen
Thanks, Stefan
Thanks, Stefan
>> --- >> board/solidrun/clearfog/README | 20 ++++++++++---------- >> 1 file changed, 10 insertions(+), 10 deletions(-) >> >> diff --git a/board/solidrun/clearfog/README >> b/board/solidrun/clearfog/README >> index ed4a712c5aa2..c86b37061a30 100644 >> --- a/board/solidrun/clearfog/README >> +++ b/board/solidrun/clearfog/README >> @@ -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 >>
Viele Grüße, Stefan Roese
-- 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: sr@denx.de
Viele Grüße, Stefan Roese
Viele Grüße, Stefan Roese

On 5/3/23 12:01, Eugen Hristev wrote:
<snip>
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/20230427085945.475619-1-sr@...
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
participants (4)
-
Eugen Hristev
-
Martin Rowe
-
Pali Rohár
-
Stefan Roese