Skip to contentSkip to conversation

verdin-am62: add u-boot update wrappers and fix check for minimum memory size

PATCH In review Emanuele Ghidoli 5 participants 15 messages Aug 24, 2023 – Sep 9, 2023

lore
Share & tools
lore
#0 lore raw

cover verdin-am62: add u-boot update wrappers and fix check for minimum memory size

From: Emanuele Ghidoli <[email protected]>

This series add boot update wrappers to Toradex Verdin AM62 SoM and fix the minimum memory size warning.
These wrappes allow flash all U-Boot binaries:
R5 SPL, A53 SPL and A53 U-Boot proper.

Emanuele Ghidoli (2):
verdin-am62: add u-boot update wrappers
board: verdin-am62: fix check for minimum memory size

 board/toradex/verdin-am62/verdin-am62.c |  4 ++--
 include/configs/verdin-am62.h           | 12 +++++++++++-
 2 files changed, 13 insertions(+), 3 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/2 verdin-am62: add u-boot update wrappers

From: Emanuele Ghidoli <[email protected]>

Add update_tiboot3, update_tispl and update_uboot wrappers to update R5 SPL, A53 SPL and A53 U-boot respectively.

Usage example:

Quoted 8 lines

tftpboot ${loadaddr} tiboot3-am62x-gp-verdin.bin
run update_tiboot3

tftpboot ${loadaddr} tispl.bin
run update_tispl

tftpboot ${loadaddr} u-boot.img
run update_uboot

---
 include/configs/verdin-am62.h | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
include/configs/verdin-am62.h +11 -1
index 7990ea831022..91fc0f03a81a 100644
@@ -46,10 +46,20 @@
 	"fdt_board=dev\0" \
 	"setup=setenv setupargs console=tty1 console=${console},${baudrate} " \
 		"consoleblank=0 earlycon=ns16550a,mmio32,0x02800000\0" \
-	"update_uboot=askenv confirm Did you load flash.bin (y/N)?; " \
+	"update_tiboot3=askenv confirm Did you load tiboot3.bin (y/N)?; " \
 		"if test \"$confirm\" = \"y\"; then " \
 		"setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt " \
 		"${blkcnt} / 0x200; mmc dev 0 1; mmc write ${loadaddr} 0x0 " \
+		"${blkcnt}; fi\0" \
+	"update_tispl=askenv confirm Did you load tispl.bin (y/N)?; " \
+		"if test \"$confirm\" = \"y\"; then " \
+		"setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt " \
+		"${blkcnt} / 0x200; mmc dev 0 1; mmc write ${loadaddr} 0x400 " \
+		"${blkcnt}; fi\0" \
+	"update_uboot=askenv confirm Did you load u-boot.img (y/N)?; " \
+		"if test \"$confirm\" = \"y\"; then " \
+		"setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt " \
+		"${blkcnt} / 0x200; mmc dev 0 1; mmc write ${loadaddr} 0x1400 " \
 		"${blkcnt}; fi\0"
 
 #endif /* __VERDIN_AM62_H */
Signature · 1 line
2.34.1
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH v1 1/2] verdin-am62: add u-boot update wrappers

Quoted 9 lines · Emanuele Ghidoli

From: Emanuele Ghidoli <[email protected]>

Add update_tiboot3, update_tispl and update_uboot wrappers to update R5 SPL, A53 SPL and A53 U-boot respectively.

Usage example:

Quoted 2 lines

tftpboot ${loadaddr} tiboot3-am62x-gp-verdin.bin
run update_tiboot3

Quoted 7 lines
Quoted 5 lines

tftpboot ${loadaddr} tispl.bin
run update_tispl

tftpboot ${loadaddr} u-boot.img
run update_uboot

#3 lore raw

Re: [PATCH v1 1/2] verdin-am62: add u-boot update wrappers

Quoted 13 lines · Francesco Dolcini
Quoted 12 lines · Emanuele Ghidoli

From: Emanuele Ghidoli <[email protected]>

Add update_tiboot3, update_tispl and update_uboot wrappers to update R5 SPL, A53 SPL and A53 U-boot respectively.

Usage example:

Quoted 5 lines

tftpboot ${loadaddr} tiboot3-am62x-gp-verdin.bin
run update_tiboot3

tftpboot ${loadaddr} tispl.bin
run update_tispl

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

tftpboot ${loadaddr} u-boot.img
run update_uboot

Should you update documentation to indicate the usage?

Currently the documentation says:
Flash to eMMC
-------------

.. code-block:: bash

    => mmc dev 0 1
    => fatload mmc 1 ${loadaddr} tiboot3.bin
    => mmc write ${loadaddr} 0x0 0x400
    => fatload mmc 1 ${loadaddr} tispl.bin
    => mmc write ${loadaddr} 0x400 0x1000
    => fatload mmc 1 ${loadaddr} u-boot.img
    => mmc write ${loadaddr} 0x1400 0x2000
Signature · 3 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
#4 lore raw

Re: [PATCH v1 1/2] verdin-am62: add u-boot update wrappers

Hello Nishanth,

Quoted 14 lines · Nishanth Menon
Quoted 13 lines · Francesco Dolcini
Quoted 12 lines · Emanuele Ghidoli

From: Emanuele Ghidoli <[email protected]>

Add update_tiboot3, update_tispl and update_uboot wrappers to update R5 SPL, A53 SPL and A53 U-boot respectively.

Usage example:

Quoted 5 lines

tftpboot ${loadaddr} tiboot3-am62x-gp-verdin.bin
run update_tiboot3

tftpboot ${loadaddr} tispl.bin
run update_tispl

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

tftpboot ${loadaddr} u-boot.img
run update_uboot

Should you update documentation to indicate the usage?

Yeah, probably we could add it. I would not remove the existing direct command usage since this is adding just env variables that could be removed from the env even at runtime.

In general the reason for these commands is that our users are accustomed to have a "guided" way to update u-boot without having to dig into the documentation. They are just convenient.

Marcel: what do you think?

Francesco

#5 lore raw

Re: [PATCH v1 1/2] verdin-am62: add u-boot update wrappers

Quoted 30 lines · Francesco Dolcini

Hello Nishanth,

Quoted 14 lines · Nishanth Menon
Quoted 13 lines · Francesco Dolcini
Quoted 12 lines · Emanuele Ghidoli

From: Emanuele Ghidoli <[email protected]>

Add update_tiboot3, update_tispl and update_uboot wrappers to update R5 SPL, A53 SPL and A53 U-boot respectively.

Usage example:

Quoted 5 lines

tftpboot ${loadaddr} tiboot3-am62x-gp-verdin.bin
run update_tiboot3

tftpboot ${loadaddr} tispl.bin
run update_tispl

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

tftpboot ${loadaddr} u-boot.img
run update_uboot

Should you update documentation to indicate the usage?

Yeah, probably we could add it. I would not remove the existing direct command usage since this is adding just env variables that could be removed from the env even at runtime.

Quoted 5 lines

In general the reason for these commands is that our users are accustomed to have a "guided" way to update u-boot without having to dig into the documentation. They are just convenient.

Marcel: what do you think?

Sure, we took care of it here:

https://lore.kernel.org/all/[email protected]

Quoted 1 line

Francesco

Cheers

Marcel

#6 lore raw

Re: [PATCH v1 1/2] verdin-am62: add u-boot update wrappers

In reply to Emanuele Ghidoli
Quoted 9 lines · Emanuele Ghidoli

From: Emanuele Ghidoli <[email protected]>

Add update_tiboot3, update_tispl and update_uboot wrappers to update R5 SPL, A53 SPL and A53 U-boot respectively.

Usage example:

Quoted 2 lines

tftpboot ${loadaddr} tiboot3-am62x-gp-verdin.bin
run update_tiboot3

Quoted 8 lines
Quoted 5 lines

tftpboot ${loadaddr} tispl.bin
run update_tispl

tftpboot ${loadaddr} u-boot.img
run update_uboot

Applied to u-boot/next, thanks!

Signature · 1 line
Tom
#7 lore raw

PATCH 2/2 board: verdin-am62: fix check for minimum memory size

In reply to Emanuele Ghidoli

From: Emanuele Ghidoli <[email protected]>

verdin am62 SKUs comes in multiple memory configuration, check that the detected memory is at least 512MB since we have some reserved memory just before this threshold and therefore the module cannot work with less memory.

Fixes 7d1a10659f5b ("board: toradex: add verdin am62 support")
---
 board/toradex/verdin-am62/verdin-am62.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
board/toradex/verdin-am62/verdin-am62.c +2 -2
index a3d1d07a0cbf..d09dda5bccc9 100644
@@ -28,8 +28,8 @@ int dram_init(void)
 {
 	gd->ram_size = get_ram_size((long *)CFG_SYS_SDRAM_BASE, CFG_SYS_SDRAM_SIZE);
 
-	if (gd->ram_size < SZ_64M)
-		puts("## WARNING: Less than 64MB RAM detected\n");
+	if (gd->ram_size < SZ_512M)
+		puts("## WARNING: Less than 512MB RAM detected\n");
 
 	return 0;
 }
Signature · 1 line
2.34.1
Acked-by on v1 2/2
#8 lore raw

Re: [PATCH v1 2/2] board: verdin-am62: fix check for minimum memory size

Quoted 9 lines · Emanuele Ghidoli

From: Emanuele Ghidoli <[email protected]>

verdin am62 SKUs comes in multiple memory configuration, check that the detected memory is at least 512MB since we have some reserved memory just before this threshold and therefore the module cannot work with less memory.

Fixes 7d1a10659f5b ("board: toradex: add verdin am62 support")
#9 lore raw

Re: [PATCH v1 2/2] board: verdin-am62: fix check for minimum memory size

In reply to Emanuele Ghidoli
Quoted 18 lines · Emanuele Ghidoli

From: Emanuele Ghidoli <[email protected]>

verdin am62 SKUs comes in multiple memory configuration, check that the detected memory is at least 512MB since we have some reserved memory just before this threshold and therefore the module cannot work with less memory.

Fixes 7d1a10659f5b ("board: toradex: add verdin am62 support")
---
 board/toradex/verdin-am62/verdin-am62.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
board/toradex/verdin-am62/verdin-am62.c +0 -0
index a3d1d07a0cbf..d09dda5bccc9 100644

board/toradex/verdin-am62/verdin-am62.c int dram_init(void) · line 32

Quoted 7 lines
board/toradex/verdin-am62/verdin-am62.c +2 -2
@@ -28,8 +28,8 @@ int dram_init(void)
 {
 	gd->ram_size = get_ram_size((long *)CFG_SYS_SDRAM_BASE, CFG_SYS_SDRAM_SIZE);
 
-	if (gd->ram_size < SZ_64M)
-		puts("## WARNING: Less than 64MB RAM detected\n");
+	if (gd->ram_size < SZ_512M)
+		puts("## WARNING: Less than 512MB RAM detected\n");

Have you considered fdtdec_setup_mem_size_base fdtdec_setup_memory_banksize - in which case the reserved memory regions can be changed in dt (will need corresponding custom binaries ofcourse)..

Quoted 6 lines
board/toradex/verdin-am62/verdin-am62.c +0 -0
 	return 0;
 }
Signature · 1 line
2.34.1
Signature · 3 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
#10 lore raw

Re: [PATCH v1 2/2] board: verdin-am62: fix check for minimum memory size

Hello Nishanth,

Quoted 22 lines · Nishanth Menon
Quoted 21 lines · Emanuele Ghidoli

From: Emanuele Ghidoli <[email protected]>

verdin am62 SKUs comes in multiple memory configuration, check that the detected memory is at least 512MB since we have some reserved memory just before this threshold and therefore the module cannot work with less memory.

Fixes 7d1a10659f5b ("board: toradex: add verdin am62 support")
---
 board/toradex/verdin-am62/verdin-am62.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
board/toradex/verdin-am62/verdin-am62.c +0 -0
index a3d1d07a0cbf..d09dda5bccc9 100644
@@ -28,8 +28,8 @@ int dram_init(void)
 {
 	gd->ram_size = get_ram_size((long *)CFG_SYS_SDRAM_BASE, CFG_SYS_SDRAM_SIZE);
 
Quoted 9 lines

board/toradex/verdin-am62/verdin-am62.c int dram_init(void) · line 32

Quoted 4 lines
board/toradex/verdin-am62/verdin-am62.c +2 -2
-	if (gd->ram_size < SZ_64M)
-		puts("## WARNING: Less than 64MB RAM detected\n");
+	if (gd->ram_size < SZ_512M)
+		puts("## WARNING: Less than 512MB RAM detected\n");

Have you considered fdtdec_setup_mem_size_base fdtdec_setup_memory_banksize - in which case the reserved memory regions can be changed in dt (will need corresponding custom binaries ofcourse)..

I would say that custom binaries is not something we want. Our goal is to rely on whatever TI is providing and to not deviate from it unless required. Luckily enough for the moment it works since our minimum memory size is 512MB.

Francesco

#11 lore raw

Re: [PATCH v1 2/2] board: verdin-am62: fix check for minimum memory size

Quoted 35 lines · Francesco Dolcini

Hello Nishanth,

Quoted 22 lines · Nishanth Menon
Quoted 21 lines · Emanuele Ghidoli

From: Emanuele Ghidoli <[email protected]>

verdin am62 SKUs comes in multiple memory configuration, check that the detected memory is at least 512MB since we have some reserved memory just before this threshold and therefore the module cannot work with less memory.

Fixes 7d1a10659f5b ("board: toradex: add verdin am62 support")
---
 board/toradex/verdin-am62/verdin-am62.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
board/toradex/verdin-am62/verdin-am62.c +0 -0
index a3d1d07a0cbf..d09dda5bccc9 100644
@@ -28,8 +28,8 @@ int dram_init(void)
 {
 	gd->ram_size = get_ram_size((long *)CFG_SYS_SDRAM_BASE, CFG_SYS_SDRAM_SIZE);
 
Quoted 9 lines

board/toradex/verdin-am62/verdin-am62.c int dram_init(void) · line 32

Quoted 4 lines
board/toradex/verdin-am62/verdin-am62.c +2 -2
-	if (gd->ram_size < SZ_64M)
-		puts("## WARNING: Less than 64MB RAM detected\n");
+	if (gd->ram_size < SZ_512M)
+		puts("## WARNING: Less than 512MB RAM detected\n");

Have you considered fdtdec_setup_mem_size_base fdtdec_setup_memory_banksize - in which case the reserved memory regions can be changed in dt (will need corresponding custom binaries ofcourse)..

Quoted 4 lines

I would say that custom binaries is not something we want. Our goal is to rely on whatever TI is providing and to not deviate from it unless required. Luckily enough for the moment it works since our minimum memory size is 512MB.

Sure - you will still benefit using fdtdec_setup_mem_size_base and fdtdec_setup_memory_banksize, but really, your call.

Signature · 3 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
#12 lore raw

Re: [PATCH v1 2/2] board: verdin-am62: fix check for minimum memory size

Quoted 36 lines · Nishanth Menon
Quoted 35 lines · Francesco Dolcini

Hello Nishanth,

Quoted 31 lines · Nishanth Menon
Quoted 18 lines · Emanuele Ghidoli

From: Emanuele Ghidoli <[email protected]>

verdin am62 SKUs comes in multiple memory configuration, check that the detected memory is at least 512MB since we have some reserved memory just before this threshold and therefore the module cannot work with less memory.

Fixes 7d1a10659f5b ("board: toradex: add verdin am62 support")
---
 board/toradex/verdin-am62/verdin-am62.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
board/toradex/verdin-am62/verdin-am62.c +0 -0
index a3d1d07a0cbf..d09dda5bccc9 100644

board/toradex/verdin-am62/verdin-am62.c int dram_init(void) · line 32

Quoted 7 lines
board/toradex/verdin-am62/verdin-am62.c +2 -2
@@ -28,8 +28,8 @@ int dram_init(void)
 {
 	gd->ram_size = get_ram_size((long *)CFG_SYS_SDRAM_BASE, CFG_SYS_SDRAM_SIZE);
 
-	if (gd->ram_size < SZ_64M)
-		puts("## WARNING: Less than 64MB RAM detected\n");
+	if (gd->ram_size < SZ_512M)
+		puts("## WARNING: Less than 512MB RAM detected\n");

Have you considered fdtdec_setup_mem_size_base fdtdec_setup_memory_banksize - in which case the reserved memory regions can be changed in dt (will need corresponding custom binaries ofcourse)..

Quoted 7 lines
Quoted 4 lines

I would say that custom binaries is not something we want. Our goal is to rely on whatever TI is providing and to not deviate from it unless required. Luckily enough for the moment it works since our minimum memory size is 512MB.

Sure - you will still benefit using fdtdec_setup_mem_size_base and fdtdec_setup_memory_banksize, but really, your call.

What would be the actual benefit? Never used it and looking at the code I do not think it works for us.

We have a range of SKUs with different memory sizes (512MB to 2GB), we do have a single device tree and a single U-Boot binary for all of the variants, the memory node in the source dts file is just a default.

The DT memory node is updated dynamically by U-Boot, and the actual memory size is detected by U-Boot using get_ram_size().

(and all of that just works fine).

Francesco

#13 lore raw

Re: [PATCH v1 2/2] board: verdin-am62: fix check for minimum memory size

Quoted 48 lines · Francesco Dolcini
Quoted 36 lines · Nishanth Menon
Quoted 35 lines · Francesco Dolcini

Hello Nishanth,

Quoted 31 lines · Nishanth Menon
Quoted 18 lines · Emanuele Ghidoli

From: Emanuele Ghidoli <[email protected]>

verdin am62 SKUs comes in multiple memory configuration, check that the detected memory is at least 512MB since we have some reserved memory just before this threshold and therefore the module cannot work with less memory.

Fixes 7d1a10659f5b ("board: toradex: add verdin am62 support")
---
 board/toradex/verdin-am62/verdin-am62.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
board/toradex/verdin-am62/verdin-am62.c +0 -0
index a3d1d07a0cbf..d09dda5bccc9 100644

board/toradex/verdin-am62/verdin-am62.c int dram_init(void) · line 32

Quoted 7 lines
board/toradex/verdin-am62/verdin-am62.c +2 -2
@@ -28,8 +28,8 @@ int dram_init(void)
 {
 	gd->ram_size = get_ram_size((long *)CFG_SYS_SDRAM_BASE, CFG_SYS_SDRAM_SIZE);
 
-	if (gd->ram_size < SZ_64M)
-		puts("## WARNING: Less than 64MB RAM detected\n");
+	if (gd->ram_size < SZ_512M)
+		puts("## WARNING: Less than 512MB RAM detected\n");

Have you considered fdtdec_setup_mem_size_base fdtdec_setup_memory_banksize - in which case the reserved memory regions can be changed in dt (will need corresponding custom binaries ofcourse)..

Quoted 7 lines
Quoted 4 lines

I would say that custom binaries is not something we want. Our goal is to rely on whatever TI is providing and to not deviate from it unless required. Luckily enough for the moment it works since our minimum memory size is 512MB.

Sure - you will still benefit using fdtdec_setup_mem_size_base and fdtdec_setup_memory_banksize, but really, your call.

What would be the actual benefit? Never used it and looking at the code I do not think it works for us.

Quoted 8 lines

We have a range of SKUs with different memory sizes (512MB to 2GB), we do have a single device tree and a single U-Boot binary for all of the variants, the memory node in the source dts file is just a default.

The DT memory node is updated dynamically by U-Boot, and the actual memory size is detected by U-Boot using get_ram_size().

(and all of that just works fine).

Understood - we just use dt to determine the DDR sizes.

Signature · 3 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
#14 lore raw

Re: [PATCH v1 2/2] board: verdin-am62: fix check for minimum memory size

In reply to Emanuele Ghidoli
Quoted 10 lines · Emanuele Ghidoli

From: Emanuele Ghidoli <[email protected]>

verdin am62 SKUs comes in multiple memory configuration, check that the detected memory is at least 512MB since we have some reserved memory just before this threshold and therefore the module cannot work with less memory.

Fixes 7d1a10659f5b ("board: toradex: add verdin am62 support")

Applied to u-boot/next, thanks!

Signature · 1 line
Tom