[PATCH v1 0/2] verdin-am62: add u-boot update wrappers and fix check for minimum memory size

From: Emanuele Ghidoli emanuele.ghidoli@toradex.com
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(-)

From: Emanuele Ghidoli emanuele.ghidoli@toradex.com
Add update_tiboot3, update_tispl and update_uboot wrappers to update R5 SPL, A53 SPL and A53 U-boot respectively.
Usage example:
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
Signed-off-by: Emanuele Ghidoli emanuele.ghidoli@toradex.com --- include/configs/verdin-am62.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/configs/verdin-am62.h b/include/configs/verdin-am62.h index 7990ea831022..91fc0f03a81a 100644 --- a/include/configs/verdin-am62.h +++ b/include/configs/verdin-am62.h @@ -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 */

On Thu, Aug 24, 2023 at 10:08:49AM +0200, Emanuele Ghidoli wrote:
From: Emanuele Ghidoli emanuele.ghidoli@toradex.com
Add update_tiboot3, update_tispl and update_uboot wrappers to update R5 SPL, A53 SPL and A53 U-boot respectively.
Usage example:
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
Signed-off-by: Emanuele Ghidoli emanuele.ghidoli@toradex.com
Acked-by: Francesco Dolcini francesco.dolcini@toradex.com

On 13:19-20230824, Francesco Dolcini wrote:
On Thu, Aug 24, 2023 at 10:08:49AM +0200, Emanuele Ghidoli wrote:
From: Emanuele Ghidoli emanuele.ghidoli@toradex.com
Add update_tiboot3, update_tispl and update_uboot wrappers to update R5 SPL, A53 SPL and A53 U-boot respectively.
Usage example:
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
Signed-off-by: Emanuele Ghidoli emanuele.ghidoli@toradex.com
Acked-by: Francesco Dolcini francesco.dolcini@toradex.com
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

Hello Nishanth,
On Thu, Aug 24, 2023 at 07:10:57AM -0500, Nishanth Menon wrote:
On 13:19-20230824, Francesco Dolcini wrote:
On Thu, Aug 24, 2023 at 10:08:49AM +0200, Emanuele Ghidoli wrote:
From: Emanuele Ghidoli emanuele.ghidoli@toradex.com
Add update_tiboot3, update_tispl and update_uboot wrappers to update R5 SPL, A53 SPL and A53 U-boot respectively.
Usage example:
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
Signed-off-by: Emanuele Ghidoli emanuele.ghidoli@toradex.com
Acked-by: Francesco Dolcini francesco.dolcini@toradex.com
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

On Thu, 2023-08-24 at 16:42 +0200, Francesco Dolcini wrote:
Hello Nishanth,
On Thu, Aug 24, 2023 at 07:10:57AM -0500, Nishanth Menon wrote:
On 13:19-20230824, Francesco Dolcini wrote:
On Thu, Aug 24, 2023 at 10:08:49AM +0200, Emanuele Ghidoli wrote:
From: Emanuele Ghidoli emanuele.ghidoli@toradex.com
Add update_tiboot3, update_tispl and update_uboot wrappers to update R5 SPL, A53 SPL and A53 U-boot respectively.
Usage example:
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
Signed-off-by: Emanuele Ghidoli emanuele.ghidoli@toradex.com
Acked-by: Francesco Dolcini francesco.dolcini@toradex.com
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?
Sure, we took care of it here:
https://lore.kernel.org/all/20230828220154.483362-1-marcel@ziswiler.com
Francesco
Cheers
Marcel

On Thu, Aug 24, 2023 at 10:08:49AM +0200, Emanuele Ghidoli wrote:
From: Emanuele Ghidoli emanuele.ghidoli@toradex.com
Add update_tiboot3, update_tispl and update_uboot wrappers to update R5 SPL, A53 SPL and A53 U-boot respectively.
Usage example:
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
Signed-off-by: Emanuele Ghidoli emanuele.ghidoli@toradex.com Acked-by: Francesco Dolcini francesco.dolcini@toradex.com
Applied to u-boot/next, thanks!

From: Emanuele Ghidoli emanuele.ghidoli@toradex.com
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") Signed-off-by: Emanuele Ghidoli emanuele.ghidoli@toradex.com --- board/toradex/verdin-am62/verdin-am62.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/board/toradex/verdin-am62/verdin-am62.c b/board/toradex/verdin-am62/verdin-am62.c index a3d1d07a0cbf..d09dda5bccc9 100644 --- a/board/toradex/verdin-am62/verdin-am62.c +++ b/board/toradex/verdin-am62/verdin-am62.c @@ -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; }

On Thu, Aug 24, 2023 at 10:08:50AM +0200, Emanuele Ghidoli wrote:
From: Emanuele Ghidoli emanuele.ghidoli@toradex.com
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") Signed-off-by: Emanuele Ghidoli emanuele.ghidoli@toradex.com
Acked-by: Francesco Dolcini francesco.dolcini@toradex.com

On 10:08-20230824, Emanuele Ghidoli wrote:
From: Emanuele Ghidoli emanuele.ghidoli@toradex.com
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") Signed-off-by: Emanuele Ghidoli emanuele.ghidoli@toradex.com
board/toradex/verdin-am62/verdin-am62.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/board/toradex/verdin-am62/verdin-am62.c b/board/toradex/verdin-am62/verdin-am62.c index a3d1d07a0cbf..d09dda5bccc9 100644 --- a/board/toradex/verdin-am62/verdin-am62.c +++ b/board/toradex/verdin-am62/verdin-am62.c @@ -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)..
return 0; } -- 2.34.1

Hello Nishanth,
On Thu, Aug 24, 2023 at 07:14:12AM -0500, Nishanth Menon wrote:
On 10:08-20230824, Emanuele Ghidoli wrote:
From: Emanuele Ghidoli emanuele.ghidoli@toradex.com
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") Signed-off-by: Emanuele Ghidoli emanuele.ghidoli@toradex.com
board/toradex/verdin-am62/verdin-am62.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/board/toradex/verdin-am62/verdin-am62.c b/board/toradex/verdin-am62/verdin-am62.c index a3d1d07a0cbf..d09dda5bccc9 100644 --- a/board/toradex/verdin-am62/verdin-am62.c +++ b/board/toradex/verdin-am62/verdin-am62.c @@ -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)..
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

On 16:37-20230824, Francesco Dolcini wrote:
Hello Nishanth,
On Thu, Aug 24, 2023 at 07:14:12AM -0500, Nishanth Menon wrote:
On 10:08-20230824, Emanuele Ghidoli wrote:
From: Emanuele Ghidoli emanuele.ghidoli@toradex.com
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") Signed-off-by: Emanuele Ghidoli emanuele.ghidoli@toradex.com
board/toradex/verdin-am62/verdin-am62.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/board/toradex/verdin-am62/verdin-am62.c b/board/toradex/verdin-am62/verdin-am62.c index a3d1d07a0cbf..d09dda5bccc9 100644 --- a/board/toradex/verdin-am62/verdin-am62.c +++ b/board/toradex/verdin-am62/verdin-am62.c @@ -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)..
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.

On Thu, Aug 24, 2023 at 09:58:56AM -0500, Nishanth Menon wrote:
On 16:37-20230824, Francesco Dolcini wrote:
Hello Nishanth,
On Thu, Aug 24, 2023 at 07:14:12AM -0500, Nishanth Menon wrote:
On 10:08-20230824, Emanuele Ghidoli wrote:
From: Emanuele Ghidoli emanuele.ghidoli@toradex.com
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") Signed-off-by: Emanuele Ghidoli emanuele.ghidoli@toradex.com
board/toradex/verdin-am62/verdin-am62.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/board/toradex/verdin-am62/verdin-am62.c b/board/toradex/verdin-am62/verdin-am62.c index a3d1d07a0cbf..d09dda5bccc9 100644 --- a/board/toradex/verdin-am62/verdin-am62.c +++ b/board/toradex/verdin-am62/verdin-am62.c @@ -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)..
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

On 17:52-20230824, Francesco Dolcini wrote:
On Thu, Aug 24, 2023 at 09:58:56AM -0500, Nishanth Menon wrote:
On 16:37-20230824, Francesco Dolcini wrote:
Hello Nishanth,
On Thu, Aug 24, 2023 at 07:14:12AM -0500, Nishanth Menon wrote:
On 10:08-20230824, Emanuele Ghidoli wrote:
From: Emanuele Ghidoli emanuele.ghidoli@toradex.com
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") Signed-off-by: Emanuele Ghidoli emanuele.ghidoli@toradex.com
board/toradex/verdin-am62/verdin-am62.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/board/toradex/verdin-am62/verdin-am62.c b/board/toradex/verdin-am62/verdin-am62.c index a3d1d07a0cbf..d09dda5bccc9 100644 --- a/board/toradex/verdin-am62/verdin-am62.c +++ b/board/toradex/verdin-am62/verdin-am62.c @@ -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)..
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).
Understood - we just use dt to determine the DDR sizes.

On Thu, Aug 24, 2023 at 10:08:50AM +0200, Emanuele Ghidoli wrote:
From: Emanuele Ghidoli emanuele.ghidoli@toradex.com
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") Signed-off-by: Emanuele Ghidoli emanuele.ghidoli@toradex.com Acked-by: Francesco Dolcini francesco.dolcini@toradex.com
Applied to u-boot/next, thanks!
participants (5)
-
Emanuele Ghidoli
-
Francesco Dolcini
-
Marcel Ziswiler
-
Nishanth Menon
-
Tom Rini