public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v2 0/2] mvebu: clearfog: add support for emmc boot
@ 2023-10-25  8:22 Josua Mayer
  2023-10-25  8:22 ` [PATCH v2 1/2] arm: mvebu: allow additional 4096 offset for bootable mmc image Josua Mayer
  2023-10-25  8:22 ` [PATCH v2 2/2] cmd: mvebu/bubt: move eMMC data-partition uboot from LBA-0 to 4096 Josua Mayer
  0 siblings, 2 replies; 7+ messages in thread
From: Josua Mayer @ 2023-10-25  8:22 UTC (permalink / raw)
  To: u-boot; +Cc: sr, sjg, kabel, Josua Mayer

On Armada 388 booting from eMMC is different to SD-Card in two major ways:

- Environment location
- Sectors scanned by Boot-ROM

This patchset first makes it possible to select offset 4096 for
eMMC partition. Here U-Boot can be placed to avoid conflict
conflict with MBR.

Secondly the bubt command is updated to use LBA-4096 for eMMC data
partition only, keeping previous values for SD and boot0/1 unchanged

Changes since v1:

- New defconfigs for environment location are skipped in this version,
  pending further research if it can be auto-detected.

- invert logic of if statement allowing it to compile both with,
  and without CONFIG_SUPPORT_EMMC_BOOT defined.
  Reported by Stefan Roese with turris_mox_defconfig, thanks!

Josua Mayer (2):
  arm: mvebu: allow additional 4096 offset for bootable mmc image
  cmd: mvebu/bubt: move eMMC data-partition uboot from LBA-0 to 4096

 arch/arm/mach-mvebu/spl.c |  5 +++--
 cmd/mvebu/bubt.c          | 11 +++++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

-- 
2.35.3


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/2] arm: mvebu: allow additional 4096 offset for bootable mmc image
  2023-10-25  8:22 [PATCH v2 0/2] mvebu: clearfog: add support for emmc boot Josua Mayer
@ 2023-10-25  8:22 ` Josua Mayer
  2023-10-26  7:10   ` Stefan Roese
  2023-10-25  8:22 ` [PATCH v2 2/2] cmd: mvebu/bubt: move eMMC data-partition uboot from LBA-0 to 4096 Josua Mayer
  1 sibling, 1 reply; 7+ messages in thread
From: Josua Mayer @ 2023-10-25  8:22 UTC (permalink / raw)
  To: u-boot; +Cc: sr, sjg, kabel, Josua Mayer

Disarm the error message forcing u-boot/spl image to be located at
sector 0 on eMMC data-partition and microSD.
Offset 0 makes sense on eMMC boot partitions only, data partition must
use 4096 to avoid conflicting with MBR.

Valid offsets when booting from microSD, reported by boot-rom v1.73:

BootROM: Bad header at offset 00000200
BootROM: Bad header at offset 00004400
BootROM: Bad header at offset 00200000
BootROM: Bad header at offset 00400000
BootROM: Bad header at offset 00600000
BootROM: Bad header at offset 00800000
BootROM: Bad header at offset 00A00000
BootROM: Bad header at offset 00C00000
BootROM: Bad header at offset 00E00000
BootROM: Bad header at offset 01000000
BootROM: Bad header at offset 01200000
BootROM: Bad header at offset 01400000
BootROM: Bad header at offset 01600000
BootROM: Bad header at offset 01800000
BootROM: Bad header at offset 01A00000
BootROM: Bad header at offset 01C00000
BootROM: Bad header at offset 01E00000
BootROM: Bad header at offset 02000000
BootROM: Bad header at offset 02200000
BootROM: Bad header at offset 02400000
BootROM: Bad header at offset 02600000
BootROM: Bad header at offset 02800000
BootROM: Bad header at offset 02A00000
BootROM: Bad header at offset 02C00000
BootROM: Bad header at offset 02E00000

Valid offsets when booting from eMMC:

BootROM: Bad header at offset 00000000
BootROM: Bad header at offset 00200000
Switching BootPartitions.
BootROM: Bad header at offset 00000000
BootROM: Bad header at offset 00200000

Fixes: 2226ca17348 ("arm: mvebu: Load U-Boot proper binary in SPL code based on kwbimage header")

Signed-off-by: Josua Mayer <josua@solid-run.com>
---
 arch/arm/mach-mvebu/spl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c
index eaaa68a8564..79f8877745b 100644
--- a/arch/arm/mach-mvebu/spl.c
+++ b/arch/arm/mach-mvebu/spl.c
@@ -71,8 +71,9 @@
 #error CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR must be set to 0
 #endif
 #if !defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET) || \
-    CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET != 0
-#error CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET must be set to 0
+    (CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET != 0 && \
+     CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET != 4096)
+#error CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET must be set to either 0 or 4096
 #endif
 #endif
 
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/2] cmd: mvebu/bubt: move eMMC data-partition uboot from LBA-0 to 4096
  2023-10-25  8:22 [PATCH v2 0/2] mvebu: clearfog: add support for emmc boot Josua Mayer
  2023-10-25  8:22 ` [PATCH v2 1/2] arm: mvebu: allow additional 4096 offset for bootable mmc image Josua Mayer
@ 2023-10-25  8:22 ` Josua Mayer
  2023-10-26  7:10   ` Stefan Roese
  1 sibling, 1 reply; 7+ messages in thread
From: Josua Mayer @ 2023-10-25  8:22 UTC (permalink / raw)
  To: u-boot; +Cc: sr, sjg, kabel, Josua Mayer

A38x bootrom only searches 2 sectors when booting from eMMC,
irregardless of data or boot partition: 0 & 4096.

For eMMC boot partitions sector 0 is fine, but on data partition it
conflicts with MBR.

Change bubt command default to 4096 for eMMC data partition only, to
allow using an MBR partition table on the eMMC data partition while also
booting from it.

Signed-off-by: Josua Mayer <josua@solid-run.com>
---
V1 -> V2: fixed build without CONFIG_SUPPORT_EMMC_BOOT

 cmd/mvebu/bubt.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c
index ca24a5c1c4b..744b1c20aa8 100644
--- a/cmd/mvebu/bubt.c
+++ b/cmd/mvebu/bubt.c
@@ -240,9 +240,16 @@ static int mmc_burn_image(size_t image_size)
 #endif
 
 	/* SD reserves LBA-0 for MBR and boots from LBA-1,
-	 * MMC/eMMC boots from LBA-0
+	 * MMC/eMMC boots from LBA-0 and LBA-4096
 	 */
-	start_lba = IS_SD(mmc) ? 1 : 0;
+	if (IS_SD(mmc))
+		start_lba = 1;
+#ifdef CONFIG_SUPPORT_EMMC_BOOT
+	else if (part)
+		start_lba = 0;
+#endif
+	else
+		start_lba = 4096;
 #ifdef CONFIG_BLK
 	blk_count = image_size / mmc->write_bl_len;
 	if (image_size % mmc->write_bl_len)
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/2] arm: mvebu: allow additional 4096 offset for bootable mmc image
  2023-10-25  8:22 ` [PATCH v2 1/2] arm: mvebu: allow additional 4096 offset for bootable mmc image Josua Mayer
@ 2023-10-26  7:10   ` Stefan Roese
  2023-10-27  6:49     ` Stefan Roese
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Roese @ 2023-10-26  7:10 UTC (permalink / raw)
  To: Josua Mayer, u-boot; +Cc: sjg, kabel

On 10/25/23 10:22, Josua Mayer wrote:
> Disarm the error message forcing u-boot/spl image to be located at
> sector 0 on eMMC data-partition and microSD.
> Offset 0 makes sense on eMMC boot partitions only, data partition must
> use 4096 to avoid conflicting with MBR.
> 
> Valid offsets when booting from microSD, reported by boot-rom v1.73:
> 
> BootROM: Bad header at offset 00000200
> BootROM: Bad header at offset 00004400
> BootROM: Bad header at offset 00200000
> BootROM: Bad header at offset 00400000
> BootROM: Bad header at offset 00600000
> BootROM: Bad header at offset 00800000
> BootROM: Bad header at offset 00A00000
> BootROM: Bad header at offset 00C00000
> BootROM: Bad header at offset 00E00000
> BootROM: Bad header at offset 01000000
> BootROM: Bad header at offset 01200000
> BootROM: Bad header at offset 01400000
> BootROM: Bad header at offset 01600000
> BootROM: Bad header at offset 01800000
> BootROM: Bad header at offset 01A00000
> BootROM: Bad header at offset 01C00000
> BootROM: Bad header at offset 01E00000
> BootROM: Bad header at offset 02000000
> BootROM: Bad header at offset 02200000
> BootROM: Bad header at offset 02400000
> BootROM: Bad header at offset 02600000
> BootROM: Bad header at offset 02800000
> BootROM: Bad header at offset 02A00000
> BootROM: Bad header at offset 02C00000
> BootROM: Bad header at offset 02E00000
> 
> Valid offsets when booting from eMMC:
> 
> BootROM: Bad header at offset 00000000
> BootROM: Bad header at offset 00200000
> Switching BootPartitions.
> BootROM: Bad header at offset 00000000
> BootROM: Bad header at offset 00200000
> 
> Fixes: 2226ca17348 ("arm: mvebu: Load U-Boot proper binary in SPL code based on kwbimage header")
> 
> Signed-off-by: Josua Mayer <josua@solid-run.com>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan


> ---
>   arch/arm/mach-mvebu/spl.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c
> index eaaa68a8564..79f8877745b 100644
> --- a/arch/arm/mach-mvebu/spl.c
> +++ b/arch/arm/mach-mvebu/spl.c
> @@ -71,8 +71,9 @@
>   #error CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR must be set to 0
>   #endif
>   #if !defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET) || \
> -    CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET != 0
> -#error CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET must be set to 0
> +    (CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET != 0 && \
> +     CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET != 4096)
> +#error CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET must be set to either 0 or 4096
>   #endif
>   #endif
>   

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/2] cmd: mvebu/bubt: move eMMC data-partition uboot from LBA-0 to 4096
  2023-10-25  8:22 ` [PATCH v2 2/2] cmd: mvebu/bubt: move eMMC data-partition uboot from LBA-0 to 4096 Josua Mayer
@ 2023-10-26  7:10   ` Stefan Roese
  2023-10-27  6:49     ` Stefan Roese
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Roese @ 2023-10-26  7:10 UTC (permalink / raw)
  To: Josua Mayer, u-boot; +Cc: sjg, kabel

On 10/25/23 10:22, Josua Mayer wrote:
> A38x bootrom only searches 2 sectors when booting from eMMC,
> irregardless of data or boot partition: 0 & 4096.
> 
> For eMMC boot partitions sector 0 is fine, but on data partition it
> conflicts with MBR.
> 
> Change bubt command default to 4096 for eMMC data partition only, to
> allow using an MBR partition table on the eMMC data partition while also
> booting from it.
> 
> Signed-off-by: Josua Mayer <josua@solid-run.com>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
> V1 -> V2: fixed build without CONFIG_SUPPORT_EMMC_BOOT
> 
>   cmd/mvebu/bubt.c | 11 +++++++++--
>   1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c
> index ca24a5c1c4b..744b1c20aa8 100644
> --- a/cmd/mvebu/bubt.c
> +++ b/cmd/mvebu/bubt.c
> @@ -240,9 +240,16 @@ static int mmc_burn_image(size_t image_size)
>   #endif
>   
>   	/* SD reserves LBA-0 for MBR and boots from LBA-1,
> -	 * MMC/eMMC boots from LBA-0
> +	 * MMC/eMMC boots from LBA-0 and LBA-4096
>   	 */
> -	start_lba = IS_SD(mmc) ? 1 : 0;
> +	if (IS_SD(mmc))
> +		start_lba = 1;
> +#ifdef CONFIG_SUPPORT_EMMC_BOOT
> +	else if (part)
> +		start_lba = 0;
> +#endif
> +	else
> +		start_lba = 4096;
>   #ifdef CONFIG_BLK
>   	blk_count = image_size / mmc->write_bl_len;
>   	if (image_size % mmc->write_bl_len)

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/2] arm: mvebu: allow additional 4096 offset for bootable mmc image
  2023-10-26  7:10   ` Stefan Roese
@ 2023-10-27  6:49     ` Stefan Roese
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Roese @ 2023-10-27  6:49 UTC (permalink / raw)
  To: Josua Mayer, u-boot; +Cc: sjg, kabel

On 10/26/23 09:10, Stefan Roese wrote:
> On 10/25/23 10:22, Josua Mayer wrote:
>> Disarm the error message forcing u-boot/spl image to be located at
>> sector 0 on eMMC data-partition and microSD.
>> Offset 0 makes sense on eMMC boot partitions only, data partition must
>> use 4096 to avoid conflicting with MBR.
>>
>> Valid offsets when booting from microSD, reported by boot-rom v1.73:
>>
>> BootROM: Bad header at offset 00000200
>> BootROM: Bad header at offset 00004400
>> BootROM: Bad header at offset 00200000
>> BootROM: Bad header at offset 00400000
>> BootROM: Bad header at offset 00600000
>> BootROM: Bad header at offset 00800000
>> BootROM: Bad header at offset 00A00000
>> BootROM: Bad header at offset 00C00000
>> BootROM: Bad header at offset 00E00000
>> BootROM: Bad header at offset 01000000
>> BootROM: Bad header at offset 01200000
>> BootROM: Bad header at offset 01400000
>> BootROM: Bad header at offset 01600000
>> BootROM: Bad header at offset 01800000
>> BootROM: Bad header at offset 01A00000
>> BootROM: Bad header at offset 01C00000
>> BootROM: Bad header at offset 01E00000
>> BootROM: Bad header at offset 02000000
>> BootROM: Bad header at offset 02200000
>> BootROM: Bad header at offset 02400000
>> BootROM: Bad header at offset 02600000
>> BootROM: Bad header at offset 02800000
>> BootROM: Bad header at offset 02A00000
>> BootROM: Bad header at offset 02C00000
>> BootROM: Bad header at offset 02E00000
>>
>> Valid offsets when booting from eMMC:
>>
>> BootROM: Bad header at offset 00000000
>> BootROM: Bad header at offset 00200000
>> Switching BootPartitions.
>> BootROM: Bad header at offset 00000000
>> BootROM: Bad header at offset 00200000
>>
>> Fixes: 2226ca17348 ("arm: mvebu: Load U-Boot proper binary in SPL code 
>> based on kwbimage header")
>>
>> Signed-off-by: Josua Mayer <josua@solid-run.com>
> 
> Reviewed-by: Stefan Roese <sr@denx.de>

Applied to u-boot-marvell/master

Thanks,
Stefan

> 
> Thanks,
> Stefan
> 
> 
>> ---
>>   arch/arm/mach-mvebu/spl.c | 5 +++--
>>   1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c
>> index eaaa68a8564..79f8877745b 100644
>> --- a/arch/arm/mach-mvebu/spl.c
>> +++ b/arch/arm/mach-mvebu/spl.c
>> @@ -71,8 +71,9 @@
>>   #error CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR must be set to 0
>>   #endif
>>   #if !defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET) || \
>> -    CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET != 0
>> -#error CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET must be set 
>> to 0
>> +    (CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET != 0 && \
>> +     CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET != 4096)
>> +#error CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET must be set 
>> to either 0 or 4096
>>   #endif
>>   #endif
> 
> Viele Grüße,
> Stefan Roese
> 

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/2] cmd: mvebu/bubt: move eMMC data-partition uboot from LBA-0 to 4096
  2023-10-26  7:10   ` Stefan Roese
@ 2023-10-27  6:49     ` Stefan Roese
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Roese @ 2023-10-27  6:49 UTC (permalink / raw)
  To: Josua Mayer, u-boot; +Cc: sjg, kabel

On 10/26/23 09:10, Stefan Roese wrote:
> On 10/25/23 10:22, Josua Mayer wrote:
>> A38x bootrom only searches 2 sectors when booting from eMMC,
>> irregardless of data or boot partition: 0 & 4096.
>>
>> For eMMC boot partitions sector 0 is fine, but on data partition it
>> conflicts with MBR.
>>
>> Change bubt command default to 4096 for eMMC data partition only, to
>> allow using an MBR partition table on the eMMC data partition while also
>> booting from it.
>>
>> Signed-off-by: Josua Mayer <josua@solid-run.com>
> 
> Reviewed-by: Stefan Roese <sr@denx.de>

Applied to u-boot-marvell/master

Thanks,
Stefan

> Thanks,
> Stefan
> 
>> ---
>> V1 -> V2: fixed build without CONFIG_SUPPORT_EMMC_BOOT
>>
>>   cmd/mvebu/bubt.c | 11 +++++++++--
>>   1 file changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c
>> index ca24a5c1c4b..744b1c20aa8 100644
>> --- a/cmd/mvebu/bubt.c
>> +++ b/cmd/mvebu/bubt.c
>> @@ -240,9 +240,16 @@ static int mmc_burn_image(size_t image_size)
>>   #endif
>>       /* SD reserves LBA-0 for MBR and boots from LBA-1,
>> -     * MMC/eMMC boots from LBA-0
>> +     * MMC/eMMC boots from LBA-0 and LBA-4096
>>        */
>> -    start_lba = IS_SD(mmc) ? 1 : 0;
>> +    if (IS_SD(mmc))
>> +        start_lba = 1;
>> +#ifdef CONFIG_SUPPORT_EMMC_BOOT
>> +    else if (part)
>> +        start_lba = 0;
>> +#endif
>> +    else
>> +        start_lba = 4096;
>>   #ifdef CONFIG_BLK
>>       blk_count = image_size / mmc->write_bl_len;
>>       if (image_size % mmc->write_bl_len)
> 
> Viele Grüße,
> Stefan Roese
> 

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-10-27  6:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-25  8:22 [PATCH v2 0/2] mvebu: clearfog: add support for emmc boot Josua Mayer
2023-10-25  8:22 ` [PATCH v2 1/2] arm: mvebu: allow additional 4096 offset for bootable mmc image Josua Mayer
2023-10-26  7:10   ` Stefan Roese
2023-10-27  6:49     ` Stefan Roese
2023-10-25  8:22 ` [PATCH v2 2/2] cmd: mvebu/bubt: move eMMC data-partition uboot from LBA-0 to 4096 Josua Mayer
2023-10-26  7:10   ` Stefan Roese
2023-10-27  6:49     ` Stefan Roese

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox