Re: [PATCH v3] ARM: imx: verdin-imx8mm: Set CAN oscillator frequency based on model

2024-06-25 Thread Francesco Dolcini
Hello Marek,
thank for taking care of this.

On Tue, Jun 25, 2024 at 10:26:15AM +0200, Marek Vasut wrote:
> The older i.MX8M Mini Verdin SoMs may came with 20 MHz SPI CAN controller
> oscillator, the newer SoMs always use 40 MHz oscillator. Handle both by
> overriding the oscillator frequency just before booting the kernel.
> 
> These are the known variants with 20 MHz oscillator:
> - 0055, V1.1A, V1.1B, V1.1C and V1.1D, use a 20MHz oscillator
> - 0059, V1.1A and V1.1B, use a 20MHz oscillator
> 
> Signed-off-by: Marek Vasut 

Reviewed-by: Francesco Dolcini 

Francesco



Re: [PATCH 2/2] net: phy: Replace PHY_ANEG_TIMEOUT with Kconfig symbol

2024-06-03 Thread Francesco Dolcini
Hello Tom,

Il 3 giugno 2024 19:56:07 CEST, Tom Rini  ha scritto:
>On Sat, Jun 01, 2024 at 11:21:54AM +0200, Francesco Dolcini wrote:
>> Hello Marek,
>> 
>> On Fri, May 31, 2024 at 06:47:17PM +0200, Marek Vasut wrote:
>> > Switch PHY_ANEG_TIMEOUT to CONFIG_PHY_ANEG_TIMEOUT Kconfig symbol.
>> > This removes one more configuration headers option finalizes its
>> > Kconfig symbol conversion. No functional change expected.
>> > 
>> > Signed-off-by: Marek Vasut 
>> > ---
>> ...
>> 
>> > diff --git a/include/configs/apalis_imx6.h b/include/configs/apalis_imx6.h
>> > index 0df3917e200..6fd43511ee4 100644
>> > --- a/include/configs/apalis_imx6.h
>> > +++ b/include/configs/apalis_imx6.h
>> > @@ -22,7 +22,6 @@
>> >  #define CFG_SYS_FSL_USDHC_NUM 3
>> >  
>> >  /* Network */
>> > -#define PHY_ANEG_TIMEOUT  15000 /* PHY needs longer aneg time */
>> 
>> You should remove also the line before, after removing the define it's
>> just a stale comment.
>
>It would be nice, but there's lots of similar garbage remaining from
>other transitions, so to me it's not a deal-breaker here.

I see your point, I gonna send a follow-up patch to cleanup what I care the 
most afterwards if we merge this as it is.

Francesco 


Re: [PATCH] spl: Kconfig: ARCH_K3: Set default SPL_STACK_R_MALLOC_SIMPLE_LEN for R5 build

2024-06-01 Thread Francesco Dolcini
On Fri, May 31, 2024 at 08:16:36PM +0530, Vignesh Raghavendra wrote:
> All ARCH_K3 platforms need about of 2MB of malloc space post
> reallocation. Since, this space is allocated from SDRAM, provide a
> generous 2MB space by default.
> 
> Platforms requiring more than 2MB can override in defconfig as needed.
> 
> Signed-off-by: Vignesh Raghavendra 
Reviewed-by: Francesco Dolcini 

Francesco



Re: [PATCH 2/2] net: phy: Replace PHY_ANEG_TIMEOUT with Kconfig symbol

2024-06-01 Thread Francesco Dolcini
Hello Marek,

On Fri, May 31, 2024 at 06:47:17PM +0200, Marek Vasut wrote:
> Switch PHY_ANEG_TIMEOUT to CONFIG_PHY_ANEG_TIMEOUT Kconfig symbol.
> This removes one more configuration headers option finalizes its
> Kconfig symbol conversion. No functional change expected.
> 
> Signed-off-by: Marek Vasut 
> ---
...

> diff --git a/include/configs/apalis_imx6.h b/include/configs/apalis_imx6.h
> index 0df3917e200..6fd43511ee4 100644
> --- a/include/configs/apalis_imx6.h
> +++ b/include/configs/apalis_imx6.h
> @@ -22,7 +22,6 @@
>  #define CFG_SYS_FSL_USDHC_NUM3
>  
>  /* Network */
> -#define PHY_ANEG_TIMEOUT 15000 /* PHY needs longer aneg time */

You should remove also the line before, after removing the define it's
just a stale comment.

> diff --git a/include/configs/ds414.h b/include/configs/ds414.h
> index 9446acba792..f1921dac5e7 100644
> --- a/include/configs/ds414.h
> +++ b/include/configs/ds414.h
> @@ -55,6 +55,5 @@
>  
>  
>  /* increase autoneg timeout, my NIC sucks */
> -#define PHY_ANEG_TIMEOUT 16000

same here.

> diff --git a/include/configs/hmibsc.h b/include/configs/hmibsc.h
> index 27404c80fdf..950ec8b190d 100644
> --- a/include/configs/hmibsc.h
> +++ b/include/configs/hmibsc.h
> @@ -9,7 +9,6 @@
>  #define __CONFIGS_HMIBSC_H
>  
>  /* PHY needs a longer aneg time */
> -#define PHY_ANEG_TIMEOUT 8000

and here, and also in some of the following files.

Francesco



Re: [PATCH v1 0/5] board: toradex: Add new Verdin and Aquila SKUs

2024-05-28 Thread Francesco Dolcini
Hello Fabio,

On Tue, May 28, 2024 at 09:31:47AM -0300, Fabio Estevam wrote:
> Hi Emanuele,
> 
> On Tue, May 28, 2024 at 7:00 AM Emanuele Ghidoli
>  wrote:
> > From: Emanuele Ghidoli 
> > This series adds support for 0090 PID4 Verdin iMX8M Mini Quad 4GB WB
> > ET SKU.  It also adds two new SKUs config block support: 0088 Aquila
> > AM69 Octa 32GB WB IT and 0089 Verdin iMX95 Hexa 16GB WB IT.
> >
> > Signed-off-by: Emanuele Ghidoli 
> >
> > Emanuele Ghidoli (5):
> >   board: toradex: verdin-imx8mm: add 4 GB lpddr4 memory support
> >   board: toradex: verdin-imx8mm: increase maximum addressable ram to 4GB
> >   toradex: tdx-cfg-block: add aquila am69 sku 0088 pid4
> >   toradex: tdx-cfg-block: add verdin imx95 sku 0089 pid4
> >   toradex: tdx-cfg-block: add verdin i.mx8m mini 0090 pid4
> 
> It would be better to split the series in two: one for the TI-SoC
> boards and another one for the NXP-SoC boards.

I disagree on doing this on this specific series. The reason is that the
changes on the tdx-cfg-block are depending one on each other and they
have nothing nxp nor ti specific, they are toradex specific.

If I misunderstood your request, how would you do it?
Patches 1,2,4 and 5 are for Toradex NXP board variant, patch 3 is for a
Toradex TI board, patches 4 and 5 depend on patch 3.

Francesco



Re: [PATCH v2 00/14] Introduce the lwIP network stack

2024-05-27 Thread Francesco Dolcini
Hello Jerome,

On Fri, May 24, 2024 at 06:19:54PM +0200, Jerome Forissier wrote:
> - Make the support of HTTPS in the wget command easier. Javier T. (CC'd)
> has some additional lwIP and Mbed TLS patches to do so. With that it
> becomes possible to fetch and launch a distro installer such as Debian
> etc. directly from the U-Boot shell.

Why this is enabling this use case? Or it is just that currently,
without TLS, is not supposed to be something you should do?
I am a little bit confused reading this sentence, since to me this is
already possible using tftp.

Francesco



Re: [PATCH v2] ARM: imx: verdin-imx8mm: Set CAN oscillator frequency based on model

2024-05-23 Thread Francesco Dolcini
On Wed, May 22, 2024 at 03:23:51PM +0200, Marek Vasut wrote:
> On 5/22/24 8:39 AM, Francesco Dolcini wrote:
> > > diff --git a/board/toradex/verdin-imx8mm/verdin-imx8mm.c 
> > > b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
> > > index 55c02653da6..ef632d95f0a 100644
> > > --- a/board/toradex/verdin-imx8mm/verdin-imx8mm.c
> > > +++ b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
> > > @@ -125,6 +125,36 @@ int board_phys_sdram_size(phys_size_t *size)
> > >   #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
> > >   int ft_board_setup(void *blob, struct bd_info *bd)
> > >   {
> > > + const char *canoscpath = "/oscillator";
> > > + int freq = 4000;/* 40 MHz is used on most variants */
> > > + int canoscoff, ret;
> > > +
> > > + canoscoff = fdt_path_offset(blob, canoscpath);
> > > + if (canoscoff < 0)  /* No CAN oscillator found. */
> > > + goto exit;
> > > +
> > > + /*
> > > +  * The actual "prodid" (PID4 in Toradex naming) that have the CAN
> > > +  * functionality are 0055 and 0059. Special case 20 MHz variant
> > > +  * here:
> > > +  * - 0055, V1.1A, V1.1B, V1.1C and V1.1D, use a 20MHz oscillator
> > > +  * - 0059, V1.1A and V1.1B, use a 20MHz oscillator
> > > +  */
> > 
> > Any reason why you ignored my suggestion here? The variants you list
> > here are the only one with a 20MHz oscillator, and this is correct.
> > 
> > What is not correct is that 0055/0059 are the only variant with CAN
> > functionality. We have other "prodid" with CAN functionality.
> > 
> > With that said, the code is correct, thanks. I appreciate you taking care
> > of this.
> 
> So ... what should I change for V3 ?
> 
> Maybe just create me a diff I can squash into the patch before resend ? (I
> think I am a bit confused, I thought I addressed all the V1 feedback)

Sorry for the confusion, here the diff.
With that please add

Reviewed-by: Francesco Dolcini 


diff --git a/board/toradex/verdin-imx8mm/verdin-imx8mm.c 
b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
index ef632d95f0a5..59cc28f652f1 100644
--- a/board/toradex/verdin-imx8mm/verdin-imx8mm.c
+++ b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
@@ -134,11 +134,10 @@ int ft_board_setup(void *blob, struct bd_info *bd)
goto exit;

/*
-* The actual "prodid" (PID4 in Toradex naming) that have the CAN
-* functionality are 0055 and 0059. Special case 20 MHz variant
-* here:
-* - 0055, V1.1A, V1.1B, V1.1C and V1.1D, use a 20MHz oscillator
-* - 0059, V1.1A and V1.1B, use a 20MHz oscillator
+* The followings "prodid" (PID4 in Toradex naming) use
+* a 20MHz CAN oscillator:
+* - 0055, V1.1A, V1.1B, V1.1C and V1.1D
+* - 0059, V1.1A and V1.1B
 */
if ((tdx_hw_tag.ver_major == 1 && tdx_hw_tag.ver_minor == 1) &&
((tdx_hw_tag.prodid == VERDIN_IMX8MMQ_IT &&




[PATCH] board: toradex: change maintainer to Francesco

2024-05-22 Thread Francesco Dolcini
From: Francesco Dolcini 

Marcel is leaving Toradex and the email will start bouncing in a few
weeks, move maintainership to myself.

Cc: Marcel Ziswiler 
Signed-off-by: Francesco Dolcini 
---
 board/toradex/apalis-imx8/MAINTAINERS | 2 +-
 board/toradex/apalis-tk1/MAINTAINERS  | 2 +-
 board/toradex/apalis_imx6/MAINTAINERS | 2 +-
 board/toradex/apalis_t30/MAINTAINERS  | 2 +-
 board/toradex/colibri-imx6ull/MAINTAINERS | 2 +-
 board/toradex/colibri-imx8x/MAINTAINERS   | 2 +-
 board/toradex/colibri_imx6/MAINTAINERS| 2 +-
 board/toradex/colibri_imx7/MAINTAINERS| 2 +-
 board/toradex/colibri_t20/MAINTAINERS | 2 +-
 board/toradex/colibri_t30/MAINTAINERS | 2 +-
 board/toradex/colibri_vf/MAINTAINERS  | 2 +-
 board/toradex/verdin-am62/MAINTAINERS | 2 +-
 board/toradex/verdin-imx8mm/MAINTAINERS   | 2 +-
 board/toradex/verdin-imx8mp/MAINTAINERS   | 2 +-
 14 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/board/toradex/apalis-imx8/MAINTAINERS 
b/board/toradex/apalis-imx8/MAINTAINERS
index 198399c879ac..761034a516aa 100644
--- a/board/toradex/apalis-imx8/MAINTAINERS
+++ b/board/toradex/apalis-imx8/MAINTAINERS
@@ -1,5 +1,5 @@
 Apalis iMX8
-M: Marcel Ziswiler 
+M: Francesco Dolcini 
 W: http://developer.toradex.com/software/linux/linux-software
 S: Maintained
 F: arch/arm/dts/fsl-imx8qm-apalis.dts
diff --git a/board/toradex/apalis-tk1/MAINTAINERS 
b/board/toradex/apalis-tk1/MAINTAINERS
index e2c6f63dcc7d..393c8dcf8016 100644
--- a/board/toradex/apalis-tk1/MAINTAINERS
+++ b/board/toradex/apalis-tk1/MAINTAINERS
@@ -1,5 +1,5 @@
 Apalis TK1
-M: Marcel Ziswiler 
+M: Francesco Dolcini 
 S: Maintained
 F: board/toradex/apalis-tk1/
 F: board/toradex/common/
diff --git a/board/toradex/apalis_imx6/MAINTAINERS 
b/board/toradex/apalis_imx6/MAINTAINERS
index 0b2907bbe709..d84527c06783 100644
--- a/board/toradex/apalis_imx6/MAINTAINERS
+++ b/board/toradex/apalis_imx6/MAINTAINERS
@@ -1,5 +1,5 @@
 Apalis iMX6
-M: Marcel Ziswiler 
+M: Francesco Dolcini 
 W: http://developer.toradex.com/software/linux/linux-software
 W:  https://www.toradex.com/community
 S: Maintained
diff --git a/board/toradex/apalis_t30/MAINTAINERS 
b/board/toradex/apalis_t30/MAINTAINERS
index 097db7deb08f..368decf66744 100644
--- a/board/toradex/apalis_t30/MAINTAINERS
+++ b/board/toradex/apalis_t30/MAINTAINERS
@@ -1,5 +1,5 @@
 Apalis T30
-M: Marcel Ziswiler 
+M: Francesco Dolcini 
 S: Maintained
 F: board/toradex/apalis_t30/
 F: board/toradex/common/
diff --git a/board/toradex/colibri-imx6ull/MAINTAINERS 
b/board/toradex/colibri-imx6ull/MAINTAINERS
index ee6fe6c13ead..6c93e35cc65f 100644
--- a/board/toradex/colibri-imx6ull/MAINTAINERS
+++ b/board/toradex/colibri-imx6ull/MAINTAINERS
@@ -1,5 +1,5 @@
 Colibri iMX6ULL
-M: Marcel Ziswiler 
+M: Francesco Dolcini 
 W: http://developer.toradex.com/software/linux/linux-software
 W: https://www.toradex.com/community
 S: Maintained
diff --git a/board/toradex/colibri-imx8x/MAINTAINERS 
b/board/toradex/colibri-imx8x/MAINTAINERS
index 8c9bf1f63f43..938c2ca0ca01 100644
--- a/board/toradex/colibri-imx8x/MAINTAINERS
+++ b/board/toradex/colibri-imx8x/MAINTAINERS
@@ -1,5 +1,5 @@
 Colibri iMX8X
-M: Marcel Ziswiler 
+M: Francesco Dolcini 
 W: http://developer.toradex.com/software/linux/linux-software
 S: Maintained
 F: arch/arm/dts/fsl-imx8x-colibri.dts
diff --git a/board/toradex/colibri_imx6/MAINTAINERS 
b/board/toradex/colibri_imx6/MAINTAINERS
index 25d3a06a8523..c1067502c082 100644
--- a/board/toradex/colibri_imx6/MAINTAINERS
+++ b/board/toradex/colibri_imx6/MAINTAINERS
@@ -1,5 +1,5 @@
 Colibri iMX6
-M: Marcel Ziswiler 
+M: Francesco Dolcini 
 W: http://developer.toradex.com/software/linux/linux-software
 W:  https://www.toradex.com/community
 S: Maintained
diff --git a/board/toradex/colibri_imx7/MAINTAINERS 
b/board/toradex/colibri_imx7/MAINTAINERS
index e4583d5a86a2..80770cc71a96 100644
--- a/board/toradex/colibri_imx7/MAINTAINERS
+++ b/board/toradex/colibri_imx7/MAINTAINERS
@@ -1,5 +1,5 @@
 Colibri iMX7
-M: Marcel Ziswiler 
+M: Francesco Dolcini 
 W: http://developer.toradex.com/software/linux/linux-software
 W: https://www.toradex.com/community
 S: Maintained
diff --git a/board/toradex/colibri_t20/MAINTAINERS 
b/board/toradex/colibri_t20/MAINTAINERS
index d0c5b1133313..58842434024f 100644
--- a/board/toradex/colibri_t20/MAINTAINERS
+++ b/board/toradex/colibri_t20/MAINTAINERS
@@ -1,5 +1,5 @@
 COLIBRI_T20
-M: Marcel Ziswiler 
+M: Francesco Dolcini 
 S: Maintained
 F: board/toradex/colibri_t20/
 F: board/toradex/common/
diff --git a/board/toradex/colibri_t30/MAINTAINERS 
b/board/toradex/colibri_t30/MAINTAINERS
index 006a0e55f113..73859fd25c2e 100644
--- a/board/toradex/colibri_t30/MAINTAINERS
+++ b/board/toradex/colibri_t30/MAINTAINERS
@@ -1,5 +1,5 @@
 Colibri T30
-M: Marcel Ziswiler 
+M

Re: [PATCH v2] ARM: imx: verdin-imx8mm: Set CAN oscillator frequency based on model

2024-05-22 Thread Francesco Dolcini
On Wed, May 22, 2024 at 02:21:14AM +0200, Marek Vasut wrote:
> The older i.MX8M Mini Verdin SoMs may came with 20 MHz SPI CAN controller
> oscillator, the newer SoMs always use 40 MHz oscillator. Handle both by
> overriding the oscillator frequency just before booting the kernel.
> 
> These are the known variants with 20 MHz oscillator:
> - 0055, V1.1A, V1.1B, V1.1C and V1.1D, use a 20MHz oscillator
> - 0059, V1.1A and V1.1B, use a 20MHz oscillator
> 
> Signed-off-by: Marek Vasut 
> ---
> Cc: "NXP i.MX U-Boot Team" 
> Cc: Fabio Estevam 
> Cc: Francesco Dolcini 
> Cc: Marcel Ziswiler 
> Cc: Martyn Welch 
> Cc: Stefano Babic 
> Cc: u-boot@lists.denx.de
> ---
> V2: - Update the comment in conditional statement
> - Update ver_assembly check for 0055 rev.A/B/C/D
> ---
>  board/toradex/verdin-imx8mm/verdin-imx8mm.c | 30 +
>  1 file changed, 30 insertions(+)
> 
> diff --git a/board/toradex/verdin-imx8mm/verdin-imx8mm.c 
> b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
> index 55c02653da6..ef632d95f0a 100644
> --- a/board/toradex/verdin-imx8mm/verdin-imx8mm.c
> +++ b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
> @@ -125,6 +125,36 @@ int board_phys_sdram_size(phys_size_t *size)
>  #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
>  int ft_board_setup(void *blob, struct bd_info *bd)
>  {
> + const char *canoscpath = "/oscillator";
> + int freq = 4000;/* 40 MHz is used on most variants */
> + int canoscoff, ret;
> +
> + canoscoff = fdt_path_offset(blob, canoscpath);
> + if (canoscoff < 0)  /* No CAN oscillator found. */
> + goto exit;
> +
> + /*
> +  * The actual "prodid" (PID4 in Toradex naming) that have the CAN
> +  * functionality are 0055 and 0059. Special case 20 MHz variant
> +  * here:
> +  * - 0055, V1.1A, V1.1B, V1.1C and V1.1D, use a 20MHz oscillator
> +  * - 0059, V1.1A and V1.1B, use a 20MHz oscillator
> +  */

Any reason why you ignored my suggestion here? The variants you list
here are the only one with a 20MHz oscillator, and this is correct.

What is not correct is that 0055/0059 are the only variant with CAN
functionality. We have other "prodid" with CAN functionality.

With that said, the code is correct, thanks. I appreciate you taking care
of this.

Francesco



Re: [PATCH] ARM: imx: verdin-imx8mm: Set CAN oscillator frequency based on model

2024-05-21 Thread Francesco Dolcini
On Tue, May 21, 2024 at 01:19:24PM +0200, Francesco Dolcini wrote:
> On Tue, May 21, 2024 at 11:39:05AM +0200, Marek Vasut wrote:
> > The older i.MX8M Mini Verdin SoMs may came with 20 MHz SPI CAN controller
> > oscillator, the newer SoMs always use 40 MHz oscillator. Handle both by
> > overriding the oscillator frequency just before booting the kernel.
> > 
> > These are the known variants with 20 MHz oscillator:
> > - 0055, V1.1A, V1.1B, V1.1C and V1.1D, use a 20MHz oscillator
> > - 0059, V1.1A and V1.1B, use a 20MHz oscillator
> > 
> > Signed-off-by: Marek Vasut 
> > ---
> > Cc: "NXP i.MX U-Boot Team" 
> > Cc: Fabio Estevam 
> > Cc: Francesco Dolcini 
> > Cc: Marcel Ziswiler 
> > Cc: Philippe Schenker 
> > Cc: Martyn Welch 
> > Cc: Stefano Babic 
> > Cc: u-boot@lists.denx.de
> > ---
> >  board/toradex/verdin-imx8mm/verdin-imx8mm.c | 30 +
> >  1 file changed, 30 insertions(+)
> > 
> > diff --git a/board/toradex/verdin-imx8mm/verdin-imx8mm.c 
> > b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
> > index 55c02653da6..b4a443ebfb0 100644
> > --- a/board/toradex/verdin-imx8mm/verdin-imx8mm.c
> > +++ b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
> > @@ -125,6 +125,36 @@ int board_phys_sdram_size(phys_size_t *size)
> >  #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
> >  int ft_board_setup(void *blob, struct bd_info *bd)
> >  {
> > +   const char *canoscpath = "/oscillator";
> > +   int freq = 4000;/* 40 MHz is used on most variants */
> > +   int canoscoff, ret;
> > +
> > +   canoscoff = fdt_path_offset(blob, canoscpath);
> > +   if (canoscoff < 0)  /* No CAN oscillator found. */
> > +   goto exit;
> > +
> > +   /*
> > +* The actual "prodid" (PID4 in Toradex naming) that have the CAN
> > +* functionality are 0055 and 0059.
> This is nor correct, we have more, they just always use 40MHz.
> 
> I would rephrase this:
> 
> /*
>  * 20MHz CAN oscillator product variants:
>  * - 0055, V1.1A, V1.1B, V1.1C and V1.1D
>  * - 0059, V1.1A and V1.1B
>  */
> 
> or in a different way, if you prefer, but you got the point.
> 
> > +   if ((tdx_hw_tag.ver_major == 1 && tdx_hw_tag.ver_minor == 1) &&
> > +   ((tdx_hw_tag.prodid == VERDIN_IMX8MMQ_IT &&
> > + tdx_hw_tag.ver_assembly <= 1) ||  /* 0055 rev. A or B */
> > +(tdx_hw_tag.prodid == VERDIN_IMX8MMQ_WIFI_BT_IT &&
> > + tdx_hw_tag.ver_assembly <= 4))) { /* 0059 rev. A/B/C/D */
> 
> ver_assembly is the hardware revision - 'A', e.g. 'A' is 0, 'D' is 3.
> 
> VERDIN_IMX8MMQ_IT is 0059
> VERDIN_IMX8MMQ_WIFI_BT_IT is 0055
> 
> with that said, it should be
> 
>   if ((tdx_hw_tag.ver_major == 1 && tdx_hw_tag.ver_minor == 1) &&
>   ((tdx_hw_tag.prodid == VERDIN_IMX8MMQ_WIFI_BT_IT &&
> tdx_hw_tag.ver_assembly <= 1) ||  /* 0055 rev. A or B */
>(tdx_hw_tag.prodid == VERDIN_IMX8MMQ_IT &&
> tdx_hw_tag.ver_assembly <= 3))) { /* 0059 rev. A/B/C/D */

whoops. I confused myself.
What is correct is the table you have in the comment and the commit
message.

What is wrong is the comment in this if branch, and this confused me
(and probably also you, sorry).

if ((tdx_hw_tag.ver_major == 1 && tdx_hw_tag.ver_minor == 1) &&
((tdx_hw_tag.prodid == VERDIN_IMX8MMQ_IT &&
  tdx_hw_tag.ver_assembly <= 1) ||  /* 0059 rev. A or B */
 (tdx_hw_tag.prodid == VERDIN_IMX8MMQ_WIFI_BT_IT &&
  tdx_hw_tag.ver_assembly <= 3))) { /* 0055 rev. A/B/C/D */

Francesco



Re: [PATCH] ARM: imx: verdin-imx8mm: Set CAN oscillator frequency based on model

2024-05-21 Thread Francesco Dolcini
Hello Marek,
thanks for this.


On Tue, May 21, 2024 at 11:39:05AM +0200, Marek Vasut wrote:
> The older i.MX8M Mini Verdin SoMs may came with 20 MHz SPI CAN controller
> oscillator, the newer SoMs always use 40 MHz oscillator. Handle both by
> overriding the oscillator frequency just before booting the kernel.
> 
> These are the known variants with 20 MHz oscillator:
> - 0055, V1.1A, V1.1B, V1.1C and V1.1D, use a 20MHz oscillator
> - 0059, V1.1A and V1.1B, use a 20MHz oscillator
> 
> Signed-off-by: Marek Vasut 
> ---
> Cc: "NXP i.MX U-Boot Team" 
> Cc: Fabio Estevam 
> Cc: Francesco Dolcini 
> Cc: Marcel Ziswiler 
> Cc: Philippe Schenker 
> Cc: Martyn Welch 
> Cc: Stefano Babic 
> Cc: u-boot@lists.denx.de
> ---
>  board/toradex/verdin-imx8mm/verdin-imx8mm.c | 30 +
>  1 file changed, 30 insertions(+)
> 
> diff --git a/board/toradex/verdin-imx8mm/verdin-imx8mm.c 
> b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
> index 55c02653da6..b4a443ebfb0 100644
> --- a/board/toradex/verdin-imx8mm/verdin-imx8mm.c
> +++ b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
> @@ -125,6 +125,36 @@ int board_phys_sdram_size(phys_size_t *size)
>  #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
>  int ft_board_setup(void *blob, struct bd_info *bd)
>  {
> + const char *canoscpath = "/oscillator";
> + int freq = 4000;/* 40 MHz is used on most variants */
> + int canoscoff, ret;
> +
> + canoscoff = fdt_path_offset(blob, canoscpath);
> + if (canoscoff < 0)  /* No CAN oscillator found. */
> + goto exit;
> +
> + /*
> +  * The actual "prodid" (PID4 in Toradex naming) that have the CAN
> +  * functionality are 0055 and 0059.
This is nor correct, we have more, they just always use 40MHz.

I would rephrase this:

/*
 * 20MHz CAN oscillator product variants:
 * - 0055, V1.1A, V1.1B, V1.1C and V1.1D
 * - 0059, V1.1A and V1.1B
 */

or in a different way, if you prefer, but you got the point.

> + if ((tdx_hw_tag.ver_major == 1 && tdx_hw_tag.ver_minor == 1) &&
> + ((tdx_hw_tag.prodid == VERDIN_IMX8MMQ_IT &&
> +   tdx_hw_tag.ver_assembly <= 1) ||  /* 0055 rev. A or B */
> +  (tdx_hw_tag.prodid == VERDIN_IMX8MMQ_WIFI_BT_IT &&
> +   tdx_hw_tag.ver_assembly <= 4))) { /* 0059 rev. A/B/C/D */

ver_assembly is the hardware revision - 'A', e.g. 'A' is 0, 'D' is 3.

VERDIN_IMX8MMQ_IT is 0059
VERDIN_IMX8MMQ_WIFI_BT_IT is 0055

with that said, it should be

if ((tdx_hw_tag.ver_major == 1 && tdx_hw_tag.ver_minor == 1) &&
((tdx_hw_tag.prodid == VERDIN_IMX8MMQ_WIFI_BT_IT &&
  tdx_hw_tag.ver_assembly <= 1) ||  /* 0055 rev. A or B */
 (tdx_hw_tag.prodid == VERDIN_IMX8MMQ_IT &&
  tdx_hw_tag.ver_assembly <= 3))) { /* 0059 rev. A/B/C/D */


Francesco



Re: [PATCH] ARM: imx: Increase PHY auto-negotiation timeout to 20s on MX8Menlo

2024-05-21 Thread Francesco Dolcini
On Tue, May 21, 2024 at 11:39:38AM +0200, Marek Vasut wrote:
> The ethernet PHY on MX8Menlo board takes a while to come out of
> reset, increase the auto-negotiation timeout to prevent it from
> timing out in case the ethernet is used right after the board was
> reset.

Is this specific of MX8Menlo or something we should have on
verdin-imx8mm instead? I am not aware of any report on this issue on the
verdin, on the other hand the verdin imx8mm has normally only one
ethernet interface, and this is the one from the verdin SOM.

Francesco



Re: [PATCH v3 4/4] imx: hab: Use nxp_imx8mcst etype for i.MX8M flash.bin signing

2024-05-17 Thread Francesco Dolcini
Hello Marek,

On Fri, May 17, 2024 at 03:25:38AM +0200, Marek Vasut wrote:
> On 5/16/24 11:40 PM, Tim Harvey wrote:
> 
> [...]
> 
> > > -The entire script is available in doc/imx/habv4/csf_examples/mx8m/csf.sh
> > > -and can be used as follows to modify flash.bin to be signed
> > > -(adjust paths as needed):
> > > -```
> > > -export CST_DIR=/usr/src/cst-3.3.1/
> > > -export CSF_KEY=$CST_DIR/crts/CSF1_1_sha256_4096_65537_v3_usr_crt.pem
> > > -export IMG_KEY=$CST_DIR/crts/IMG1_1_sha256_4096_65537_v3_usr_crt.pem
> > > -export SRK_TABLE=$CST_DIR/crts/SRK_1_2_3_4_table.bin
> > > -export PATH=$CST_DIR/linux64/bin:$PATH
> > 
> > Hi Marek,
> > 
> > I thought you were going to leave the above env setting examples in
> > the documentation.
> > 
> > I suggest showing how to specify using env (by just leaving the above
> > in) as well as by copying them directly to the build directory if
> > wanted.. otherwise the documentation is lacking.
> 
> If the tool can do env vars now, I would like to avoid copying key material
> around. So what about this:
> 
> diff --git a/doc/imx/habv4/guides/mx8m_spl_secure_boot.txt
> b/doc/imx/habv4/guides/mx8m_spl_secure_boot.txt
> index 1eb1fb0aa61..257ffb45656 100644
> --- a/doc/imx/habv4/guides/mx8m_spl_secure_boot.txt
> +++ b/doc/imx/habv4/guides/mx8m_spl_secure_boot.txt
> @@ -144,6 +144,8 @@ The signing is activated by wrapping SPL and fitImage
> sections into nxp-imx8mcst
>  etype, which is done automatically in
> arch/arm/dts/imx8m{m,n,p,q}-u-boot.dtsi
>  in case CONFIG_IMX_HAB Kconfig symbol is enabled.
> 
> +Build of flash.bin target then produces a signed flash.bin automatically.
> +
>  The nxp-imx8mcst etype is configurable using either DT properties or
> environment
>  variables. The following DT properties and environment variables are
> supported.
>  Note that environment variables override DT properties.
> @@ -160,7 +162,15 @@ Note that environment variables override DT properties.
>  | nxp,img-crt| IMG_KEY   | full path to the IMG Key
> IMG1_1_sha256_4096_65537_v3_usr_crt.pem |
> 
> ++---+--+
> 
> -Build of flash.bin target then produces a signed flash.bin automatically.
> +Environment variables can be set as follows to point the build process
> +to external key material:
> +```
> +export CST_DIR=/usr/src/cst-3.3.1/
> +export CSF_KEY=$CST_DIR/crts/CSF1_1_sha256_4096_65537_v3_usr_crt.pem
> +export IMG_KEY=$CST_DIR/crts/IMG1_1_sha256_4096_65537_v3_usr_crt.pem
> +export SRK_TABLE=$CST_DIR/crts/SRK_1_2_3_4_table.bin
> +make flash.bin
> +```

FWIW, this addresses the concern I raised on the previous version, works
for me. Thanks Marek (and Tim).

Francesco



Re: [PATCH v5 4/6] configs: am62x_evm_*: Enable USB and DFU support

2024-05-07 Thread Francesco Dolcini
Hello Martyn,
first thanks for your series, with this we might be able to drop some
downstream branch.

On Mon, May 06, 2024 at 03:38:44PM +0100, Martyn Welch wrote:
> From: Sjoerd Simons 
> 
> Provide config fragments to enable USB host as well as USB gadget and DFU
> support for a53 and r5. This relevant fragment is included into the
> am62x EVM a53 defconfig. For the r5, due to the smaller available size,
> the config fragment also disables support for persistent storage to free
> up space for USB support. This fragment needs to be included is DFU
> booting is desired.
> 
> The CONFIG_DFU_SF option is placed in the defconfig rather than the
> fragment as this is known not to be supported on all boards that can
> support DFU.
> 
> Signed-off-by: Sjoerd Simons 
> Signed-off-by: Martyn Welch 

...

> diff --git a/configs/am62x_r5_usbdfu.config b/configs/am62x_r5_usbdfu.config
> new file mode 100644
> index 00..772bb2ab93
> --- /dev/null
> +++ b/configs/am62x_r5_usbdfu.config
> @@ -0,0 +1,28 @@

...

> +CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
> +CONFIG_USB_GADGET_VENDOR_NUM=0x0451
> +CONFIG_USB_GADGET_PRODUCT_NUM=0x6165

This is making this fragment TI _board_ specific, while the file name seems
to imply that this is generic for the TI SoC. Other vendors, using TI
SoCs, will likely want to use their own USB IDs.

Not a big deal and no need to change it, we'll handle this in our own
defconfig when we'll enable this, but I wanted to mention this.

Francesco



Re: [PATCH v2 1/4] binman: Add nxp_imx8mcst etype for i.MX8M flash.bin signing

2024-05-06 Thread Francesco Dolcini
Hello Marek,

On Fri, May 03, 2024 at 03:05:09AM +0200, Marek Vasut wrote:
> Add new binman etype which allows signing both the SPL and fitImage sections
> of i.MX8M flash.bin using CST. There are multiple DT properties which govern
> the signing process, nxp,loader-address is the only mandatory one which sets
> the SPL signature start address without the imx8mimage header, this should be
> SPL text base. The key material can be configured using optional DT properties
> nxp,srk-table, nxp,csf-crt, nxp,img-crt, all of which default the key material
> names generated by CST tool scripts. The nxp,unlock property can be used to
> unlock CAAM access in SPL section.
> 
> Signed-off-by: Marek Vasut 

I was not able to test or really look into your series [1], however I can
relate with a comment from Tim Harvey.

I think is important to keep in mind that that signing cannot be done
with key material that is in-tree, because well, that's private, and I
think we should not force people to branch to properly sign the
binaries.

I think that it would be valuable to share how do you foresee this used
in a real environment.

Francesco

[1] so feel free to reference me to any already agreed discussion on the
topic ...




Re: [GIT PULL] Please pull u-boot-mmc master

2024-04-30 Thread Francesco Dolcini
On Mon, Apr 29, 2024 at 03:39:53PM -0500, Judith Mendez wrote:
> On 4/26/24 10:51 AM, Tom Rini wrote:
> > On Fri, Apr 26, 2024 at 07:38:30PM +0900, Jaehoon Chung wrote:
> > > Please pull u-boot-mmc master into u-boot master branch.
> > > If there is any problem, let me know, plz
> > Applied to u-boot/master, thanks!
> A patch in this series caused a regression for AM62x SK with the
> following error:

+1, this affects also Verdin AM62.

```
Trying to boot from MMC1
mmc_load_image_raw_sector: mmc block read error
Partition 1 invalid on device 0
spl_register_fat_device: fat register err - -1
spl_load_image_fat: error reading image u-boot.img, err - -1
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###
```

Francesco



[PATCH v1] board: toradex: colibri-imx(6ull|imx7): Fix missing fdt_fixup boot error

2024-04-23 Thread Francesco Dolcini
From: Francesco Dolcini 

In commit 51aaaf5e7975 ("board: toradex: imx: Remove not needed env variables")
the empty definition of fdt_fixup variable was removed, however this was
still referenced from the boot command leading to boot failures:
 ## Error: \"fdt_fixup\" not defined`

Fix this by removing "run fdt_fixup" from the boot command and instead
enable CONFIG_OF_ENV_SETUP in the defconfig that would achieve the same
but in a more robust way (it works fine even if the variable is not
defined).

Fixes: 51aaaf5e7975 ("board: toradex: imx: Remove not needed env variables")
Signed-off-by: Francesco Dolcini 
---
 configs/colibri-imx6ull_defconfig | 1 +
 configs/colibri_imx7_defconfig| 1 +
 include/configs/colibri-imx6ull.h | 2 +-
 include/configs/colibri_imx7.h| 2 +-
 4 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/configs/colibri-imx6ull_defconfig 
b/configs/colibri-imx6ull_defconfig
index fc10d7f66a60..4a0ff029ac75 100644
--- a/configs/colibri-imx6ull_defconfig
+++ b/configs/colibri-imx6ull_defconfig
@@ -18,6 +18,7 @@ CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=1
+CONFIG_OF_ENV_SETUP=y
 CONFIG_BOOTCOMMAND="run ubiboot || run distro_bootcmd;"
 CONFIG_USE_PREBOOT=y
 CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile 
imx6ull-colibri${variant}-${fdt_board}.dtb"
diff --git a/configs/colibri_imx7_defconfig b/configs/colibri_imx7_defconfig
index 16f923b07c22..f2802b10fa8a 100644
--- a/configs/colibri_imx7_defconfig
+++ b/configs/colibri_imx7_defconfig
@@ -19,6 +19,7 @@ CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=1
+CONFIG_OF_ENV_SETUP=y
 CONFIG_BOOTCOMMAND="run ubiboot ; echo ; echo ubiboot failed ; run 
distro_bootcmd;"
 CONFIG_USE_PREBOOT=y
 CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile 
${soc}-colibri-${fdt_board}.dtb "
diff --git a/include/configs/colibri-imx6ull.h 
b/include/configs/colibri-imx6ull.h
index 7c9d633b68d9..8860ceec1a0a 100644
--- a/include/configs/colibri-imx6ull.h
+++ b/include/configs/colibri-imx6ull.h
@@ -53,7 +53,7 @@
"ubi part ubi &&" \
"ubi read ${kernel_addr_r} kernel && " \
"ubi read ${fdt_addr_r} dtb && " \
-   "run fdt_fixup && bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \
+   "bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \
 
 #if defined(CONFIG_TARGET_COLIBRI_IMX6ULL_NAND)
 /* Run Distro Boot script if ubiboot fails */
diff --git a/include/configs/colibri_imx7.h b/include/configs/colibri_imx7.h
index c34f1f903df6..33133a0b96e1 100644
--- a/include/configs/colibri_imx7.h
+++ b/include/configs/colibri_imx7.h
@@ -94,7 +94,7 @@
"ubi part ubi && run m4boot && " \
"ubi read ${kernel_addr_r} kernel && " \
"ubi read ${fdt_addr_r} dtb && " \
-   "run fdt_fixup && bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \
+   "bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \
 
 #if defined(CONFIG_TARGET_COLIBRI_IMX7_NAND)
 #define MODULE_EXTRA_ENV_SETTINGS \
-- 
2.39.2



[PATCH v1] board: toradex: verdin-am62: Remove not needed env variables

2024-04-18 Thread Francesco Dolcini
From: Francesco Dolcini 

Remove not needed variables from environment.

 - boot_scripts is not needed, the default value is just fine and
   already includes boot.scr
 - setup variable used to be executed from some bootscript, however
   it's not required and there is no point on having this small helper
   here

Signed-off-by: Francesco Dolcini 
---
 include/configs/verdin-am62.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/include/configs/verdin-am62.h b/include/configs/verdin-am62.h
index 9d2e37f2d96d..ac44809fdfa5 100644
--- a/include/configs/verdin-am62.h
+++ b/include/configs/verdin-am62.h
@@ -39,12 +39,9 @@
 #define CFG_EXTRA_ENV_SETTINGS \
BOOTENV \
MEM_LAYOUT_ENV_SETTINGS \
-   "boot_scripts=boot.scr\0" \
"boot_script_dhcp=boot.scr\0" \
"console=ttyS2\0" \
"fdt_board=dev\0" \
-   "setup=setenv setupargs console=tty1 console=${console},${baudrate} " \
-   "consoleblank=0 earlycon=ns16550a,mmio32,0x0280\0" \
"update_tiboot3=askenv confirm Did you load tiboot3.bin (y/N)?; " \
"if test \"$confirm\" = \"y\"; then " \
"setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt " \
-- 
2.39.2



[PATCH v1] board: toradex: imx: Remove not needed env variables

2024-04-18 Thread Francesco Dolcini
From: Francesco Dolcini 

Remove not needed variables from environment and include config files.

 - setup variable used to be executed from some bootscript, however
   it's not required and there is no point on having this small helper
   here
 - boot_file, kernel_file, ip_dyn variables are not used anywhere
 - fdt_fixup variable is just set empty
 - defargs, vidargs variables used to be used from some bootscript,
   however there is no point on having it here and even old legacy
   bootscript can work without them
 - removed CONFIG_ENABLE_DDR_TRAINING_DEBUG, this is a leftover from
   some copy/paste

On colibri imx6ull/imx7 NAND module, remove consoleblank=0, this is
already the Linux kernel default therefore useless.

Various Linux Kernel command line options removed are not-existing
left-over that applied to some old NXP i.MX downstream branch

Signed-off-by: Francesco Dolcini 
---
 include/configs/apalis-imx8.h |  2 --
 include/configs/apalis_imx6.h |  9 +
 include/configs/colibri-imx6ull.h | 10 +++---
 include/configs/colibri-imx8x.h   |  2 --
 include/configs/colibri_imx6.h|  9 +
 include/configs/colibri_imx7.h| 11 +++
 include/configs/verdin-imx8mm.h   |  3 ---
 include/configs/verdin-imx8mp.h   |  5 -
 8 files changed, 8 insertions(+), 43 deletions(-)

diff --git a/include/configs/apalis-imx8.h b/include/configs/apalis-imx8.h
index 845705c86db2..c8ec034fc979 100644
--- a/include/configs/apalis-imx8.h
+++ b/include/configs/apalis-imx8.h
@@ -46,8 +46,6 @@
"fdt_board=eval\0" \
"initrd_addr=0x8380\0" \
"initrd_high=0x\0" \
-   "setup=setenv setupargs console=tty1 console=${console},${baudrate} " \
-   "consoleblank=0 earlycon\0" \
"update_uboot=askenv confirm Did you load flash.bin resp. 
u-boot-dtb.imx (y/N)?; " \
"if test \"$confirm\" = \"y\"; then " \
"setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt " \
diff --git a/include/configs/apalis_imx6.h b/include/configs/apalis_imx6.h
index 8a9f3ef75a7d..0df3917e2009 100644
--- a/include/configs/apalis_imx6.h
+++ b/include/configs/apalis_imx6.h
@@ -64,12 +64,9 @@
 
 #define CFG_EXTRA_ENV_SETTINGS \
BOOTENV \
-   "boot_file=zImage\0" \
"boot_script_dhcp=boot.scr\0" \
"console=ttymxc0\0" \
-   "defargs=enable_wait_mode=off vmalloc=400M\0" \
"fdt_board=eval\0" \
-   "fdt_fixup=;\0" \
MEM_LAYOUT_ENV_SETTINGS \
UBOOT_UPDATE \
"setethupdate=if env exists ethaddr; then; else setenv ethaddr " \
@@ -80,16 +77,12 @@
"|| setenv drive 2; mmc rescan; load ${interface} ${drive}:1" \
" ${loadaddr} flash_blk.img && " \
"source ${loadaddr}\0" \
-   "setup=setenv setupargs fec_mac=${ethaddr} " \
-   "consoleblank=0 no_console_suspend=1 console=tty1 " \
-   "console=${console},${baudrate}n8\0 " \
"setupdate=run setsdupdate || run setusbupdate || run setethupdate\0" \
"setusbupdate=usb start && setenv interface usb; setenv drive 0; " \
"load ${interface} ${drive}:1 ${loadaddr} flash_blk.img && " \
"source ${loadaddr}\0" \
"splashpos=m,m\0" \
-   "splashimage=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
-   "vidargs=mxc_hdmi.only_cea=1 fbmem=32M\0"
+   "splashimage=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0"
 
 /* Miscellaneous configurable options */
 
diff --git a/include/configs/colibri-imx6ull.h 
b/include/configs/colibri-imx6ull.h
index 561a61ebc03c..7c9d633b68d9 100644
--- a/include/configs/colibri-imx6ull.h
+++ b/include/configs/colibri-imx6ull.h
@@ -48,8 +48,8 @@
"ubiargs=ubi.mtd=ubi root=ubi0:rootfs rw rootfstype=ubifs " \
"ubi.fm_autoconvert=1\0" \
"ubiboot=run setup; " \
-   "setenv bootargs ${defargs} ${ubiargs} " \
-   "${setupargs} ${vidargs} ${tdxargs}; echo Booting from NAND...; 
" \
+   "setenv bootargs ${ubiargs} " \
+   "${setupargs} ${tdxargs}; echo Booting from NAND...; " \
"ubi part ubi &&" \
"ubi read ${kernel_addr_r} kernel && " \
"ubi read ${fdt_addr_r} dtb && " \
@@ -86,11 +86,7 @@
UBOOT_UPDATE \
"boot_script_dhcp=boot.scr\0" \
"console=ttymxc0\0" \
-   "defargs=user_debug=30\0" \
"fdt_board=eval-v3\0" \
-   &

Re: [PATCH 4/4] Kconfig: Make all Kconfig encoding ascii

2024-04-16 Thread Francesco Dolcini
On Tue, Apr 16, 2024 at 03:18:08PM +0200, Dragan Simic wrote:
> On 2024-04-16 08:59, Francesco Dolcini wrote:
> > On Tue, Apr 16, 2024 at 02:36:12AM +0200, Tom Rini wrote:
> > > On Mon, Apr 15, 2024 at 02:22:02PM +0200, Heinrich Schuchardt wrote:
> > > > C is the sign for coulomb which is the unit of electric charge. How
> > > > about 'deg C'?
> > > 
> > > I'll note that in Linux there's seemingly nothing consistent, and I'm
> > > fine with any of "deg C" or "degrees C" or "temperature range (-40 C to
> > > +85 C)" as all of those should be clear in context.
> > 
> > My 2 cents ... while I agree with Tom that the context will make it
> > clear, it is not making it correct nor nice. Using just "C" for Celsius
> > degrees is horrible ...
> 
> FWIW, I usually use "oC", which is far from perfect, but IMHO also
> far from horrible. :)

"oC" is also horrible, "deg C" or "degrees C" that Heinrich proposed are the
way to go if you need something 7-bit ascii :-).


Francesco



Re: [PATCH 4/4] Kconfig: Make all Kconfig encoding ascii

2024-04-16 Thread Francesco Dolcini
On Tue, Apr 16, 2024 at 02:36:12AM +0200, Tom Rini wrote:
> On Mon, Apr 15, 2024 at 02:22:02PM +0200, Heinrich Schuchardt wrote:
> > On 15.04.24 13:35, Michal Simek wrote:
> > > Some of Kconfigs are using utf-8 encoding because of used chars. Convert
> > > all of them to ascii enconging.
> > > 
> > > Signed-off-by: Michal Simek 
> [snip]
> > > diff --git a/arch/arm/mach-rockchip/rv1126/Kconfig 
> > > b/arch/arm/mach-rockchip/rv1126/Kconfig
> > > index ae323ee91235..64a70f61f894 100644
> > > --- a/arch/arm/mach-rockchip/rv1126/Kconfig
> > > +++ b/arch/arm/mach-rockchip/rv1126/Kconfig
> > > @@ -6,8 +6,8 @@ config TARGET_RV1126_NEU2
> > > Neu2:
> > > Neural Compute Module 2(Neu2) is a 96boards SoM-CB compute 
> > > module
> > > based on Rockchip RV1126 from Edgeble AI.
> > > -   Neu2 powered with Consumer grade (0 to +80 °C) RV1126 SoC.
> > > -   Neu2k powered with Industrial grade (-40 °C to +85 °C) RV1126K SoC.
> > > +   Neu2 powered with Consumer grade (0 to +80 C) RV1126 SoC.
> > > +   Neu2k powered with Industrial grade (-40 C to +85 C) RV1126K SoC.
> > 
> > C is the sign for coulomb which is the unit of electric charge. How
> > about 'deg C'?
> 
> I'll note that in Linux there's seemingly nothing consistent, and I'm
> fine with any of "deg C" or "degrees C" or "temperature range (-40 C to
> +85 C)" as all of those should be clear in context.

My 2 cents ... while I agree with Tom that the context will make it
clear, it is not making it correct nor nice. Using just "C" for Celsius
degrees is horrible ...

Francesco




[PATCH v1] arm: dts: k3-am625-verdin: add tifsstub to tispl.bin

2024-04-15 Thread Francesco Dolcini
From: Parth Pancholi 

Adds tifsstub binaries, this is required for deepsleep functionality.

This implements the same change as commit 128f81290b7d ("arm: dts: k3:
binman: am625: add support for signing TIFSSTUB Images") did for TI AM62
SK board.

Signed-off-by: Parth Pancholi 
Signed-off-by: Francesco Dolcini 
---
 .../dts/k3-am625-verdin-wifi-dev-binman.dtsi  | 140 +-
 1 file changed, 138 insertions(+), 2 deletions(-)

diff --git a/arch/arm/dts/k3-am625-verdin-wifi-dev-binman.dtsi 
b/arch/arm/dts/k3-am625-verdin-wifi-dev-binman.dtsi
index 6f5845024f27..a9b86b61e53e 100644
--- a/arch/arm/dts/k3-am625-verdin-wifi-dev-binman.dtsi
+++ b/arch/arm/dts/k3-am625-verdin-wifi-dev-binman.dtsi
@@ -150,12 +150,107 @@
filename = 
"ti-dm/am62xx/ipc_echo_testb_mcu1_0_release_strip.xer5f";
};
};
+
+   tifsstub-hs {
+   filename = "tifsstub.bin_hs";
+   ti-secure-rom {
+   content = <_hs_cert>;
+   core = "secure";
+   load = <0x4>;
+   sw-rev = ;
+   keyfile = "custMpk.pem";
+   countersign;
+   tifsstub;
+   };
+   tifsstub_hs_cert: tifsstub-hs-cert.bin {
+   filename = 
"ti-sysfw/ti-fs-stub-firmware-am62x-hs-cert.bin";
+   type = "blob-ext";
+   optional;
+   };
+   tifsstub_hs_enc: tifsstub-hs-enc.bin {
+   filename = 
"ti-sysfw/ti-fs-stub-firmware-am62x-hs-enc.bin";
+   type = "blob-ext";
+   optional;
+   };
+   };
+
+   tifsstub-fs {
+   filename = "tifsstub.bin_fs";
+   tifsstub_fs_cert: tifsstub-fs-cert.bin {
+   filename = 
"ti-sysfw/ti-fs-stub-firmware-am62x-hs-cert.bin";
+   type = "blob-ext";
+   optional;
+   };
+   tifsstub_fs_enc: tifsstub-fs-enc.bin {
+   filename = 
"ti-sysfw/ti-fs-stub-firmware-am62x-hs-enc.bin";
+   type = "blob-ext";
+   optional;
+   };
+
+   };
+
+   tifsstub-gp {
+   filename = "tifsstub.bin_gp";
+   ti-secure-rom {
+   content = <_gp>;
+   core = "secure";
+   load = <0x6>;
+   sw-rev = ;
+   keyfile = "ti-degenerate-key.pem";
+   tifsstub;
+   };
+   tifsstub_gp: tifsstub-gp.bin {
+   filename = "ti-sysfw/ti-fs-stub-firmware-am62x-gp.bin";
+   type = "blob-ext";
+   optional;
+   };
+   };
+
ti-spl {
insert-template = <_spl_template>;
 
fit {
 
images {
+   tifsstub-hs {
+   description = "TIFSSTUB";
+   type = "firmware";
+   arch = "arm32";
+   compression = "none";
+   os = "tifsstub-hs";
+   load = <0x9dc0>;
+   entry = <0x9dc0>;
+   blob-ext {
+   filename = "tifsstub.bin_hs";
+   };
+   };
+
+   tifsstub-fs {
+   description = "TIFSSTUB";
+   type = "firmware";
+   arch = "arm32";
+   compression = "none";
+   os = "tifsstub-fs";
+   load = <0x9dc0>;
+   entry = <0x9dc0>;
+   blob-ext {
+   filename = "tifsstub.bin_fs";
+   };
+   };
+
+   tifsstub-gp {
+   description = "TIFSSTUB";
+   type = "firmware";
+   

Re: [PATCH 2/2] arm: dts: k3: binman: am625: add support for signing TIFSSTUB Images

2024-04-04 Thread Francesco Dolcini
On Thu, Apr 04, 2024 at 10:20:21AM +0530, Neha Malcom Francis wrote:
> On 03/04/24 17:33, Dhruva Gole wrote:
> > From: Kamlesh Gurudasani 
> > 
> > Add support for signing of TIFSSTUB images for HSSE, HSFS and GP devices
> > and include them in tispl.bin and tispl.bin_unsigned.
> > 
> > Signed-off-by: Kamlesh Gurudasani 
> > Signed-off-by: Dhruva Gole 

[...]

> > @@ -270,7 +406,8 @@
> > conf-0 {
> > description = "k3-am625-sk";
> > firmware = "atf";
> > -   loadables = "tee", "dm", "spl";
> > +   loadables = "tee", "tifsstub-hs", 
> > "tifsstub-fs",
> > + "tifsstub-gp", "dm", "spl";
> > fdt = "fdt-0";
> > };
> > };
> 
> 
> If there are multiple boards that will support TIFSSTUB in future, I would

I would assume that this will be the case. Verdin AM62 would need the
same, for example.

Francesco



Re: bugs with EFI "reserved" memory and LMB?

2024-03-25 Thread Francesco Dolcini
Hello all,
re-opening this old email thread ...

On Sat, Aug 12, 2023 at 08:23:32AM +0200, Heinrich Schuchardt wrote:
> On 7/27/23 14:14, Emanuele Ghidoli wrote:
> > On 27/07/2023 13:21, Heinrich Schuchardt wrote:
> > > On 27.07.23 13:08, Emanuele Ghidoli wrote:
> > > > Efi loader module have its own memory management that flags as reserved 
> > > > the
> > > > area between ram_top to ram_end (currently where dt reserved-memory is
> > > > falling).  uboot lmb updates reserved-memory by adding these
> > > > efi loader module areas (see lmb_reserve_common->efi_lmb_reserve).
> > > > 
> > > > 
> > > > On our system (AM62xx SoC, 512MB RAM) we have some reserved-memory 
> > > > specified in
> > > > the device tree (used for comunication with other microcontroller on 
> > > > the SoC,
> > > > OPTEE, ...) falling in the DDR range between 456 and 512 MB.
> > > > 
> > > > Normally U-Boot relocate itself at the end of DDR so it overlap this
> > > > reserved-memory and this of course does not work [1].
> > > > 
> > > > In this case U-Boot prints the following errors:
> > > > 
> > > >     ERROR: reserving fdt memory region failed (addr=9c80 
> > > > size=30)
> > > >     ERROR: reserving fdt memory region failed (addr=9cb0 
> > > > size=10)
> > > >     ...
> > > >     ERROR: reserving fdt memory region failed (addr=9e80 
> > > > size=180)
> > > > 
> > > > because U-Boot reserved area (lmb_flag LMB_NONE) overlaps with the FDT 
> > > > reserve
> > > > memories (lmb_flag LMB_NOMAP).
> > > > 
> > > > 
> > > > To fix this I moved the U-Boot relocation address, implementing
> > > > board_get_usable_ram_top() and therefore setting gd->ram_top to a lower 
> > > > value
> > > > with no overlap (448 MB).
> > > > 
> > > > 
> > > > The memory map is:
> > > > +---+ 512 MB
> > > > |DT reserved-mem|
> > > > +---+ 456 MB
> > > > |free space |
> > > > +---+ 448 MB (ram_top)
> > > > |   |
> > > > |uboot  |
> > > > |   |
> > > > +---+ 0 MB
> > > > 
> > > > This is working fine (the board is able to boot, no memory overlaps) ...
> > > > 
> > > > however, in this configuration U-Boot we still have some errors prints 
> > > > while
> > > > loading linux dtb:
> > > > 
> > > >     ERROR: reserving fdt memory region failed (addr=9cb0 
> > > > size=10 flags=4)
> > > >     ERROR: reserving fdt memory region failed (addr=9cc0 
> > > > size=e0 flags=4)
> > > >     ERROR: reserving fdt memory region failed (addr=9da0 
> > > > size=10 flags=4)
> > > >     ERROR: reserving fdt memory region failed (addr=9db0 
> > > > size=c0 flags=4)
> > > >     ERROR: reserving fdt memory region failed (addr=9e78 size=8 
> > > > flags=4)
> > > >     ERROR: reserving fdt memory region failed (addr=9e80 
> > > > size=180 flags=4)
> > > > 
> > > > And the reason of these error is complete different: The efi loader lmb 
> > > > memory
> > > > reservation (lib/lmb.c:efi_lmb_reserve()) is wrongly reserving some 
> > > > area.
> > > > 
> > > > 
> > > > 1) lib/lmb.c:lmb_reserve_common() reserve these memories:
> > > >     ~415M - 448M u-boot reserved area (lmb_flag LMB_NONE)
> > > >      456M - 512M fdt reserved-memory (lmb_flag LMB_NOMAP)
> > > > 
> > > > 2) lib/lmb.c:efi_lmb_reserve() reserve a region just before u-boot 
> > > > reserved
> > > > area. This is not coalesced/merged with the u-boot reserved area 
> > > > because it is
> > > > not contiguous.
> > > > 
> > > > This is the reserved-memory array at this point:
> > > >     ~414M - ~414M efi loader reserved area (lmb_flag LMB_NONE)
> > > >     ~415M - 448M u-boot reserved area (lmb_flag LMB_NONE)
> > > >      456M - 512M fdt reserved-memory (lmb_flag LMB_NOMAP)
> > > > 
> > > > 3) lib/lmb.c:efi_lmb_reserve() reserve some more areas.
> > > > In the last two steps efi loader add some reserved area that overlap 
> > > > u-boot and fdt
> > > > reserved area BUT they are also contiguous to the "efi loader reserved 
> > > > area".
> > > > The very last step reserve also area between ram_top (448M) to ram_end 
> > > > (512M)
> > > > 
> > > > We fall in this condition (where we have overlapping areas!):
> > > >     ~414M - 512M efi loader reserved area (lmb_flag LMB_NONE)
> > > >     ~415M - 448M u-boot reserved area (lmb_flag LMB_NONE)
> > > >      456M - 512M fdt reserved-memory (lmb_flag LMB_NOMAP)
> > > > 
> > > > 4) Now, while loading the linux fdt the reserved-memory areas are 
> > > > checked
> > > > toward efi loader reserved area, they overlap, BUT they have different
> > > > lmb_flag. So we get the ERROR print.
> > > > 
> > > > Hopefully this is clear, I undestand is not that obvious ...
> > > 
> > >     efidebug memmap
> > Verdin AM62 # efidebug memmap
> > MMC: no card present
> > No EFI system partition
> > No EFI system partition
> > Failed to persist EFI variables
> > Type StartEnd  Attributes
> >  

Re: [PATCH v1] board: toradex: verdin-am62_r5: Increase SPL_STACK_R_MALLOC_SIMPLE_LEN

2024-03-21 Thread Francesco Dolcini
On Wed, Mar 20, 2024 at 01:48:45PM -0300, Hiago De Franco wrote:
> From: Hiago De Franco 
> 
> Increase the SPL_STACK_R_MALLOC_SIMPLE_LEN to 0x20 to accommodate the
> size of tispl.bin fit image. With the recent upgrade of ti-linux-firmware
> from version v9.1.0 to v9.2.5, the size of tispl.bin fit image has
> increased to 1.4MB, causing allocation errors in the R5 SPL:
> 
> ```
> alloc space exhausted
> Could not get FIT buffer of 1325056 bytes
> check CONFIG_SPL_SYS_MALLOC_SIZE
> ```
> 
> Signed-off-by: Hiago De Franco 
Reviewed-by: Francesco Dolcini 


Tom, this is also a candidate for master, thanks :-)

Francesco



Re: [PATCH] arm: dts: k3-am625-verdin-r5: Change CPU frequency to 800MHz

2024-03-19 Thread Francesco Dolcini
Hello Tom,

On Tue, Mar 19, 2024 at 11:04:27AM -0300, Joao Paulo Goncalves wrote:
> From: Joao Paulo Goncalves 
> 
> The lowest speed grade of Toradex AM62 SoMs is K speed, resulting in a
> max value of 800MHz for the CPU operating frequency. A solution with
> runtime selection of the CPU frequency is already planned to avoid these
> kinds of problems in the future.
> 
> Fixes: 8fb8a6d49977 ("arm: dts: k3-am625-verdin-r5:Change CPU
> frequency to 1000MHz")
> Signed-off-by: Joao Paulo Goncalves 

We have a patch ready to make the frequency adjusted at runtime that
should be on the mailing list in a day or so, as suggested by Vignesh,
targetting uboot-next, this one fix should go into master however.

Thanks,
Francesco




Re: [PATCH v1] doc: board: colibri-imx8x: Update and improve documentation

2024-03-15 Thread Francesco Dolcini
On Fri, Mar 15, 2024 at 11:39:30AM -0300, Hiago De Franco wrote:
> From: Hiago De Franco 
> 
> Update and improve the building documentation of Colibri iMX8X.
> The following changes were made:
> - imx-atf repository changed to nxp-imx GitHub.
> - imx-atf branch updated to 'lf_v2.6'.
> - imx-seco updated to version 5.8.7.
> - nxp-imx mfgtools link updated to GitHub releases.
> - General writing improvements.
> 
> Signed-off-by: Hiago De Franco 

Reviewed-by: Francesco Dolcini 

Francesco



Re: [PATCH v1] arm: imx: imx8m: soc: Fix NPU/VPU fdt disable fixup

2024-03-15 Thread Francesco Dolcini
On Fri, Mar 15, 2024 at 02:44:25PM +, Vitor Soares wrote:
> From: Vitor Soares 
> 
> On imx8m[m|p|q].dtsi, upstream Linux uses different names for NPU/VPU
> IP block nodes. It leads variants without such HW block having it
> enabled by default.
> 
> This patch adds the upstream Linux node's paths to the disable list while
> keep the compatibility with downstream Linux.
> 
> Signed-off-by: Vitor Soares 

Reviewed-by: Francesco Dolcini 

Francesco



Re: [PATCH 1/2] lmb: Avoid to add identical region in lmb_add_region_flags()

2024-03-11 Thread Francesco Dolcini
Hello Patrice,

On Mon, Mar 11, 2024 at 03:39:17PM +0100, Patrice Chotard wrote:
> In case lmb_add_region_flags() is called with the same parameter than
> an already existing lmb and this lmb is adjacent to its previous lmb with
> different flag, this lmb is added again.

Is this

On Mon, Mar 11, 2024 at 03:39:18PM +0100, Patrice Chotard wrote:
> In case a new region is adjacent to a previous region with
> similar flag, this region is merged with its predecessor, but no
> check are done if this new added region is overlapping another region
> present in lmb (see reserved[3] which overlaps reserved[4]).

or this, related to some

ERROR: reserving fdt memory region failed

message in your opinion?

More details in 
https://lore.kernel.org/all/fe9431c5-6806-1b7a-f9f4-dbe97ee13...@toradex.com/

Francesco



Re: [PATCH v1] configs: colibri-imx7: enable watchdog

2024-03-11 Thread Francesco Dolcini
Hello Fabio,

On Mon, Mar 11, 2024 at 07:44:02AM -0300, Fabio Estevam wrote:
> On Thu, Mar 7, 2024 at 12:23 PM Parth Pancholi  wrote:
> > From: Parth Pancholi 
> >
> > Enable watchdog functionality for Toradex's Colibri iMX7 (NAND/EMMC)
> > modules.
> 
> You described what the patch does, but the reason is missing.
> 
> Is the reason for this patch to fix the 'reset' command regression
> like you did at:
> https://gitlab.com/u-boot/u-boot/-/commit/be23b1331fb35b7d5a095ef2c0b522c1f241eee9
> ?
> 
> Please send a v2 with an improved commit log.

No, on colibri-imx7 the reset is already working, it uses the PMIC so
it's not affected by the issue that was affecting most of our other
boards.

The reason for enabling the watchdog here is just an improvement to
improve reliability, given we have it enabled on other boards with no
drawback it seems nice and consistent to enable it.

Francesco



[PATCH v2 6/7] toradex: common: Use random mac address if toradex config block is missing

2024-02-23 Thread Francesco Dolcini
From: Emanuele Ghidoli 

Set CONFIG_NET_RANDOM_ETHADDR=y, which sets random eth address in
case there is no toradex config block programmed.
In case of missing toradex config block the generated mac address was
always the same, linked to serial number 0.
Use random generated mac address instead.

Acked-by: Marcel Ziswiler 
Tested-by: Marcel Ziswiler  # Verdin iMX8M Plus
Signed-off-by: Emanuele Ghidoli 
Signed-off-by: Francesco Dolcini 
---
v2: remove CONFIG_NET_RANDOM_ETHADDR from verdin am62 r5
---
 board/toradex/common/tdx-common.c  | 1 -
 configs/apalis-imx8_defconfig  | 1 +
 configs/apalis-tk1_defconfig   | 1 +
 configs/apalis_imx6_defconfig  | 1 +
 configs/apalis_t30_defconfig   | 1 +
 configs/colibri-imx6ull-emmc_defconfig | 1 +
 configs/colibri-imx6ull_defconfig  | 1 +
 configs/colibri-imx8x_defconfig| 1 +
 configs/colibri_imx6_defconfig | 1 +
 configs/colibri_imx7_defconfig | 1 +
 configs/colibri_imx7_emmc_defconfig| 1 +
 configs/colibri_t20_defconfig  | 1 +
 configs/colibri_t30_defconfig  | 1 +
 configs/colibri_vf_defconfig   | 1 +
 configs/verdin-am62_a53_defconfig  | 1 +
 configs/verdin-imx8mm_defconfig| 1 +
 configs/verdin-imx8mp_defconfig| 1 +
 17 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/board/toradex/common/tdx-common.c 
b/board/toradex/common/tdx-common.c
index 1f3253f4222e..9f09788137d5 100644
--- a/board/toradex/common/tdx-common.c
+++ b/board/toradex/common/tdx-common.c
@@ -126,7 +126,6 @@ static int settings_r(void)
 
if (read_tdx_cfg_block()) {
printf("MISSING TORADEX CONFIG BLOCK\n");
-   get_mac_from_serial(tdx_serial, _eth_addr);
 
/* Board can run even if config block is not present */
return 0;
diff --git a/configs/apalis-imx8_defconfig b/configs/apalis-imx8_defconfig
index 982098d81420..da3b0e254899 100644
--- a/configs/apalis-imx8_defconfig
+++ b/configs/apalis-imx8_defconfig
@@ -52,6 +52,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_VERSION_VARIABLE=y
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_IP_DEFRAG=y
 CONFIG_TFTP_BLOCKSIZE=4096
 CONFIG_TFTP_TSIZE=y
diff --git a/configs/apalis-tk1_defconfig b/configs/apalis-tk1_defconfig
index 6ed3898b60c3..20c9c06cdeac 100644
--- a/configs/apalis-tk1_defconfig
+++ b/configs/apalis-tk1_defconfig
@@ -52,6 +52,7 @@ CONFIG_ENV_OVERWRITE=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_VERSION_VARIABLE=y
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_IP_DEFRAG=y
 CONFIG_TFTP_BLOCKSIZE=16352
 CONFIG_TFTP_TSIZE=y
diff --git a/configs/apalis_imx6_defconfig b/configs/apalis_imx6_defconfig
index 05ff6fa115ce..492550607035 100644
--- a/configs/apalis_imx6_defconfig
+++ b/configs/apalis_imx6_defconfig
@@ -75,6 +75,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_VERSION_VARIABLE=y
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_IP_DEFRAG=y
 CONFIG_TFTP_BLOCKSIZE=4096
 CONFIG_USE_IPADDR=y
diff --git a/configs/apalis_t30_defconfig b/configs/apalis_t30_defconfig
index 0a27509a97e6..03a1f2c23906 100644
--- a/configs/apalis_t30_defconfig
+++ b/configs/apalis_t30_defconfig
@@ -45,6 +45,7 @@ CONFIG_OF_LIVE=y
 CONFIG_ENV_OVERWRITE=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_SYS_MMC_ENV_PART=1
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_IP_DEFRAG=y
 CONFIG_TFTP_BLOCKSIZE=16352
 CONFIG_TFTP_TSIZE=y
diff --git a/configs/colibri-imx6ull-emmc_defconfig 
b/configs/colibri-imx6ull-emmc_defconfig
index 285fed9e4faf..2b04855770ab 100644
--- a/configs/colibri-imx6ull-emmc_defconfig
+++ b/configs/colibri-imx6ull-emmc_defconfig
@@ -51,6 +51,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_VERSION_VARIABLE=y
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_IP_DEFRAG=y
 CONFIG_TFTP_BLOCKSIZE=16352
 CONFIG_TFTP_TSIZE=y
diff --git a/configs/colibri-imx6ull_defconfig 
b/configs/colibri-imx6ull_defconfig
index a8a633063d00..959930cf2e31 100644
--- a/configs/colibri-imx6ull_defconfig
+++ b/configs/colibri-imx6ull_defconfig
@@ -60,6 +60,7 @@ CONFIG_ENV_RANGE=0x8
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_VERSION_VARIABLE=y
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_IP_DEFRAG=y
 CONFIG_TFTP_BLOCKSIZE=16352
 CONFIG_TFTP_TSIZE=y
diff --git a/configs/colibri-imx8x_defconfig b/configs/colibri-imx8x_defconfig
index aa18d28d3e6d..88928b0e4bc5 100644
--- a/configs/colibri-imx8x_defconfig
+++ b/configs/colibri-imx8x_defconfig
@@ -52,6 +52,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_VERSION_VARIABLE=y
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_IP_DEFRAG=y
 CONFIG_TFTP_BLOCKSIZE=4096
 CONFIG_TFTP_TSIZE=y
diff --git a/configs/colibri_imx6_defconfig b/configs/colibri_imx6_defconfig
index 70cb79531e92..55c71a000d00 100644
---

[PATCH v2 7/7] toradex: imx6*: fix reset using wdt-reboot driver

2024-02-23 Thread Francesco Dolcini
From: Parth Pancholi 

commit 68dcbdd594d4 ("ARM: imx: Add weak default reset_cpu()")
introduced a regression that 'reset' command unable to reset
imx6 and imx6ull based Toradex's modules in the u-boot.

This change enables a watchdog-based sysreset driver for
Toradex's colibri-imx6, colibri-imx6ull (with nand and emmc)
and apalis-imx6 which solves the reset command regression on
these modules.

Acked-by: Marcel Ziswiler 
Fixes: 68dcbdd594d4 ("ARM: imx: Add weak default reset_cpu()")
Signed-off-by: Parth Pancholi 
Signed-off-by: Francesco Dolcini 
---
 arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi  |  6 ++
 arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi   |  6 ++
 arch/arm/dts/imx6ull-colibri-eval-v3-u-boot.dtsi | 10 ++
 configs/apalis_imx6_defconfig|  3 +++
 configs/colibri-imx6ull-emmc_defconfig   |  3 +++
 configs/colibri-imx6ull_defconfig|  3 +++
 configs/colibri_imx6_defconfig   |  3 +++
 7 files changed, 34 insertions(+)

diff --git a/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi 
b/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi
index 5a91d0aca204..44baaa803243 100644
--- a/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi
+++ b/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi
@@ -20,6 +20,12 @@
sysinfo {
compatible = "toradex,sysinfo";
};
+
+   wdt-reboot {
+   compatible = "wdt-reboot";
+   wdt = <>;
+   bootph-pre-ram;
+   };
 };
 
  {
diff --git a/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi 
b/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi
index 59412635420a..103605ac930d 100644
--- a/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi
+++ b/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi
@@ -23,6 +23,12 @@
sysinfo {
compatible = "toradex,sysinfo";
};
+
+   wdt-reboot {
+   compatible = "wdt-reboot";
+   wdt = <>;
+   bootph-pre-ram;
+   };
 };
 
  {
diff --git a/arch/arm/dts/imx6ull-colibri-eval-v3-u-boot.dtsi 
b/arch/arm/dts/imx6ull-colibri-eval-v3-u-boot.dtsi
index 731814216e1f..8494b1a2c603 100644
--- a/arch/arm/dts/imx6ull-colibri-eval-v3-u-boot.dtsi
+++ b/arch/arm/dts/imx6ull-colibri-eval-v3-u-boot.dtsi
@@ -13,6 +13,12 @@
sysinfo {
compatible = "toradex,sysinfo";
};
+
+   wdt-reboot {
+   compatible = "wdt-reboot";
+   wdt = <>;
+   bootph-pre-ram;
+   };
 };
 
 _uart1 {
@@ -58,3 +64,7 @@
};
};
 };
+
+ {
+   bootph-pre-ram;
+};
diff --git a/configs/apalis_imx6_defconfig b/configs/apalis_imx6_defconfig
index 492550607035..fae3dc322471 100644
--- a/configs/apalis_imx6_defconfig
+++ b/configs/apalis_imx6_defconfig
@@ -96,6 +96,8 @@ CONFIG_DM_I2C=y
 CONFIG_SPL_SYS_I2C_LEGACY=y
 CONFIG_SYS_I2C_MXC=y
 CONFIG_SYS_MXC_I2C3_SPEED=40
+CONFIG_SYSRESET=y
+CONFIG_SYSRESET_WATCHDOG=y
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_FSL_USDHC=y
 CONFIG_PHYLIB=y
@@ -113,6 +115,7 @@ CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_SCSI=y
 CONFIG_MXC_UART=y
 CONFIG_IMX_THERMAL=y
+CONFIG_IMX_WATCHDOG=y
 CONFIG_USB=y
 CONFIG_SPL_USB_HOST=y
 CONFIG_USB_MAX_CONTROLLER_COUNT=2
diff --git a/configs/colibri-imx6ull-emmc_defconfig 
b/configs/colibri-imx6ull-emmc_defconfig
index 2b04855770ab..c4ecdc03e2a8 100644
--- a/configs/colibri-imx6ull-emmc_defconfig
+++ b/configs/colibri-imx6ull-emmc_defconfig
@@ -69,6 +69,8 @@ CONFIG_FASTBOOT_BUF_ADDR=0x8110
 CONFIG_FASTBOOT_UUU_SUPPORT=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MXC=y
+CONFIG_SYSRESET=y
+CONFIG_SYSRESET_WATCHDOG=y
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_FSL_USDHC=y
 CONFIG_PHYLIB=y
@@ -83,6 +85,7 @@ CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_SERIAL=y
 CONFIG_MXC_UART=y
 CONFIG_IMX_THERMAL=y
+CONFIG_IMX_WATCHDOG=y
 CONFIG_USB=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="Toradex"
diff --git a/configs/colibri-imx6ull_defconfig 
b/configs/colibri-imx6ull_defconfig
index 959930cf2e31..9c68d96b2fd7 100644
--- a/configs/colibri-imx6ull_defconfig
+++ b/configs/colibri-imx6ull_defconfig
@@ -80,6 +80,8 @@ CONFIG_FASTBOOT_BUF_ADDR=0x8110
 CONFIG_FASTBOOT_UUU_SUPPORT=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MXC=y
+CONFIG_SYSRESET=y
+CONFIG_SYSRESET_WATCHDOG=y
 CONFIG_FSL_USDHC=y
 CONFIG_MTD=y
 CONFIG_DM_MTD=y
@@ -100,6 +102,7 @@ CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_SERIAL=y
 CONFIG_MXC_UART=y
 CONFIG_IMX_THERMAL=y
+CONFIG_IMX_WATCHDOG=y
 CONFIG_USB=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="Toradex"
diff --git a/configs/colibri_imx6_defconfig b/configs/colibri_imx6_defconfig
index 55c71a000d00..74c54011989c 100644
--- a/configs/colibri_imx6_defconfig
+++ b/configs/colibri_imx6_defconfig
@@ -22,6 +22,8 @@ CONFIG_SYS_MONITOR_LEN=409600
 CONFIG_SPL_MMC=y
 CONFIG_SPL_SERIAL=y
 CONFIG_SPL=y
+CONFIG_SYSRESET=y
+CONFIG_SYSRESET_WATC

[PATCH v2 3/7] toradex: common: Use SETTINGS_R event to read toradex config block

2024-02-23 Thread Francesco Dolcini
From: Emanuele Ghidoli 

Use SETTINGS_R event to read toradex config block and checkboard()
to print board info.

Acked-by: Marcel Ziswiler 
Tested-by: Marcel Ziswiler  # Verdin iMX8M Plus
Signed-off-by: Emanuele Ghidoli 
Signed-off-by: Francesco Dolcini 
---
 board/toradex/common/tdx-common.c | 92 ++-
 1 file changed, 54 insertions(+), 38 deletions(-)

diff --git a/board/toradex/common/tdx-common.c 
b/board/toradex/common/tdx-common.c
index cdf645b14177..6084436b48b4 100644
--- a/board/toradex/common/tdx-common.c
+++ b/board/toradex/common/tdx-common.c
@@ -103,54 +103,69 @@ __weak int print_bootinfo(void)
 
 int checkboard(void)
 {
-   unsigned char ethaddr[6];
-
-   if (read_tdx_cfg_block()) {
-   printf("MISSING TORADEX CONFIG BLOCK\n");
-   get_mac_from_serial(tdx_serial, _eth_addr);
-   } else {
-   snprintf(tdx_serial_str, sizeof(tdx_serial_str),
-"%08u", tdx_serial);
-   snprintf(tdx_board_rev_str, sizeof(tdx_board_rev_str),
-"V%1d.%1d%s",
-tdx_hw_tag.ver_major,
-tdx_hw_tag.ver_minor,
-get_board_assembly(tdx_hw_tag.ver_assembly));
-
-   env_set("serial#", tdx_serial_str);
-
+   if (valid_cfgblock) {
printf("Model: Toradex %04d %s %s\n",
   tdx_hw_tag.prodid,
   toradex_modules[tdx_hw_tag.prodid].name,
   tdx_board_rev_str);
printf("Serial#: %s\n", tdx_serial_str);
+   }
+
 #ifdef CONFIG_TDX_CFG_BLOCK_EXTRA
-   if (read_tdx_cfg_block_carrier()) {
-   printf("MISSING TORADEX CARRIER CONFIG BLOCKS\n");
-   try_migrate_tdx_cfg_block_carrier();
-   } else {
-   tdx_carrier_board_name =
-   
get_toradex_carrier_boards(tdx_car_hw_tag.prodid);
-
-   snprintf(tdx_car_serial_str, sizeof(tdx_car_serial_str),
-"%08u", tdx_car_serial);
-   snprintf(tdx_car_rev_str, sizeof(tdx_car_rev_str),
-"V%1d.%1d%s",
-tdx_car_hw_tag.ver_major,
-tdx_car_hw_tag.ver_minor,
-
get_board_assembly(tdx_car_hw_tag.ver_assembly));
-
-   env_set("carrier_serial#", tdx_car_serial_str);
-   printf("Carrier: Toradex %s %s, Serial# %s\n",
-  tdx_carrier_board_name,
-  tdx_car_rev_str,
-  tdx_car_serial_str);
-   }
+   if (tdx_carrier_board_name)
+   printf("Carrier: Toradex %s %s, Serial# %s\n",
+  tdx_carrier_board_name,
+  tdx_car_rev_str,
+  tdx_car_serial_str);
 #endif
-   }
 
print_bootinfo();
 
+   return 0;
+}
+
+static int settings_r(void)
+{
+   unsigned char ethaddr[6];
+
+   if (read_tdx_cfg_block()) {
+   printf("MISSING TORADEX CONFIG BLOCK\n");
+   get_mac_from_serial(tdx_serial, _eth_addr);
+
+   /* Board can run even if config block is not present */
+   return 0;
+   }
+
+   snprintf(tdx_serial_str, sizeof(tdx_serial_str),
+"%08u", tdx_serial);
+   snprintf(tdx_board_rev_str, sizeof(tdx_board_rev_str),
+"V%1d.%1d%s",
+tdx_hw_tag.ver_major,
+tdx_hw_tag.ver_minor,
+get_board_assembly(tdx_hw_tag.ver_assembly));
+
+   env_set("serial#", tdx_serial_str);
+
+#ifdef CONFIG_TDX_CFG_BLOCK_EXTRA
+   if (read_tdx_cfg_block_carrier()) {
+   printf("MISSING TORADEX CARRIER CONFIG BLOCKS\n");
+   try_migrate_tdx_cfg_block_carrier();
+   } else {
+   tdx_carrier_board_name =
+   get_toradex_carrier_boards(tdx_car_hw_tag.prodid);
+
+   snprintf(tdx_car_serial_str, sizeof(tdx_car_serial_str),
+"%08u", tdx_car_serial);
+   snprintf(tdx_car_rev_str, sizeof(tdx_car_rev_str),
+"V%1d.%1d%s",
+tdx_car_hw_tag.ver_major,
+tdx_car_hw_tag.ver_minor,
+get_board_assembly(tdx_car_hw_tag.ver_assembly));
+
+   env_set("carrier_serial#", tdx_car_serial_str);
+   }
+#endif
+
/*
 * Check if environment contains a valid MAC address,
 * set the one from config block if not
@@ -171,6 +186,7 @@ int checkboard(void)
 
return 0;
 }
+EVENT_SPY_SIMPLE(EVT_SETTINGS_R, settings_r);
 
 #ifdef CONFIG_TDX_CFG_BLOCK_USB_GADGET_PID
 int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
-- 
2.39.2



[PATCH v2 5/7] toradex: common: Add sysinfo driver

2024-02-23 Thread Francesco Dolcini
From: Emanuele Ghidoli 

This commit introduces support for the Toradex sysinfo driver in U-Boot,
which uses information from Toradex config block to print correct
board model.
In case the Toradex config block is not present sysinfo prints the model
of the board provided by device tree removing per board specific prints.

Acked-by: Marcel Ziswiler 
Tested-by: Marcel Ziswiler  # Verdin iMX8M Plus
Signed-off-by: Emanuele Ghidoli 
Signed-off-by: Francesco Dolcini 
---
 arch/arm/dts/fsl-imx8qm-apalis-u-boot.dtsi|  6 +++
 arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi  |  6 +++
 .../dts/imx6dl-colibri-eval-v3-u-boot.dtsi|  4 ++
 arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi|  4 ++
 .../dts/imx6ull-colibri-eval-v3-u-boot.dtsi   |  4 ++
 .../arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi |  4 ++
 .../dts/imx8mm-verdin-wifi-dev-u-boot.dtsi|  4 ++
 .../dts/imx8mp-verdin-wifi-dev-u-boot.dtsi|  4 ++
 .../dts/k3-am625-verdin-wifi-dev-u-boot.dtsi  |  4 ++
 arch/arm/dts/tegra124-apalis-u-boot.dtsi  | 12 +
 arch/arm/dts/tegra20-colibri-u-boot.dtsi  | 12 +
 arch/arm/dts/tegra30-apalis-u-boot.dtsi   | 12 +
 arch/arm/dts/tegra30-colibri-u-boot.dtsi  | 12 +
 .../arm/dts/vf610-colibri-eval-v3-u-boot.dtsi |  4 ++
 board/toradex/common/Kconfig  |  1 +
 board/toradex/common/tdx-common.c | 50 ---
 16 files changed, 136 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/tegra124-apalis-u-boot.dtsi
 create mode 100644 arch/arm/dts/tegra20-colibri-u-boot.dtsi
 create mode 100644 arch/arm/dts/tegra30-apalis-u-boot.dtsi
 create mode 100644 arch/arm/dts/tegra30-colibri-u-boot.dtsi

diff --git a/arch/arm/dts/fsl-imx8qm-apalis-u-boot.dtsi 
b/arch/arm/dts/fsl-imx8qm-apalis-u-boot.dtsi
index c54a59e89c5d..d73be74d2112 100644
--- a/arch/arm/dts/fsl-imx8qm-apalis-u-boot.dtsi
+++ b/arch/arm/dts/fsl-imx8qm-apalis-u-boot.dtsi
@@ -3,6 +3,12 @@
  * Copyright 2019 Toradex AG
  */
 
+/ {
+   sysinfo {
+   compatible = "toradex,sysinfo";
+   };
+};
+
  {
bootph-some-ram;
 };
diff --git a/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi 
b/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi
index 6ab6b1f9ee69..60c4cd6fc01f 100644
--- a/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi
+++ b/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi
@@ -3,6 +3,12 @@
  * Copyright 2019 Toradex AG
  */
 
+/ {
+   sysinfo {
+   compatible = "toradex,sysinfo";
+   };
+};
+
 &{/imx8qx-pm} {
 
bootph-some-ram;
diff --git a/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi 
b/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi
index 0eea4d1862ae..5a91d0aca204 100644
--- a/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi
+++ b/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi
@@ -16,6 +16,10 @@
mmc0 = 
mmc1 = 
};
+
+   sysinfo {
+   compatible = "toradex,sysinfo";
+   };
 };
 
  {
diff --git a/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi 
b/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi
index 3c6e503d043b..59412635420a 100644
--- a/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi
+++ b/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi
@@ -19,6 +19,10 @@
mmc1 = 
mmc2 = 
};
+
+   sysinfo {
+   compatible = "toradex,sysinfo";
+   };
 };
 
  {
diff --git a/arch/arm/dts/imx6ull-colibri-eval-v3-u-boot.dtsi 
b/arch/arm/dts/imx6ull-colibri-eval-v3-u-boot.dtsi
index 6823b42d4514..731814216e1f 100644
--- a/arch/arm/dts/imx6ull-colibri-eval-v3-u-boot.dtsi
+++ b/arch/arm/dts/imx6ull-colibri-eval-v3-u-boot.dtsi
@@ -9,6 +9,10 @@
usb0 =  /* required for ums */
display0 = 
};
+
+   sysinfo {
+   compatible = "toradex,sysinfo";
+   };
 };
 
 _uart1 {
diff --git a/arch/arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi 
b/arch/arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi
index b2c12a413daf..68142769d360 100644
--- a/arch/arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi
+++ b/arch/arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi
@@ -11,6 +11,10 @@
mmc0 = 
mmc1 = 
};
+
+   sysinfo {
+   compatible = "toradex,sysinfo";
+   };
 };
 
  {
diff --git a/arch/arm/dts/imx8mm-verdin-wifi-dev-u-boot.dtsi 
b/arch/arm/dts/imx8mm-verdin-wifi-dev-u-boot.dtsi
index 515f195ab759..38db56059d69 100644
--- a/arch/arm/dts/imx8mm-verdin-wifi-dev-u-boot.dtsi
+++ b/arch/arm/dts/imx8mm-verdin-wifi-dev-u-boot.dtsi
@@ -12,6 +12,10 @@
eeprom2 = _display_adapter;
};
 
+   sysinfo {
+   compatible = "toradex,sysinfo";
+   };
+
wdt-reboot {
compatible = "wdt-reboot";
bootph-pre-ram;
diff --git a/arch/arm/dts/imx8mp-verdin-wifi-dev-u-boot.dtsi 
b/arch/arm/dts/imx8mp-verdin-wifi-dev-u-boot.dtsi
index 67f1d45ce269..03f211d5f7d3 100644
--

[PATCH v2 2/7] toradex: Remove not necessary model prints from checkboard()

2024-02-23 Thread Francesco Dolcini
From: Emanuele Ghidoli 

Sysinfo prints the model obtained from device tree, checkboard()
take info from hardware and tdx_checkboard() use the model retrieved by
toradex config block.

Remove the print from checkboard() function because the model obtained
from toradex config block is the most complete.
If toradex config block is missing the model info from device tree is
enough.

Acked-by: Marcel Ziswiler 
Tested-by: Marcel Ziswiler  # Verdin iMX8M Plus
Signed-off-by: Emanuele Ghidoli 
Signed-off-by: Francesco Dolcini 
---
 board/toradex/apalis-imx8/apalis-imx8.c   | 10 -
 board/toradex/apalis-tk1/apalis-tk1.c |  7 ---
 board/toradex/apalis_imx6/apalis_imx6.c   | 21 ---
 board/toradex/apalis_t30/apalis_t30.c |  8 ---
 .../toradex/colibri-imx6ull/colibri-imx6ull.c |  7 ---
 board/toradex/colibri-imx8x/colibri-imx8x.c   | 10 -
 board/toradex/colibri_imx6/colibri_imx6.c | 20 --
 board/toradex/colibri_imx7/colibri_imx7.c |  8 ---
 board/toradex/colibri_t20/colibri_t20.c   | 10 -
 board/toradex/colibri_t30/colibri_t30.c   |  7 ---
 board/toradex/colibri_vf/colibri_vf.c | 10 -
 board/toradex/common/tdx-common.c |  9 +++-
 board/toradex/common/tdx-common.h |  1 -
 13 files changed, 8 insertions(+), 120 deletions(-)

diff --git a/board/toradex/apalis-imx8/apalis-imx8.c 
b/board/toradex/apalis-imx8/apalis-imx8.c
index b351ce64abfc..2483a63c6733 100644
--- a/board/toradex/apalis-imx8/apalis-imx8.c
+++ b/board/toradex/apalis-imx8/apalis-imx8.c
@@ -208,16 +208,6 @@ void board_preboot_os(void)
gpio_direction_output(BKL1_GPIO, 0);
 }
 
-int checkboard(void)
-{
-   puts("Model: Toradex Apalis iMX8\n");
-
-   build_info();
-   print_bootinfo();
-
-   return tdx_checkboard();
-}
-
 static enum pcb_rev_t get_pcb_revision(void)
 {
unsigned int pcb_vers = 0;
diff --git a/board/toradex/apalis-tk1/apalis-tk1.c 
b/board/toradex/apalis-tk1/apalis-tk1.c
index 79a1c92da0a0..ee87d9f4145f 100644
--- a/board/toradex/apalis-tk1/apalis-tk1.c
+++ b/board/toradex/apalis-tk1/apalis-tk1.c
@@ -91,13 +91,6 @@ int arch_misc_init(void)
return 0;
 }
 
-int checkboard(void)
-{
-   puts("Model: Toradex Apalis TK1 2GB\n");
-
-   return tdx_checkboard();
-}
-
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
 int ft_board_setup(void *blob, struct bd_info *bd)
 {
diff --git a/board/toradex/apalis_imx6/apalis_imx6.c 
b/board/toradex/apalis_imx6/apalis_imx6.c
index 164fcc41f550..0da245374a0d 100644
--- a/board/toradex/apalis_imx6/apalis_imx6.c
+++ b/board/toradex/apalis_imx6/apalis_imx6.c
@@ -716,27 +716,6 @@ int board_late_init(void)
 }
 #endif /* CONFIG_BOARD_LATE_INIT */
 
-int checkboard(void)
-{
-   char it[] = " IT";
-   int minc, maxc;
-
-   switch (get_cpu_temp_grade(, )) {
-   case TEMP_AUTOMOTIVE:
-   case TEMP_INDUSTRIAL:
-   break;
-   case TEMP_EXTCOMMERCIAL:
-   default:
-   it[0] = 0;
-   };
-   printf("Model: Toradex Apalis iMX6 %s %s%s\n",
-  is_cpu_type(MXC_CPU_MX6D) ? "Dual" : "Quad",
-  (gd->ram_size == 0x8000) ? "2GB" :
-  (gd->ram_size == 0x4000) ? "1GB" : "512MB", it);
-
-   return tdx_checkboard();
-}
-
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
 int ft_board_setup(void *blob, struct bd_info *bd)
 {
diff --git a/board/toradex/apalis_t30/apalis_t30.c 
b/board/toradex/apalis_t30/apalis_t30.c
index b9a2af33f19f..b10beb447965 100644
--- a/board/toradex/apalis_t30/apalis_t30.c
+++ b/board/toradex/apalis_t30/apalis_t30.c
@@ -45,14 +45,6 @@ int arch_misc_init(void)
return 0;
 }
 
-int checkboard(void)
-{
-   printf("Model: Toradex Apalis T30 %dGB\n",
-  (gd->ram_size == 0x4000) ? 1 : 2);
-
-   return tdx_checkboard();
-}
-
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
 int ft_board_setup(void *blob, struct bd_info *bd)
 {
diff --git a/board/toradex/colibri-imx6ull/colibri-imx6ull.c 
b/board/toradex/colibri-imx6ull/colibri-imx6ull.c
index a775f54eb3f4..9b9fb342c9d9 100644
--- a/board/toradex/colibri-imx6ull/colibri-imx6ull.c
+++ b/board/toradex/colibri-imx6ull/colibri-imx6ull.c
@@ -205,13 +205,6 @@ int board_late_init(void)
return 0;
 }
 
-int checkboard(void)
-{
-   printf("Model: Toradex Colibri iMX6ULL\n");
-
-   return tdx_checkboard();
-}
-
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
 int ft_board_setup(void *blob, struct bd_info *bd)
 {
diff --git a/board/toradex/colibri-imx8x/colibri-imx8x.c 
b/board/toradex/colibri-imx8x/colibri-imx8x.c
index d8cc72f323c5..2c673a4a6b06 100644
--- a/board/toradex/colibri-imx8x/colibri-imx8x.c
+++ b/board/torade

[PATCH v2 0/7] toradex: fix reset and hardware detection regressions

2024-02-23 Thread Francesco Dolcini
From: Francesco Dolcini 

This series fixes two regressions affecting multiple Toradex boards
(i.MX, TI and TEGRA based) and targets the current master, e.g. v2024.04
release.

U-Boot `reset` command is broken on all Tordex i.MX6* based SoMs since
v2023.07, this series fixes it enabling the `wdt-reboot` driver.

Since v2024.04-rc1 reading the Toradex configuration block is not working
properly anymore, the serial number and the hardware version are not read
correctly, preventing the board from functioning correctly (wrong mac address,
wrong DT, ...). This is fixed by reading the config block in `EVT_SETTINGS_R`
and adding a toradex sysinfo driver. In addition to that, we now use a random
mac address in case the config block is invalid.


Reported-by: Sahaj Sarup 
Closes: 
https://lore.kernel.org/all/CAKZ1LvM45MB8N0CqgU+C7i9=bjb6kqntxwo2tv407hklwtc...@mail.gmail.com/
Reported-by: Marcel Ziswiler 
Closes: 
https://lore.kernel.org/all/e40ed93bd8f371ec56b8fc451dcb458f3ce6dcba.ca...@toradex.com/
Reported-by: Francesco Dolcini 
Closes: https://lore.kernel.org/all/ZY2ZDWAQuTlRjV9H@francesco-nb/

v2:
 - add Marcel acked and tested-by
 - remove CONFIG_NET_RANDOM_ETHADDR from verdin-am62_r5_defconfig

v1: https://lore.kernel.org/all/20240220182926.101161-1-france...@dolcini.it/

Emanuele Ghidoli (6):
  toradex: Fix recursive call to checkboard
  toradex: Remove not necessary model prints from checkboard()
  toradex: common: Use SETTINGS_R event to read toradex config block
  arm: dts: Refactor device trees using "&{/aliases}" syntax
  toradex: common: Add sysinfo driver
  toradex: common: Use random mac address if toradex config block is
missing

Parth Pancholi (1):
  toradex: imx6*: fix reset using wdt-reboot driver

 arch/arm/dts/fsl-imx8qm-apalis-u-boot.dtsi|   6 +
 arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi  |   6 +
 .../dts/imx6dl-colibri-eval-v3-u-boot.dtsi|  28 +++-
 arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi|  36 +++--
 .../dts/imx6ull-colibri-eval-v3-u-boot.dtsi   |  14 ++
 .../arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi |  14 +-
 .../dts/imx8mm-verdin-wifi-dev-u-boot.dtsi|  16 +-
 .../dts/imx8mp-verdin-wifi-dev-u-boot.dtsi|  16 +-
 .../dts/k3-am625-verdin-wifi-dev-u-boot.dtsi  |   4 +
 arch/arm/dts/tegra124-apalis-u-boot.dtsi  |  12 ++
 arch/arm/dts/tegra20-colibri-u-boot.dtsi  |  12 ++
 arch/arm/dts/tegra30-apalis-u-boot.dtsi   |  12 ++
 arch/arm/dts/tegra30-colibri-u-boot.dtsi  |  12 ++
 .../arm/dts/vf610-colibri-eval-v3-u-boot.dtsi |   4 +
 board/toradex/apalis-imx8/apalis-imx8.c   |  10 --
 board/toradex/apalis-tk1/apalis-tk1.c |   7 -
 board/toradex/apalis_imx6/apalis_imx6.c   |  21 ---
 board/toradex/apalis_t30/apalis_t30.c |   8 -
 .../toradex/colibri-imx6ull/colibri-imx6ull.c |   7 -
 board/toradex/colibri-imx8x/colibri-imx8x.c   |  10 --
 board/toradex/colibri_imx6/colibri_imx6.c |  20 ---
 board/toradex/colibri_imx7/colibri_imx7.c |   8 -
 board/toradex/colibri_t20/colibri_t20.c   |  10 --
 board/toradex/colibri_t30/colibri_t30.c   |   7 -
 board/toradex/colibri_vf/colibri_vf.c |  10 --
 board/toradex/common/Kconfig  |   1 +
 board/toradex/common/tdx-common.c | 137 +-
 board/toradex/common/tdx-common.h |   1 -
 configs/apalis-imx8_defconfig |   1 +
 configs/apalis-tk1_defconfig  |   1 +
 configs/apalis_imx6_defconfig |   4 +
 configs/apalis_t30_defconfig  |   1 +
 configs/colibri-imx6ull-emmc_defconfig|   4 +
 configs/colibri-imx6ull_defconfig |   4 +
 configs/colibri-imx8x_defconfig   |   1 +
 configs/colibri_imx6_defconfig|   4 +
 configs/colibri_imx7_defconfig|   1 +
 configs/colibri_imx7_emmc_defconfig   |   1 +
 configs/colibri_t20_defconfig |   1 +
 configs/colibri_t30_defconfig |   1 +
 configs/colibri_vf_defconfig  |   1 +
 configs/verdin-am62_a53_defconfig |   1 +
 configs/verdin-imx8mm_defconfig   |   1 +
 configs/verdin-imx8mp_defconfig   |   1 +
 44 files changed, 283 insertions(+), 194 deletions(-)
 create mode 100644 arch/arm/dts/tegra124-apalis-u-boot.dtsi
 create mode 100644 arch/arm/dts/tegra20-colibri-u-boot.dtsi
 create mode 100644 arch/arm/dts/tegra30-apalis-u-boot.dtsi
 create mode 100644 arch/arm/dts/tegra30-colibri-u-boot.dtsi

-- 
2.39.2



[PATCH v2 4/7] arm: dts: Refactor device trees using "&{/aliases}" syntax

2024-02-23 Thread Francesco Dolcini
From: Emanuele Ghidoli 

Use the common syntax to define aliases.

Acked-by: Marcel Ziswiler 
Tested-by: Marcel Ziswiler  # Verdin iMX8M Plus
Signed-off-by: Emanuele Ghidoli 
Signed-off-by: Francesco Dolcini 
---
 .../dts/imx6dl-colibri-eval-v3-u-boot.dtsi| 18 -
 arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi| 26 ++-
 .../arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi | 10 ---
 .../dts/imx8mm-verdin-wifi-dev-u-boot.dtsi| 12 -
 .../dts/imx8mp-verdin-wifi-dev-u-boot.dtsi| 12 -
 5 files changed, 43 insertions(+), 35 deletions(-)

diff --git a/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi 
b/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi
index 31f3a48dd9f0..0eea4d1862ae 100644
--- a/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi
+++ b/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi
@@ -5,13 +5,17 @@
 
 #include "imx6qdl-u-boot.dtsi"
 
-&{/aliases} {
-   /* U-Boot won't find PMIC otherwise */
-   i2c0 = 
-   i2c1 = 
-   /* SDHCI instance order: eMMC, 4-bit SD/MMC (U-Boot won't find 
ConfigBlock otherwise) */
-   mmc0 = 
-   mmc1 = 
+/ {
+   aliases {
+   /* U-Boot won't find PMIC otherwise */
+   i2c0 = 
+   i2c1 = 
+   /* SDHCI instance order: eMMC, 4-bit SD/MMC
+* (U-Boot won't find ConfigBlock otherwise)
+*/
+   mmc0 = 
+   mmc1 = 
+   };
 };
 
  {
diff --git a/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi 
b/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi
index 3d19796cb698..3c6e503d043b 100644
--- a/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi
+++ b/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi
@@ -5,18 +5,20 @@
 
 #include "imx6qdl-u-boot.dtsi"
 
-&{/aliases} {
-   /* U-Boot won't find PMIC otherwise */
-   i2c0 = 
-   i2c1 = 
-   i2c2 = 
-   /*
-* SDHCI instance order: eMMC, 8-bit SD/MMC, 4-bit SD
-* (U-Boot won't find ConfigBlock otherwise)
-*/
-   mmc0 = 
-   mmc1 = 
-   mmc2 = 
+/ {
+   aliases {
+   /* U-Boot won't find PMIC otherwise */
+   i2c0 = 
+   i2c1 = 
+   i2c2 = 
+   /*
+* SDHCI instance order: eMMC, 8-bit SD/MMC, 4-bit SD
+* (U-Boot won't find ConfigBlock otherwise)
+*/
+   mmc0 = 
+   mmc1 = 
+   mmc2 = 
+   };
 };
 
  {
diff --git a/arch/arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi 
b/arch/arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi
index 57ca28edb70d..b2c12a413daf 100644
--- a/arch/arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi
+++ b/arch/arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi
@@ -5,10 +5,12 @@
 
 #include "imx7s-u-boot.dtsi"
 
-&{/aliases} {
-   /* SDHCI instance order: eMMC, SD/MMC */
-   mmc0 = 
-   mmc1 = 
+/ {
+   aliases {
+   /* SDHCI instance order: eMMC, SD/MMC */
+   mmc0 = 
+   mmc1 = 
+   };
 };
 
  {
diff --git a/arch/arm/dts/imx8mm-verdin-wifi-dev-u-boot.dtsi 
b/arch/arm/dts/imx8mm-verdin-wifi-dev-u-boot.dtsi
index 8efa4ddc734a..515f195ab759 100644
--- a/arch/arm/dts/imx8mm-verdin-wifi-dev-u-boot.dtsi
+++ b/arch/arm/dts/imx8mm-verdin-wifi-dev-u-boot.dtsi
@@ -6,6 +6,12 @@
 #include "imx8mm-u-boot.dtsi"
 
 / {
+   aliases {
+   eeprom0 = _module;
+   eeprom1 = _carrier_board;
+   eeprom2 = _display_adapter;
+   };
+
wdt-reboot {
compatible = "wdt-reboot";
bootph-pre-ram;
@@ -13,12 +19,6 @@
};
 };
 
-&{/aliases} {
-   eeprom0 = _module;
-   eeprom1 = _carrier_board;
-   eeprom2 = _display_adapter;
-};
-
 &{/soc@0/bus@3080/i2c@30a2/pmic@25} {
bootph-pre-ram;
 };
diff --git a/arch/arm/dts/imx8mp-verdin-wifi-dev-u-boot.dtsi 
b/arch/arm/dts/imx8mp-verdin-wifi-dev-u-boot.dtsi
index 2a1aa1935a76..67f1d45ce269 100644
--- a/arch/arm/dts/imx8mp-verdin-wifi-dev-u-boot.dtsi
+++ b/arch/arm/dts/imx8mp-verdin-wifi-dev-u-boot.dtsi
@@ -6,6 +6,12 @@
 #include "imx8mp-u-boot.dtsi"
 
 / {
+   aliases {
+   eeprom0 = _module;
+   eeprom1 = _carrier_board;
+   eeprom2 = _display_adapter;
+   };
+
wdt-reboot {
compatible = "wdt-reboot";
bootph-pre-ram;
@@ -13,12 +19,6 @@
};
 };
 
-&{/aliases} {
-   eeprom0 = _module;
-   eeprom1 = _carrier_board;
-   eeprom2 = _display_adapter;
-};
-
  {
bootph-all;
bootph-pre-ram;
-- 
2.39.2



[PATCH v2 1/7] toradex: Fix recursive call to checkboard

2024-02-23 Thread Francesco Dolcini
From: Emanuele Ghidoli 

Since checkboard() is used instead of show_board_info(), in case toradex
config block is missing or malformed, checkboard is recursively called.
It prints a long list of "MISSING TORADEX CONFIG BLOCK" till the stack
is full.

Fixes: edb0ecd18708 ("toradex: Use checkboard() instead of show_board_info()")
Acked-by: Marcel Ziswiler 
Tested-by: Marcel Ziswiler  # Verdin iMX8M Plus
Signed-off-by: Emanuele Ghidoli 
Signed-off-by: Francesco Dolcini 
---
 board/toradex/common/tdx-common.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/board/toradex/common/tdx-common.c 
b/board/toradex/common/tdx-common.c
index ed8f0a6a4756..ddc4a175da68 100644
--- a/board/toradex/common/tdx-common.c
+++ b/board/toradex/common/tdx-common.c
@@ -103,7 +103,6 @@ int tdx_checkboard(void)
if (read_tdx_cfg_block()) {
printf("MISSING TORADEX CONFIG BLOCK\n");
get_mac_from_serial(tdx_serial, _eth_addr);
-   checkboard();
} else {
snprintf(tdx_serial_str, sizeof(tdx_serial_str),
 "%08u", tdx_serial);
-- 
2.39.2



Re: [PATCH v1 6/7] toradex: common: Use random mac address if toradex config block is missing

2024-02-23 Thread Francesco Dolcini
On Tue, Feb 20, 2024 at 07:29:25PM +0100, Francesco Dolcini wrote:
> From: Emanuele Ghidoli 
> 
> Set CONFIG_NET_RANDOM_ETHADDR=y, which sets random eth address in
> case there is no toradex config block programmed.
> In case of missing toradex config block the generated mac address was
> always the same, linked to serial number 0.
> Use random generated mac address instead.
> 
> Signed-off-by: Emanuele Ghidoli 
> Signed-off-by: Francesco Dolcini 
> ---
>  board/toradex/common/tdx-common.c  | 1 -
>  configs/apalis-imx8_defconfig  | 1 +
>  configs/apalis-tk1_defconfig   | 1 +
>  configs/apalis_imx6_defconfig  | 1 +
>  configs/apalis_t30_defconfig   | 1 +
>  configs/colibri-imx6ull-emmc_defconfig | 1 +
>  configs/colibri-imx6ull_defconfig  | 1 +
>  configs/colibri-imx8x_defconfig| 1 +
>  configs/colibri_imx6_defconfig | 1 +
>  configs/colibri_imx7_defconfig | 1 +
>  configs/colibri_imx7_emmc_defconfig| 1 +
>  configs/colibri_t20_defconfig  | 1 +
>  configs/colibri_t30_defconfig  | 1 +
>  configs/colibri_vf_defconfig   | 1 +
>  configs/verdin-am62_a53_defconfig  | 1 +
>  configs/verdin-am62_r5_defconfig   | 1 +
>  configs/verdin-imx8mm_defconfig| 1 +
>  configs/verdin-imx8mp_defconfig| 1 +
>  18 files changed, 17 insertions(+), 1 deletion(-)

...

> diff --git a/configs/verdin-am62_r5_defconfig 
> b/configs/verdin-am62_r5_defconfig
> index a3febdcb6941..910340ea5a41 100644
> --- a/configs/verdin-am62_r5_defconfig
> +++ b/configs/verdin-am62_r5_defconfig
> @@ -65,6 +65,7 @@ CONFIG_SPL_OF_CONTROL=y
>  CONFIG_SPL_MULTI_DTB_FIT=y
>  CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y
>  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
> +CONFIG_NET_RANDOM_ETHADDR=y
>  CONFIG_SPL_DM=y
>  CONFIG_SPL_DM_SEQ_ALIAS=y
>  CONFIG_REGMAP=y

This change here is not required, it has no effect since there is no
network available on the verdin am62 r5, however it is just confusing to
have it enabled.

I will send a v2 with this removed.

Francesco



Re: [PATCH 7/7] verdin-imx8mp_defconfig: Enable PCIe/NVMe support

2024-02-22 Thread Francesco Dolcini
On Wed, Feb 21, 2024 at 11:57:51AM +0530, Sumit Garg wrote:
> On Tue, 20 Feb 2024 at 21:02, Marek Vasut  wrote:
> > On 2/20/24 14:10, Sumit Garg wrote:
> > > Also, enable reset driver which is a prerequisite for PCIe support.
> > Commit message needs to be fixed.
> 
> Let me reiterate the header here too.
> 
> Enable PCIe/NVMe support. Also, enable the reset driver which
> is a prerequisite for PCIe support.

With the commit message improved ..

On Wed, Feb 21, 2024 at 11:59:10AM +0530, Sumit Garg wrote:
> On Tue, 20 Feb 2024 at 21:34, Fabio Estevam  wrote:
> > On Tue, Feb 20, 2024 at 10:51 AM Sumit Garg  wrote:
> > > diff --git a/configs/verdin-imx8mp_defconfig 
> > > b/configs/verdin-imx8mp_defconfig
> > > index 22b8a334dfa..d8bd644322b 100644
> > > --- a/configs/verdin-imx8mp_defconfig
> > > +++ b/configs/verdin-imx8mp_defconfig
> > > @@ -185,3 +185,12 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x1b67
> > >  CONFIG_USB_GADGET_PRODUCT_NUM=0x4000
> > >  CONFIG_IMX_WATCHDOG=y
> > >  CONFIG_HEXDUMP=y
> > > +CONFIG_DM_RESET=y
> > > +CONFIG_RESET_IMX=y
> > > +CONFIG_PCI=y
> > > +CONFIG_PCIE_DW_IMX8=y
> > > +CONFIG_PHY_IMX8M_PCIE=y
> > > +CONFIG_CMD_PCI=y
> > > +CONFIG_NVME=y
> > > +CONFIG_NVME_PCI=y
> > > +CONFIG_CMD_NVME=y
> >
> > Please don't group all these new config options at the end of the file.
> That sounds better, I will do that for v2.

... and this change, feel free to add in v2

Acked-by: Francesco Dolcini 

Francesco



Re: [PATCH v1 5/7] toradex: common: Add sysinfo driver

2024-02-21 Thread Francesco Dolcini
On Wed, Feb 21, 2024 at 04:43:28PM +0100, Igor Opaniuk wrote:
> On Tue, Feb 20, 2024 at 7:31 PM Francesco Dolcini  
> wrote:
> >
> > +   sysinfo {
> > +   compatible = "toradex,sysinfo";
> > +   };
> > +
> Have you considered introducing some common *-u-boot.dtsi include
> and putting such nodes there just to avoid code duplication?

Yes, we discussed internally about this. In pratice it was a trade off between
one line with a well defined and transparent meaning with an opaque include, we
concluded that the current proposal is the best approach.

Francesco



Re: [PATCH 7/7] verdin-imx8mp_defconfig: Enable PCIe/NVMe support

2024-02-21 Thread Francesco Dolcini
On Wed, Feb 21, 2024 at 09:18:51AM +, Marcel Ziswiler wrote:
> On Wed, 2024-02-21 at 08:55 +0100, Francesco Dolcini wrote:
> > On Tue, Feb 20, 2024 at 06:40:56PM +0530, Sumit Garg wrote:
> > > Also, enable reset driver which is a prerequisite for PCIe support.
> > > 
> > > Signed-off-by: Sumit Garg 
> > > ---
> > >  configs/verdin-imx8mp_defconfig | 9 +
> > >  1 file changed, 9 insertions(+)
> > > 
> > > diff --git a/configs/verdin-imx8mp_defconfig 
> > > b/configs/verdin-imx8mp_defconfig
> > > index 22b8a334dfa..d8bd644322b 100644
> > > --- a/configs/verdin-imx8mp_defconfig
> > > +++ b/configs/verdin-imx8mp_defconfig
> > > @@ -185,3 +185,12 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x1b67
> > >  CONFIG_USB_GADGET_PRODUCT_NUM=0x4000
> > >  CONFIG_IMX_WATCHDOG=y
> > >  CONFIG_HEXDUMP=y
> > > +CONFIG_DM_RESET=y
> > > +CONFIG_RESET_IMX=y
> > > +CONFIG_PCI=y
> > > +CONFIG_PCIE_DW_IMX8=y
> > > +CONFIG_PHY_IMX8M_PCIE=y
> > > +CONFIG_CMD_PCI=y
> > > +CONFIG_NVME=y
> > > +CONFIG_NVME_PCI=y
> > > +CONFIG_CMD_NVME=y
> > 
> > This will increase the u-boot proper size
> 
> Yes, I checked and it is actually slightly more than 32 K.
> 
> > and marginally increase the
> > boot time (because of a bigger binary to be read from the eMMC).
> 
> That was also my concern.
> 
> > Apart of that do you expect any other impact on those changes? SPL
> > binary size should not be affected, correct?
> > 
> > Asking this out loudly to confirm that nothing unexpected is going to
> > happen because of these changes.
> 
> Other than that I actually gave it a quick try and PCIe/NVMe does indeed work 
> and the regular boot is not
> affected (other than the slight size and boot time increase, of course).
> 
> > For my curiosity, care to share what's the use case? Do you plan to have
> > the OS stored into an NVME device?
> 
> For us the question is basically whether that use case does mandate
> enforcing such changes for each and every customer. Plus the regular
> expected maintenance effort any such change brings with it, of course.

Marcel, given all you wrote here I would personally be fine
on having this enabled in the verdin_imx8mp defconfig.

What's your idea? Are you good with it?

Francesco



Re: [PATCH V6 07/20] configs: am62x_evm_a53_defconfig: Switch to bootstd

2024-02-21 Thread Francesco Dolcini
Hello Jan,

On Mon, Feb 19, 2024 at 07:37:55PM +0100, Jan Kiszka wrote:
> My personal observation is that continuous integration testings with
> all-upstream components is not really a common thing. I saw that with
> multiple active SoCs from various vendors.

With some limitation we have this running in Toradex since a couple of
years, we do integrate latest mainline kernel/u-boot and OE master
layers and run all that through our Lava test suite on real hardware.

It has challenges, even getting the build to succeed is not obvious and
requires continuous care, but we do spot regression on RC releases and
we actively report and/or contribute fixes for it.

Unfortunately the test results are still not published on some website
and are only internal, but we are working on making this available.

Looking forward to have more players doing it, starting from the SoC
vendors!

Francesco



Re: [PATCH 7/7] verdin-imx8mp_defconfig: Enable PCIe/NVMe support

2024-02-20 Thread Francesco Dolcini
Hello Sumit,

On Tue, Feb 20, 2024 at 06:40:56PM +0530, Sumit Garg wrote:
> Also, enable reset driver which is a prerequisite for PCIe support.
> 
> Signed-off-by: Sumit Garg 
> ---
>  configs/verdin-imx8mp_defconfig | 9 +
>  1 file changed, 9 insertions(+)
> 
> diff --git a/configs/verdin-imx8mp_defconfig b/configs/verdin-imx8mp_defconfig
> index 22b8a334dfa..d8bd644322b 100644
> --- a/configs/verdin-imx8mp_defconfig
> +++ b/configs/verdin-imx8mp_defconfig
> @@ -185,3 +185,12 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x1b67
>  CONFIG_USB_GADGET_PRODUCT_NUM=0x4000
>  CONFIG_IMX_WATCHDOG=y
>  CONFIG_HEXDUMP=y
> +CONFIG_DM_RESET=y
> +CONFIG_RESET_IMX=y
> +CONFIG_PCI=y
> +CONFIG_PCIE_DW_IMX8=y
> +CONFIG_PHY_IMX8M_PCIE=y
> +CONFIG_CMD_PCI=y
> +CONFIG_NVME=y
> +CONFIG_NVME_PCI=y
> +CONFIG_CMD_NVME=y

This will increase the u-boot proper size and marginally increase the
boot time (because of a bigger binary to be read from the eMMC).

Apart of that do you expect any other impact on those changes? SPL
binary size should not be affected, correct?

Asking this out loudly to confirm that nothing unexpected is going to
happen because of these changes.

For my curiosity, care to share what's the use case? Do you plan to have
the OS stored into an NVME device?

Francesco



[PATCH v1 6/7] toradex: common: Use random mac address if toradex config block is missing

2024-02-20 Thread Francesco Dolcini
From: Emanuele Ghidoli 

Set CONFIG_NET_RANDOM_ETHADDR=y, which sets random eth address in
case there is no toradex config block programmed.
In case of missing toradex config block the generated mac address was
always the same, linked to serial number 0.
Use random generated mac address instead.

Signed-off-by: Emanuele Ghidoli 
Signed-off-by: Francesco Dolcini 
---
 board/toradex/common/tdx-common.c  | 1 -
 configs/apalis-imx8_defconfig  | 1 +
 configs/apalis-tk1_defconfig   | 1 +
 configs/apalis_imx6_defconfig  | 1 +
 configs/apalis_t30_defconfig   | 1 +
 configs/colibri-imx6ull-emmc_defconfig | 1 +
 configs/colibri-imx6ull_defconfig  | 1 +
 configs/colibri-imx8x_defconfig| 1 +
 configs/colibri_imx6_defconfig | 1 +
 configs/colibri_imx7_defconfig | 1 +
 configs/colibri_imx7_emmc_defconfig| 1 +
 configs/colibri_t20_defconfig  | 1 +
 configs/colibri_t30_defconfig  | 1 +
 configs/colibri_vf_defconfig   | 1 +
 configs/verdin-am62_a53_defconfig  | 1 +
 configs/verdin-am62_r5_defconfig   | 1 +
 configs/verdin-imx8mm_defconfig| 1 +
 configs/verdin-imx8mp_defconfig| 1 +
 18 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/board/toradex/common/tdx-common.c 
b/board/toradex/common/tdx-common.c
index 1f3253f4222e..9f09788137d5 100644
--- a/board/toradex/common/tdx-common.c
+++ b/board/toradex/common/tdx-common.c
@@ -126,7 +126,6 @@ static int settings_r(void)
 
if (read_tdx_cfg_block()) {
printf("MISSING TORADEX CONFIG BLOCK\n");
-   get_mac_from_serial(tdx_serial, _eth_addr);
 
/* Board can run even if config block is not present */
return 0;
diff --git a/configs/apalis-imx8_defconfig b/configs/apalis-imx8_defconfig
index 982098d81420..da3b0e254899 100644
--- a/configs/apalis-imx8_defconfig
+++ b/configs/apalis-imx8_defconfig
@@ -52,6 +52,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_VERSION_VARIABLE=y
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_IP_DEFRAG=y
 CONFIG_TFTP_BLOCKSIZE=4096
 CONFIG_TFTP_TSIZE=y
diff --git a/configs/apalis-tk1_defconfig b/configs/apalis-tk1_defconfig
index 6ed3898b60c3..20c9c06cdeac 100644
--- a/configs/apalis-tk1_defconfig
+++ b/configs/apalis-tk1_defconfig
@@ -52,6 +52,7 @@ CONFIG_ENV_OVERWRITE=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_VERSION_VARIABLE=y
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_IP_DEFRAG=y
 CONFIG_TFTP_BLOCKSIZE=16352
 CONFIG_TFTP_TSIZE=y
diff --git a/configs/apalis_imx6_defconfig b/configs/apalis_imx6_defconfig
index 05ff6fa115ce..492550607035 100644
--- a/configs/apalis_imx6_defconfig
+++ b/configs/apalis_imx6_defconfig
@@ -75,6 +75,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_VERSION_VARIABLE=y
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_IP_DEFRAG=y
 CONFIG_TFTP_BLOCKSIZE=4096
 CONFIG_USE_IPADDR=y
diff --git a/configs/apalis_t30_defconfig b/configs/apalis_t30_defconfig
index 0a27509a97e6..03a1f2c23906 100644
--- a/configs/apalis_t30_defconfig
+++ b/configs/apalis_t30_defconfig
@@ -45,6 +45,7 @@ CONFIG_OF_LIVE=y
 CONFIG_ENV_OVERWRITE=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_SYS_MMC_ENV_PART=1
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_IP_DEFRAG=y
 CONFIG_TFTP_BLOCKSIZE=16352
 CONFIG_TFTP_TSIZE=y
diff --git a/configs/colibri-imx6ull-emmc_defconfig 
b/configs/colibri-imx6ull-emmc_defconfig
index 285fed9e4faf..2b04855770ab 100644
--- a/configs/colibri-imx6ull-emmc_defconfig
+++ b/configs/colibri-imx6ull-emmc_defconfig
@@ -51,6 +51,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_VERSION_VARIABLE=y
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_IP_DEFRAG=y
 CONFIG_TFTP_BLOCKSIZE=16352
 CONFIG_TFTP_TSIZE=y
diff --git a/configs/colibri-imx6ull_defconfig 
b/configs/colibri-imx6ull_defconfig
index a8a633063d00..959930cf2e31 100644
--- a/configs/colibri-imx6ull_defconfig
+++ b/configs/colibri-imx6ull_defconfig
@@ -60,6 +60,7 @@ CONFIG_ENV_RANGE=0x8
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_VERSION_VARIABLE=y
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_IP_DEFRAG=y
 CONFIG_TFTP_BLOCKSIZE=16352
 CONFIG_TFTP_TSIZE=y
diff --git a/configs/colibri-imx8x_defconfig b/configs/colibri-imx8x_defconfig
index aa18d28d3e6d..88928b0e4bc5 100644
--- a/configs/colibri-imx8x_defconfig
+++ b/configs/colibri-imx8x_defconfig
@@ -52,6 +52,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_SYS_MMC_ENV_PART=1
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_VERSION_VARIABLE=y
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_IP_DEFRAG=y
 CONFIG_TFTP_BLOCKSIZE=4096
 CONFIG_TFTP_TSIZE=y
diff --git a/configs/colibri_imx6_defconfig b/configs/colibri_imx6_defconfig
index 70cb79531e92..55c71a000d00 100644
--- a/configs/colibri_imx6_defconfig
+++ b/configs/colibri_imx6_defconfig
@@ -

[PATCH v1 7/7] toradex: imx6*: fix reset using wdt-reboot driver

2024-02-20 Thread Francesco Dolcini
From: Parth Pancholi 

commit 68dcbdd594d4 ("ARM: imx: Add weak default reset_cpu()")
introduced a regression that 'reset' command unable to reset
imx6 and imx6ull based Toradex's modules in the u-boot.

This change enables a watchdog-based sysreset driver for
Toradex's colibri-imx6, colibri-imx6ull (with nand and emmc)
and apalis-imx6 which solves the reset command regression on
these modules.

Fixes: 68dcbdd594d4 ("ARM: imx: Add weak default reset_cpu()")
Signed-off-by: Parth Pancholi 
Signed-off-by: Francesco Dolcini 
---
 arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi  |  6 ++
 arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi   |  6 ++
 arch/arm/dts/imx6ull-colibri-eval-v3-u-boot.dtsi | 10 ++
 configs/apalis_imx6_defconfig|  3 +++
 configs/colibri-imx6ull-emmc_defconfig   |  3 +++
 configs/colibri-imx6ull_defconfig|  3 +++
 configs/colibri_imx6_defconfig   |  3 +++
 7 files changed, 34 insertions(+)

diff --git a/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi 
b/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi
index 5a91d0aca204..44baaa803243 100644
--- a/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi
+++ b/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi
@@ -20,6 +20,12 @@
sysinfo {
compatible = "toradex,sysinfo";
};
+
+   wdt-reboot {
+   compatible = "wdt-reboot";
+   wdt = <>;
+   bootph-pre-ram;
+   };
 };
 
  {
diff --git a/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi 
b/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi
index 59412635420a..103605ac930d 100644
--- a/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi
+++ b/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi
@@ -23,6 +23,12 @@
sysinfo {
compatible = "toradex,sysinfo";
};
+
+   wdt-reboot {
+   compatible = "wdt-reboot";
+   wdt = <>;
+   bootph-pre-ram;
+   };
 };
 
  {
diff --git a/arch/arm/dts/imx6ull-colibri-eval-v3-u-boot.dtsi 
b/arch/arm/dts/imx6ull-colibri-eval-v3-u-boot.dtsi
index 731814216e1f..8494b1a2c603 100644
--- a/arch/arm/dts/imx6ull-colibri-eval-v3-u-boot.dtsi
+++ b/arch/arm/dts/imx6ull-colibri-eval-v3-u-boot.dtsi
@@ -13,6 +13,12 @@
sysinfo {
compatible = "toradex,sysinfo";
};
+
+   wdt-reboot {
+   compatible = "wdt-reboot";
+   wdt = <>;
+   bootph-pre-ram;
+   };
 };
 
 _uart1 {
@@ -58,3 +64,7 @@
};
};
 };
+
+ {
+   bootph-pre-ram;
+};
diff --git a/configs/apalis_imx6_defconfig b/configs/apalis_imx6_defconfig
index 492550607035..fae3dc322471 100644
--- a/configs/apalis_imx6_defconfig
+++ b/configs/apalis_imx6_defconfig
@@ -96,6 +96,8 @@ CONFIG_DM_I2C=y
 CONFIG_SPL_SYS_I2C_LEGACY=y
 CONFIG_SYS_I2C_MXC=y
 CONFIG_SYS_MXC_I2C3_SPEED=40
+CONFIG_SYSRESET=y
+CONFIG_SYSRESET_WATCHDOG=y
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_FSL_USDHC=y
 CONFIG_PHYLIB=y
@@ -113,6 +115,7 @@ CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_SCSI=y
 CONFIG_MXC_UART=y
 CONFIG_IMX_THERMAL=y
+CONFIG_IMX_WATCHDOG=y
 CONFIG_USB=y
 CONFIG_SPL_USB_HOST=y
 CONFIG_USB_MAX_CONTROLLER_COUNT=2
diff --git a/configs/colibri-imx6ull-emmc_defconfig 
b/configs/colibri-imx6ull-emmc_defconfig
index 2b04855770ab..c4ecdc03e2a8 100644
--- a/configs/colibri-imx6ull-emmc_defconfig
+++ b/configs/colibri-imx6ull-emmc_defconfig
@@ -69,6 +69,8 @@ CONFIG_FASTBOOT_BUF_ADDR=0x8110
 CONFIG_FASTBOOT_UUU_SUPPORT=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MXC=y
+CONFIG_SYSRESET=y
+CONFIG_SYSRESET_WATCHDOG=y
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_FSL_USDHC=y
 CONFIG_PHYLIB=y
@@ -83,6 +85,7 @@ CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_SERIAL=y
 CONFIG_MXC_UART=y
 CONFIG_IMX_THERMAL=y
+CONFIG_IMX_WATCHDOG=y
 CONFIG_USB=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="Toradex"
diff --git a/configs/colibri-imx6ull_defconfig 
b/configs/colibri-imx6ull_defconfig
index 959930cf2e31..9c68d96b2fd7 100644
--- a/configs/colibri-imx6ull_defconfig
+++ b/configs/colibri-imx6ull_defconfig
@@ -80,6 +80,8 @@ CONFIG_FASTBOOT_BUF_ADDR=0x8110
 CONFIG_FASTBOOT_UUU_SUPPORT=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MXC=y
+CONFIG_SYSRESET=y
+CONFIG_SYSRESET_WATCHDOG=y
 CONFIG_FSL_USDHC=y
 CONFIG_MTD=y
 CONFIG_DM_MTD=y
@@ -100,6 +102,7 @@ CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_SERIAL=y
 CONFIG_MXC_UART=y
 CONFIG_IMX_THERMAL=y
+CONFIG_IMX_WATCHDOG=y
 CONFIG_USB=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="Toradex"
diff --git a/configs/colibri_imx6_defconfig b/configs/colibri_imx6_defconfig
index 55c71a000d00..74c54011989c 100644
--- a/configs/colibri_imx6_defconfig
+++ b/configs/colibri_imx6_defconfig
@@ -22,6 +22,8 @@ CONFIG_SYS_MONITOR_LEN=409600
 CONFIG_SPL_MMC=y
 CONFIG_SPL_SERIAL=y
 CONFIG_SPL=y
+CONFIG_SYSRESET=y
+CONFIG_SYSRESET_WATCHDOG=y
 CONFIG_CMD_HDMIDETECT=y
 C

[PATCH v1 5/7] toradex: common: Add sysinfo driver

2024-02-20 Thread Francesco Dolcini
From: Emanuele Ghidoli 

This commit introduces support for the Toradex sysinfo driver in U-Boot,
which uses information from Toradex config block to print correct
board model.
In case the Toradex config block is not present sysinfo prints the model
of the board provided by device tree removing per board specific prints.

Signed-off-by: Emanuele Ghidoli 
Signed-off-by: Francesco Dolcini 
---
 arch/arm/dts/fsl-imx8qm-apalis-u-boot.dtsi|  6 +++
 arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi  |  6 +++
 .../dts/imx6dl-colibri-eval-v3-u-boot.dtsi|  4 ++
 arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi|  4 ++
 .../dts/imx6ull-colibri-eval-v3-u-boot.dtsi   |  4 ++
 .../arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi |  4 ++
 .../dts/imx8mm-verdin-wifi-dev-u-boot.dtsi|  4 ++
 .../dts/imx8mp-verdin-wifi-dev-u-boot.dtsi|  4 ++
 .../dts/k3-am625-verdin-wifi-dev-u-boot.dtsi  |  4 ++
 arch/arm/dts/tegra124-apalis-u-boot.dtsi  | 12 +
 arch/arm/dts/tegra20-colibri-u-boot.dtsi  | 12 +
 arch/arm/dts/tegra30-apalis-u-boot.dtsi   | 12 +
 arch/arm/dts/tegra30-colibri-u-boot.dtsi  | 12 +
 .../arm/dts/vf610-colibri-eval-v3-u-boot.dtsi |  4 ++
 board/toradex/common/Kconfig  |  1 +
 board/toradex/common/tdx-common.c | 50 ---
 16 files changed, 136 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/tegra124-apalis-u-boot.dtsi
 create mode 100644 arch/arm/dts/tegra20-colibri-u-boot.dtsi
 create mode 100644 arch/arm/dts/tegra30-apalis-u-boot.dtsi
 create mode 100644 arch/arm/dts/tegra30-colibri-u-boot.dtsi

diff --git a/arch/arm/dts/fsl-imx8qm-apalis-u-boot.dtsi 
b/arch/arm/dts/fsl-imx8qm-apalis-u-boot.dtsi
index c54a59e89c5d..d73be74d2112 100644
--- a/arch/arm/dts/fsl-imx8qm-apalis-u-boot.dtsi
+++ b/arch/arm/dts/fsl-imx8qm-apalis-u-boot.dtsi
@@ -3,6 +3,12 @@
  * Copyright 2019 Toradex AG
  */
 
+/ {
+   sysinfo {
+   compatible = "toradex,sysinfo";
+   };
+};
+
  {
bootph-some-ram;
 };
diff --git a/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi 
b/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi
index 6ab6b1f9ee69..60c4cd6fc01f 100644
--- a/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi
+++ b/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi
@@ -3,6 +3,12 @@
  * Copyright 2019 Toradex AG
  */
 
+/ {
+   sysinfo {
+   compatible = "toradex,sysinfo";
+   };
+};
+
 &{/imx8qx-pm} {
 
bootph-some-ram;
diff --git a/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi 
b/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi
index 0eea4d1862ae..5a91d0aca204 100644
--- a/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi
+++ b/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi
@@ -16,6 +16,10 @@
mmc0 = 
mmc1 = 
};
+
+   sysinfo {
+   compatible = "toradex,sysinfo";
+   };
 };
 
  {
diff --git a/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi 
b/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi
index 3c6e503d043b..59412635420a 100644
--- a/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi
+++ b/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi
@@ -19,6 +19,10 @@
mmc1 = 
mmc2 = 
};
+
+   sysinfo {
+   compatible = "toradex,sysinfo";
+   };
 };
 
  {
diff --git a/arch/arm/dts/imx6ull-colibri-eval-v3-u-boot.dtsi 
b/arch/arm/dts/imx6ull-colibri-eval-v3-u-boot.dtsi
index 6823b42d4514..731814216e1f 100644
--- a/arch/arm/dts/imx6ull-colibri-eval-v3-u-boot.dtsi
+++ b/arch/arm/dts/imx6ull-colibri-eval-v3-u-boot.dtsi
@@ -9,6 +9,10 @@
usb0 =  /* required for ums */
display0 = 
};
+
+   sysinfo {
+   compatible = "toradex,sysinfo";
+   };
 };
 
 _uart1 {
diff --git a/arch/arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi 
b/arch/arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi
index b2c12a413daf..68142769d360 100644
--- a/arch/arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi
+++ b/arch/arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi
@@ -11,6 +11,10 @@
mmc0 = 
mmc1 = 
};
+
+   sysinfo {
+   compatible = "toradex,sysinfo";
+   };
 };
 
  {
diff --git a/arch/arm/dts/imx8mm-verdin-wifi-dev-u-boot.dtsi 
b/arch/arm/dts/imx8mm-verdin-wifi-dev-u-boot.dtsi
index 515f195ab759..38db56059d69 100644
--- a/arch/arm/dts/imx8mm-verdin-wifi-dev-u-boot.dtsi
+++ b/arch/arm/dts/imx8mm-verdin-wifi-dev-u-boot.dtsi
@@ -12,6 +12,10 @@
eeprom2 = _display_adapter;
};
 
+   sysinfo {
+   compatible = "toradex,sysinfo";
+   };
+
wdt-reboot {
compatible = "wdt-reboot";
bootph-pre-ram;
diff --git a/arch/arm/dts/imx8mp-verdin-wifi-dev-u-boot.dtsi 
b/arch/arm/dts/imx8mp-verdin-wifi-dev-u-boot.dtsi
index 67f1d45ce269..03f211d5f7d3 100644
--- a/arch/arm/dts/imx8mp-verdin-wifi-dev-u-boot.dtsi
+++ b/arch/a

[PATCH v1 3/7] toradex: common: Use SETTINGS_R event to read toradex config block

2024-02-20 Thread Francesco Dolcini
From: Emanuele Ghidoli 

Use SETTINGS_R event to read toradex config block and checkboard()
to print board info.

Signed-off-by: Emanuele Ghidoli 
Signed-off-by: Francesco Dolcini 
---
 board/toradex/common/tdx-common.c | 92 ++-
 1 file changed, 54 insertions(+), 38 deletions(-)

diff --git a/board/toradex/common/tdx-common.c 
b/board/toradex/common/tdx-common.c
index cdf645b14177..6084436b48b4 100644
--- a/board/toradex/common/tdx-common.c
+++ b/board/toradex/common/tdx-common.c
@@ -103,54 +103,69 @@ __weak int print_bootinfo(void)
 
 int checkboard(void)
 {
-   unsigned char ethaddr[6];
-
-   if (read_tdx_cfg_block()) {
-   printf("MISSING TORADEX CONFIG BLOCK\n");
-   get_mac_from_serial(tdx_serial, _eth_addr);
-   } else {
-   snprintf(tdx_serial_str, sizeof(tdx_serial_str),
-"%08u", tdx_serial);
-   snprintf(tdx_board_rev_str, sizeof(tdx_board_rev_str),
-"V%1d.%1d%s",
-tdx_hw_tag.ver_major,
-tdx_hw_tag.ver_minor,
-get_board_assembly(tdx_hw_tag.ver_assembly));
-
-   env_set("serial#", tdx_serial_str);
-
+   if (valid_cfgblock) {
printf("Model: Toradex %04d %s %s\n",
   tdx_hw_tag.prodid,
   toradex_modules[tdx_hw_tag.prodid].name,
   tdx_board_rev_str);
printf("Serial#: %s\n", tdx_serial_str);
+   }
+
 #ifdef CONFIG_TDX_CFG_BLOCK_EXTRA
-   if (read_tdx_cfg_block_carrier()) {
-   printf("MISSING TORADEX CARRIER CONFIG BLOCKS\n");
-   try_migrate_tdx_cfg_block_carrier();
-   } else {
-   tdx_carrier_board_name =
-   
get_toradex_carrier_boards(tdx_car_hw_tag.prodid);
-
-   snprintf(tdx_car_serial_str, sizeof(tdx_car_serial_str),
-"%08u", tdx_car_serial);
-   snprintf(tdx_car_rev_str, sizeof(tdx_car_rev_str),
-"V%1d.%1d%s",
-tdx_car_hw_tag.ver_major,
-tdx_car_hw_tag.ver_minor,
-
get_board_assembly(tdx_car_hw_tag.ver_assembly));
-
-   env_set("carrier_serial#", tdx_car_serial_str);
-   printf("Carrier: Toradex %s %s, Serial# %s\n",
-  tdx_carrier_board_name,
-  tdx_car_rev_str,
-  tdx_car_serial_str);
-   }
+   if (tdx_carrier_board_name)
+   printf("Carrier: Toradex %s %s, Serial# %s\n",
+  tdx_carrier_board_name,
+  tdx_car_rev_str,
+  tdx_car_serial_str);
 #endif
-   }
 
print_bootinfo();
 
+   return 0;
+}
+
+static int settings_r(void)
+{
+   unsigned char ethaddr[6];
+
+   if (read_tdx_cfg_block()) {
+   printf("MISSING TORADEX CONFIG BLOCK\n");
+   get_mac_from_serial(tdx_serial, _eth_addr);
+
+   /* Board can run even if config block is not present */
+   return 0;
+   }
+
+   snprintf(tdx_serial_str, sizeof(tdx_serial_str),
+"%08u", tdx_serial);
+   snprintf(tdx_board_rev_str, sizeof(tdx_board_rev_str),
+"V%1d.%1d%s",
+tdx_hw_tag.ver_major,
+tdx_hw_tag.ver_minor,
+get_board_assembly(tdx_hw_tag.ver_assembly));
+
+   env_set("serial#", tdx_serial_str);
+
+#ifdef CONFIG_TDX_CFG_BLOCK_EXTRA
+   if (read_tdx_cfg_block_carrier()) {
+   printf("MISSING TORADEX CARRIER CONFIG BLOCKS\n");
+   try_migrate_tdx_cfg_block_carrier();
+   } else {
+   tdx_carrier_board_name =
+   get_toradex_carrier_boards(tdx_car_hw_tag.prodid);
+
+   snprintf(tdx_car_serial_str, sizeof(tdx_car_serial_str),
+"%08u", tdx_car_serial);
+   snprintf(tdx_car_rev_str, sizeof(tdx_car_rev_str),
+"V%1d.%1d%s",
+tdx_car_hw_tag.ver_major,
+tdx_car_hw_tag.ver_minor,
+get_board_assembly(tdx_car_hw_tag.ver_assembly));
+
+   env_set("carrier_serial#", tdx_car_serial_str);
+   }
+#endif
+
/*
 * Check if environment contains a valid MAC address,
 * set the one from config block if not
@@ -171,6 +186,7 @@ int checkboard(void)
 
return 0;
 }
+EVENT_SPY_SIMPLE(EVT_SETTINGS_R, settings_r);
 
 #ifdef CONFIG_TDX_CFG_BLOCK_USB_GADGET_PID
 int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
-- 
2.39.2



[PATCH v1 2/7] toradex: Remove not necessary model prints from checkboard()

2024-02-20 Thread Francesco Dolcini
From: Emanuele Ghidoli 

Sysinfo prints the model obtained from device tree, checkboard()
take info from hardware and tdx_checkboard() use the model retrieved by
toradex config block.

Remove the print from checkboard() function because the model obtained
from toradex config block is the most complete.
If toradex config block is missing the model info from device tree is
enough.

Signed-off-by: Emanuele Ghidoli 
Signed-off-by: Francesco Dolcini 
---
 board/toradex/apalis-imx8/apalis-imx8.c   | 10 -
 board/toradex/apalis-tk1/apalis-tk1.c |  7 ---
 board/toradex/apalis_imx6/apalis_imx6.c   | 21 ---
 board/toradex/apalis_t30/apalis_t30.c |  8 ---
 .../toradex/colibri-imx6ull/colibri-imx6ull.c |  7 ---
 board/toradex/colibri-imx8x/colibri-imx8x.c   | 10 -
 board/toradex/colibri_imx6/colibri_imx6.c | 20 --
 board/toradex/colibri_imx7/colibri_imx7.c |  8 ---
 board/toradex/colibri_t20/colibri_t20.c   | 10 -
 board/toradex/colibri_t30/colibri_t30.c   |  7 ---
 board/toradex/colibri_vf/colibri_vf.c | 10 -
 board/toradex/common/tdx-common.c |  9 +++-
 board/toradex/common/tdx-common.h |  1 -
 13 files changed, 8 insertions(+), 120 deletions(-)

diff --git a/board/toradex/apalis-imx8/apalis-imx8.c 
b/board/toradex/apalis-imx8/apalis-imx8.c
index b351ce64abfc..2483a63c6733 100644
--- a/board/toradex/apalis-imx8/apalis-imx8.c
+++ b/board/toradex/apalis-imx8/apalis-imx8.c
@@ -208,16 +208,6 @@ void board_preboot_os(void)
gpio_direction_output(BKL1_GPIO, 0);
 }
 
-int checkboard(void)
-{
-   puts("Model: Toradex Apalis iMX8\n");
-
-   build_info();
-   print_bootinfo();
-
-   return tdx_checkboard();
-}
-
 static enum pcb_rev_t get_pcb_revision(void)
 {
unsigned int pcb_vers = 0;
diff --git a/board/toradex/apalis-tk1/apalis-tk1.c 
b/board/toradex/apalis-tk1/apalis-tk1.c
index 79a1c92da0a0..ee87d9f4145f 100644
--- a/board/toradex/apalis-tk1/apalis-tk1.c
+++ b/board/toradex/apalis-tk1/apalis-tk1.c
@@ -91,13 +91,6 @@ int arch_misc_init(void)
return 0;
 }
 
-int checkboard(void)
-{
-   puts("Model: Toradex Apalis TK1 2GB\n");
-
-   return tdx_checkboard();
-}
-
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
 int ft_board_setup(void *blob, struct bd_info *bd)
 {
diff --git a/board/toradex/apalis_imx6/apalis_imx6.c 
b/board/toradex/apalis_imx6/apalis_imx6.c
index 164fcc41f550..0da245374a0d 100644
--- a/board/toradex/apalis_imx6/apalis_imx6.c
+++ b/board/toradex/apalis_imx6/apalis_imx6.c
@@ -716,27 +716,6 @@ int board_late_init(void)
 }
 #endif /* CONFIG_BOARD_LATE_INIT */
 
-int checkboard(void)
-{
-   char it[] = " IT";
-   int minc, maxc;
-
-   switch (get_cpu_temp_grade(, )) {
-   case TEMP_AUTOMOTIVE:
-   case TEMP_INDUSTRIAL:
-   break;
-   case TEMP_EXTCOMMERCIAL:
-   default:
-   it[0] = 0;
-   };
-   printf("Model: Toradex Apalis iMX6 %s %s%s\n",
-  is_cpu_type(MXC_CPU_MX6D) ? "Dual" : "Quad",
-  (gd->ram_size == 0x8000) ? "2GB" :
-  (gd->ram_size == 0x4000) ? "1GB" : "512MB", it);
-
-   return tdx_checkboard();
-}
-
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
 int ft_board_setup(void *blob, struct bd_info *bd)
 {
diff --git a/board/toradex/apalis_t30/apalis_t30.c 
b/board/toradex/apalis_t30/apalis_t30.c
index b9a2af33f19f..b10beb447965 100644
--- a/board/toradex/apalis_t30/apalis_t30.c
+++ b/board/toradex/apalis_t30/apalis_t30.c
@@ -45,14 +45,6 @@ int arch_misc_init(void)
return 0;
 }
 
-int checkboard(void)
-{
-   printf("Model: Toradex Apalis T30 %dGB\n",
-  (gd->ram_size == 0x4000) ? 1 : 2);
-
-   return tdx_checkboard();
-}
-
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
 int ft_board_setup(void *blob, struct bd_info *bd)
 {
diff --git a/board/toradex/colibri-imx6ull/colibri-imx6ull.c 
b/board/toradex/colibri-imx6ull/colibri-imx6ull.c
index a775f54eb3f4..9b9fb342c9d9 100644
--- a/board/toradex/colibri-imx6ull/colibri-imx6ull.c
+++ b/board/toradex/colibri-imx6ull/colibri-imx6ull.c
@@ -205,13 +205,6 @@ int board_late_init(void)
return 0;
 }
 
-int checkboard(void)
-{
-   printf("Model: Toradex Colibri iMX6ULL\n");
-
-   return tdx_checkboard();
-}
-
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
 int ft_board_setup(void *blob, struct bd_info *bd)
 {
diff --git a/board/toradex/colibri-imx8x/colibri-imx8x.c 
b/board/toradex/colibri-imx8x/colibri-imx8x.c
index d8cc72f323c5..2c673a4a6b06 100644
--- a/board/toradex/colibri-imx8x/colibri-imx8x.c
+++ b/board/toradex/colibri-imx8x/colibri-imx8x.c
@@ -114,16 +114,6 @@ int

[PATCH v1 4/7] arm: dts: Refactor device trees using "&{/aliases}" syntax

2024-02-20 Thread Francesco Dolcini
From: Emanuele Ghidoli 

Use the common syntax to define aliases.

Signed-off-by: Emanuele Ghidoli 
Signed-off-by: Francesco Dolcini 
---
 .../dts/imx6dl-colibri-eval-v3-u-boot.dtsi| 18 -
 arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi| 26 ++-
 .../arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi | 10 ---
 .../dts/imx8mm-verdin-wifi-dev-u-boot.dtsi| 12 -
 .../dts/imx8mp-verdin-wifi-dev-u-boot.dtsi| 12 -
 5 files changed, 43 insertions(+), 35 deletions(-)

diff --git a/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi 
b/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi
index 31f3a48dd9f0..0eea4d1862ae 100644
--- a/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi
+++ b/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi
@@ -5,13 +5,17 @@
 
 #include "imx6qdl-u-boot.dtsi"
 
-&{/aliases} {
-   /* U-Boot won't find PMIC otherwise */
-   i2c0 = 
-   i2c1 = 
-   /* SDHCI instance order: eMMC, 4-bit SD/MMC (U-Boot won't find 
ConfigBlock otherwise) */
-   mmc0 = 
-   mmc1 = 
+/ {
+   aliases {
+   /* U-Boot won't find PMIC otherwise */
+   i2c0 = 
+   i2c1 = 
+   /* SDHCI instance order: eMMC, 4-bit SD/MMC
+* (U-Boot won't find ConfigBlock otherwise)
+*/
+   mmc0 = 
+   mmc1 = 
+   };
 };
 
  {
diff --git a/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi 
b/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi
index 3d19796cb698..3c6e503d043b 100644
--- a/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi
+++ b/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi
@@ -5,18 +5,20 @@
 
 #include "imx6qdl-u-boot.dtsi"
 
-&{/aliases} {
-   /* U-Boot won't find PMIC otherwise */
-   i2c0 = 
-   i2c1 = 
-   i2c2 = 
-   /*
-* SDHCI instance order: eMMC, 8-bit SD/MMC, 4-bit SD
-* (U-Boot won't find ConfigBlock otherwise)
-*/
-   mmc0 = 
-   mmc1 = 
-   mmc2 = 
+/ {
+   aliases {
+   /* U-Boot won't find PMIC otherwise */
+   i2c0 = 
+   i2c1 = 
+   i2c2 = 
+   /*
+* SDHCI instance order: eMMC, 8-bit SD/MMC, 4-bit SD
+* (U-Boot won't find ConfigBlock otherwise)
+*/
+   mmc0 = 
+   mmc1 = 
+   mmc2 = 
+   };
 };
 
  {
diff --git a/arch/arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi 
b/arch/arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi
index 57ca28edb70d..b2c12a413daf 100644
--- a/arch/arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi
+++ b/arch/arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi
@@ -5,10 +5,12 @@
 
 #include "imx7s-u-boot.dtsi"
 
-&{/aliases} {
-   /* SDHCI instance order: eMMC, SD/MMC */
-   mmc0 = 
-   mmc1 = 
+/ {
+   aliases {
+   /* SDHCI instance order: eMMC, SD/MMC */
+   mmc0 = 
+   mmc1 = 
+   };
 };
 
  {
diff --git a/arch/arm/dts/imx8mm-verdin-wifi-dev-u-boot.dtsi 
b/arch/arm/dts/imx8mm-verdin-wifi-dev-u-boot.dtsi
index 8efa4ddc734a..515f195ab759 100644
--- a/arch/arm/dts/imx8mm-verdin-wifi-dev-u-boot.dtsi
+++ b/arch/arm/dts/imx8mm-verdin-wifi-dev-u-boot.dtsi
@@ -6,6 +6,12 @@
 #include "imx8mm-u-boot.dtsi"
 
 / {
+   aliases {
+   eeprom0 = _module;
+   eeprom1 = _carrier_board;
+   eeprom2 = _display_adapter;
+   };
+
wdt-reboot {
compatible = "wdt-reboot";
bootph-pre-ram;
@@ -13,12 +19,6 @@
};
 };
 
-&{/aliases} {
-   eeprom0 = _module;
-   eeprom1 = _carrier_board;
-   eeprom2 = _display_adapter;
-};
-
 &{/soc@0/bus@3080/i2c@30a2/pmic@25} {
bootph-pre-ram;
 };
diff --git a/arch/arm/dts/imx8mp-verdin-wifi-dev-u-boot.dtsi 
b/arch/arm/dts/imx8mp-verdin-wifi-dev-u-boot.dtsi
index 2a1aa1935a76..67f1d45ce269 100644
--- a/arch/arm/dts/imx8mp-verdin-wifi-dev-u-boot.dtsi
+++ b/arch/arm/dts/imx8mp-verdin-wifi-dev-u-boot.dtsi
@@ -6,6 +6,12 @@
 #include "imx8mp-u-boot.dtsi"
 
 / {
+   aliases {
+   eeprom0 = _module;
+   eeprom1 = _carrier_board;
+   eeprom2 = _display_adapter;
+   };
+
wdt-reboot {
compatible = "wdt-reboot";
bootph-pre-ram;
@@ -13,12 +19,6 @@
};
 };
 
-&{/aliases} {
-   eeprom0 = _module;
-   eeprom1 = _carrier_board;
-   eeprom2 = _display_adapter;
-};
-
  {
bootph-all;
bootph-pre-ram;
-- 
2.39.2



[PATCH v1 1/7] toradex: Fix recursive call to checkboard

2024-02-20 Thread Francesco Dolcini
From: Emanuele Ghidoli 

Since checkboard() is used instead of show_board_info(), in case toradex
config block is missing or malformed, checkboard is recursively called.
It prints a long list of "MISSING TORADEX CONFIG BLOCK" till the stack
is full.

Fixes: edb0ecd18708 ("toradex: Use checkboard() instead of show_board_info()")
Signed-off-by: Emanuele Ghidoli 
Signed-off-by: Francesco Dolcini 
---
 board/toradex/common/tdx-common.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/board/toradex/common/tdx-common.c 
b/board/toradex/common/tdx-common.c
index ed8f0a6a4756..ddc4a175da68 100644
--- a/board/toradex/common/tdx-common.c
+++ b/board/toradex/common/tdx-common.c
@@ -103,7 +103,6 @@ int tdx_checkboard(void)
if (read_tdx_cfg_block()) {
printf("MISSING TORADEX CONFIG BLOCK\n");
get_mac_from_serial(tdx_serial, _eth_addr);
-   checkboard();
} else {
snprintf(tdx_serial_str, sizeof(tdx_serial_str),
 "%08u", tdx_serial);
-- 
2.39.2



[PATCH v1 0/7] toradex: fix reset and hardware detection regressions

2024-02-20 Thread Francesco Dolcini
From: Francesco Dolcini 

This series fixes two regressions affecting multiple Toradex boards
(i.MX, TI and TEGRA based) and targets the current master, e.g. v2024.04 
release.

U-Boot `reset` command is broken on all Tordex i.MX6* based SoMs since
v2023.07, this series fixes it enabling the `wdt-reboot` driver.

Since v2024.04-rc1 reading the Toradex configuration block is not working
properly anymore, the serial number and the hardware version are not read
correctly, preventing the board from functioning correctly (wrong mac address,
wrong DT, ...). This is fixed by reading the config block in `EVT_SETTINGS_R` 
and
adding a toradex sysinfo driver. In addition to that, we now use a random mac
address in case the config block is invalid.


Reported-by: Sahaj Sarup 
Closes: 
https://lore.kernel.org/all/CAKZ1LvM45MB8N0CqgU+C7i9=bjb6kqntxwo2tv407hklwtc...@mail.gmail.com/
Reported-by: Marcel Ziswiler 
Closes: 
https://lore.kernel.org/all/e40ed93bd8f371ec56b8fc451dcb458f3ce6dcba.ca...@toradex.com/
Reported-by: Francesco Dolcini 
Closes: https://lore.kernel.org/all/ZY2ZDWAQuTlRjV9H@francesco-nb/

Emanuele Ghidoli (6):
  toradex: Fix recursive call to checkboard
  toradex: Remove not necessary model prints from checkboard()
  toradex: common: Use SETTINGS_R event to read toradex config block
  arm: dts: Refactor device trees using "&{/aliases}" syntax
  toradex: common: Add sysinfo driver
  toradex: common: Use random mac address if toradex config block is
missing

Parth Pancholi (1):
  toradex: imx6*: fix reset using wdt-reboot driver

 arch/arm/dts/fsl-imx8qm-apalis-u-boot.dtsi|   6 +
 arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi  |   6 +
 .../dts/imx6dl-colibri-eval-v3-u-boot.dtsi|  28 +++-
 arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi|  36 +++--
 .../dts/imx6ull-colibri-eval-v3-u-boot.dtsi   |  14 ++
 .../arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi |  14 +-
 .../dts/imx8mm-verdin-wifi-dev-u-boot.dtsi|  16 +-
 .../dts/imx8mp-verdin-wifi-dev-u-boot.dtsi|  16 +-
 .../dts/k3-am625-verdin-wifi-dev-u-boot.dtsi  |   4 +
 arch/arm/dts/tegra124-apalis-u-boot.dtsi  |  12 ++
 arch/arm/dts/tegra20-colibri-u-boot.dtsi  |  12 ++
 arch/arm/dts/tegra30-apalis-u-boot.dtsi   |  12 ++
 arch/arm/dts/tegra30-colibri-u-boot.dtsi  |  12 ++
 .../arm/dts/vf610-colibri-eval-v3-u-boot.dtsi |   4 +
 board/toradex/apalis-imx8/apalis-imx8.c   |  10 --
 board/toradex/apalis-tk1/apalis-tk1.c |   7 -
 board/toradex/apalis_imx6/apalis_imx6.c   |  21 ---
 board/toradex/apalis_t30/apalis_t30.c |   8 -
 .../toradex/colibri-imx6ull/colibri-imx6ull.c |   7 -
 board/toradex/colibri-imx8x/colibri-imx8x.c   |  10 --
 board/toradex/colibri_imx6/colibri_imx6.c |  20 ---
 board/toradex/colibri_imx7/colibri_imx7.c |   8 -
 board/toradex/colibri_t20/colibri_t20.c   |  10 --
 board/toradex/colibri_t30/colibri_t30.c   |   7 -
 board/toradex/colibri_vf/colibri_vf.c |  10 --
 board/toradex/common/Kconfig  |   1 +
 board/toradex/common/tdx-common.c | 137 +-
 board/toradex/common/tdx-common.h |   1 -
 configs/apalis-imx8_defconfig |   1 +
 configs/apalis-tk1_defconfig  |   1 +
 configs/apalis_imx6_defconfig |   4 +
 configs/apalis_t30_defconfig  |   1 +
 configs/colibri-imx6ull-emmc_defconfig|   4 +
 configs/colibri-imx6ull_defconfig |   4 +
 configs/colibri-imx8x_defconfig   |   1 +
 configs/colibri_imx6_defconfig|   4 +
 configs/colibri_imx7_defconfig|   1 +
 configs/colibri_imx7_emmc_defconfig   |   1 +
 configs/colibri_t20_defconfig |   1 +
 configs/colibri_t30_defconfig |   1 +
 configs/colibri_vf_defconfig  |   1 +
 configs/verdin-am62_a53_defconfig |   1 +
 configs/verdin-am62_r5_defconfig  |   1 +
 configs/verdin-imx8mm_defconfig   |   1 +
 configs/verdin-imx8mp_defconfig   |   1 +
 45 files changed, 284 insertions(+), 194 deletions(-)
 create mode 100644 arch/arm/dts/tegra124-apalis-u-boot.dtsi
 create mode 100644 arch/arm/dts/tegra20-colibri-u-boot.dtsi
 create mode 100644 arch/arm/dts/tegra30-apalis-u-boot.dtsi
 create mode 100644 arch/arm/dts/tegra30-colibri-u-boot.dtsi

-- 
2.39.2



Re: [PATCH] arm: dts: k3-am625-verdin-r5: Change CPU frequency to 1000MHz

2024-02-20 Thread Francesco Dolcini
On Tue, Feb 20, 2024 at 10:47:03AM +0530, Vignesh Raghavendra wrote:
> 
> 
> On 19/02/24 18:04, Vitor Soares wrote:
> > From: Vitor Soares 
> > 
> > The same U-Boot binary is compatible with multiple Verdin AM62 board
> > variants. However, some of the SoC models can only operate at a maximum
> > speed of 1 GHz.
> > 
> > Previously, the boards with lower-speed grades were running at
> > overclocked speeds, leading to kernel complaints about unsupported
> > configurations.
> > 
> > To resolve this issue, the operating speed has been decreased to the
> > maximum allowable value across all Verdin AM62 board variants. As a
> > result, there is a regression in overall boot time, increasing by around
> > 200 milliseconds for the faster SoC variant.
> > 
> 
> Patch as such is fine. But one way to avoid boot regression is to fixup
> the clock freq using based on speed grade identified by
> k3_get_speed_grade() and freq mapping table for each letter as show in
> datasheet [0]

Ack. I would still merge this as it is, I think that is conceptually
better to have a safe and valid value in the DT source file.

We can still do the optimization you suggested afterward, we just wanted
to get rid of any potential malfunction because of this overclocking as
soon as possible.

Francesco



Re: [PATCH] arm: dts: k3-am625-verdin-r5: Change CPU frequency to 1000MHz

2024-02-19 Thread Francesco Dolcini
On Mon, Feb 19, 2024 at 12:34:08PM +, Vitor Soares wrote:
> From: Vitor Soares 
> 
> The same U-Boot binary is compatible with multiple Verdin AM62 board
> variants. However, some of the SoC models can only operate at a maximum
> speed of 1 GHz.
> 
> Previously, the boards with lower-speed grades were running at
> overclocked speeds, leading to kernel complaints about unsupported
> configurations.
> 
> To resolve this issue, the operating speed has been decreased to the
> maximum allowable value across all Verdin AM62 board variants. As a
> result, there is a regression in overall boot time, increasing by around
> 200 milliseconds for the faster SoC variant.
> 
> Signed-off-by: Vitor Soares 

Reviewed-by: Francesco Dolcini 



Re: verdin-imx8mp: Ethernet does not load at boot

2024-02-15 Thread Francesco Dolcini
On Fri, Feb 16, 2024 at 10:31:20AM +0530, Sahaj Sarup wrote:
> On a verdin-imx8mp platform I am now unable to use the ethernet ports.
I believe it's a known regression, we are currently working on a fix.

See 
https://lore.kernel.org/all/e40ed93bd8f371ec56b8fc451dcb458f3ce6dcba.ca...@toradex.com/

Francesco



Re: [PATCH 6/6] arm: mach-k3: Move DRAM address of ATF for AM62/AM62a

2024-02-15 Thread Francesco Dolcini
Hello Andrew,
thanks for this series.

On Wed, Feb 14, 2024 at 10:30:09AM -0600, Andrew Davis wrote:
> The current address of TF-A in DRAM is just below the 512MB address line.
> This means if the DRAM in a system is 512MB then TF-A is right at the
> end of memory which is often reused, for instance U-Boot relocates itself
> here. If a system has less than 512MB then that system wouldn't work at
> all as TF-A would fail to load.

Do you expect issue with system with exactly 512MB of RAM? We have such
a board available and this is something that was not on our radar.

The way we handle this is with `verdin-am62.c:board_get_usable_ram_top()`

There is also some other reserved memory just before the 512MB limit,
not just the TF-A.

Francesco



[PATCH v1] Revert "board: verdin-am62: set cpu core voltage depending on speed grade"

2024-02-13 Thread Francesco Dolcini
From: Francesco Dolcini 

This reverts commit d2099587d661c6ca2309256c0e04c06e26c8d34c.

According to TI changing the VDD_CORE while the SoC is running is not
allowed, the voltage must be set before the AM62 device reset is
released, revert this change therefore.

The correct solution would be to program the PMIC during manufactoring
according to the speed grade of the SoC.

Link: 
https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1318338/am623-booting-from-mmc-failed-after-lowering-vdd_core-to-0-75v/5036508#5036508
Fixes: d2099587d661 ("board: verdin-am62: set cpu core voltage depending on 
speed grade")
Signed-off-by: Francesco Dolcini 
---
 board/toradex/verdin-am62/verdin-am62.c | 47 -
 1 file changed, 47 deletions(-)

diff --git a/board/toradex/verdin-am62/verdin-am62.c 
b/board/toradex/verdin-am62/verdin-am62.c
index 395eb365a0bf..e948fc16ba99 100644
--- a/board/toradex/verdin-am62/verdin-am62.c
+++ b/board/toradex/verdin-am62/verdin-am62.c
@@ -14,13 +14,10 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include "../common/tdx-cfg-block.h"
 
-#define VDD_CORE_REG "buck1"
-
 DECLARE_GLOBAL_DATA_PTR;
 
 int board_init(void)
@@ -53,37 +50,9 @@ int board_fit_config_name_match(const char *name)
 }
 #endif
 
-static u32 get_vdd_core_nominal(void)
-{
-   int core_uvolt;
-
-   switch (k3_get_speed_grade()) {
-   case 'G':
-   case 'K':
-   case 'S':
-   core_uvolt = 75;
-   break;
-   case 'T':
-   default:
-   core_uvolt = 85;
-   break;
-   }
-   return core_uvolt;
-}
-
 #if IS_ENABLED(CONFIG_OF_LIBFDT) && IS_ENABLED(CONFIG_OF_BOARD_SETUP)
 int ft_board_setup(void *blob, struct bd_info *bd)
 {
-   int core_uvolt;
-
-   core_uvolt = get_vdd_core_nominal();
-   if (core_uvolt != 85) {
-   do_fixup_by_path_u32(blob, 
"/bus@f/i2c@2000/pmic@30/regulators/buck1",
-"regulator-max-microvolt", core_uvolt, 0);
-   do_fixup_by_path_u32(blob, 
"/bus@f/i2c@2000/pmic@30/regulators/buck1",
-"regulator-min-microvolt", core_uvolt, 0);
-   }
-
return ft_common_board_setup(blob, bd);
 }
 #endif
@@ -118,22 +87,6 @@ static void select_dt_from_module_version(void)
 
 int board_late_init(void)
 {
-   int ret;
-   int core_uvolt;
-   struct udevice *dev = NULL;
-
-   core_uvolt = get_vdd_core_nominal();
-   if (core_uvolt != 85) {
-   /* Set CPU core voltage to 0.75V for slower speed grades */
-   ret = regulator_get_by_devname(VDD_CORE_REG, );
-   if (ret)
-   pr_err("VDD CORE Regulator get error: %d\n", ret);
-
-   ret = regulator_set_value_force(dev, core_uvolt);
-   if (ret)
-   pr_err("VDD CORE Regulator value setting error: %d\n", 
ret);
-   }
-
select_dt_from_module_version();
 
return 0;
-- 
2.39.2



[PATCH v1 2/2] arm: mach-k3: am62: Fixup thermal zone critical points

2024-02-08 Thread Francesco Dolcini
From: Joao Paulo Goncalves 

Read the max temperature for the SoC temperature grade from the hardware
and change the critical trip nodes on each thermal zone of FDT at
runtime so they are correct with the hardware value for its grade.

Signed-off-by: Joao Paulo Goncalves 
Signed-off-by: Francesco Dolcini 
---
 arch/arm/mach-k3/am625_fdt.c | 37 
 1 file changed, 37 insertions(+)

diff --git a/arch/arm/mach-k3/am625_fdt.c b/arch/arm/mach-k3/am625_fdt.c
index 970dd3447dec..3c46d1028fd0 100644
--- a/arch/arm/mach-k3/am625_fdt.c
+++ b/arch/arm/mach-k3/am625_fdt.c
@@ -38,11 +38,48 @@ static void fdt_fixup_pru_node_am625(void *blob, int 
has_pru)
fdt_del_node_path(blob, "/bus@f/pruss@3004");
 }
 
+static int fdt_fixup_trips_node(void *blob, int zoneoffset, int maxc)
+{
+   int node, trip;
+
+   node = fdt_subnode_offset(blob, zoneoffset, "trips");
+   if (node < 0)
+   return -1;
+
+   fdt_for_each_subnode(trip, blob, node) {
+   const char *type = fdt_getprop(blob, trip, "type", NULL);
+
+   if (!type || (strncmp(type, "critical", 8) != 0))
+   continue;
+
+   if (fdt_setprop_u32(blob, trip, "temperature", 1000 * maxc) < 0)
+   return -1;
+   }
+
+   return 0;
+}
+
+static void fdt_fixup_thermal_zone_nodes_am625(void *blob, int maxc)
+{
+   int node, zone;
+
+   node = fdt_path_offset(blob, "/thermal-zones");
+   if (node < 0)
+   return;
+
+   fdt_for_each_subnode(zone, blob, node) {
+   if (fdt_fixup_trips_node(blob, zone, maxc) < 0)
+   printf("Failed to set temperature in %s critical 
trips\n",
+  fdt_get_name(blob, zone, NULL));
+   }
+}
+
 int ft_system_setup(void *blob, struct bd_info *bd)
 {
fdt_fixup_cores_nodes_am625(blob, k3_get_core_nr());
fdt_fixup_gpu_nodes_am625(blob, k3_has_gpu());
fdt_fixup_pru_node_am625(blob, k3_has_pru());
+   fdt_fixup_thermal_zone_nodes_am625(blob, k3_get_max_temp());
 
return 0;
 }
-- 
2.39.2



[PATCH v1 1/2] arm: mach-k3: am62: Get soc max temperature by grade

2024-02-08 Thread Francesco Dolcini
From: Joao Paulo Goncalves 

AM62x SoC is available in multiple temperature grade:
- Commercial: 0° to 95° C
- Industrial: -40° to 105° C
- Automotive: -40° to 125° C

Add a new function that returns the am62 max temperature value
accordingly to its temperature grade in Celsius.

Signed-off-by: Joao Paulo Goncalves 
Signed-off-by: Francesco Dolcini 
---
 arch/arm/mach-k3/include/mach/am62_hardware.h | 17 +
 1 file changed, 17 insertions(+)

diff --git a/arch/arm/mach-k3/include/mach/am62_hardware.h 
b/arch/arm/mach-k3/include/mach/am62_hardware.h
index 54380f36e161..9c4c6c542b63 100644
--- a/arch/arm/mach-k3/include/mach/am62_hardware.h
+++ b/arch/arm/mach-k3/include/mach/am62_hardware.h
@@ -42,6 +42,10 @@
 
 #define JTAG_DEV_FEATURE_NO_PRU0x4
 
+#define JTAG_DEV_TEMP_COMMERCIAL   0x3
+#define JTAG_DEV_TEMP_INDUSTRIAL   0x4
+#define JTAG_DEV_TEMP_AUTOMOTIVE   0x5
+
 #define CTRLMMR_MAIN_DEVSTAT   (WKUP_CTRL_MMR0_BASE + 0x30)
 #define MAIN_DEVSTAT_PRIMARY_BOOTMODE_MASK GENMASK(6, 3)
 #define MAIN_DEVSTAT_PRIMARY_BOOTMODE_SHIFT3
@@ -102,6 +106,19 @@ static inline int k3_get_temp_grade(void)
return (full_devid & JTAG_DEV_TEMP_MASK) >> JTAG_DEV_TEMP_SHIFT;
 }
 
+static inline int k3_get_max_temp(void)
+{
+   switch (k3_get_temp_grade()) {
+   case JTAG_DEV_TEMP_INDUSTRIAL:
+   return 105;
+   case JTAG_DEV_TEMP_AUTOMOTIVE:
+   return 125;
+   case JTAG_DEV_TEMP_COMMERCIAL:
+   default:
+   return 95;
+   }
+}
+
 static inline int k3_has_pru(void)
 {
u32 full_devid = readl(CTRLMMR_WKUP_JTAG_DEVICE_ID);
-- 
2.39.2



[PATCH v1 0/2] arm: mach-k3: am62: Fixup thermal zone critical points

2024-02-08 Thread Francesco Dolcini
From: Francesco Dolcini 

This series adds support to dynamically fixup the DT the critical thermal trip
point of TI AM62 depending on the SoC temperature grade.

Joao Paulo Goncalves (2):
  arm: mach-k3: am62: Get soc max temperature by grade
  arm: mach-k3: am62: Fixup thermal zone critical points

 arch/arm/mach-k3/am625_fdt.c  | 37 +++
 arch/arm/mach-k3/include/mach/am62_hardware.h | 17 +
 2 files changed, 54 insertions(+)

-- 
2.39.2



Re: [PATCH] toradex: tdx-cfg-block: Add new apalis and colibri pid

2024-01-25 Thread Francesco Dolcini
On Mon, Jan 22, 2024 at 05:09:30PM -0300, Joao Paulo Goncalves wrote:
> From: Joao Paulo Goncalves 
> 
> Add new apalis imx6 and colibri imx6/imx7 products IDs.
> 
> Signed-off-by: Joao Paulo Goncalves 
> ---
>  board/toradex/common/tdx-cfg-block.c | 9 +
>  board/toradex/common/tdx-cfg-block.h | 9 +
>  2 files changed, 18 insertions(+)
> 
> diff --git a/board/toradex/common/tdx-cfg-block.c 
> b/board/toradex/common/tdx-cfg-block.c
> index 7187e1ba377..7affc290395 100644
> --- a/board/toradex/common/tdx-cfg-block.c
> +++ b/board/toradex/common/tdx-cfg-block.c
> @@ -147,6 +147,15 @@ const struct toradex_som toradex_modules[] = {
>   [74] = { "Verdin AM62 Dual 1GB IT",  
> TARGET_IS_ENABLED(VERDIN_AM62_A53) },
>   [75] = { "Verdin AM62 Dual 1GB WB IT",   
> TARGET_IS_ENABLED(VERDIN_AM62_A53) },
>   [76] = { "Verdin AM62 Quad 2GB WB IT",   
> TARGET_IS_ENABLED(VERDIN_AM62_A53) },
> + [77] = { "Colibri iMX6S 256MB",  
> TARGET_IS_ENABLED(COLIBRI_IMX6)},
> + [78] = { "Colibri iMX6S 256MB IT",   
> TARGET_IS_ENABLED(COLIBRI_IMX6)},
> + [79] = { "Colibri iMX6DL 512MB", 
> TARGET_IS_ENABLED(COLIBRI_IMX6)},  
there is some trailing space here at the end of the line.

Fabio, can you fix this up before applying?

Francesco



Re: [PATCH v1 4/4] board: verdin-am62: set cpu core voltage depending on speed grade

2024-01-18 Thread Francesco Dolcini
On Thu, Jan 18, 2024 at 05:31:20PM +0100, Max Krummenacher wrote:
> On Thu, Jan 18, 2024 at 10:50:07AM +0100, Max Krummenacher wrote:
> > On Wed, Jan 17, 2024 at 11:16:49AM +0100, Max Krummenacher wrote:
> > > From: Max Krummenacher 
> > > 
> > > Speed grade T requires the VDD_CORE voltage to be 0.85V if using
> > > the maximum core frequency.
> > > 
> > > Speed grades G, K, S allow the VDD_CORE voltage to be 0.75V up to the
> > > maximum core frequency but allow to run at 0.85V.
> > > 
> > > For efficiency in manufacturing and code maintenance we use 0.85V for
> > > the PMIC defaults and device tree settings and dynamically adjust the
> > > voltage in the PMIC and device tree to 0.75V for lower speed SKU to
> > > gain more than 100mW power consumption reduction.
> > > 
> > > Signed-off-by: Max Krummenacher 
> > > ---
> > > 
> > >  board/toradex/verdin-am62/verdin-am62.c | 47 +
> > >  1 file changed, 47 insertions(+)
> > > 
> > > diff --git a/board/toradex/verdin-am62/verdin-am62.c 
> > > b/board/toradex/verdin-am62/verdin-am62.c
> > > index 4e912b5f32f..8b9db224069 100644
> > > --- a/board/toradex/verdin-am62/verdin-am62.c
> > > +++ b/board/toradex/verdin-am62/verdin-am62.c
> > > @@ -13,10 +13,13 @@
> > >  #include 
> > >  #include 
> > >  #include 
> > > +#include 
> > 
> > In the !DM_REGULATOR case regulator.h assumes errno.h to be already 
> > included.
> > This happens when compiling the R5 SPL.
> > 
> > Will fix this in a v2 of the series.
> 
> Actually we can go on with the series. While it is true that errno.h is not
> included in regulator.h, the required header is included and its definitions
> available.
> 
> I will create a separate patch which cleans up the headers, so that they
> become self contained.

FTR, https://lore.kernel.org/all/20240118181106.4133924-1-max.oss...@gmail.com/

As Max wrote this series does not require that cleanup.

Francesco



Re: [PATCH] headers: don't depend on errno.h being available

2024-01-18 Thread Francesco Dolcini
On Thu, Jan 18, 2024 at 07:10:47PM +0100, max.oss...@gmail.com wrote:
> From: Max Krummenacher 
> 
> These headers follow the pattern:
> 
> | #if CONFIG_IS_ENABLED(FANCY_FEATURE)
> |   void foo(void);
> | #else
> |   static inline void foo(void) { return -ENOSYS; }
> | #endif
> 
> In the #else path ENOSYS is used, however linux/errno.h is not included.
> If errno.h has not been included already the compiler errors out even
> if the inline function is not referenced.
> 
> Make those headers self contained.
> 
> Signed-off-by: Max Krummenacher 

Reviewed-by: Francesco Dolcini 



Re: [PATCH v13 00/24] Modernize U-Boot shell

2024-01-17 Thread Francesco Dolcini
On Thu, Jan 18, 2024 at 12:30:42AM +0700, Francis Laniel wrote:
> Le mercredi 17 janvier 2024, 17:05:28 +07 Patrice CHOTARD a écrit :
> > On 1/16/24 18:25, Francis Laniel wrote:
> > > Le mardi 16 janvier 2024, 00:34:24 +07 Patrice CHOTARD a écrit :
> > >> On 1/11/24 18:04, Francesco Dolcini wrote:
> > >>> On Fri, Dec 29, 2023 at 07:55:37PM +0100, Francis Laniel wrote:
> > >>>> Le jeudi 28 décembre 2023, 21:58:59 CET Tom Rini a écrit :
> > >>>>> On Fri, 22 Dec 2023 22:02:20 +0100, Francis Laniel wrote:
> > >>>>>> During 2021 summer, Sean Anderson wrote a contribution to add a new
> > >>>>>> shell,
> > >>>>>> based on LIL, to U-Boot [1, 2].
> > >>>>>> While one of the goals of this contribution was to address the fact
> > >>>>>> actual
> > >>>>>> U-Boot shell, which is based on Busybox hush, is old there was a
> > >>>>>> discussion
> > >>>>>> about adding a new shell versus updating the actual one [3, 4].
> > >>>>>> 
> > >>>>>> So, in this series, with Harald Seiler, we updated the actual U-Boot
> > >>>>>> shell
> > >>>>>> to reflect what is currently in Busybox source code.
> > >>>>>> Basically, this contribution is about taking a snapshot of Busybox
> > >>>>>> shell/hush.c file (as it exists in commit 37460f5da) and adapt it to
> > >>>>>> suit
> > >>>>>> U-Boot needs.
> > >>>>>> 
> > >>>>>> [...]
> > >>>>> 
> > >>>>> Applied to u-boot/next, thanks!
> > >>>> 
> > >>>> Thank you for the merge!
> > >>>> If there is any problem, do not hesitate to mail me and I will take
> > >>>> care
> > >>>> of
> > >>>> it!
> > >>> 
> > >>> This change, specifically setting the modern hush shell as default, is
> > >>> breaking our boot script, just noticed since the current U-Boot master
> > >>> has a regression for us.
> > >>> 
> > >>> We still need to figure out the exact details, here [1] you can find the
> > >>> boot script (that has some placeholder that is replaced during build).
> > >>> 
> > >>> and the error is something like:
> > >>> 
> > >>> ```
> > >>> ## Executing script at 9028
> > >>> Loading DeviceTree: k3-am625-verdin-nonwifi-dev.dtb
> > >>> 69025 bytes read in 11 ms (6 MiB/s)
> > >>> 82 bytes read in 9 ms (8.8 KiB/s)
> > >>> Working FDT set to 9020
> > >>> syntax error at 'done'HUSH died!
> > >>> resetting ...
> > >>> ```
> > >>> 
> > >>> that I _assume_ comes from this line
> > >>> 
> > >>> env set set_apply_overlays 'env set apply_overlays "for overlay_file
> > >>> in \\${fdt_overlays}; do echo Applying Overlay: \\${overlay_file} &&
> > >>> ${load_cmd} \\${loadaddr} \\${overlays_prefix}\\${overlay_file} &&
> > >>> fdt apply \\${loadaddr}; env set overlay_file; done; true"'>
> > >>> 
> > >>> [1]
> > >>> https://git.toradex.com/cgit/meta-toradex-bsp-common.git/tree/recipes-bs
> > >>> p
> > >>> /u-boot/u-boot-distro-boot/boot.cmd.in
> > >>> 
> > >>> Francesco
> > >> 
> > >> Hi all
> > >> 
> > >> I observed a similar issue with STM32MP157c-DK2 board.
> > >> Since commit 78912cfde281 ("cmd: Set modern hush as default shell")
> > >> U-Boot
> > >> crashes :
> > >> 
> > >> 
> > >> U-Boot 2024.01-00486-g697758e7c81-dirty (Jan 15 2024 - 18:23:52 +0100)
> > >> 
> > >> CPU: STM32MP157CAC Rev.B
> > >> Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
> > >> Board: stm32mp1 in trusted mode (st,stm32mp157c-dk2)
> > >> Board: MB1272 Var2.0 Rev.C-01
> > >> DRAM:  512 MiB
> > >> Clocks:
> > >> - MPU : 650 MHz
> > >> - MCU : 208.878 MHz
> > >> - AXI : 266.500 MHz
> > >> - PER : 24 MHz
> > >> - DDR : 533 MHz
> > >> optee optee: OP-TEE: revision

Re: [PATCH v1 0/4] board: verdin-am62: set cpu core voltage depending on speed grade

2024-01-17 Thread Francesco Dolcini
On Wed, Jan 17, 2024 at 11:16:45AM +0100, Max Krummenacher wrote:
> 
> The series moves the existing access functions to the AM62 Device
> Identification fields and adds function for the not yet accessible
> fields to be available to all.
> 
> This is then used in the Verdin AM62 board code to set the CPU core
> voltage according to speed grade to gain more than 100mW power
> consumption reduction for the slower speed graded SKUs.

For the whole series,

Reviewed-by: Francesco Dolcini 



Re: [RFC][PATCH] ARM: imx: verdin-imx8mm: Set CAN oscillator frequency based on model

2024-01-16 Thread Francesco Dolcini
On Tue, Jan 16, 2024 at 02:01:02AM +0100, Marek Vasut wrote:
> On 1/15/24 16:44, Francesco Dolcini wrote:
> > On Sat, Jan 13, 2024 at 07:33:17PM +0100, Marek Vasut wrote:
> > 0059, V1.1A and V1.1B, use a 20MHz oscillator
> > 0055, V1.1A, V1.1B, V1.1C and V1.1D, use a 20Mhz oscillator
> 
> Do you happen to have a table of what was populated with which oscillator,
> so I can fill all the 20 MHz parts in right away ?

I guess that one quoted here from my previous email is "the table", but maybe I
have not understood your question.

Francesco





Re: [RFC][PATCH] ARM: imx: verdin-imx8mm: Set CAN oscillator frequency based on model

2024-01-15 Thread Francesco Dolcini
On Sat, Jan 13, 2024 at 07:33:17PM +0100, Marek Vasut wrote:
> The older i.MX8M Mini Verdin SoMs before rev. 1.1C came with 20 MHz SPI CAN
> controller oscillator, the newer SoMs use 40 MHz oscillator. Handle both by
> overriding the oscillator frequency just before booting the kernel.
> 
> Signed-off-by: Marek Vasut 
> ---
> Cc: "NXP i.MX U-Boot Team" 
> Cc: Fabio Estevam 
> Cc: Francesco Dolcini 
> Cc: Marcel Ziswiler 
> Cc: Philippe Schenker 

Philippe is no longer in toradex, removed from cc list.

> Cc: Stefano Babic 
> ---
>  board/toradex/verdin-imx8mm/verdin-imx8mm.c | 19 +++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/board/toradex/verdin-imx8mm/verdin-imx8mm.c 
> b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
> index b2781b51d6a..8bc1a51eeb1 100644
> --- a/board/toradex/verdin-imx8mm/verdin-imx8mm.c
> +++ b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
> @@ -142,6 +142,25 @@ int board_phys_sdram_size(phys_size_t *size)
>  #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
>  int ft_board_setup(void *blob, struct bd_info *bd)
>  {
> + const char *canoscpath = "/oscillator";
> + int canoscoff, freq, ret;
> +
> + canoscoff = fdt_path_offset(blob, canoscpath);
> + if (canoscoff < 0)  /* No CAN oscillator found. */
> + goto exit;
> +
> + if (tdx_hw_tag.ver_assembly < 2)/* rev. A or B */
> + freq = 2000;
> + else/* rev. C or newer */
> + freq = 4000;

So, the situation is more complex than what I thought initially.

The actual frequency of the oscillator depends on the whole
`struct toradex_hw`, you would need to check prodid, ver_major,
ver_minor and ver_assembly.

In addition to that code should not expect `ver_assembly` to be an
increasing number, this is just a number that is matching the BOM.

The actual `prodid` (PID4 in Toradex naming) that have the CAN
functionality are 0055 and 0059.

0059, V1.1A and V1.1B, use a 20MHz oscillator
0055, V1.1A, V1.1B, V1.1C and V1.1D, use a 20Mhz oscillator

Verdin iMX8MM V1.0* is something I would not consider, from what I know
they were all scrapped (not even myself has any of those anymore).

With that said what I would do is something like

if ((tdx_hw_tag.ver_major == 1 && tdx_hw_tag.ver_minor == 1) &&
((tdx_hw_tag.prodid == VERDIN_IMX8MMQ_IT && ver_assembly <= 1) ||
(tdx_hw_tag.prodid == VERDIN_IMX8MMQ_WIFI_BT_IT &&. ))

ft_fixup_can_oscillator_freq();

or any other more readable variant of your choice ;-)

And I would not have the code guess anything apart this, just setting
20MHz for the well known configuration.

If you are interested the details on the versions they are public, see
https://www.toradex.com/computer-on-modules/verdin-arm-family/nxp-imx-8m-mini-nano
and
https://developer.toradex.com/hardware/verdin-som-family/modules/verdin-imx8m-mini/#revision-history

Francesco



Re: [RFC][PATCH] ARM: imx: verdin-imx8mm: Set CAN oscillator frequency based on model

2024-01-13 Thread Francesco Dolcini
On Sat, Jan 13, 2024 at 09:45:42PM +0100, Francesco Dolcini wrote:
> On Sat, Jan 13, 2024 at 06:40:19PM +, Marcel Ziswiler wrote:
> > Hi Marek
> > 
> > Thanks, seems like a decent idea. I guess we just did not do it as those 
> > previous revisions were just samples
> > but with this change can still be used much easier (e.g. without requiring 
> > manual intervention).
> > 
> > On Sat, 2024-01-13 at 19:33 +0100, Marek Vasut wrote:
> > > The older i.MX8M Mini Verdin SoMs before rev. 1.1C came with 20 MHz SPI 
> > > CAN
> > > controller oscillator, the newer SoMs use 40 MHz oscillator. Handle both 
> > > by
> > > overriding the oscillator frequency just before booting the kernel.
> > > 
> > > Signed-off-by: Marek Vasut 
> > > ---
> > > Cc: "NXP i.MX U-Boot Team" 
> > > Cc: Fabio Estevam 
> > > Cc: Francesco Dolcini 
> > > Cc: Marcel Ziswiler 
> > > Cc: Philippe Schenker 
> > > Cc: Stefano Babic 
> > 
> > Acked-by: Marcel Ziswiler 
> 
> Marcel, that patch is buggy.
> 
> The assembly version makes sense only for a specific major/minor
> hardware version.
> 
> So what you need to check if revision < 1.1C, while the code from Marek
> check just for the assembly version C.

And in the general case even my suggested test is not enough.  We
started having assembly version that are not linearly increasing since
some time.

I am fine on finding a solution to dynamically handle the different
oscillator frequency, but let's do it right.

I will reply Monday with some more details so we can have a working
solution.

Francesco



Re: [RFC][PATCH] ARM: imx: verdin-imx8mm: Set CAN oscillator frequency based on model

2024-01-13 Thread Francesco Dolcini
On Sat, Jan 13, 2024 at 06:40:19PM +, Marcel Ziswiler wrote:
> Hi Marek
> 
> Thanks, seems like a decent idea. I guess we just did not do it as those 
> previous revisions were just samples
> but with this change can still be used much easier (e.g. without requiring 
> manual intervention).
> 
> On Sat, 2024-01-13 at 19:33 +0100, Marek Vasut wrote:
> > The older i.MX8M Mini Verdin SoMs before rev. 1.1C came with 20 MHz SPI CAN
> > controller oscillator, the newer SoMs use 40 MHz oscillator. Handle both by
> > overriding the oscillator frequency just before booting the kernel.
> > 
> > Signed-off-by: Marek Vasut 
> > ---
> > Cc: "NXP i.MX U-Boot Team" 
> > Cc: Fabio Estevam 
> > Cc: Francesco Dolcini 
> > Cc: Marcel Ziswiler 
> > Cc: Philippe Schenker 
> > Cc: Stefano Babic 
> 
> Acked-by: Marcel Ziswiler 

Marcel, that patch is buggy.

The assembly version makes sense only for a specific major/minor
hardware version.

So what you need to check if revision < 1.1C, while the code from Marek
check just for the assembly version C.

> 
> > ---
> >  board/toradex/verdin-imx8mm/verdin-imx8mm.c | 19 +++
> >  1 file changed, 19 insertions(+)
> > 
> > diff --git a/board/toradex/verdin-imx8mm/verdin-imx8mm.c 
> > b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
> > index b2781b51d6a..8bc1a51eeb1 100644
> > --- a/board/toradex/verdin-imx8mm/verdin-imx8mm.c
> > +++ b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
> > @@ -142,6 +142,25 @@ int board_phys_sdram_size(phys_size_t *size)
> >  #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
> >  int ft_board_setup(void *blob, struct bd_info *bd)
> >  {
> > +   const char *canoscpath = "/oscillator";
> > +   int canoscoff, freq, ret;
> > +
> > +   canoscoff = fdt_path_offset(blob, canoscpath);
> > +   if (canoscoff < 0)  /* No CAN oscillator found. */
> > +   goto exit;
> > +
> > +   if (tdx_hw_tag.ver_assembly < 2)    /* rev. A or B */
I would suggest a slightly different approach.

First you need to check also for major/minor version. The revision
restart from A every time there is a change in a version.

Second I would set the 20MHz oscillator only for older version and do
nothing, not set anything, for the newer one.

On Sat, Jan 13, 2024 at 04:52:57PM -0300, Fabio Estevam wrote:
> On Sat, Jan 13, 2024 at 3:34 PM Marek Vasut  wrote:
> >
> > The older i.MX8M Mini Verdin SoMs before rev. 1.1C came with 20 MHz SPI CAN
> > controller oscillator, the newer SoMs use 40 MHz oscillator. Handle both by
> > overriding the oscillator frequency just before booting the kernel.
> >
> > Signed-off-by: Marek Vasut 
> 
> Applied, thanks.

Fabio, you were too fast ... please revert it.

Francesco




Re: [PATCH v13 00/24] Modernize U-Boot shell

2024-01-11 Thread Francesco Dolcini
Hello Tom, Francis

On Fri, Dec 29, 2023 at 07:55:37PM +0100, Francis Laniel wrote:
> Le jeudi 28 décembre 2023, 21:58:59 CET Tom Rini a écrit :
> > On Fri, 22 Dec 2023 22:02:20 +0100, Francis Laniel wrote:
> > > During 2021 summer, Sean Anderson wrote a contribution to add a new shell,
> > > based on LIL, to U-Boot [1, 2].
> > > While one of the goals of this contribution was to address the fact actual
> > > U-Boot shell, which is based on Busybox hush, is old there was a
> > > discussion
> > > about adding a new shell versus updating the actual one [3, 4].
> > > 
> > > So, in this series, with Harald Seiler, we updated the actual U-Boot shell
> > > to reflect what is currently in Busybox source code.
> > > Basically, this contribution is about taking a snapshot of Busybox
> > > shell/hush.c file (as it exists in commit 37460f5da) and adapt it to suit
> > > U-Boot needs.
> > > 
> > > [...]
> > 
> > Applied to u-boot/next, thanks!
> 
> Thank you for the merge!
> If there is any problem, do not hesitate to mail me and I will take care of 
> it!

This change, specifically setting the modern hush shell as default, is
breaking our boot script, just noticed since the current U-Boot master
has a regression for us.

We still need to figure out the exact details, here [1] you can find the
boot script (that has some placeholder that is replaced during build).

and the error is something like:

```
## Executing script at 9028
Loading DeviceTree: k3-am625-verdin-nonwifi-dev.dtb
69025 bytes read in 11 ms (6 MiB/s)
82 bytes read in 9 ms (8.8 KiB/s)
Working FDT set to 9020
syntax error at 'done'HUSH died!
resetting ...
```

that I _assume_ comes from this line

env set set_apply_overlays 'env set apply_overlays "for overlay_file in 
\\${fdt_overlays}; do echo Applying Overlay: \\${overlay_file} && ${load_cmd} 
\\${loadaddr} \\${overlays_prefix}\\${overlay_file} && fdt apply \\${loadaddr}; 
env set overlay_file; done; true"'

[1] 
https://git.toradex.com/cgit/meta-toradex-bsp-common.git/tree/recipes-bsp/u-boot/u-boot-distro-boot/boot.cmd.in

Francesco



Re: [PATCH 4/4] configs: am64x_evm_a53_defconfig: Enable NAND

2024-01-09 Thread Francesco Dolcini
On Tue, Jan 09, 2024 at 02:54:00PM -0500, Tom Rini wrote:
> On Tue, Jan 09, 2024 at 01:18:59PM -0600, Nishanth Menon wrote:
> > On 14:26-20240109, Roger Quadros wrote:
> > >  CONFIG_CMD_PMIC=y
> > >  CONFIG_CMD_REGULATOR=y
> > > +CONFIG_CMD_MTDPARTS=y
> > > +CONFIG_MTDIDS_DEFAULT="nand0=omap2-nand.0"
> > > +CONFIG_MTDPARTS_DEFAULT="mtdparts=omap2-nand.0:2m(NAND.tiboot3),2m(NAND.tispl),2m(NAND.tiboot3.backup),4m(NAND.u-boot),256k(NAND.u-boot-env),256k(NAND.u-boot-env.backup),-(NAND.file-system)"
> > 
> > Why not handle this as device tree partitions?
> 
> I honestly forget what the preferred way of defining and passing NAND
> partition information is these days. It might even be the funny case
> that passing as cmdline args is "best" rather than fixed-partitions
> binding?

According to past discussions [1] doing the fixup in U-Boot is not advised.

Using the command line or having the partition fixed in the DT are both
valid options.

[1] https://lore.kernel.org/all/20230206224838.75963-1-france...@dolcini.it/

Francesco



[PATCH v1] verdin-imx8mm: Remove stale fdt_addr env variable

2024-01-02 Thread Francesco Dolcini
From: Francesco Dolcini 

fdt_addr variable is the location in flash of the device tree blob [1], it
does not exist for verdin-imx8mm.

Because of this the bootefi command fails unless the optional
`[fdt address]` parameter is passed on the command line,
bootefi.c:efi_install_fdt() assumes that `fdt_addr` is valid when
present.

Fix this removing fdt_addr from the U-Boot environment.

[1] doc/usage/environment.rst

Signed-off-by: Francesco Dolcini 
---
 include/configs/verdin-imx8mm.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/configs/verdin-imx8mm.h b/include/configs/verdin-imx8mm.h
index 8072d5d503f2..a7ea02807ddf 100644
--- a/include/configs/verdin-imx8mm.h
+++ b/include/configs/verdin-imx8mm.h
@@ -40,7 +40,6 @@
"boot_file=Image\0" \
"boot_script_dhcp=boot.scr\0" \
"console=ttymxc0\0" \
-   "fdt_addr=0x4300\0" \
"fdt_board=dev\0" \
"initrd_addr=0x4380\0" \
"initrd_high=0x\0" \
-- 
2.39.2



Re: Regression: i.MX6ULL reset not working

2023-12-28 Thread Francesco Dolcini
On Thu, Dec 28, 2023 at 02:08:33PM -0300, Fabio Estevam wrote:
> On Thu, Dec 28, 2023 at 1:46 PM Francesco Dolcini  
> wrote:
> 
> > With that we would have to enable the watchdog, something that is not
> > done today. Any potential downside on doing it?
> 
> I don't see any.
> 
> The watchdog was being used originally too, but not via DM.

Are you sure? After the related kconfig changes you'll have CONFIG_WDT
enabled, and with that the watchdog is started and you need to
periodically refresh it. At the moment the watchdog is not enabled at
boot and it is used only for the reset.

While the change might be fine, my concern is that this might affect some use
cases. Debugging? Kernel not having the watchdog driver enabled? Any
other fancy use-case?

Assuming I am not getting this all wrong, and enabling CONFIG_WDT has
no real effects, please correct me if I'm wrong.

Francesco




Re: Regression: i.MX6ULL reset not working

2023-12-28 Thread Francesco Dolcini
On Thu, Dec 28, 2023 at 01:35:31PM -0300, Fabio Estevam wrote:
> Hi Francesco,
> 
> On Thu, Dec 28, 2023 at 12:49 PM Francesco Dolcini  
> wrote:
> >
> > Hello Marek and all,
> > I just tried latest master on colibri-imx6ull-emmc and the reset command
> > is broken - it does nothing.
> >
> > From a bisect the issue was introduced with commit 68dcbdd594d4 ("ARM:
> > imx: Add weak default reset_cpu()"), U-Boot releases >= v2023.07 are
> > broken.
> >
> > Any hint? I did not try to debug it myself (yet?).
> 
> I think we need something like this:
> https://gitlab.com/u-boot/u-boot/-/commit/9043adee3ea67f4a71498e8f06023e3f63d7668f
> 
> but it needs to be more generic, at the SoC level, instead of per board.

With that we would have to enable the watchdog, something that is not
done today. Any potential downside on doing it?

Francesco



Re: Regression: i.MX6ULL reset not working

2023-12-28 Thread Francesco Dolcini
On Thu, Dec 28, 2023 at 04:49:33PM +0100, Francesco Dolcini wrote:
> Hello Marek and all,
> I just tried latest master on colibri-imx6ull-emmc and the reset command
> is broken - it does nothing.
> 
> >From a bisect the issue was introduced with commit 68dcbdd594d4 ("ARM:
> imx: Add weak default reset_cpu()"), U-Boot releases >= v2023.07 are
> broken.
> 
> Any hint? I did not try to debug it myself (yet?).

Ok, the reason for the bug is simple.

Before that change we had drivers/watchdog/imx_watchdog.c:reset_cpu()
implementing the reset. However that function is also weak and now the
newly defined and empty weak is taking precedence.

I assume every i.MX that is not i.MX8M* or i.MX7ULP is now broken, not
just i.MX6ULL nor just the colibri.

Francesco




Regression: i.MX6ULL reset not working

2023-12-28 Thread Francesco Dolcini
Hello Marek and all,
I just tried latest master on colibri-imx6ull-emmc and the reset command
is broken - it does nothing.

>From a bisect the issue was introduced with commit 68dcbdd594d4 ("ARM:
imx: Add weak default reset_cpu()"), U-Boot releases >= v2023.07 are
broken.

Any hint? I did not try to debug it myself (yet?).

Francesco



Re: [PATCH v1 3/3] colibri-imx8x: configure usb hub to bypass mode

2023-12-20 Thread Francesco Dolcini
On Wed, Dec 20, 2023 at 08:39:38AM -0300, Fabio Estevam wrote:
> Hi Francesco,
> 
> On Wed, Dec 20, 2023 at 8:30 AM Francesco Dolcini  
> wrote:
> 
> > Valid point.
> >
> > In general re-using the DTS for the kernel would not work.
> >
> > The bypass and reset signals are part of the USB HUB node [1], and we
> > would need to add such a driver to U-Boot to be able to properly
> > implement it (despite the recent plans to make SPL a full blown
> > bootloader and U-Boot proper the operating system and kick out Linux I
> > would not go into that direction ;-)
> >
> > Given that I believe that overriding the Linux DTS to use these 2
> > signals are simple GPIO HOG for U-Boot is the correct approach.
> 
> Yes, this series can go as-is.
> 
> My main concern is why U-Boot still uses the NXP-based
> fsl-imx8qxp-mek.dts, fsl-imx8qxp-colibri.dts
> variant instead of the mainline versions.
> 
> The other i.MX SoCs in U-Boot are better synced with the Linux kernel DTs.
> 
> I don't have access to i.MX8QXP/i.MX8QM boards to help on this, but
> for better long-term support it would be nice if someone could sync
> the U-Boot i.MX8QXP/i.MX8QM DTs with Linux.

Understood. Yes, this is some real work that someone should take up.
Just doing the sync will likely break everything now.

At the moment the situation with i.MX8QXP/i.MX8QM is not as good as
i.MX8M* neither in U-Boot nor in Linux :-/

Francesco



Re: [PATCH v1 3/3] colibri-imx8x: configure usb hub to bypass mode

2023-12-20 Thread Francesco Dolcini
Hello Fabio,

On Wed, Dec 20, 2023 at 07:48:50AM -0300, Fabio Estevam wrote:
> On Wed, Dec 20, 2023 at 7:39 AM Andrejs Cainikovs
>  wrote:
> 
> > diff --git a/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi 
> > b/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi
> > index a6af4e5e2b7..6ab6b1f9ee6 100644
> > --- a/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi
> > +++ b/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi
> > @@ -84,6 +84,21 @@
> > bootph-some-ram;
> >  };
> >
> > +_expander_43 {
> > +   usb-bypass-n-hog {
> > +   gpio-hog;
> > +   gpios = <5 GPIO_ACTIVE_LOW>;
> > +   line-name = "usb-bypass-n";
> > +   output-high;
> > +   };
> > +   usb-reset-n-hog {
> > +   gpio-hog;
> > +   gpios = <4 GPIO_ACTIVE_LOW>;
> > +   line-name = "usb-reset-n";
> > +   output-low;
> > +   };
> > +};
> 
> Patch looks good from a U-Boot perspective, but just want to
> understand why the imx8qxp/imx8qm boards
> in U-Boot use devicetrees based on downstream NXP instead of the
> mainline kernel dts?
> 
> Shouldn't this 'hub out of reset' be added in mainline Linux first and
> then just sync the dts in U-Boot?

Valid point.

In general re-using the DTS for the kernel would not work.

The bypass and reset signals are part of the USB HUB node [1], and we
would need to add such a driver to U-Boot to be able to properly
implement it (despite the recent plans to make SPL a full blown
bootloader and U-Boot proper the operating system and kick out Linux I
would not go into that direction ;-)

Given that I believe that overriding the Linux DTS to use these 2
signals are simple GPIO HOG for U-Boot is the correct approach.

Francesco

[1] Linux: Documentation/devicetree/bindings/usb/smsc,usb3503.yaml


Re: [PATCH v1] arm: dts: k3-am625-verdin: fix DDRSS configuration

2023-12-19 Thread Francesco Dolcini
On Tue, Dec 19, 2023 at 09:25:33AM +0100, Francesco Dolcini wrote:
> From: Emanuele Ghidoli 
> 
> The current DDR subsystem configuration occasionally results in write 
> failures,
> impacting memory stability, on Verdin AM62 Solo 512MB WB IT 0072 SKU.
> This commit addresses the issue by adjusting Drive Pull-Up/Down and
> Write Latency to improve the eye diagram and ensure reliable write operations.
> This configuration is shared with all Verdin AM62 SoM and
> it does not introduce regressions.
> 
> Configurations changes from previous / default values:
> - Drive Pull-Up/Down from 40 to 34.3 Ohm
> - Write Latency from 8 to 10
> - ODTLon / ODTLoff latency from 0 / 0 to 4 / 20 nCK
> - VREF control range 1 at 27 %
> - tFAW from 30 to 40 ns
> 
> Configuration is output from SysConfig [1] web tool, currently at version
> 1.18.1+3343 (DDR SubSystem v9.10).
> 
> [1] https://dev.ti.com/sysconfig
> 
> Fixes: 7d1a10659f5b ("board: toradex: add verdin am62 support")
> Signed-off-by: Emanuele Ghidoli 
> Signed-off-by: Francesco Dolcini 

Hello Tom,
would be nice to have this in for v2024.01 (... I know we are pretty close
to the release with winter holidays in between ...).

Thanks,
Francesco



[PATCH v1] arm: dts: k3-am625-verdin: fix DDRSS configuration

2023-12-19 Thread Francesco Dolcini
From: Emanuele Ghidoli 

The current DDR subsystem configuration occasionally results in write failures,
impacting memory stability, on Verdin AM62 Solo 512MB WB IT 0072 SKU.
This commit addresses the issue by adjusting Drive Pull-Up/Down and
Write Latency to improve the eye diagram and ensure reliable write operations.
This configuration is shared with all Verdin AM62 SoM and
it does not introduce regressions.

Configurations changes from previous / default values:
- Drive Pull-Up/Down from 40 to 34.3 Ohm
- Write Latency from 8 to 10
- ODTLon / ODTLoff latency from 0 / 0 to 4 / 20 nCK
- VREF control range 1 at 27 %
- tFAW from 30 to 40 ns

Configuration is output from SysConfig [1] web tool, currently at version
1.18.1+3343 (DDR SubSystem v9.10).

[1] https://dev.ti.com/sysconfig

Fixes: 7d1a10659f5b ("board: toradex: add verdin am62 support")
Signed-off-by: Emanuele Ghidoli 
Signed-off-by: Francesco Dolcini 
---
 .../dts/k3-am625-verdin-lpddr4-1600MTs.dtsi   | 151 +-
 1 file changed, 76 insertions(+), 75 deletions(-)

diff --git a/arch/arm/dts/k3-am625-verdin-lpddr4-1600MTs.dtsi 
b/arch/arm/dts/k3-am625-verdin-lpddr4-1600MTs.dtsi
index 9bad4309b491..841541bb2433 100644
--- a/arch/arm/dts/k3-am625-verdin-lpddr4-1600MTs.dtsi
+++ b/arch/arm/dts/k3-am625-verdin-lpddr4-1600MTs.dtsi
@@ -1,19 +1,20 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
  * This file was generated with the
- * AM62x SysConfig DDR Subsystem Register Configuration Tool v0.09.08
- * Fri Jun 09 2023 08:01:37 GMT+0200 (Central European Summer Time)
+ * AM62x SysConfig DDR Subsystem Register Configuration Tool v0.09.10
+ * Mon Dec 11 2023 17:07:35 GMT+0100 (Central European Standard Time)
  * DDR Type: LPDDR4
  * F0 = 50MHzF1 = NA F2 = 800MHz
  * Density (per channel): 16Gb
  * Write DBI: Enable
  * Number of Ranks: 1
- */
+*/
 
 #define DDRSS_PLL_FHS_CNT 3
 #define DDRSS_PLL_FREQUENCY_1 4
 #define DDRSS_PLL_FREQUENCY_2 4
 
+
 #define DDRSS_CTL_0_DATA 0x0B00
 #define DDRSS_CTL_1_DATA 0x
 #define DDRSS_CTL_2_DATA 0x
@@ -54,20 +55,20 @@
 #define DDRSS_CTL_37_DATA 0x
 #define DDRSS_CTL_38_DATA 0x040C
 #define DDRSS_CTL_39_DATA 0x
-#define DDRSS_CTL_40_DATA 0x081C
+#define DDRSS_CTL_40_DATA 0x0A1C
 #define DDRSS_CTL_41_DATA 0x
-#define DDRSS_CTL_42_DATA 0x081C
+#define DDRSS_CTL_42_DATA 0x0A1C
 #define DDRSS_CTL_43_DATA 0x
 #define DDRSS_CTL_44_DATA 0x05000804
 #define DDRSS_CTL_45_DATA 0x0B00
 #define DDRSS_CTL_46_DATA 0x09090004
-#define DDRSS_CTL_47_DATA 0x0204
+#define DDRSS_CTL_47_DATA 0x0304
 #define DDRSS_CTL_48_DATA 0x00370008
 #define DDRSS_CTL_49_DATA 0x09090024
-#define DDRSS_CTL_50_DATA 0x1910
+#define DDRSS_CTL_50_DATA 0x2110
 #define DDRSS_CTL_51_DATA 0x00370008
 #define DDRSS_CTL_52_DATA 0x09090024
-#define DDRSS_CTL_53_DATA 0x09001910
+#define DDRSS_CTL_53_DATA 0x09002110
 #define DDRSS_CTL_54_DATA 0x000A0A09
 #define DDRSS_CTL_55_DATA 0x0400036D
 #define DDRSS_CTL_56_DATA 0x09092004
@@ -223,19 +224,19 @@
 #define DDRSS_CTL_206_DATA 0x
 #define DDRSS_CTL_207_DATA 0x
 #define DDRSS_CTL_208_DATA 0x0024
-#define DDRSS_CTL_209_DATA 0x0012
+#define DDRSS_CTL_209_DATA 0x001A
 #define DDRSS_CTL_210_DATA 0x
 #define DDRSS_CTL_211_DATA 0x0024
-#define DDRSS_CTL_212_DATA 0x0012
+#define DDRSS_CTL_212_DATA 0x001A
 #define DDRSS_CTL_213_DATA 0x
 #define DDRSS_CTL_214_DATA 0x0004
 #define DDRSS_CTL_215_DATA 0x
 #define DDRSS_CTL_216_DATA 0x
 #define DDRSS_CTL_217_DATA 0x0024
-#define DDRSS_CTL_218_DATA 0x0012
+#define DDRSS_CTL_218_DATA 0x001A
 #define DDRSS_CTL_219_DATA 0x
 #define DDRSS_CTL_220_DATA 0x0024
-#define DDRSS_CTL_221_DATA 0x0012
+#define DDRSS_CTL_221_DATA 0x001A
 #define DDRSS_CTL_222_DATA 0x
 #define DDRSS_CTL_223_DATA 0x
 #define DDRSS_CTL_224_DATA 0x0031
@@ -268,21 +269,21 @@
 #define DDRSS_CTL_251_DATA 0x
 #define DDRSS_CTL_252_DATA 0x
 #define DDRSS_CTL_253_DATA 0x
-#define DDRSS_CTL_254_DATA 0x46004646
-#define DDRSS_CTL_255_DATA 0x2746
-#define DDRSS_CTL_256_DATA 0x0027
-#define DDRSS_CTL_257_DATA 0x0027
-#define DDRSS_CTL_258_DATA 0x0027
-#define DDRSS_CTL_259_DATA 0x0027
-#define DDRSS_CTL_260_DATA 0x0027
+#define DDRSS_CTL_254_DATA 0x4400
+#define DDRSS_CTL_255_DATA 0x4D44
+#define DDRSS_CTL_256_DATA 0x004D
+#define DDRSS_CTL_257_DATA 0x004D
+#define DDRSS_CTL_258_DATA 0x004D
+#define DDRSS_CTL_259_DATA 0x004D
+#define DDRSS_CTL_260_DATA 0x004D
 #define DDRSS_CTL_261_DATA 0x
 #define DDRSS_CTL_262_DATA 0x
-#define DDRSS_CTL_263_DATA 0x000F
-#define DDRSS_CTL_264_DATA 0x000F
-#define DDRSS_CTL_265_DATA 0x000F
-#define DDRSS_CTL_266_DATA 0x000F
-#define DDRSS_CTL_267_DATA 0x000F
-#define DDRSS_CTL_268_DATA 0x000F
+#define DDRSS_CTL_263_DATA 

Re: [PATCH v1] board: colibri_imx7: fix emmc detection

2023-12-12 Thread Francesco Dolcini
Hello Fabio,

On Tue, Dec 12, 2023 at 08:28:15AM -0300, Hiago De Franco wrote:
> From: Marcel Ziswiler 
> 
> Later versions of Colibri iMX7D V1.1B modules use a "new" SoC fusing. The
> difference lies in whether we enable the boot ROM to use the eMMC reset
> signal. Depending on the SoC fuse, the boot ROM configures this pin as a
> GPIO output to drive the reset signal. Our eMMC vs NAND detection
> currently only sets that signal to a GPIO without explicitly setting any
> direction. Previously, by default, it was set as an input. As the boot ROM
> now configures it as an output, we receive a value of zero instead of one,
> indicating the absence of the pull-up on eMMC modules.
...
> Fixes: 0c39564d ("toradex: colibri_imx7: Enable nand/emmc detection and set 
> boot variant")

It would be nice to have this fix in for 2024.01, if possible, thanks!

Francesco



[PATCH v1] configs: verdin-am62: Disable SPL FIT Overlay

2023-12-11 Thread Francesco Dolcini
From: Francesco Dolcini 

Disable CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY, this is not required nor used
on verdin am62, disable it to save precious binary size.

Update defconfig using savedefconfig, this adds CONFIG_OF_LIBFDT_OVERLAY
explicitly.

Signed-off-by: Francesco Dolcini 
---
 configs/verdin-am62_a53_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configs/verdin-am62_a53_defconfig 
b/configs/verdin-am62_a53_defconfig
index 780860180879..cdd6ba8baed4 100644
--- a/configs/verdin-am62_a53_defconfig
+++ b/configs/verdin-am62_a53_defconfig
@@ -17,6 +17,7 @@ CONFIG_ENV_OFFSET=0xDE00
 CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="k3-am625-verdin-wifi-dev"
 CONFIG_SPL_TEXT_BASE=0x8008
+CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_SPL_MMC=y
 CONFIG_SPL_SERIAL=y
@@ -33,7 +34,6 @@ CONFIG_SYS_MEMTEST_END=0xB000
 CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x8100
-CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY=y
 CONFIG_LEGACY_IMAGE_FORMAT=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=1
-- 
2.25.1



Re: [PATCH v5 04/17] arm: mach-k3: Add basic support for J784S4 SoC definition

2023-12-01 Thread Francesco Dolcini
On Fri, Dec 01, 2023 at 10:37:55AM -0600, Bryan Brattlof wrote:
> On November 30, 2023 thus sayeth Apurva Nandan:
> > Add J784S4 initialization files for initial SPL boot.
> > 
> > Signed-off-by: Hari Nagalla 
> > [ add firewall configurations and change the R5 MCU scratchpad ]
> > Signed-off-by: Manorit Chawdhry 
> > Signed-off-by: Dasnavis Sabiya 
> > Signed-off-by: Apurva Nandan 
> > ---
> >  arch/arm/mach-k3/Kconfig  |  16 +-
> >  arch/arm/mach-k3/Makefile |   2 +
> >  arch/arm/mach-k3/arm64-mmu.c  |  52 +++
> >  arch/arm/mach-k3/include/mach/hardware.h  |   4 +
> >  .../mach-k3/include/mach/j784s4_hardware.h|  60 
> >  arch/arm/mach-k3/include/mach/j784s4_spl.h|  47 +++
> >  arch/arm/mach-k3/include/mach/spl.h   |   4 +
> >  arch/arm/mach-k3/j784s4_fdt.c |  15 +
> >  arch/arm/mach-k3/j784s4_init.c| 338 ++
> >  arch/arm/mach-k3/r5/Makefile  |   1 +
> >  10 files changed, 532 insertions(+), 7 deletions(-)
> >  create mode 100644 arch/arm/mach-k3/include/mach/j784s4_hardware.h
> >  create mode 100644 arch/arm/mach-k3/include/mach/j784s4_spl.h
> >  create mode 100644 arch/arm/mach-k3/j784s4_fdt.c
> >  create mode 100644 arch/arm/mach-k3/j784s4_init.c
> > 
> 
> ...
> 
> > +   if (IS_ENABLED(CONFIG_TARGET_J784S4_R5_EVM)) {
> > +   ret = uclass_get_device_by_name(UCLASS_MISC, "msmc", );
> > +   if (ret)
> > +   panic("Probe of msmc failed: %d\n", ret);
> > +
> > +   ret = uclass_get_device(UCLASS_RAM, 0, );
> > +   if (ret)
> > +   panic("DRAM 0 init failed: %d\n", ret);
> > +
> > +   ret = uclass_next_device_err();
> > +   if (ret)
> > +   panic("DRAM 1 init failed: %d\n", ret);
> > +
> > +   ret = uclass_next_device_err();
> > +   if (ret)
> > +   panic("DRAM 2 init failed: %d\n", ret);
> > +
> > +   ret = uclass_next_device_err();
> > +   if (ret)
> > +   panic("DRAM 3 init failed: %d\n", ret);
> > +   }
> 
> I don't know if this is is the right approach. I can see situations 
> where people will not have all these controllers utilized or would want 
> to artificially remove them for some reason. 

Not sure on the exact implication, but yes, you should expect customers
(like myself/my company) integrating the SoC into some board to not
necessarily use all the functionalities, memory controller included.

Francesco



Re: [PATCH 2/4] arm: dts: k3-am625: Drop SoC provided bootph params from board u-boot/r5 dtsi

2023-11-13 Thread Francesco Dolcini
On Mon, Nov 13, 2023 at 08:59:17AM -0600, Nishanth Menon wrote:
> k3-am62* SoC dtsi files now provide the following:
> 
> bootph-all: dmss secure_proxy_main dmsc k3_pds k3_clks k3_reset
>main_pmx0 main_timer0 mcu_pmx0 wkup_conf chipid
> 
> bootph-pre-ram: secure_proxy_sa3 main_esm mcu_esm
> 
> Drop these from board r5 and u-boot.dtsi files as these are duplicate in
> them now.
> 
> Signed-off-by: Nishanth Menon 

I had just a quick look and I have not tested the change, with that said

Acked-by: Francesco Dolcini 



Re: [RFC PATCH 1/1] arm: mach-k3: Enable icache on am625 to boot faster

2023-11-10 Thread Francesco Dolcini
On Thu, Nov 09, 2023 at 01:51:19PM -0500, Tom Rini wrote:
> On Thu, Nov 09, 2023 at 12:44:56PM -0600, Andrew Davis wrote:
> > On 11/9/23 11:37 AM, Nishanth Menon wrote:
> > > On 11:09-20231109, Joao Paulo Goncalves wrote:
> > > > Enable the am625 instruction cache on SPL and U-boot earlier for the A53
> > > > to execute code a bit faster. For normal boot flow, it was possible to
> > > > gain about 2 seconds on boot time.
> > > > 
> > > > Signed-off-by: Joao Paulo Goncalves 
> > > > ---
> > > > Hello all,
> > > > 
> > > > We are trying to optimize boot time on our AM62 devices and on TI 
> > > > community
> > > > forum [1] someone advised to enable ICACHE for am625. We enabled it, 
> > > > tested and got
> > > > around 2 seconds faster boot on storage media and about 5 seconds with 
> > > > DFU
> > > > for downloading images from A53 SPL. However, we don't know if this is 
> > > > the correct
> > > > solution and want more comments on this or why the ICACHE was not 
> > > > enabled by TI in
> > > > the first place.
> > > > 
> > > > [1] 
> > > > https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1217839/am625-boot-time-between-a53-spl-and-a53-u-boot
> > > > 
> > > > Regards,
> > > > Joao Paulo Goncalves
> > > > 
> > > >   arch/arm/mach-k3/am625_init.c | 3 +++
> > > >   1 file changed, 3 insertions(+)
> > > > 
> > > > diff --git a/arch/arm/mach-k3/am625_init.c 
> > > > b/arch/arm/mach-k3/am625_init.c
> > > > index 8fa36f7b91..d665d07b0b 100644
> > > > --- a/arch/arm/mach-k3/am625_init.c
> > > > +++ b/arch/arm/mach-k3/am625_init.c
> > > > @@ -210,6 +210,9 @@ void board_init_f(ulong dummy)
> > > > panic("DRAM init failed: %d\n", ret);
> > > > }
> > > > spl_enable_dcache();
> > > > +
> > > > +   if (!IS_ENABLED(CONFIG_CPU_V7R) && 
> > > > !IS_ENABLED(CONFIG_SYS_ICACHE_OFF))
> > > > +   icache_enable();
> > > >   }
> > > >   u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
> > > > -- 
> > > > 2.34.1
> > > 
> > > Just noticed that icache_enable was missed for all of k3 as well - I
> > > suspect this is a miss rather than anything consciously done. btw
...
> > We enable Icache in SPL for our CPU_V7R case inside setup_mpu_regions()(??)
> > We also enable Dcache in spl_enable_dcache(), maybe this should be
> > renamed spl_enable_cache() and it call enable_caches() which enables
> > both. Just be careful to invalidate the icache when enabling after
> > relocation.
> > 
> > This would be temporary, better solution would be to add it to the
> > SPL common board_init_r() to match the U-Boot one, that way all these
> > platforms wouldn't need to do it in their current inconsistent ways.
> 
> I will say that part of the reason we don't have a more high-level
> "enable all the caches in SPL on ARMv7" is that I never could figure out
> why on earth it locked up my am335x GP EVM, I believe. So yes, I'd be
> quite happy to see the mach-k3 case cleaned up and made generic to
> enable (and then disable/flush/enable in full). But we can't easily make
> it higher-level than that.

So the plan would be to enable the cache for SPL in mach-k3 and not just
for AM625, correct?

Andrew: is this something you could do or should we send a patch
ourselves? We can test only TI AM62.

Francesco



Re: [PATCH V2 2/2] arm: mach-k3: Move TI dummy keys out of board folder

2023-11-04 Thread Francesco Dolcini
On Fri, Nov 03, 2023 at 09:45:11PM -0500, Nishanth Menon wrote:
> This file is used to emulate customer keys on TI development board
> ecosystems, move it out of board/ directory and into mach-k3. And
> change the relative paths to absolute paths in the binman paths.
> 
> While at it, drop the reference in verdin-binman file which is
> redundant.
> 
> Signed-off-by: Nishanth Menon 

Reviewed-by: Francesco Dolcini 



Re: [PATCH V2 1/2] arm: mach-k3: Move K3 degenerate keys out of board folder

2023-11-04 Thread Francesco Dolcini
On Fri, Nov 03, 2023 at 09:45:10PM -0500, Nishanth Menon wrote:
> This file is common for all of K3, move it out of board/ directory and
> into mach-k3. And change the relative paths to absolute paths in the
> binman paths.
> 
> While at it, drop the reference in verdin-binman file which is
> redundant.
> 
> Signed-off-by: Nishanth Menon 

Reviewed-by: Francesco Dolcini 

Francesco



Re: [PATCH] arm: mach-k3: Move K3 common schema.yaml out of board directory

2023-11-02 Thread Francesco Dolcini
Hello Andrew,
thanks for the patch.

On Wed, Nov 01, 2023 at 01:33:29PM -0500, Andrew Davis wrote:
> This file is common for all K3, move it out of board/ directory and
> into mach-k3. As we need to change the path in k3-binman.dtsi let's
> take this opportunity to switch to absolute paths which makes adding
> non-TI boards (like Toradex Verdin) not need to override these paths.
> 
> Signed-off-by: Andrew Davis 

Reviewed-by: Francesco Dolcini 

Francesco


Re: [PATCH 5/7] arm: mach-k3: am62x: Move board selection to mach-k3

2023-11-02 Thread Francesco Dolcini
Hello Andrew,

On Wed, Nov 01, 2023 at 03:35:28PM -0500, Andrew Davis wrote:
> Currently each set of board targets from a vendor is selected inside
> the board directory for that vendor. This has the problem of multiple
> targets, one from each vendor, being selectable at the same time.
> For instance you can select both TARGET_AM654_A53_EVM and
> TARGET_IOT2050_A53 in the same build.
> 
> To fix this we need to move the target board choice to a common location
> for each parent SoC selection. Do this in arch/arm/mach-k3.

Is this oddity specific of ti k3 based board or is this a generic issue
in u-boot? Asking to understand if a k3-specific fix is the correct one
here.

Francesco



[PATCH] toradex: verdin-imx8mm/imx8mp: Remove bootcmd_mfg

2023-10-04 Thread Francesco Dolcini
From: Joao Paulo Goncalves 

The bootcmd_mfg env variable is legacy from IMX downstream u-boot branch
and is not needed on mainline.

Signed-off-by: Joao Paulo Goncalves 
Signed-off-by: Francesco Dolcini 
---
 include/configs/verdin-imx8mm.h | 1 -
 include/configs/verdin-imx8mp.h | 1 -
 2 files changed, 2 deletions(-)

diff --git a/include/configs/verdin-imx8mm.h b/include/configs/verdin-imx8mm.h
index 8cb1f1aff353..8072d5d503f2 100644
--- a/include/configs/verdin-imx8mm.h
+++ b/include/configs/verdin-imx8mm.h
@@ -37,7 +37,6 @@
 #define CFG_EXTRA_ENV_SETTINGS \
BOOTENV \
MEM_LAYOUT_ENV_SETTINGS \
-   "bootcmd_mfg=fastboot 0\0" \
"boot_file=Image\0" \
"boot_script_dhcp=boot.scr\0" \
"console=ttymxc0\0" \
diff --git a/include/configs/verdin-imx8mp.h b/include/configs/verdin-imx8mp.h
index 942081ab84d7..5a34f6a9b205 100644
--- a/include/configs/verdin-imx8mp.h
+++ b/include/configs/verdin-imx8mp.h
@@ -46,7 +46,6 @@
 #define CFG_EXTRA_ENV_SETTINGS \
BOOTENV \
MEM_LAYOUT_ENV_SETTINGS \
-   "bootcmd_mfg=fastboot 0\0" \
"boot_file=Image\0" \
"boot_scripts=" BOOT_SCRIPT "\0" \
"boot_script_dhcp=" BOOT_SCRIPT "\0" \
-- 
2.25.1



Re: [PATCH V5 02/17] include: configs: am62x_evm: Drop unused SDRAM address

2023-08-24 Thread Francesco Dolcini
On Thu, Aug 24, 2023 at 06:09:54PM +0200, Francesco Dolcini wrote:
> On Thu, Aug 24, 2023 at 01:02:21PM +, Marcel Ziswiler wrote:
> > On Thu, 2023-08-24 at 07:05 -0500, Nishanth Menon wrote:
> > > On 10:13-20230824, Mattijs Korpershoek wrote:
> > > > Hi Nishanth,
> > > > 
> > > > On mer., août 23, 2023 at 22:10, Nishanth Menon  wrote:
> > > > 
> > > > > Drop unused macro. This was meant for a second region of DDR which we
> > > > > do not need for AM62x evm configurations.
> > > > > 
> > > > > Signed-off-by: Nishanth Menon 
> > > > > ---
> > > > > New patch (part of bootstd transition)
> > > > > 
> > > > >  include/configs/am62x_evm.h | 3 ---
> > > > >  1 file changed, 3 deletions(-)
> > > > 
> > > > What about include/configs/verdin-am62.h ?
> > > > 
> > > > It seems that that board, which is am62x based, also has the un-needed
> > > > include.
> > > > 
> > > > Since i'm not 100% sure, I have added Marcel (who posted the verdin am62
> > > > support) here.
> > > 
> > > Toradex team, Can you handle that cleanup? I stayed focussed on am62x_evm 
> > > side
> > > of things.
> > 
> > Yes, of course.
> 
> I believe that this is used on verdin-am62, please double check marcel.

No, likely I need to go home and not spread incomplete information here ...


Re: [PATCH V5 02/17] include: configs: am62x_evm: Drop unused SDRAM address

2023-08-24 Thread Francesco Dolcini
On Thu, Aug 24, 2023 at 01:02:21PM +, Marcel Ziswiler wrote:
> On Thu, 2023-08-24 at 07:05 -0500, Nishanth Menon wrote:
> > On 10:13-20230824, Mattijs Korpershoek wrote:
> > > Hi Nishanth,
> > > 
> > > On mer., août 23, 2023 at 22:10, Nishanth Menon  wrote:
> > > 
> > > > Drop unused macro. This was meant for a second region of DDR which we
> > > > do not need for AM62x evm configurations.
> > > > 
> > > > Signed-off-by: Nishanth Menon 
> > > > ---
> > > > New patch (part of bootstd transition)
> > > > 
> > > >  include/configs/am62x_evm.h | 3 ---
> > > >  1 file changed, 3 deletions(-)
> > > 
> > > What about include/configs/verdin-am62.h ?
> > > 
> > > It seems that that board, which is am62x based, also has the un-needed
> > > include.
> > > 
> > > Since i'm not 100% sure, I have added Marcel (who posted the verdin am62
> > > support) here.
> > 
> > Toradex team, Can you handle that cleanup? I stayed focussed on am62x_evm 
> > side
> > of things.
> 
> Yes, of course.

I believe that this is used on verdin-am62, please double check marcel.




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

2023-08-24 Thread Francesco Dolcini
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 
> > > > 
> > > > 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 
> > > > ---
> > > >  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



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

2023-08-24 Thread Francesco Dolcini
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 
> > > 
> > > 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 
> > 
> > Acked-by: Francesco Dolcini 
> 
> 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



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

2023-08-24 Thread Francesco Dolcini
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 
> > 
> > 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 
> > ---
> >  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



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

2023-08-24 Thread Francesco Dolcini
On Thu, Aug 24, 2023 at 10:08:50AM +0200, Emanuele Ghidoli wrote:
> From: Emanuele Ghidoli 
> 
> 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 

Acked-by: Francesco Dolcini 



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

2023-08-24 Thread Francesco Dolcini
On Thu, Aug 24, 2023 at 10:08:49AM +0200, Emanuele Ghidoli wrote:
> From: Emanuele Ghidoli 
> 
> 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 

Acked-by: Francesco Dolcini 


Re: [PATCH v5 3/3] board: toradex: add verdin am62 support

2023-08-04 Thread Francesco Dolcini
On Fri, Aug 04, 2023 at 08:12:36AM +, Marcel Ziswiler wrote:
> Hi Neha
> 
> On Fri, 2023-08-04 at 13:35 +0530, Neha Malcom Francis wrote:
> > Hi Francesco
> > 
> > On 04/08/23 13:24, Francesco Dolcini wrote:
> > > On Fri, Aug 04, 2023 at 12:04:59PM +0530, Neha Malcom Francis wrote:
> > > > On 03/08/23 19:30, Marcel Ziswiler wrote:
> > > > > +   combined-sysfw-cfg {
> > > > > +   filename = "combined-sysfw-cfg.bin";
> > > > > +   ti-board-config {
> > > > > +   board-cfg {
> > > > > +   config = "board-cfg.yaml";
> > > > > +   schema = 
> > > > > "../../ti/common/schema.yaml";
> > > > > +   };
> > > > > +   sec-cfg {
> > > > > +   config = "sec-cfg.yaml";
> > > > > +   schema = 
> > > > > "../../ti/common/schema.yaml";
> > > > > +   };
> > > > > +   pm-cfg {
> > > > > +   config = "pm-cfg.yaml";
> > > > > +   schema = 
> > > > > "../../ti/common/schema.yaml";
> > > > > +   };
> > > > > +   rm-cfg {
> > > > > +   config = "rm-cfg.yaml";
> > > > > +   schema = 
> > > > > "../../ti/common/schema.yaml";
> > > > > +   };
> > > > > +   };
> > > > > +   };
> > > > > +};
> > > > > +
> > > > 
> > > > ^ If you are already including k3-binman.dtsi, why are you redefining 
> > > > these?
> > > 
> > > We want/need out own `config`. Any other solution apart of this one?
> > > 
> > 
> > Ah I see, how about using the cfg phandle to replace it with your own? See 
> > example in arch/arm/dts/k3-j7200-binman.dtsi
> 
> Yes, I missed that. Let me do it that way and post a v6.

Will it work? in k3-binman.dtsi the schema is referenced with such
relative path: `schema = "../common/schema.yaml";` there.

There is an assumption of this being used from board/ti/$boardname if I
understand it correctly.

Francesco



Re: [PATCH v5 3/3] board: toradex: add verdin am62 support

2023-08-04 Thread Francesco Dolcini
On Fri, Aug 04, 2023 at 12:04:59PM +0530, Neha Malcom Francis wrote:
> On 03/08/23 19:30, Marcel Ziswiler wrote:
> > +   combined-sysfw-cfg {
> > +   filename = "combined-sysfw-cfg.bin";
> > +   ti-board-config {
> > +   board-cfg {
> > +   config = "board-cfg.yaml";
> > +   schema = "../../ti/common/schema.yaml";
> > +   };
> > +   sec-cfg {
> > +   config = "sec-cfg.yaml";
> > +   schema = "../../ti/common/schema.yaml";
> > +   };
> > +   pm-cfg {
> > +   config = "pm-cfg.yaml";
> > +   schema = "../../ti/common/schema.yaml";
> > +   };
> > +   rm-cfg {
> > +   config = "rm-cfg.yaml";
> > +   schema = "../../ti/common/schema.yaml";
> > +   };
> > +   };
> > +   };
> > +};
> > +
> 
> ^ If you are already including k3-binman.dtsi, why are you redefining these?

We want/need out own `config`. Any other solution apart of this one?

Francesco



Re: [PATCH 3/6] board: ti: am62x: Add basic initialization for usb voltage, 32k crystal, debounce

2023-07-26 Thread Francesco Dolcini
On Wed, Jul 26, 2023 at 06:10:19AM -0500, Nishanth Menon wrote:
> On 00:35-20230726, Francesco Dolcini wrote:
> > However to my understanding this would need to have the corresponding
> > DEBOUNCE_SEL register written on the pad configuration, and by default it's 
> > 0.
> > 
> > What's the use case for this debounce configuration you have here?
> 
> TRM was a bit of a crap (internal ticket was filed to improve), but long
> story short:
> * bootloader configures delays per index
> * in the pinmux configuration, we pick which index to use for the pin

Thanks, this clarify it.

Francesco



  1   2   3   >