Re: [PATCH 01/11] imx: implement get_effective_memsize

2022-11-14 Thread Pali Rohár
On Tuesday 15 November 2022 11:06:23 Peng Fan wrote:
> On 11/9/2022 3:40 PM, Pali Rohár wrote:
> > On Wednesday 09 November 2022 09:48:53 Peng Fan wrote:
> > > On 11/8/2022 4:03 PM, Pali Rohár wrote:
> > > > On Tuesday 08 November 2022 07:56:59 Peng Fan wrote:
> > > > > > Subject: Re: [PATCH 01/11] imx: implement get_effective_memsize
> > > > > > 
> > > > > > On Tuesday 08 November 2022 09:38:01 Peng Fan wrote:
> > > > > > > On 11/7/2022 3:55 PM, Pali Rohár wrote:
> > > > > > > > On Monday 07 November 2022 16:00:06 Peng Fan (OSS) wrote:
> > > > > > > > > From: Peng Fan 
> > > > > > > > > 
> > > > > > > > > To i.MX6/7 which has 2GB memory, the upper 4KB cut off, will 
> > > > > > > > > cause
> > > > > > > > > the top 1MB not mapped as normal memory, because ARMV7-A use
> > > > > > > > > section mapping. So implement i.MX6/7 specific
> > > > > > > > > get_effective_memsize to fix the issue.
> > > > > > > > > 
> > > > > > > > > Fixes: 777706bc("common/memsize.c: Fix 
> > > > > > > > > get_effective_memsize()
> > > > > > > > > to check for overflow")
> > > > > > > > > Signed-off-by: Peng Fan 
> > > > > > > > 
> > > > > > > > Should not just configuring CONFIG_MAX_MEM_MAPPED properly avoid
> > > > > > that issue?
> > > > > > > 
> > > > > > > No, unless I decrease PHYS_SDRAM_SIZE.
> > > > > > 
> > > > > > So, what is the issue? I just do not see what happens after 
> > > > > > 777706bc
> > > > > > that RAM size is calculated incorrectly in your case. I did not 
> > > > > > catch the
> > > > > > description from commit message. What are your gd->ram_size and
> > > > > > CONFIG_MAX_MEM_MAPPED values that current code does not work?
> > > > > 
> > > > > The base is 2GB, the size is 2GB. With CONFIG_MAX_MEM_MAPPED,
> > > > > the ram_size already decreased by 4KB.
> > > > 
> > > > If base is 2GB and size is 2GB then ram_top is 4GB which cannot be
> > > > represented in 32-bit phys_size_t type and hence some of other u-boot
> > > > functions use 0 as ram_top. Mentioned commit tries to fix this issue.
> > > > I guess that you have some other hidden problem and my change just
> > > > showed implication of that.
> > > 
> > > The issue is with higher 4KB cut off, the MMU mapping will cut off
> > > 1MB or 2MB(section mapping), so after MMU enabled, the PC instruction will
> > > not able to fetch instruction in the higher 1MB area because of U-Boot
> > > relocated to
> > > top of DRAM.
> > 
> > But it is not possible to represent whole 4GB of RAM size in 32-bit
> > phys_size_t type. So some cut-off for this storage is required.
> 
> I understand this. But this means I have to reserve the higher 2MB section
> because of the 4KB cut off.
> 
> Even the ram_top is 0 in my case, it does not matter. The relocaddr
> is unsigned long, when reserve other memory, it will back to the
> high address.

Well, zero ram_top did not work, that is why I introduced that commit.
Better to cut off 4kB/2MB of RAM size and have working u-boot, as having
issues with reserving parts of RAM.

> Regards,
> Peng.
> 
> > 
> > > Regards,
> > > Peng.
> > > 
> > > Could you check how is gd->ram_top
> > > > configured with and without this change?
> > 
> > Could you check this?
> > 
> > > > > Regards,
> > > > > Peng.
> > > > > 
> > > > > > 
> > > > > > > Regards,
> > > > > > > Peng.
> > > > > > > 
> > > > > > > > 
> > > > > > > > > ---
> > > > > > > > > arch/arm/mach-imx/cache.c | 14 ++
> > > > > > > > > 1 file changed, 14 insertions(+)
> > > > > > > > > 
> > > > > > > > > diff --git a/arch/arm/mach-imx/cache.c 
> > > > > > > > > b/arch/arm/mach-imx/cache.c
> > > > > > > > > index ab9b621a2a6..69a085abee7 100644
> > > > > > > > > --- a/arch/arm/mach-imx/cache.c
> > > > > > > > > +++ b/arch/arm/mach-imx/cache.c
> > > > > > > > > @@ -7,10 +7,24 @@
> > > > > > > > > #include 
> > > > > > > > > #include 
> > > > > > > > > #include 
> > > > > > > > > +#include 
> > > > > > > > > #include 
> > > > > > > > > #include 
> > > > > > > > > #include 
> > > > > > > > > +DECLARE_GLOBAL_DATA_PTR;
> > > > > > > > > +
> > > > > > > > > +phys_size_t get_effective_memsize(void) { #ifndef
> > > > > > > > > +CONFIG_MAX_MEM_MAPPED
> > > > > > > > > + return gd->ram_size;
> > > > > > > > > +#else
> > > > > > > > > + /* limit stack to what we can reasonable map */
> > > > > > > > > + return ((gd->ram_size > CONFIG_MAX_MEM_MAPPED) ?
> > > > > > > > > + CONFIG_MAX_MEM_MAPPED : gd->ram_size); #endif }
> > > > > > > > > +
> > > > > > > > > void enable_ca7_smp(void)
> > > > > > > > > {
> > > > > > > > >   u32 val;
> > > > > > > > > --
> > > > > > > > > 2.36.0
> > > > > > > > > 


Re: [PATCH] watchdog: designware: make reset really optional

2022-11-14 Thread Stefan Roese

On 14.11.22 13:52, Quentin Schulz wrote:

From: Quentin Schulz 

Checking for DM_RESET is not enough since not all watchdog
implementations use a reset lane. Such is the case for Rockchip
implementation for example. Since reset_assert_bulk will only succeed if
the resets property exists in the watchdog DT node, it needs to be
called only if a reset property is present.

This adds a condition on the resets property presence in the watchdog DT
node before assuming a reset lane needs to be fetched with
reset_assert_bulk, by calling ofnode_read_prop.

Cc: Quentin Schulz 
Signed-off-by: Quentin Schulz 
---
To: Stefan Roese 
Cc: u-boot@lists.denx.de


Reviewed-by: Stefan Roese 

Thanks,
Stefan


---
  drivers/watchdog/designware_wdt.c | 9 +
  1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/designware_wdt.c 
b/drivers/watchdog/designware_wdt.c
index cad756aeaf..6155939f49 100644
--- a/drivers/watchdog/designware_wdt.c
+++ b/drivers/watchdog/designware_wdt.c
@@ -72,13 +72,13 @@ static int designware_wdt_reset(struct udevice *dev)
  static int designware_wdt_stop(struct udevice *dev)
  {
struct designware_wdt_priv *priv = dev_get_priv(dev);
+   __maybe_unused int ret;
  
  	designware_wdt_reset(dev);

writel(0, priv->base + DW_WDT_CR);
  
-if (CONFIG_IS_ENABLED(DM_RESET)) {

-   int ret;
-
+if (CONFIG_IS_ENABLED(DM_RESET) &&


You seem to be adding spaces instead of a tab here.


+   ofnode_read_prop(dev_ofnode(dev), "resets", &ret)) {
ret = reset_assert_bulk(&priv->resets);
if (ret)
return ret;
@@ -135,7 +135,8 @@ static int designware_wdt_probe(struct udevice *dev)
priv->clk_khz = CONFIG_DW_WDT_CLOCK_KHZ;
  #endif
  
-	if (CONFIG_IS_ENABLED(DM_RESET)) {

+   if (CONFIG_IS_ENABLED(DM_RESET) &&
+   ofnode_read_prop(dev_ofnode(dev), "resets", &ret)) {
ret = reset_get_bulk(dev, &priv->resets);
if (ret)
goto err;

---
base-commit: 0cbeed4f6648e0e4966475e3544280a69ecb59d3
change-id: 20221114-dw-wdt-no-reset-2296a2bf37b3

Best regards,


Other than this:

Reviewed-by: Stefan Roese 

Thanks,
Stefan


Re: [PATCH 1/1] doc: fix documentation of enum gd_flags

2022-11-14 Thread Stefan Roese

On 14.11.22 10:25, Heinrich Schuchardt wrote:

Correct GD_FLG_CYCLIC_RUNNING documentation to match Sphinx style.

Fixes: d7de5ef62935 ("cyclic: use a flag in gd->flags for recursion protection")
Signed-off-by: Heinrich Schuchardt 


Reviewed-by: Stefan Roese 

Thanks,
Stefan


---
  include/asm-generic/global_data.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/asm-generic/global_data.h 
b/include/asm-generic/global_data.h
index 02ad8ca595..88829126fb 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -651,7 +651,7 @@ enum gd_flags {
 */
GD_FLG_FDT_CHANGED = 0x10,
/**
-* GD_FLG_CYCLIC_RUNNING: cyclic_run is in progress
+* @GD_FLG_CYCLIC_RUNNING: cyclic_run is in progress
 */
GD_FLG_CYCLIC_RUNNING = 0x20,
  };


Viele Grüße,
Stefan Roese

--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de


Re: [PATCH 01/11] imx: implement get_effective_memsize

2022-11-14 Thread Peng Fan




On 11/9/2022 3:40 PM, Pali Rohár wrote:

On Wednesday 09 November 2022 09:48:53 Peng Fan wrote:

On 11/8/2022 4:03 PM, Pali Rohár wrote:

On Tuesday 08 November 2022 07:56:59 Peng Fan wrote:

Subject: Re: [PATCH 01/11] imx: implement get_effective_memsize

On Tuesday 08 November 2022 09:38:01 Peng Fan wrote:

On 11/7/2022 3:55 PM, Pali Rohár wrote:

On Monday 07 November 2022 16:00:06 Peng Fan (OSS) wrote:

From: Peng Fan 

To i.MX6/7 which has 2GB memory, the upper 4KB cut off, will cause
the top 1MB not mapped as normal memory, because ARMV7-A use
section mapping. So implement i.MX6/7 specific
get_effective_memsize to fix the issue.

Fixes: 777706bc("common/memsize.c: Fix get_effective_memsize()
to check for overflow")
Signed-off-by: Peng Fan 


Should not just configuring CONFIG_MAX_MEM_MAPPED properly avoid

that issue?


No, unless I decrease PHYS_SDRAM_SIZE.


So, what is the issue? I just do not see what happens after 777706bc
that RAM size is calculated incorrectly in your case. I did not catch the
description from commit message. What are your gd->ram_size and
CONFIG_MAX_MEM_MAPPED values that current code does not work?


The base is 2GB, the size is 2GB. With CONFIG_MAX_MEM_MAPPED,
the ram_size already decreased by 4KB.


If base is 2GB and size is 2GB then ram_top is 4GB which cannot be
represented in 32-bit phys_size_t type and hence some of other u-boot
functions use 0 as ram_top. Mentioned commit tries to fix this issue.
I guess that you have some other hidden problem and my change just
showed implication of that.


The issue is with higher 4KB cut off, the MMU mapping will cut off
1MB or 2MB(section mapping), so after MMU enabled, the PC instruction will
not able to fetch instruction in the higher 1MB area because of U-Boot
relocated to
top of DRAM.


But it is not possible to represent whole 4GB of RAM size in 32-bit
phys_size_t type. So some cut-off for this storage is required.


I understand this. But this means I have to reserve the higher 2MB 
section because of the 4KB cut off.


Even the ram_top is 0 in my case, it does not matter. The relocaddr
is unsigned long, when reserve other memory, it will back to the
high address.

Regards,
Peng.




Regards,
Peng.

Could you check how is gd->ram_top

configured with and without this change?


Could you check this?


Regards,
Peng.




Regards,
Peng.




---
arch/arm/mach-imx/cache.c | 14 ++
1 file changed, 14 insertions(+)

diff --git a/arch/arm/mach-imx/cache.c b/arch/arm/mach-imx/cache.c
index ab9b621a2a6..69a085abee7 100644
--- a/arch/arm/mach-imx/cache.c
+++ b/arch/arm/mach-imx/cache.c
@@ -7,10 +7,24 @@
#include 
#include 
#include 
+#include 
#include 
#include 
#include 
+DECLARE_GLOBAL_DATA_PTR;
+
+phys_size_t get_effective_memsize(void) { #ifndef
+CONFIG_MAX_MEM_MAPPED
+   return gd->ram_size;
+#else
+   /* limit stack to what we can reasonable map */
+   return ((gd->ram_size > CONFIG_MAX_MEM_MAPPED) ?
+   CONFIG_MAX_MEM_MAPPED : gd->ram_size); #endif }
+
void enable_ca7_smp(void)
{
u32 val;
--
2.36.0



Re: [PATCH] rockchip: clk: add watchdog clock to px30_clk_enable

2022-11-14 Thread Kever Yang



On 2022/11/14 18:33, Quentin Schulz wrote:

From: Quentin Schulz 

Add the PCLK_WDT_NS clock to px30_clk_enable so that the watchdog driver
can probe since it wants to enable this clock.

Cc: Quentin Schulz 
Signed-off-by: Quentin Schulz 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
rockchip: clk: add watchdog clock to px30_clk_enable

This is required for px30 to be able to probe the Designware watchdog device.

To: Lukasz Majewski 
To: Sean Anderson 
To: Simon Glass 
To: Philipp Tomsich 
To: Kever Yang 
Cc: u-boot@lists.denx.de
---
  drivers/clk/rockchip/clk_px30.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/drivers/clk/rockchip/clk_px30.c b/drivers/clk/rockchip/clk_px30.c
index 5d467447a1..38cb90e512 100644
--- a/drivers/clk/rockchip/clk_px30.c
+++ b/drivers/clk/rockchip/clk_px30.c
@@ -1415,6 +1415,9 @@ static int px30_clk_enable(struct clk *clk)
case SCLK_GMAC_RMII:
/* Required to successfully probe the Designware GMAC driver */
return 0;
+   case PCLK_WDT_NS:
+   /* Required to successfully probe the Designware watchdog 
driver */
+   return 0;
}
  
  	debug("%s: unsupported clk %ld\n", __func__, clk->id);


---
base-commit: 0cbeed4f6648e0e4966475e3544280a69ecb59d3
change-id: 20221114-px30-wdt-clk-58c875b33d37

Best regards,


RE: [PATCH] include/configs: mx6/mx7: drop dangling comments

2022-11-14 Thread Peng Fan
> Subject: [PATCH] include/configs: mx6/mx7: drop dangling comments
> 
> Cleanup some dangling comments left by automated migration processes
> that are no longer value.
> 
> Signed-off-by: Peter Robinson 

Acked-by: Peng Fan 

> ---
>  include/configs/mx6_common.h |  4 
>  include/configs/mx7_common.h | 12 
>  2 files changed, 16 deletions(-)
> 
> diff --git a/include/configs/mx6_common.h
> b/include/configs/mx6_common.h index 43145567544..f70c515b840
> 100644
> --- a/include/configs/mx6_common.h
> +++ b/include/configs/mx6_common.h
> @@ -22,8 +22,4 @@
>  #include 
>  #include 
> 
> -/* Miscellaneous configurable options */
> -
> -/* MMC */
> -
>  #endif
> diff --git a/include/configs/mx7_common.h
> b/include/configs/mx7_common.h index 4704276a74d..7e83715a76f
> 100644
> --- a/include/configs/mx7_common.h
> +++ b/include/configs/mx7_common.h
> @@ -20,16 +20,4 @@
>  /* Enable iomux-lpsr support */
>  #define CONFIG_IOMUX_LPSR
> 
> -/* Miscellaneous configurable options */
> -
> -/* UART */
> -
> -/* MMC */
> -
> -/*
> - * If we have defined the OPTEE ram size and not OPTEE it means that we
> were
> - * launched by OPTEE, because of that we shall skip all the low level
> - * initialization since it was already done by ATF or OPTEE
> - */
> -
>  #endif
> --
> 2.38.1



Re: [PATCH 1/2] udoo_neo: Move to DM for REGUALTOR/PMIC/I2C drivers

2022-11-14 Thread Peter Robinson
On Mon, Nov 14, 2022 at 10:50 PM Simon Glass  wrote:
>
> On Mon, 14 Nov 2022 at 10:32, Fabio Estevam  wrote:
> >
> > Hi Peter,
> >
> > On Mon, Nov 14, 2022 at 1:15 PM Peter Robinson  wrote:
> > >
> > > This moves over the PMIC power init to DM and the associated i2c and
> > > regulator bits.
> >
> > There is a typo in the Subject line: s/REGUALTOR/REGULATOR
> >
> > > diff --git a/configs/udoo_neo_defconfig b/configs/udoo_neo_defconfig
> > > index 8ae9fa57f03..6c29f8fd251 100644
> > > --- a/configs/udoo_neo_defconfig
> > > +++ b/configs/udoo_neo_defconfig
> > > @@ -10,8 +10,9 @@ CONFIG_ENV_SIZE=0x2000
> > >  CONFIG_ENV_OFFSET=0x8
> > >  CONFIG_MX6SX=y
> > >  CONFIG_TARGET_UDOO_NEO=y
> > > -CONFIG_SYS_I2C_MXC_I2C1=y
> > > +CONFIG_DM_I2C=y
> > >  CONFIG_DM_GPIO=y
> > > +CONFIG_DM_MMC=y
> >
> > CONFIG_DM_MMC is selected by default. No need to have it in the defconfig.
> >
>
> Would be good to fix REGUALTOR when applying

Was fixed in a v2 with other bits.

> > Reviewed-by: Fabio Estevam 


Re: [PATCH 06/10] Convert CONFIG_SYS_NAND_MAX_OOBFREE et al to Kconfig

2022-11-14 Thread Simon Glass
On Sat, 12 Nov 2022 at 15:38, Tom Rini  wrote:
>
> This converts the following to Kconfig:
>CONFIG_SYS_NAND_MAX_OOBFREE
>CONFIG_SYS_NAND_MAX_ECCPOS
>
> Signed-off-by: Tom Rini 
> ---
>  configs/CHIP_pro_defconfig |  1 +
>  configs/Nintendo_NES_Classic_Edition_defconfig |  1 +
>  configs/am3517_evm_defconfig   |  2 ++
>  configs/ls1088aqds_defconfig   |  2 ++
>  configs/ls1088aqds_qspi_SECURE_BOOT_defconfig  |  2 ++
>  configs/ls1088aqds_qspi_defconfig  |  2 ++
>  configs/ls1088aqds_sdcard_ifc_defconfig|  2 ++
>  configs/ls1088aqds_sdcard_qspi_defconfig   |  2 ++
>  configs/ls1088aqds_tfa_defconfig   |  2 ++
>  configs/ls1088ardb_qspi_SECURE_BOOT_defconfig  |  2 ++
>  configs/ls1088ardb_qspi_defconfig  |  2 ++
>  ...s1088ardb_sdcard_qspi_SECURE_BOOT_defconfig |  2 ++
>  configs/ls1088ardb_sdcard_qspi_defconfig   |  2 ++
>  configs/ls1088ardb_tfa_SECURE_BOOT_defconfig   |  2 ++
>  configs/ls1088ardb_tfa_defconfig   |  2 ++
>  configs/ls2080aqds_SECURE_BOOT_defconfig   |  2 ++
>  configs/ls2080aqds_defconfig   |  2 ++
>  configs/ls2080aqds_nand_defconfig  |  2 ++
>  configs/ls2080aqds_qspi_defconfig  |  2 ++
>  configs/ls2080aqds_sdcard_defconfig|  2 ++
>  configs/ls2080ardb_SECURE_BOOT_defconfig   |  2 ++
>  configs/ls2080ardb_defconfig   |  2 ++
>  configs/ls2080ardb_nand_defconfig  |  2 ++
>  configs/ls2088aqds_tfa_defconfig   |  2 ++
>  configs/ls2088ardb_tfa_SECURE_BOOT_defconfig   |  2 ++
>  configs/ls2088ardb_tfa_defconfig   |  2 ++
>  configs/omap35_logic_defconfig |  2 ++
>  configs/omap35_logic_somlv_defconfig   |  2 ++
>  configs/omap3_logic_defconfig  |  2 ++
>  configs/omap3_logic_somlv_defconfig|  2 ++
>  doc/README.nand| 10 --
>  drivers/mtd/Kconfig| 18 ++
>  include/configs/T4240RDB.h |  2 --
>  include/configs/am3517_evm.h   |  2 --
>  include/configs/ls1088aqds.h   |  3 ---
>  include/configs/ls1088ardb.h   |  3 ---
>  include/configs/ls2080aqds.h   |  3 ---
>  include/configs/ls2080ardb.h   |  3 ---
>  include/configs/omap3_logic.h  |  2 --
>  include/configs/sunxi-common.h |  4 
>  40 files changed, 76 insertions(+), 32 deletions(-)
>

Reviewed-by: Simon Glass 


Re: [PATCH 08/10] Convert CONFIG_SYS_NAND_PAGE_2K et al to Kconfig

2022-11-14 Thread Simon Glass
On Sat, 12 Nov 2022 at 15:38, Tom Rini  wrote:
>
> This converts the following to Kconfig:
>CONFIG_SYS_NAND_PAGE_2K
>CONFIG_SYS_NAND_PAGE_4K
>
> Signed-off-by: Tom Rini 
> ---
>  configs/k2l_evm_defconfig   |  1 +
>  configs/k2l_hs_evm_defconfig|  1 +
>  drivers/mtd/nand/raw/Kconfig| 13 +
>  include/configs/da850evm.h  |  1 -
>  include/configs/k2e_evm.h   |  3 ---
>  include/configs/k2g_evm.h   |  3 ---
>  include/configs/k2hk_evm.h  |  3 ---
>  include/configs/k2l_evm.h   |  3 ---
>  include/configs/omapl138_lcdk.h |  1 -
>  9 files changed, 15 insertions(+), 14 deletions(-)
>

Reviewed-by: Simon Glass 


Re: Peculiar problem executing boot.scr

2022-11-14 Thread Simon Glass
Hi,

On Mon, 14 Nov 2022 at 06:50, Tasos Terzidis  wrote:
>
> Hello,
>
> I have a very peculiar problem.
>
> I have a very simple boot.scr script so that u-boot can load it and run it.
>
> My set up is a Raspberry 3 B (32 bit)
>
> Sript is
>
> Fatload mmc 0:1 ${kernel_addr_r} kernel7.img
>
> Bootz ${kernel_addr_r} - ${fdt_addr}
>
>
>
> When u-boot stops autocounting, finds the script loads it and the error
> message is
>
> -à‘ailed to find kernel7.img ß--
>
>
>
> Instead of F for word Failed, prints ‘ailed.
>
>
>
> If I stop auto counting and enter the commands of script by hand it runs
> and loads kernel as expected
>
>
>
> As a matter of fact whatever command I add to the script gives an error
>
> Example : if I add printenv the error is “can not find command”
>
>
>
> I can not understand what the problem is.
>
>
>
> Has anyone encountered such a problem ??

Can you post the whole console output so we can see version, etc.?

I cannot immediately even find that 'Failed to find %s' string in U-Boot.

Regards,
Simon


Re: [PATCH 10/10] global: Move remaining CONFIG_SYS_NAND_* to CFG_SYS_NAND_*

2022-11-14 Thread Simon Glass
n Sat, 12 Nov 2022 at 15:38, Tom Rini  wrote:
>
> The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_NAND
> namespace do not easily transition to Kconfig. In many cases they likely
> should come from the device tree instead. Move these out of CONFIG
> namespace and in to CFG namespace.
>
> Signed-off-by: Tom Rini 
> ---
>  README| 10 +--
>  arch/arm/include/asm/arch-lpc32xx/config.h|  8 +-
>  arch/arm/include/asm/ti-common/davinci_nand.h |  8 +-
>  arch/arm/mach-kirkwood/include/mach/config.h  |  2 +-
>  arch/arm/mach-omap2/mem-common.c  |  2 +-
>  arch/powerpc/cpu/mpc83xx/elbc/elbc.h  | 20 ++---
>  arch/powerpc/cpu/mpc83xx/spl_minimal.c| 10 +--
>  board/atmel/at91sam9260ek/at91sam9260ek.c |  4 +-
>  board/atmel/at91sam9261ek/at91sam9261ek.c |  4 +-
>  board/atmel/at91sam9263ek/at91sam9263ek.c |  4 +-
>  .../atmel/at91sam9m10g45ek/at91sam9m10g45ek.c |  4 +-
>  board/atmel/at91sam9rlek/at91sam9rlek.c   |  4 +-
>  board/atmel/at91sam9x5ek/at91sam9x5ek.c   |  4 +-
>  board/atmel/sam9x60ek/sam9x60ek.c |  4 +-
>  board/bluewater/gurnard/gurnard.c |  8 +-
>  board/calao/usb_a9263/usb_a9263.c |  8 +-
>  board/egnite/ethernut5/ethernut5.c|  6 +-
>  board/esd/meesc/meesc.c   |  4 +-
>  board/freescale/common/p_corenet/law.c|  4 +-
>  board/freescale/common/p_corenet/tlb.c|  4 +-
>  board/freescale/ls1043aqds/ls1043aqds.c   | 32 
>  board/freescale/ls1043ardb/ls1043ardb.c   | 34 
>  board/freescale/ls1046aqds/ls1046aqds.c   | 32 
>  board/freescale/ls1088a/ls1088a.c | 32 
>  board/freescale/p1010rdb/law.c|  2 +-
>  board/freescale/p1010rdb/spl_minimal.c|  6 +-
>  board/freescale/p1010rdb/tlb.c|  2 +-
>  board/freescale/p1_p2_rdb_pc/law.c|  4 +-
>  board/freescale/p1_p2_rdb_pc/spl_minimal.c|  6 +-
>  board/freescale/p1_p2_rdb_pc/tlb.c|  4 +-
>  board/freescale/t102xrdb/law.c|  4 +-
>  board/freescale/t102xrdb/tlb.c|  4 +-
>  board/freescale/t104xrdb/law.c|  4 +-
>  board/freescale/t104xrdb/tlb.c|  4 +-
>  board/freescale/t208xqds/law.c|  4 +-
>  board/freescale/t208xqds/tlb.c|  4 +-
>  board/freescale/t208xrdb/law.c|  4 +-
>  board/freescale/t208xrdb/tlb.c|  4 +-
>  board/freescale/t4rdb/law.c   |  4 +-
>  board/freescale/t4rdb/tlb.c   |  4 +-
>  board/gardena/smart-gateway-at91sam/spl.c |  4 +-
>  board/keymile/kmcent2/law.c   |  2 +-
>  board/keymile/kmcent2/tlb.c   |  2 +-
>  board/ronetix/pm9261/pm9261.c |  4 +-
>  board/ronetix/pm9263/pm9263.c |  4 +-
>  board/ronetix/pm9g45/pm9g45.c |  6 +-
>  board/siemens/corvus/board.c  |  8 +-
>  board/siemens/smartweb/smartweb.c |  8 +-
>  board/siemens/taurus/taurus.c | 10 +--
>  board/socrates/nand.c |  2 +-
>  common/spl/spl_nand.c |  8 +-
>  doc/README.arm-relocation |  8 +-
>  doc/README.omap3  |  6 +-
>  doc/board/ti/am335x_evm.rst   |  2 +-
>  drivers/mtd/nand/raw/am335x_spl_bch.c | 12 +--
>  drivers/mtd/nand/raw/atmel_nand.c | 40 +-
>  drivers/mtd/nand/raw/davinci_nand.c   | 14 ++--
>  drivers/mtd/nand/raw/denali_spl.c |  4 +-
>  drivers/mtd/nand/raw/fsl_elbc_nand.c  |  6 +-
>  drivers/mtd/nand/raw/fsl_elbc_spl.c   | 12 +--
>  drivers/mtd/nand/raw/fsl_ifc_nand.c   |  6 +-
>  drivers/mtd/nand/raw/fsl_ifc_spl.c| 20 ++---
>  drivers/mtd/nand/raw/fsmc_nand.c  |  2 +-
>  drivers/mtd/nand/raw/kmeter1_nand.c   |  4 +-
>  drivers/mtd/nand/raw/lpc32xx_nand_slc.c   | 22 +++---
>  drivers/mtd/nand/raw/mxc_nand.c   |  6 +-
>  drivers/mtd/nand/raw/mxc_nand_spl.c   |  8 +-
>  drivers/mtd/nand/raw/nand.c   |  6 +-
>  drivers/mtd/nand/raw/nand_spl_load.c  |  6 +-
>  drivers/mtd/nand/raw/nand_spl_simple.c| 16 ++--
>  drivers/mtd/nand/raw/omap_gpmc.c  |  2 +-
>  drivers/mtd/nand/raw/vf610_nfc.c  |  2 +-
>  include/configs/M5329EVB.h|  4 +-
>  include/configs/M5373EVB.h|  4 +-
>  include/configs/MCR3000.h |  2 +-
>  include/configs/MPC837XERDB.h |  2 +-
>  include/configs/P1010RDB.h| 78 +--
>  include/configs/P2041RDB.h| 12 +--
>  include/configs/T102xRDB.h| 64 +++
>  include/configs/T104xRDB.h| 62 +++
>  include/co

Re: [PATCH 09/10] Convert CONFIG_SYS_NAND_SIZE to Kconfig

2022-11-14 Thread Simon Glass
On Sat, 12 Nov 2022 at 15:38, Tom Rini  wrote:
>
> This converts the following to Kconfig:
>CONFIG_SYS_NAND_SIZE
>
> Signed-off-by: Tom Rini 
> ---
>  drivers/mtd/nand/raw/Kconfig | 5 +
>  include/configs/M5329EVB.h   | 1 -
>  include/configs/M5373EVB.h   | 1 -
>  include/configs/m53menlo.h   | 6 --
>  include/configs/smartweb.h   | 1 -
>  include/configs/taurus.h | 1 -
>  6 files changed, 5 insertions(+), 10 deletions(-)
>

Reviewed-by: Simon Glass 


Re: [PATCH 04/10] Convert CONFIG_SYS_NAND_HW_ECC to Kconfig

2022-11-14 Thread Simon Glass
On Sat, 12 Nov 2022 at 15:38, Tom Rini  wrote:
>
> This converts the following to Kconfig:
>CONFIG_SYS_NAND_HW_ECC
>
> Signed-off-by: Tom Rini 
> ---
>  configs/da850evm_nand_defconfig |  1 -
>  configs/k2e_evm_defconfig   |  1 -
>  configs/k2e_hs_evm_defconfig|  1 -
>  configs/k2hk_evm_defconfig  |  1 -
>  configs/k2hk_hs_evm_defconfig   |  1 -
>  configs/k2l_evm_defconfig   |  1 -
>  configs/k2l_hs_evm_defconfig|  1 -
>  configs/omapl138_lcdk_defconfig |  1 -
>  drivers/mtd/nand/raw/Kconfig| 14 +-
>  drivers/mtd/nand/raw/davinci_nand.c |  7 +++
>  include/configs/da850evm.h  |  1 -
>  include/configs/omapl138_lcdk.h |  1 -
>  12 files changed, 16 insertions(+), 15 deletions(-)

Reviewed-by: Simon Glass 


Re: [PATCH 02/10] Remove unused symbols

2022-11-14 Thread Simon Glass
On Sat, 12 Nov 2022 at 15:37, Tom Rini  wrote:
>
> This commit removes the following unused symbols:
>CONFIG_SYS_NAND_DDR_LAW
>CONFIG_SYS_NAND_ECCSTEPS
>CONFIG_SYS_NAND_ECCTOTAL
>CONFIG_SYS_NAND_ENABLE_PIN_SPL
>CONFIG_SYS_NAND_MX7_GPMI_62_ECC_BYTES
>CONFIG_SYS_NAND_U_BOOT_RELOC_SP
>
> Signed-off-by: Tom Rini 
> ---
>  include/configs/P1010RDB.h | 2 --
>  include/configs/T102xRDB.h | 1 -
>  include/configs/T104xRDB.h | 1 -
>  include/configs/T208xQDS.h | 1 -
>  include/configs/T208xRDB.h | 1 -
>  include/configs/T4240RDB.h | 1 -
>  include/configs/colibri_imx7.h | 1 -
>  include/configs/da850evm.h | 4 
>  include/configs/omapl138_lcdk.h| 4 
>  include/configs/siemens-am33x-common.h | 4 
>  include/configs/smartweb.h | 1 -
>  include/configs/taurus.h   | 1 -
>  12 files changed, 22 deletions(-)

Reviewed-by: Simon Glass 


Re: [PATCH 1/2] udoo_neo: Move to DM for REGUALTOR/PMIC/I2C drivers

2022-11-14 Thread Simon Glass
On Mon, 14 Nov 2022 at 10:32, Fabio Estevam  wrote:
>
> Hi Peter,
>
> On Mon, Nov 14, 2022 at 1:15 PM Peter Robinson  wrote:
> >
> > This moves over the PMIC power init to DM and the associated i2c and
> > regulator bits.
>
> There is a typo in the Subject line: s/REGUALTOR/REGULATOR
>
> > diff --git a/configs/udoo_neo_defconfig b/configs/udoo_neo_defconfig
> > index 8ae9fa57f03..6c29f8fd251 100644
> > --- a/configs/udoo_neo_defconfig
> > +++ b/configs/udoo_neo_defconfig
> > @@ -10,8 +10,9 @@ CONFIG_ENV_SIZE=0x2000
> >  CONFIG_ENV_OFFSET=0x8
> >  CONFIG_MX6SX=y
> >  CONFIG_TARGET_UDOO_NEO=y
> > -CONFIG_SYS_I2C_MXC_I2C1=y
> > +CONFIG_DM_I2C=y
> >  CONFIG_DM_GPIO=y
> > +CONFIG_DM_MMC=y
>
> CONFIG_DM_MMC is selected by default. No need to have it in the defconfig.
>

Would be good to fix REGUALTOR when applying

> Reviewed-by: Fabio Estevam 


Re: [PATCH 1/1] doc: fix documentation of enum gd_flags

2022-11-14 Thread Simon Glass
On Mon, 14 Nov 2022 at 02:25, Heinrich Schuchardt
 wrote:
>
> Correct GD_FLG_CYCLIC_RUNNING documentation to match Sphinx style.
>
> Fixes: d7de5ef62935 ("cyclic: use a flag in gd->flags for recursion 
> protection")
> Signed-off-by: Heinrich Schuchardt 
> ---
>  include/asm-generic/global_data.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass 


Re: [PATCH 07/10] Convert CONFIG_SYS_NAND_NO_SUBPAGE_WRITE to Kconfig

2022-11-14 Thread Simon Glass
On Sat, 12 Nov 2022 at 15:37, Tom Rini  wrote:
>
> This converts the following to Kconfig:
>CONFIG_SYS_NAND_NO_SUBPAGE_WRITE
>
> Signed-off-by: Tom Rini 
> ---
>  README   | 5 -
>  configs/k2e_evm_defconfig| 1 +
>  configs/k2e_hs_evm_defconfig | 1 +
>  configs/k2hk_evm_defconfig   | 1 +
>  configs/k2hk_hs_evm_defconfig| 1 +
>  configs/k2l_evm_defconfig| 1 +
>  configs/k2l_hs_evm_defconfig | 1 +
>  drivers/mtd/nand/raw/Kconfig | 4 
>  include/configs/ti_armv7_keystone2.h | 1 -
>  9 files changed, 10 insertions(+), 6 deletions(-)
>

Reviewed-by: Simon Glass 


Re: [PATCH 03/10] Convert CONFIG_SYS_NAND_HW_ECC_OOBFIRST to Kconfig

2022-11-14 Thread Simon Glass
On Sat, 12 Nov 2022 at 15:37, Tom Rini  wrote:
>
> This converts the following to Kconfig:
>CONFIG_SYS_NAND_HW_ECC_OOBFIRST
>
> Signed-off-by: Tom Rini 
> ---
>  README  | 4 
>  configs/da850evm_nand_defconfig | 1 +
>  configs/omapl138_lcdk_defconfig | 1 +
>  drivers/mtd/nand/raw/Kconfig| 5 +
>  include/configs/da850evm.h  | 1 -
>  include/configs/omapl138_lcdk.h | 1 -
>  6 files changed, 7 insertions(+), 6 deletions(-)

Reviewed-by: Simon Glass 


Re: [PATCH 05/10] mtd: nand: raw: atmel_nand: Use ATMEL_BASE_ECC directly

2022-11-14 Thread Simon Glass
On Sat, 12 Nov 2022 at 15:37, Tom Rini  wrote:
>
> This is the only driver, and only one platform makes use of, setting
> CONFIG_SYS_NAND_ECC_BASE. Reference ATMEL_BASE_ECC directly in this
> case.
>
> Signed-off-by: Tom Rini 
> ---
>  drivers/mtd/nand/raw/atmel_nand.c | 18 +-
>  include/configs/snapper9g45.h |  1 -
>  2 files changed, 9 insertions(+), 10 deletions(-)

Reviewed-by: Simon Glass 


Re: [PATCH 01/10] Convert CONFIG_SYS_NAND_DBW_8 et al to Kconfig

2022-11-14 Thread Simon Glass
On Sat, 12 Nov 2022 at 15:37, Tom Rini  wrote:
>
> This converts the following to Kconfig:
>CONFIG_SYS_NAND_DBW_8
>CONFIG_SYS_NAND_DBW_16
>
> Note that all instances of the code check for CONFIG_SYS_NAND_DBW_16
> being defined, and then "else" to CONFIG_SYS_NAND_DBW_8 whereas all of
> the configs set CONFIG_SYS_NAND_DBW_8. So we introduce
> CONFIG_SYS_NAND_DBW_16 as an option.
>
> Signed-off-by: Tom Rini 
> ---
>  drivers/mtd/nand/raw/Kconfig| 12 
>  include/configs/at91sam9260ek.h |  1 -
>  include/configs/at91sam9261ek.h |  1 -
>  include/configs/at91sam9263ek.h |  1 -
>  include/configs/at91sam9m10g45ek.h  |  1 -
>  include/configs/at91sam9rlek.h  |  1 -
>  include/configs/at91sam9x5ek.h  |  1 -
>  include/configs/corvus.h|  1 -
>  include/configs/ethernut5.h |  1 -
>  include/configs/gardena-smart-gateway-at91sam.h |  1 -
>  include/configs/meesc.h |  1 -
>  include/configs/pm9261.h|  1 -
>  include/configs/pm9263.h|  1 -
>  include/configs/pm9g45.h|  1 -
>  include/configs/smartweb.h  |  1 -
>  include/configs/snapper9g45.h   |  1 -
>  include/configs/taurus.h|  1 -
>  17 files changed, 12 insertions(+), 16 deletions(-)

Reviewed-by: Simon Glass 


Re: [PATCH 1/1] sandbox: fix documentation of struct host_ops

2022-11-14 Thread Simon Glass
On Mon, 14 Nov 2022 at 02:28, Heinrich Schuchardt
 wrote:
>
> The documentation of struct host_ops should be Sphinx compliant.
>
> Fixes: 9bd1aa8af2ed ("dm: sandbox: Create a new HOST uclass")
> Signed-off-by: Heinrich Schuchardt 
> ---
>  include/sandbox_host.h | 19 ---
>  1 file changed, 8 insertions(+), 11 deletions(-)
>

Reviewed-by: Simon Glass 


Re: [PATCH 1/1] Documentation: man-page for command bootd

2022-11-14 Thread Simon Glass
On Mon, 14 Nov 2022 at 02:31, Heinrich Schuchardt
 wrote:
>
> Provide a man-page for the bootd command.
>
> Signed-off-by: Heinrich Schuchardt 
> ---
>  doc/usage/cmd/bootd.rst | 38 ++
>  doc/usage/index.rst |  1 +
>  2 files changed, 39 insertions(+)
>  create mode 100644 doc/usage/cmd/bootd.rst

Reviewed-by: Simon Glass 


[PATCH] include/configs: mx6/mx7: drop dangling comments

2022-11-14 Thread Peter Robinson
Cleanup some dangling comments left by automated migration
processes that are no longer value.

Signed-off-by: Peter Robinson 
---
 include/configs/mx6_common.h |  4 
 include/configs/mx7_common.h | 12 
 2 files changed, 16 deletions(-)

diff --git a/include/configs/mx6_common.h b/include/configs/mx6_common.h
index 43145567544..f70c515b840 100644
--- a/include/configs/mx6_common.h
+++ b/include/configs/mx6_common.h
@@ -22,8 +22,4 @@
 #include 
 #include 
 
-/* Miscellaneous configurable options */
-
-/* MMC */
-
 #endif
diff --git a/include/configs/mx7_common.h b/include/configs/mx7_common.h
index 4704276a74d..7e83715a76f 100644
--- a/include/configs/mx7_common.h
+++ b/include/configs/mx7_common.h
@@ -20,16 +20,4 @@
 /* Enable iomux-lpsr support */
 #define CONFIG_IOMUX_LPSR
 
-/* Miscellaneous configurable options */
-
-/* UART */
-
-/* MMC */
-
-/*
- * If we have defined the OPTEE ram size and not OPTEE it means that we were
- * launched by OPTEE, because of that we shall skip all the low level
- * initialization since it was already done by ATF or OPTEE
- */
-
 #endif
-- 
2.38.1



[PATCH v2 2/2] test: cmd: fdt: Add fdt get value test case

2022-11-14 Thread Marek Vasut
Add test case for 'fdt get value' sub command.

The test case can be triggered using:
"
./u-boot -d u-boot.dtb -c 'ut fdt'
"

Acked-by: Heinrich Schuchardt 
Signed-off-by: Marek Vasut 
---
Cc: Heinrich Schuchardt 
Cc: Simon Glass 
Cc: Tom Rini 
---
V2: - Add AB from Heinrich
---
 test/cmd/fdt.c | 53 ++
 1 file changed, 53 insertions(+)

diff --git a/test/cmd/fdt.c b/test/cmd/fdt.c
index ba9eaa42c14..7974c88c0d6 100644
--- a/test/cmd/fdt.c
+++ b/test/cmd/fdt.c
@@ -142,6 +142,59 @@ static int fdt_test_resize(struct unit_test_state *uts)
 }
 FDT_TEST(fdt_test_resize, UT_TESTF_CONSOLE_REC);
 
+/* Test 'fdt get' reading an fdt */
+static int fdt_test_get(struct unit_test_state *uts)
+{
+   ulong addr;
+
+   addr = map_to_sysmem(gd->fdt_blob);
+   set_working_fdt_addr(addr);
+
+   /* Test getting default element of /clk-test node clock-names property 
*/
+   ut_assertok(console_record_reset_enable());
+   ut_assertok(run_command("fdt get value fdflt /clk-test clock-names", 
0));
+   ut_asserteq_str("fixed", env_get("fdflt"));
+   ut_assertok(ut_check_console_end(uts));
+
+   /* Test getting 0th element of /clk-test node clock-names property */
+   ut_assertok(console_record_reset_enable());
+   ut_assertok(run_command("fdt get value fzero /clk-test clock-names 0", 
0));
+   ut_asserteq_str("fixed", env_get("fzero"));
+   ut_assertok(ut_check_console_end(uts));
+
+   /* Test getting 1st element of /clk-test node clock-names property */
+   ut_assertok(console_record_reset_enable());
+   ut_assertok(run_command("fdt get value fone /clk-test clock-names 1", 
0));
+   ut_asserteq_str("i2c", env_get("fone"));
+   ut_assertok(ut_check_console_end(uts));
+
+   /* Test getting 2nd element of /clk-test node clock-names property */
+   ut_assertok(console_record_reset_enable());
+   ut_assertok(run_command("fdt get value ftwo /clk-test clock-names 2", 
0));
+   ut_asserteq_str("spi", env_get("ftwo"));
+   ut_assertok(ut_check_console_end(uts));
+
+   /* Test missing 10th element of /clk-test node clock-names property */
+   ut_assertok(console_record_reset_enable());
+   ut_asserteq(1, run_command("fdt get value ftwo /clk-test clock-names 
10", 0));
+   ut_assertok(ut_check_console_end(uts));
+
+   /* Test getting default element of /clk-test node nonexistent property 
*/
+   ut_assertok(console_record_reset_enable());
+   ut_asserteq(1, run_command("fdt get value fnone /clk-test nonexistent", 
1));
+   ut_assert_nextline("libfdt fdt_getprop(): FDT_ERR_NOTFOUND");
+   ut_assertok(ut_check_console_end(uts));
+
+   /* Test getting default element of /nonexistent node */
+   ut_assertok(console_record_reset_enable());
+   ut_asserteq(1, run_command("fdt get value fnode /nonexistent 
nonexistent", 1));
+   ut_assert_nextline("libfdt fdt_path_offset() returned 
FDT_ERR_NOTFOUND");
+   ut_assertok(ut_check_console_end(uts));
+
+   return 0;
+}
+FDT_TEST(fdt_test_get, UT_TESTF_CONSOLE_REC);
+
 int do_ut_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
struct unit_test *tests = UNIT_TEST_SUITE_START(fdt_test);
-- 
2.35.1



[PATCH v2 1/2] cmd: fdt: Fix iteration over elements above index 1 in fdt get

2022-11-14 Thread Marek Vasut
Always increment both the iterator and pointer into the string
property value by length of the current element + 1 (to cater
for the string delimiter), otherwise the element extracted from
the string property value would be extracted from an offset that
is multiple of the length of the first element, instead of sum
of element lengths until select index.

This fixes 'fdt get value' operation for index above 1 (counting
from index 0).

Acked-by: Heinrich Schuchardt 
Fixes: 13982ced2cc ("cmd: fdt: Add support for reading stringlist property 
values")
Signed-off-by: Marek Vasut 
---
Cc: Heinrich Schuchardt 
Cc: Simon Glass 
Cc: Tom Rini 
---
V2: - Update commit message, use index above 1 and clarify the
  counting is zero-based
- Add AB from Heinrich
---
 cmd/fdt.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/cmd/fdt.c b/cmd/fdt.c
index 4b2dcfec863..8e51a431261 100644
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -60,11 +60,14 @@ static int fdt_value_env_set(const void *nodep, int len,
 * Iterate over all members in stringlist and find the one at
 * offset $index. If no such index exists, indicate failure.
 */
-   for (i = 0; i < len; i += strlen(nodec) + 1) {
-   if (index-- > 0)
+   for (i = 0; i < len; ) {
+   if (index-- > 0) {
+   i += strlen(nodec) + 1;
+   nodec += strlen(nodec) + 1;
continue;
+   }
 
-   env_set(var, nodec + i);
+   env_set(var, nodec);
return 0;
}
 
-- 
2.35.1



Re: [PATCH] rockchip: rk3399: pass platform parameter to TF-A by default

2022-11-14 Thread Jerome Forissier



On 11/14/22 18:37, Quentin Schulz wrote:
> From: Quentin Schulz 
> 
> Long are gone the times TF-A couldn't handle the FDT passed by U-Boot.
> Specifically, since commit e7b586987c0a ("rockchip: don't crash if we
> get an FDT we can't parse") in TF-A, failure to parse the FDT will use
> the fallback mechanism. This patch was merged in TF-A v2.4-rc0 from two
> years ago.
> 
> Therefore, let's finally pass the FDT to TF-A so that it can get the
> serial configuration from U-Boot FDT instead of requiring the user to
> patch TF-A hardcoded fallback values.
> 
> Cc: Quentin Schulz 
> Signed-off-by: Quentin Schulz 
> ---
> rockchip: rk3399: pass platform parameter to TF-A
> 
> Finally pass the FDT address to TF-A since it now gracefully fallbacks to
> hardcoded defaults if it cannot parse it. This allows us to avoid modifying
> hardcoded values in TF-A to enable the console.

Does this mean that with this patch TF-A will properly set the baudrate of
the console UART to 1.5MBd? I'm asking because I am about to send the
following patch to TF-A (if I can figure out the Gerrit stuff that is...):

=
>From 51c1aa9277f6386b3a8055ad8ad582f894ab9230 Mon Sep 17 00:00:00 2001
From: Jerome Forissier 
Date: Thu, 10 Nov 2022 21:38:30 +0100
Subject: [PATCH] rk3399: set console baudrate to 150

The default speed for the console UART of the rk3399 SoC is 1.5 MBaud.
It is the value used by U-Boot so if TF-A has a different value there
is no output when the boot switches from TPL to TF-A BL31 (note that
OP-TEE which does not change the speed). The Rockchip loader aka flash
helper (rk3399_loader_v1.20.119.bin [1][2]) also uses the same speed.
Therefore set the default baudrate to 150.

Link: [1] https://dl.radxa.com/rockpi/images/loader/
Link: [2] https://wiki.radxa.com/Rockpi4/dev/usb-install
Signed-off-by: Jerome Forissier 
---
 plat/rockchip/rk3399/rk3399_def.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plat/rockchip/rk3399/rk3399_def.h 
b/plat/rockchip/rk3399/rk3399_def.h
index ba83242eb..8d6ecfbe6 100644
--- a/plat/rockchip/rk3399/rk3399_def.h
+++ b/plat/rockchip/rk3399/rk3399_def.h
@@ -17,7 +17,7 @@
 /**
  * UART related constants
  **/
-#define RK3399_BAUDRATE115200
+#define RK3399_BAUDRATE150
 #define RK3399_UART_CLOCK  2400
 
 /**
-- 
2.34.1
=

Thanks,
-- 
Jerome


Re: [PATCH v2 2/2] udoo_neo: Select DM_SERIAL and drop iomux board level init

2022-11-14 Thread Fabio Estevam
On Mon, Nov 14, 2022 at 5:53 PM Peter Robinson  wrote:
>
> Convert to DM_SERIAL and drop the iomux board file
> level init as it's handled as part of the DM serial
> layer instead.
>
> Signed-off-by: Peter Robinson 

Reviewed-by: Fabio Estevam 


Re: [PATCH v2 1/2] udoo_neo: Move to DM for REGULATOR/PMIC/I2C drivers

2022-11-14 Thread Fabio Estevam
On Mon, Nov 14, 2022 at 5:53 PM Peter Robinson  wrote:
>
> This moves over the PMIC power init to DM and the associated i2c and
> regulator bits.
>
> Signed-off-by: Peter Robinson 

Reviewed-by: Fabio Estevam 


[PATCH v2 2/2] udoo_neo: Select DM_SERIAL and drop iomux board level init

2022-11-14 Thread Peter Robinson
Convert to DM_SERIAL and drop the iomux board file
level init as it's handled as part of the DM serial
layer instead.

Signed-off-by: Peter Robinson 
---

Changes in v2:
- Drop no longer needed setup_iomux_uart and associated bits

 board/udoo/neo/neo.c   | 26 +++---
 configs/udoo_neo_defconfig |  2 +-
 2 files changed, 4 insertions(+), 24 deletions(-)

diff --git a/board/udoo/neo/neo.c b/board/udoo/neo/neo.c
index 9e2a66996c4..1287f719197 100644
--- a/board/udoo/neo/neo.c
+++ b/board/udoo/neo/neo.c
@@ -43,10 +43,6 @@ enum {
UDOO_NEO_TYPE_EXTENDED,
 };
 
-#define UART_PAD_CTRL  (PAD_CTL_PKE | PAD_CTL_PUE |\
-   PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED |   \
-   PAD_CTL_DSE_40ohm   | PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
-
 #define USDHC_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE |\
PAD_CTL_PUS_22K_UP  | PAD_CTL_SPEED_LOW |   \
PAD_CTL_DSE_80ohm   | PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
@@ -98,11 +94,6 @@ int power_init_board(void)
return 0;
 }
 
-static iomux_v3_cfg_t const uart1_pads[] = {
-   MX6_PAD_GPIO1_IO04__UART1_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
-   MX6_PAD_GPIO1_IO05__UART1_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
-};
-
 static iomux_v3_cfg_t const usdhc2_pads[] = {
MX6_PAD_SD2_CLK__USDHC2_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6_PAD_SD2_CMD__USDHC2_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
@@ -130,11 +121,6 @@ static iomux_v3_cfg_t const peri_3v3_pads[] = {
MX6_PAD_QSPI1A_DATA0__GPIO4_IO_16 | MUX_PAD_CTRL(NO_PAD_CTRL),
 };
 
-static void setup_iomux_uart(void)
-{
-   imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
-}
-
 static int setup_fec(void)
 {
struct anatop_regs *anatop = (struct anatop_regs *)ANATOP_BASE_ADDR;
@@ -184,13 +170,6 @@ int board_init(void)
return 0;
 }
 
-int board_early_init_f(void)
-{
-   setup_iomux_uart();
-
-   return 0;
-}
-
 static struct fsl_esdhc_cfg usdhc_cfg[1] = {
{USDHC2_BASE_ADDR},
 };
@@ -421,11 +400,12 @@ void board_init_f(ulong dummy)
/* setup AIPS and disable watchdog */
arch_cpu_init();
 
-   board_early_init_f();
-
/* setup GP timer */
timer_init();
 
+   /* Enable device tree and early DM support*/
+   spl_early_init();
+
/* UART clocks enabled and gd valid - init serial console */
preloader_console_init();
 
diff --git a/configs/udoo_neo_defconfig b/configs/udoo_neo_defconfig
index 341ee4671db..3d50bf7d79f 100644
--- a/configs/udoo_neo_defconfig
+++ b/configs/udoo_neo_defconfig
@@ -21,7 +21,6 @@ CONFIG_SPL_LIBDISK_SUPPORT=y
 # CONFIG_CMD_BMODE is not set
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd"
-CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SYS_SPL_MALLOC=y
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_FS_EXT4=y
@@ -59,6 +58,7 @@ CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_ANATOP=y
 CONFIG_DM_REGULATOR_PFUZE100=y
+CONFIG_DM_SERIAL=y
 CONFIG_MXC_UART=y
 CONFIG_IMX_THERMAL=y
 CONFIG_USB=y
-- 
2.38.1



[PATCH v2 1/2] udoo_neo: Move to DM for REGULATOR/PMIC/I2C drivers

2022-11-14 Thread Peter Robinson
This moves over the PMIC power init to DM and the associated i2c and
regulator bits.

Signed-off-by: Peter Robinson 
---

Changes in v2:
- Fix spelling mistake
- Drop unneeded DM_MMC
- Drop dangling comment in udoo_neo.h

 board/udoo/neo/neo.c   | 139 +++--
 configs/udoo_neo_defconfig |   9 ++-
 include/configs/udoo_neo.h |   7 --
 3 files changed, 14 insertions(+), 141 deletions(-)

diff --git a/board/udoo/neo/neo.c b/board/udoo/neo/neo.c
index 5e40583ab43..9e2a66996c4 100644
--- a/board/udoo/neo/neo.c
+++ b/board/udoo/neo/neo.c
@@ -51,11 +51,6 @@ enum {
PAD_CTL_PUS_22K_UP  | PAD_CTL_SPEED_LOW |   \
PAD_CTL_DSE_80ohm   | PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
 
-#define I2C_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE |  \
-   PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED |   \
-   PAD_CTL_DSE_40ohm | PAD_CTL_HYS |   \
-   PAD_CTL_ODE)
-
 #define ENET_PAD_CTRL  (PAD_CTL_PUS_100K_UP | PAD_CTL_PUE | \
PAD_CTL_SPEED_MED   |   \
PAD_CTL_DSE_40ohm   | PAD_CTL_SRE_FAST)
@@ -83,135 +78,25 @@ int dram_init(void)
return 0;
 }
 
-#ifdef CONFIG_SYS_I2C_MXC
-#define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
-/* I2C1 for PMIC */
-static struct i2c_pads_info i2c_pad_info1 = {
-   .scl = {
-   .i2c_mode = MX6_PAD_GPIO1_IO00__I2C1_SCL | PC,
-   .gpio_mode = MX6_PAD_GPIO1_IO00__GPIO1_IO_0 | PC,
-   .gp = IMX_GPIO_NR(1, 0),
-   },
-   .sda = {
-   .i2c_mode = MX6_PAD_GPIO1_IO01__I2C1_SDA | PC,
-   .gpio_mode = MX6_PAD_GPIO1_IO01__GPIO1_IO_1 | PC,
-   .gp = IMX_GPIO_NR(1, 1),
-   },
-};
-#endif
-
-#if CONFIG_IS_ENABLED(POWER_LEGACY)
 int power_init_board(void)
 {
-   struct pmic *p;
-   int ret;
-   unsigned int reg, rev_id;
-
-   ret = power_pfuze3000_init(PFUZE3000_I2C_BUS);
-   if (ret)
-   return ret;
-
-   p = pmic_get("PFUZE3000");
-   ret = pmic_probe(p);
-   if (ret)
-   return ret;
+   struct udevice *dev;
+   int ret, dev_id, rev_id;
 
-   pmic_reg_read(p, PFUZE3000_DEVICEID, ®);
-   pmic_reg_read(p, PFUZE3000_REVID, &rev_id);
-   printf("PMIC:  PFUZE3000 DEV_ID=0x%x REV_ID=0x%x\n", reg, rev_id);
-
-   /* disable Low Power Mode during standby mode */
-   pmic_reg_read(p, PFUZE3000_LDOGCTL, ®);
-   reg |= 0x1;
-   ret = pmic_reg_write(p, PFUZE3000_LDOGCTL, reg);
-   if (ret)
+   ret = pmic_get("pfuze3000@8", &dev);
+   if (ret == -ENODEV)
+   return 0;
+   if (ret != 0)
return ret;
 
-   ret = pmic_reg_write(p, PFUZE3000_SW1AMODE, 0xc);
-   if (ret)
-   return ret;
+   dev_id = pmic_reg_read(dev, PFUZE3000_DEVICEID);
+   rev_id = pmic_reg_read(dev, PFUZE3000_REVID);
+   printf("PMIC: PFUZE3000 DEV_ID=0x%x REV_ID=0x%x\n", dev_id, rev_id);
 
-   ret = pmic_reg_write(p, PFUZE3000_SW1BMODE, 0xc);
-   if (ret)
-   return ret;
-
-   ret = pmic_reg_write(p, PFUZE3000_SW2MODE, 0xc);
-   if (ret)
-   return ret;
-
-   ret = pmic_reg_write(p, PFUZE3000_SW3MODE, 0xc);
-   if (ret)
-   return ret;
-
-   /* set SW1A standby voltage 0.975V */
-   pmic_reg_read(p, PFUZE3000_SW1ASTBY, ®);
-   reg &= ~0x3f;
-   reg |= PFUZE3000_SW1AB_SETP(9750);
-   ret = pmic_reg_write(p, PFUZE3000_SW1ASTBY, reg);
-   if (ret)
-   return ret;
-
-   /* set SW1B standby voltage 0.975V */
-   pmic_reg_read(p, PFUZE3000_SW1BSTBY, ®);
-   reg &= ~0x3f;
-   reg |= PFUZE3000_SW1AB_SETP(9750);
-   ret = pmic_reg_write(p, PFUZE3000_SW1BSTBY, reg);
-   if (ret)
-   return ret;
-
-   /* set SW1A/VDD_ARM_IN step ramp up time from 16us to 4us/25mV */
-   pmic_reg_read(p, PFUZE3000_SW1ACONF, ®);
-   reg &= ~0xc0;
-   reg |= 0x40;
-   ret = pmic_reg_write(p, PFUZE3000_SW1ACONF, reg);
-   if (ret)
-   return ret;
-
-   /* set SW1B/VDD_SOC_IN step ramp up time from 16us to 4us/25mV */
-   pmic_reg_read(p, PFUZE3000_SW1BCONF, ®);
-   reg &= ~0xc0;
-   reg |= 0x40;
-   ret = pmic_reg_write(p, PFUZE3000_SW1BCONF, reg);
-   if (ret)
-   return ret;
-
-   /* set VDD_ARM_IN to 1.350V */
-   pmic_reg_read(p, PFUZE3000_SW1AVOLT, ®);
-   reg &= ~0x3f;
-   reg |= PFUZE3000_SW1AB_SETP(13500);
-   ret = pmic_reg_write(p, PFUZE3000_SW1AVOLT, reg);
-   if (ret)
-   return ret;
-
-   /* set VDD_SOC_IN to 1.350V */
-   pmic_reg_read(p, PFUZE3000_SW1BVOLT, ®);
-   reg &= ~0x3f;
-   reg |= PFUZE3000_SW1AB_SETP(13500);
-   ret = pmic_reg_write(p, PFUZE3000_SW1BVOLT, reg);
-   if (ret)
-   return ret;
-
-   /* set DDR_1_5V to 1.350V */
-   pmic_reg_read(p, PFUZE3000_SW3VOLT, ®);
-   reg &= ~0x0f;
-   reg |= PF

Re: Pull request: u-boot-imx u-boot-imx-20221114

2022-11-14 Thread Tom Rini
On Mon, Nov 14, 2022 at 11:29:27AM +0100, Stefano Babic wrote:

> Hi Tom,
> 
> please pull from u-boot-imx, thanks !
> 
> The following changes since commit 88bd8ee106591eb900561715c44ad04441afc0e3:
> 
>   Prepare v2023.01-rc1 (2022-11-07 15:27:03 -0500)
> 
> are available in the Git repository at:
> 
>   https://gitlab.denx.de/u-boot/custodians/u-boot-imx.git
> tags/u-boot-imx-20221114
> 
> for you to fetch changes up to fc1c1760de38823edbdc2cdd9606dff938a07f6e:
> 
>   Revert "serial: mxc: have putc use the TXFIFO" (2022-11-12 14:16:26 +0100)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: Please pull u-boot-i2c

2022-11-14 Thread Tom Rini
On Mon, Nov 14, 2022 at 10:12:10AM +0100, Heiko Schocher wrote:

> Hello Tom,
> 
> please pull from u-boot-i2c:
> 
> The following changes since commit 0cbeed4f6648e0e4966475e3544280a69ecb59d3:
> 
>   Merge branch '2022-11-10-symbol-migrations' (2022-11-10 10:09:40 -0500)
> 
> are available in the Git repository at:
> 
>   https://source.denx.de/u-boot/custodians/u-boot-i2c.git 
> tags/for-v2023.01-rc2
> 
> for you to fetch changes up to b0c485fd384b2706717d4c19fa9837c1d785e9e8:
> 
>   i2c: i2c-gpio: add newline (2022-11-14 07:24:47 +0100)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 04/11] imx: mx6ull/z_14x14_evk: clean up UART iomux

2022-11-14 Thread Peter Robinson
On Mon, Nov 7, 2022 at 7:14 AM Peng Fan (OSS)  wrote:
>
> From: Peng Fan 
>
> After DM_SERIAL, and set pinctrl_uart1 as pre-reloc, no need initialize
> iomux at board file.
>
> Signed-off-by: Peng Fan 
> ---
>  arch/arm/dts/imx6ull-14x14-evk-u-boot.dtsi |  8 
>  arch/arm/dts/imx6ulz-14x14-evk-u-boot.dtsi |  8 
>  board/freescale/mx6ullevk/mx6ullevk.c  | 16 
>  3 files changed, 16 insertions(+), 16 deletions(-)
>  create mode 100644 arch/arm/dts/imx6ull-14x14-evk-u-boot.dtsi
>  create mode 100644 arch/arm/dts/imx6ulz-14x14-evk-u-boot.dtsi
>
> diff --git a/arch/arm/dts/imx6ull-14x14-evk-u-boot.dtsi 
> b/arch/arm/dts/imx6ull-14x14-evk-u-boot.dtsi
> new file mode 100644
> index 000..d283e815e6a
> --- /dev/null
> +++ b/arch/arm/dts/imx6ull-14x14-evk-u-boot.dtsi
> @@ -0,0 +1,8 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright 2022 NXP
> + */
> +
> +&pinctrl_uart1 {
> +   u-boot,dm-pre-reloc;
> +};
> diff --git a/arch/arm/dts/imx6ulz-14x14-evk-u-boot.dtsi 
> b/arch/arm/dts/imx6ulz-14x14-evk-u-boot.dtsi
> new file mode 100644
> index 000..d283e815e6a
> --- /dev/null
> +++ b/arch/arm/dts/imx6ulz-14x14-evk-u-boot.dtsi
> @@ -0,0 +1,8 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright 2022 NXP
> + */
> +
> +&pinctrl_uart1 {
> +   u-boot,dm-pre-reloc;
> +};
> diff --git a/board/freescale/mx6ullevk/mx6ullevk.c 
> b/board/freescale/mx6ullevk/mx6ullevk.c
> index 86c11c7bd3a..87bdbe51c6d 100644
> --- a/board/freescale/mx6ullevk/mx6ullevk.c
> +++ b/board/freescale/mx6ullevk/mx6ullevk.c
> @@ -24,10 +24,6 @@
>
>  DECLARE_GLOBAL_DATA_PTR;
>
> -#define UART_PAD_CTRL  (PAD_CTL_PKE | PAD_CTL_PUE |\
> -   PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED |   \
> -   PAD_CTL_DSE_40ohm   | PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
> -
>  int dram_init(void)
>  {
> gd->ram_size = imx_ddr_size();
> @@ -35,16 +31,6 @@ int dram_init(void)
> return 0;
>  }
>
> -static iomux_v3_cfg_t const uart1_pads[] = {
> -   MX6_PAD_UART1_TX_DATA__UART1_DCE_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
> -   MX6_PAD_UART1_RX_DATA__UART1_DCE_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
> -};
> -
> -static void setup_iomux_uart(void)
> -{
> -   imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
> -}
> -
>  int board_mmc_get_env_dev(int devno)
>  {
> return devno;
> @@ -57,8 +43,6 @@ int mmc_map_to_kernel_blk(int devno)
>
>  int board_early_init_f(void)
>  {
> -   setup_iomux_uart();
> -
> return 0;
>  }

Can you not just drop the entire board_early_init_f function and also
the matching CONFIG_BOARD_EARLY_INIT_F=y option too?


Re: [PATCH 2/2] udoo_neo: Select DM_SERIAL

2022-11-14 Thread Fabio Estevam
On Mon, Nov 14, 2022 at 2:51 PM Peter Robinson  wrote:

> Yes, I realised that, I was going to do a follow up patch like some of
> the other conversions I'd seen, but I'm reviewing a few other bits
> while I'm at it.

It is OK to do that on incremental patches, thanks.


Re: [PATCH 2/2] test: cmd: fdt: Add fdt get value test case

2022-11-14 Thread Marek Vasut

On 11/14/22 09:30, Heinrich Schuchardt wrote:

On 11/13/22 21:45, Marek Vasut wrote:

Add test case for 'fdt get value' sub command.

The test case can be triggered using:
"
./u-boot -d u-boot.dtb -c 'ut fdt'
"

Signed-off-by: Marek Vasut 
---
Cc: Heinrich Schuchardt 
Cc: Simon Glass 
Cc: Tom Rini 
---
  test/cmd/fdt.c | 53 ++
  1 file changed, 53 insertions(+)

diff --git a/test/cmd/fdt.c b/test/cmd/fdt.c
index ba9eaa42c14..7974c88c0d6 100644
--- a/test/cmd/fdt.c
+++ b/test/cmd/fdt.c
@@ -142,6 +142,59 @@ static int fdt_test_resize(struct unit_test_state 
*uts)

  }
  FDT_TEST(fdt_test_resize, UT_TESTF_CONSOLE_REC);
+/* Test 'fdt get' reading an fdt */
+static int fdt_test_get(struct unit_test_state *uts)
+{
+    ulong addr;
+
+    addr = map_to_sysmem(gd->fdt_blob);
+    set_working_fdt_addr(addr);
+
+    /* Test getting default element of /clk-test node clock-names 
property */

+    ut_assertok(console_record_reset_enable());
+    ut_assertok(run_command("fdt get value fdflt /clk-test 
clock-names", 0));


The command 'fdt get value' is missing in doc/usage/cmd/fdt.rst.


Ugh ... the entire 'fdt' command documentation except for 'fdt addr' is 
missing in that file.


Re: [PATCH 11/11] imx: mx6sabresd: select DM_SERIAL

2022-11-14 Thread Fabio Estevam
Hi Peng,

On Mon, Nov 7, 2022 at 4:14 AM Peng Fan (OSS)  wrote:
>
> From: Peng Fan 
>
> Select DM_SERIAL

When converting to DM_SERIAL, please also remove setup_iomux_uart()
from the board code.


Re: [PATCH 2/2] udoo_neo: Select DM_SERIAL

2022-11-14 Thread Peter Robinson
On Mon, Nov 14, 2022 at 5:34 PM Fabio Estevam  wrote:
>
> On Mon, Nov 14, 2022 at 1:15 PM Peter Robinson  wrote:
> >
> > The conversion to DM_SERIAL is mandatory, so select this
> > option.
>
> After converting it to DM_SERIAL, the setup_iomux_uart() could be removed.
>
> With that removed:

Yes, I realised that, I was going to do a follow up patch like some of
the other conversions I'd seen, but I'm reviewing a few other bits
while I'm at it.

> Reviewed-by: Fabio Estevam 


Re: [PATCH v4] schemas: Add schema for U-Boot driver model 'phase tags'

2022-11-14 Thread Rob Herring
+Ilias, Bill and Joakim

On Sat, Nov 12, 2022 at 9:21 AM Simon Glass  wrote:
>
> Hi Rob,
>
> (unfortunately I have a filter on this list due to the insane traffic
> and am not sure how to let these emails through, so I just saw this)

https://lore.kernel.org/linux-devicetree/?q=a%3Asjg%40chromium.org

And 'lei' can make that search a persistent mailbox.

>
> On Thu, 10 Nov 2022 at 11:30, Rob Herring  wrote:
> >
> > On Thu, Nov 10, 2022 at 10:59 AM Simon Glass  wrote:
> > >
> > > Hi Rob,
> > >
> > > On Tue, 8 Nov 2022 at 10:19, Rob Herring  wrote:
> > > >
> > > > On Tue, Nov 1, 2022 at 10:13 PM Simon Glass  wrote:
> > > > >
> > > > > U-Boot has some particular challenges with device tree and devices:
> > > > >
> > > > > - U-Boot has multiple build phases, such as a Secondary Program Loader
> > > > >   (SPL) phase which typically runs in a pre-SDRAM environment where 
> > > > > code
> > > > >   and data space are limited. In particular, there may not be enough
> > > > >   space for the full device tree blob. U-Boot uses various automated
> > > > >   techniques to reduce the size from perhaps 40KB to 3KB. It is not
> > > > >   always possible to handle these tags entirely at build time, since
> > > > >   U-Boot proper must have the full device tree, even though we do not
> > > > >   want it to process all nodes until after relocation.
> > > > > - Some U-Boot phases needs to run before the clocks are properly set 
> > > > > up,
> > > > >   where the CPU may be running very slowly. Therefore it is important 
> > > > > to
> > > > >   bind only those devices which are actually needed in that phase
> > > > > - U-Boot uses lazy initialisation for its devices, with 'bind' and
> > > > >   'probe' being separate steps. Even if a device is bound, it is not
> > > > >   actually probed until it is used. This is necessary to keep the boot
> > > > >   time reasonable, e.g. to under a second
> > > > >
> > > > > The phases of U-Boot in order are: TPL, VPL, SPL, U-Boot (first
> > > > > pre-relocation, then post-relocation). ALl but the last two are 
> > > > > optional.
> > > > >
> > > > > For the above reasons, U-Boot only includes the full device tree in 
> > > > > the
> > > > > final 'U-Boot proper' build. Even then, before relocation U-Boot only
> > > > > processes nodes which are marked as being needed.
> > > > >
> > > > > For this to work, U-Boot's driver model[1] provides a way to mark 
> > > > > device
> > > > > tree nodes as applicable for a particular phase. This works by adding 
> > > > > a
> > > > > tag to the node, e.g.:
> > > > >
> > > > >cru: clock-controller@ff76 {
> > > > >   phase,all;
> > > > >   compatible = "rockchip,rk3399-cru";
> > > > >   reg = <0x0 0xff76 0x0 0x1000>;
> > > > >   rockchip,grf = <&grf>;
> > > > >   #clock-cells = <1>;
> > > > >   #reset-cells = <1>;
> > > > >   ...
> > > > >};
> > > > >
> > > > > Here the "phase,all" tag indicates that the node must be present in 
> > > > > all
> > > > > phases, since the clock driver is required.
> > > > >
> > > > > There has been discussion over the years about whether this could be 
> > > > > done
> > > > > in a property instead, e.g.
> > > > >
> > > > >options {
> > > > >   phase,all = <&cru> <&gpio_a> ...;
> > > > >   ...
> > > > >};
> > > > >
> > > > > Some problems with this:
> > > > >
> > > > > - we need to be able to merge several such tags from different .dtsi 
> > > > > files
> > > > >   since many boards have their own specific requirements
> > > > > - it is hard to find and cross-reference the affected nodes
> > > > > - it is more error-prone
> > > > > - it requires significant tool rework in U-Boot, including fdtgrep and
> > > > >   the build system
> > > > > - is harder (slower, more code) to process since it involves scanning
> > > > >   another node/property to find out what to do with a particular node
> > > > > - we don't want to add phandle arguments to the above since we are
> > > > >   referring, e.g., to the clock device as a whole, not a paricular 
> > > > > clock
> > > > > - the of-platdata feature[2], which converts device tree to C for even
> > > > >   more constrained environments, would need to become aware of the
> > > > >   /options node
> > > > >
> > > > > There is also the question about whether this needs to be 
> > > > > U-Boot-specific,
> > > > > or whether the tags could be generic. From what I can tell, U-Boot is 
> > > > > the
> > > > > only bootloader which seriously attempts to use a runtime device tree 
> > > > > in
> > > > > all cases. For this version, an attempt is made to name the phases in 
> > > > > a
> > > > > generic manner.
> > > > >
> > > > > It should also be noted that the approach provided here has stood the 
> > > > > test
> > > > > of time, used in U-Boot for 8 years so far.
> > > > >
> > > > > So add the schema for this. This will allow a major class of schema
> > > > > exceptions to be dropped from the U-Boot source tree.
> > > > >
> > 

[PATCH] rockchip: rk3399: pass platform parameter to TF-A by default

2022-11-14 Thread Quentin Schulz
From: Quentin Schulz 

Long are gone the times TF-A couldn't handle the FDT passed by U-Boot.
Specifically, since commit e7b586987c0a ("rockchip: don't crash if we
get an FDT we can't parse") in TF-A, failure to parse the FDT will use
the fallback mechanism. This patch was merged in TF-A v2.4-rc0 from two
years ago.

Therefore, let's finally pass the FDT to TF-A so that it can get the
serial configuration from U-Boot FDT instead of requiring the user to
patch TF-A hardcoded fallback values.

Cc: Quentin Schulz 
Signed-off-by: Quentin Schulz 
---
rockchip: rk3399: pass platform parameter to TF-A

Finally pass the FDT address to TF-A since it now gracefully fallbacks to
hardcoded defaults if it cannot parse it. This allows us to avoid modifying
hardcoded values in TF-A to enable the console.

This was tested with TF-A v2.7.0 on Puma Haikou RK3399.

To: Simon Glass 
To: Philipp Tomsich 
To: Kever Yang 
Cc: Hugh Cole-Baker 
Cc: Walter Lozano 
Cc: u-boot@lists.denx.de
---
 arch/arm/mach-rockchip/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 69d51ff378..2fcc23f9fa 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -249,7 +249,6 @@ config ROCKCHIP_RK3399
imply PRE_CONSOLE_BUFFER
imply ROCKCHIP_COMMON_BOARD
imply ROCKCHIP_SDRAM_COMMON
-   imply SPL_ATF_NO_PLATFORM_PARAM if SPL_ATF
imply SPL_ROCKCHIP_COMMON_BOARD
imply TPL_SERIAL
imply TPL_LIBCOMMON_SUPPORT

---
base-commit: 0cbeed4f6648e0e4966475e3544280a69ecb59d3
change-id: 20221114-rk3399-tf-a-plat-param-3ab055f40b9e

Best regards,
-- 
Quentin Schulz 


Re: [PATCH v4] schemas: Add schema for U-Boot driver model 'phase tags'

2022-11-14 Thread Simon Glass
+Ilias Apalodimas too


On Mon, 14 Nov 2022 at 10:33, Simon Glass  wrote:
>
> +Ilias Apalodimas too
>
> On Sat, 12 Nov 2022 at 08:21, Simon Glass  wrote:
>>
>> Hi Rob,
>>
>> (unfortunately I have a filter on this list due to the insane traffic
>> and am not sure how to let these emails through, so I just saw this)
>>
>> On Thu, 10 Nov 2022 at 11:30, Rob Herring  wrote:
>> >
>> > On Thu, Nov 10, 2022 at 10:59 AM Simon Glass  wrote:
>> > >
>> > > Hi Rob,
>> > >
>> > > On Tue, 8 Nov 2022 at 10:19, Rob Herring  wrote:
>> > > >
>> > > > On Tue, Nov 1, 2022 at 10:13 PM Simon Glass  wrote:
>> > > > >
>> > > > > U-Boot has some particular challenges with device tree and devices:
>> > > > >
>> > > > > - U-Boot has multiple build phases, such as a Secondary Program 
>> > > > > Loader
>> > > > >   (SPL) phase which typically runs in a pre-SDRAM environment where 
>> > > > > code
>> > > > >   and data space are limited. In particular, there may not be enough
>> > > > >   space for the full device tree blob. U-Boot uses various automated
>> > > > >   techniques to reduce the size from perhaps 40KB to 3KB. It is not
>> > > > >   always possible to handle these tags entirely at build time, since
>> > > > >   U-Boot proper must have the full device tree, even though we do not
>> > > > >   want it to process all nodes until after relocation.
>> > > > > - Some U-Boot phases needs to run before the clocks are properly set 
>> > > > > up,
>> > > > >   where the CPU may be running very slowly. Therefore it is 
>> > > > > important to
>> > > > >   bind only those devices which are actually needed in that phase
>> > > > > - U-Boot uses lazy initialisation for its devices, with 'bind' and
>> > > > >   'probe' being separate steps. Even if a device is bound, it is not
>> > > > >   actually probed until it is used. This is necessary to keep the 
>> > > > > boot
>> > > > >   time reasonable, e.g. to under a second
>> > > > >
>> > > > > The phases of U-Boot in order are: TPL, VPL, SPL, U-Boot (first
>> > > > > pre-relocation, then post-relocation). ALl but the last two are 
>> > > > > optional.
>> > > > >
>> > > > > For the above reasons, U-Boot only includes the full device tree in 
>> > > > > the
>> > > > > final 'U-Boot proper' build. Even then, before relocation U-Boot only
>> > > > > processes nodes which are marked as being needed.
>> > > > >
>> > > > > For this to work, U-Boot's driver model[1] provides a way to mark 
>> > > > > device
>> > > > > tree nodes as applicable for a particular phase. This works by 
>> > > > > adding a
>> > > > > tag to the node, e.g.:
>> > > > >
>> > > > >cru: clock-controller@ff76 {
>> > > > >   phase,all;
>> > > > >   compatible = "rockchip,rk3399-cru";
>> > > > >   reg = <0x0 0xff76 0x0 0x1000>;
>> > > > >   rockchip,grf = <&grf>;
>> > > > >   #clock-cells = <1>;
>> > > > >   #reset-cells = <1>;
>> > > > >   ...
>> > > > >};
>> > > > >
>> > > > > Here the "phase,all" tag indicates that the node must be present in 
>> > > > > all
>> > > > > phases, since the clock driver is required.
>> > > > >
>> > > > > There has been discussion over the years about whether this could be 
>> > > > > done
>> > > > > in a property instead, e.g.
>> > > > >
>> > > > >options {
>> > > > >   phase,all = <&cru> <&gpio_a> ...;
>> > > > >   ...
>> > > > >};
>> > > > >
>> > > > > Some problems with this:
>> > > > >
>> > > > > - we need to be able to merge several such tags from different .dtsi 
>> > > > > files
>> > > > >   since many boards have their own specific requirements
>> > > > > - it is hard to find and cross-reference the affected nodes
>> > > > > - it is more error-prone
>> > > > > - it requires significant tool rework in U-Boot, including fdtgrep 
>> > > > > and
>> > > > >   the build system
>> > > > > - is harder (slower, more code) to process since it involves scanning
>> > > > >   another node/property to find out what to do with a particular node
>> > > > > - we don't want to add phandle arguments to the above since we are
>> > > > >   referring, e.g., to the clock device as a whole, not a paricular 
>> > > > > clock
>> > > > > - the of-platdata feature[2], which converts device tree to C for 
>> > > > > even
>> > > > >   more constrained environments, would need to become aware of the
>> > > > >   /options node
>> > > > >
>> > > > > There is also the question about whether this needs to be 
>> > > > > U-Boot-specific,
>> > > > > or whether the tags could be generic. From what I can tell, U-Boot 
>> > > > > is the
>> > > > > only bootloader which seriously attempts to use a runtime device 
>> > > > > tree in
>> > > > > all cases. For this version, an attempt is made to name the phases 
>> > > > > in a
>> > > > > generic manner.
>> > > > >
>> > > > > It should also be noted that the approach provided here has stood 
>> > > > > the test
>> > > > > of time, used in U-Boot for 8 years so far.
>> > > > >
>> > > > > So add the schema for this. This wil

Re: [PATCH 2/2] udoo_neo: Select DM_SERIAL

2022-11-14 Thread Fabio Estevam
On Mon, Nov 14, 2022 at 1:15 PM Peter Robinson  wrote:
>
> The conversion to DM_SERIAL is mandatory, so select this
> option.

After converting it to DM_SERIAL, the setup_iomux_uart() could be removed.

With that removed:

Reviewed-by: Fabio Estevam 


Re: [PATCH v4] schemas: Add schema for U-Boot driver model 'phase tags'

2022-11-14 Thread Simon Glass
+Ilias Apalodimas  too

On Sat, 12 Nov 2022 at 08:21, Simon Glass  wrote:

> Hi Rob,
>
> (unfortunately I have a filter on this list due to the insane traffic
> and am not sure how to let these emails through, so I just saw this)
>
> On Thu, 10 Nov 2022 at 11:30, Rob Herring  wrote:
> >
> > On Thu, Nov 10, 2022 at 10:59 AM Simon Glass  wrote:
> > >
> > > Hi Rob,
> > >
> > > On Tue, 8 Nov 2022 at 10:19, Rob Herring  wrote:
> > > >
> > > > On Tue, Nov 1, 2022 at 10:13 PM Simon Glass 
> wrote:
> > > > >
> > > > > U-Boot has some particular challenges with device tree and devices:
> > > > >
> > > > > - U-Boot has multiple build phases, such as a Secondary Program
> Loader
> > > > >   (SPL) phase which typically runs in a pre-SDRAM environment
> where code
> > > > >   and data space are limited. In particular, there may not be
> enough
> > > > >   space for the full device tree blob. U-Boot uses various
> automated
> > > > >   techniques to reduce the size from perhaps 40KB to 3KB. It is not
> > > > >   always possible to handle these tags entirely at build time,
> since
> > > > >   U-Boot proper must have the full device tree, even though we do
> not
> > > > >   want it to process all nodes until after relocation.
> > > > > - Some U-Boot phases needs to run before the clocks are properly
> set up,
> > > > >   where the CPU may be running very slowly. Therefore it is
> important to
> > > > >   bind only those devices which are actually needed in that phase
> > > > > - U-Boot uses lazy initialisation for its devices, with 'bind' and
> > > > >   'probe' being separate steps. Even if a device is bound, it is
> not
> > > > >   actually probed until it is used. This is necessary to keep the
> boot
> > > > >   time reasonable, e.g. to under a second
> > > > >
> > > > > The phases of U-Boot in order are: TPL, VPL, SPL, U-Boot (first
> > > > > pre-relocation, then post-relocation). ALl but the last two are
> optional.
> > > > >
> > > > > For the above reasons, U-Boot only includes the full device tree
> in the
> > > > > final 'U-Boot proper' build. Even then, before relocation U-Boot
> only
> > > > > processes nodes which are marked as being needed.
> > > > >
> > > > > For this to work, U-Boot's driver model[1] provides a way to mark
> device
> > > > > tree nodes as applicable for a particular phase. This works by
> adding a
> > > > > tag to the node, e.g.:
> > > > >
> > > > >cru: clock-controller@ff76 {
> > > > >   phase,all;
> > > > >   compatible = "rockchip,rk3399-cru";
> > > > >   reg = <0x0 0xff76 0x0 0x1000>;
> > > > >   rockchip,grf = <&grf>;
> > > > >   #clock-cells = <1>;
> > > > >   #reset-cells = <1>;
> > > > >   ...
> > > > >};
> > > > >
> > > > > Here the "phase,all" tag indicates that the node must be present
> in all
> > > > > phases, since the clock driver is required.
> > > > >
> > > > > There has been discussion over the years about whether this could
> be done
> > > > > in a property instead, e.g.
> > > > >
> > > > >options {
> > > > >   phase,all = <&cru> <&gpio_a> ...;
> > > > >   ...
> > > > >};
> > > > >
> > > > > Some problems with this:
> > > > >
> > > > > - we need to be able to merge several such tags from different
> .dtsi files
> > > > >   since many boards have their own specific requirements
> > > > > - it is hard to find and cross-reference the affected nodes
> > > > > - it is more error-prone
> > > > > - it requires significant tool rework in U-Boot, including fdtgrep
> and
> > > > >   the build system
> > > > > - is harder (slower, more code) to process since it involves
> scanning
> > > > >   another node/property to find out what to do with a particular
> node
> > > > > - we don't want to add phandle arguments to the above since we are
> > > > >   referring, e.g., to the clock device as a whole, not a paricular
> clock
> > > > > - the of-platdata feature[2], which converts device tree to C for
> even
> > > > >   more constrained environments, would need to become aware of the
> > > > >   /options node
> > > > >
> > > > > There is also the question about whether this needs to be
> U-Boot-specific,
> > > > > or whether the tags could be generic. From what I can tell, U-Boot
> is the
> > > > > only bootloader which seriously attempts to use a runtime device
> tree in
> > > > > all cases. For this version, an attempt is made to name the phases
> in a
> > > > > generic manner.
> > > > >
> > > > > It should also be noted that the approach provided here has stood
> the test
> > > > > of time, used in U-Boot for 8 years so far.
> > > > >
> > > > > So add the schema for this. This will allow a major class of schema
> > > > > exceptions to be dropped from the U-Boot source tree.
> > > > >
> > > > > This being sent to the mailing list since it might attract more
> review.
> > > > > A PR will be sent when this has had some review. That is why the
> file
> > > > > path is set up for https://github.com/devicetree-org/dt-schema
> rather
>

Re: [PATCH 1/2] udoo_neo: Move to DM for REGUALTOR/PMIC/I2C drivers

2022-11-14 Thread Fabio Estevam
Hi Peter,

On Mon, Nov 14, 2022 at 1:15 PM Peter Robinson  wrote:
>
> This moves over the PMIC power init to DM and the associated i2c and
> regulator bits.

There is a typo in the Subject line: s/REGUALTOR/REGULATOR

> diff --git a/configs/udoo_neo_defconfig b/configs/udoo_neo_defconfig
> index 8ae9fa57f03..6c29f8fd251 100644
> --- a/configs/udoo_neo_defconfig
> +++ b/configs/udoo_neo_defconfig
> @@ -10,8 +10,9 @@ CONFIG_ENV_SIZE=0x2000
>  CONFIG_ENV_OFFSET=0x8
>  CONFIG_MX6SX=y
>  CONFIG_TARGET_UDOO_NEO=y
> -CONFIG_SYS_I2C_MXC_I2C1=y
> +CONFIG_DM_I2C=y
>  CONFIG_DM_GPIO=y
> +CONFIG_DM_MMC=y

CONFIG_DM_MMC is selected by default. No need to have it in the defconfig.

Reviewed-by: Fabio Estevam 


[PATCH 2/2] udoo_neo: Select DM_SERIAL

2022-11-14 Thread Peter Robinson
The conversion to DM_SERIAL is mandatory, so select this
option.

Signed-off-by: Peter Robinson 
---
 configs/udoo_neo_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/udoo_neo_defconfig b/configs/udoo_neo_defconfig
index 6c29f8fd251..0c60e4a6f4a 100644
--- a/configs/udoo_neo_defconfig
+++ b/configs/udoo_neo_defconfig
@@ -60,6 +60,7 @@ CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_ANATOP=y
 CONFIG_DM_REGULATOR_PFUZE100=y
+CONFIG_DM_SERIAL=y
 CONFIG_MXC_UART=y
 CONFIG_IMX_THERMAL=y
 CONFIG_USB=y
-- 
2.38.1



[PATCH 1/2] udoo_neo: Move to DM for REGUALTOR/PMIC/I2C drivers

2022-11-14 Thread Peter Robinson
This moves over the PMIC power init to DM and the associated i2c and
regulator bits.

Signed-off-by: Peter Robinson 
---

Rebase this and I think I've fixed the previous build error reported by
Stefano.

 board/udoo/neo/neo.c   | 139 +++--
 configs/udoo_neo_defconfig |  10 +--
 include/configs/udoo_neo.h |   5 --
 3 files changed, 15 insertions(+), 139 deletions(-)

diff --git a/board/udoo/neo/neo.c b/board/udoo/neo/neo.c
index 5e40583ab43..9e2a66996c4 100644
--- a/board/udoo/neo/neo.c
+++ b/board/udoo/neo/neo.c
@@ -51,11 +51,6 @@ enum {
PAD_CTL_PUS_22K_UP  | PAD_CTL_SPEED_LOW |   \
PAD_CTL_DSE_80ohm   | PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
 
-#define I2C_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE |  \
-   PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED |   \
-   PAD_CTL_DSE_40ohm | PAD_CTL_HYS |   \
-   PAD_CTL_ODE)
-
 #define ENET_PAD_CTRL  (PAD_CTL_PUS_100K_UP | PAD_CTL_PUE | \
PAD_CTL_SPEED_MED   |   \
PAD_CTL_DSE_40ohm   | PAD_CTL_SRE_FAST)
@@ -83,135 +78,25 @@ int dram_init(void)
return 0;
 }
 
-#ifdef CONFIG_SYS_I2C_MXC
-#define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
-/* I2C1 for PMIC */
-static struct i2c_pads_info i2c_pad_info1 = {
-   .scl = {
-   .i2c_mode = MX6_PAD_GPIO1_IO00__I2C1_SCL | PC,
-   .gpio_mode = MX6_PAD_GPIO1_IO00__GPIO1_IO_0 | PC,
-   .gp = IMX_GPIO_NR(1, 0),
-   },
-   .sda = {
-   .i2c_mode = MX6_PAD_GPIO1_IO01__I2C1_SDA | PC,
-   .gpio_mode = MX6_PAD_GPIO1_IO01__GPIO1_IO_1 | PC,
-   .gp = IMX_GPIO_NR(1, 1),
-   },
-};
-#endif
-
-#if CONFIG_IS_ENABLED(POWER_LEGACY)
 int power_init_board(void)
 {
-   struct pmic *p;
-   int ret;
-   unsigned int reg, rev_id;
-
-   ret = power_pfuze3000_init(PFUZE3000_I2C_BUS);
-   if (ret)
-   return ret;
-
-   p = pmic_get("PFUZE3000");
-   ret = pmic_probe(p);
-   if (ret)
-   return ret;
+   struct udevice *dev;
+   int ret, dev_id, rev_id;
 
-   pmic_reg_read(p, PFUZE3000_DEVICEID, ®);
-   pmic_reg_read(p, PFUZE3000_REVID, &rev_id);
-   printf("PMIC:  PFUZE3000 DEV_ID=0x%x REV_ID=0x%x\n", reg, rev_id);
-
-   /* disable Low Power Mode during standby mode */
-   pmic_reg_read(p, PFUZE3000_LDOGCTL, ®);
-   reg |= 0x1;
-   ret = pmic_reg_write(p, PFUZE3000_LDOGCTL, reg);
-   if (ret)
+   ret = pmic_get("pfuze3000@8", &dev);
+   if (ret == -ENODEV)
+   return 0;
+   if (ret != 0)
return ret;
 
-   ret = pmic_reg_write(p, PFUZE3000_SW1AMODE, 0xc);
-   if (ret)
-   return ret;
+   dev_id = pmic_reg_read(dev, PFUZE3000_DEVICEID);
+   rev_id = pmic_reg_read(dev, PFUZE3000_REVID);
+   printf("PMIC: PFUZE3000 DEV_ID=0x%x REV_ID=0x%x\n", dev_id, rev_id);
 
-   ret = pmic_reg_write(p, PFUZE3000_SW1BMODE, 0xc);
-   if (ret)
-   return ret;
-
-   ret = pmic_reg_write(p, PFUZE3000_SW2MODE, 0xc);
-   if (ret)
-   return ret;
-
-   ret = pmic_reg_write(p, PFUZE3000_SW3MODE, 0xc);
-   if (ret)
-   return ret;
-
-   /* set SW1A standby voltage 0.975V */
-   pmic_reg_read(p, PFUZE3000_SW1ASTBY, ®);
-   reg &= ~0x3f;
-   reg |= PFUZE3000_SW1AB_SETP(9750);
-   ret = pmic_reg_write(p, PFUZE3000_SW1ASTBY, reg);
-   if (ret)
-   return ret;
-
-   /* set SW1B standby voltage 0.975V */
-   pmic_reg_read(p, PFUZE3000_SW1BSTBY, ®);
-   reg &= ~0x3f;
-   reg |= PFUZE3000_SW1AB_SETP(9750);
-   ret = pmic_reg_write(p, PFUZE3000_SW1BSTBY, reg);
-   if (ret)
-   return ret;
-
-   /* set SW1A/VDD_ARM_IN step ramp up time from 16us to 4us/25mV */
-   pmic_reg_read(p, PFUZE3000_SW1ACONF, ®);
-   reg &= ~0xc0;
-   reg |= 0x40;
-   ret = pmic_reg_write(p, PFUZE3000_SW1ACONF, reg);
-   if (ret)
-   return ret;
-
-   /* set SW1B/VDD_SOC_IN step ramp up time from 16us to 4us/25mV */
-   pmic_reg_read(p, PFUZE3000_SW1BCONF, ®);
-   reg &= ~0xc0;
-   reg |= 0x40;
-   ret = pmic_reg_write(p, PFUZE3000_SW1BCONF, reg);
-   if (ret)
-   return ret;
-
-   /* set VDD_ARM_IN to 1.350V */
-   pmic_reg_read(p, PFUZE3000_SW1AVOLT, ®);
-   reg &= ~0x3f;
-   reg |= PFUZE3000_SW1AB_SETP(13500);
-   ret = pmic_reg_write(p, PFUZE3000_SW1AVOLT, reg);
-   if (ret)
-   return ret;
-
-   /* set VDD_SOC_IN to 1.350V */
-   pmic_reg_read(p, PFUZE3000_SW1BVOLT, ®);
-   reg &= ~0x3f;
-   reg |= PFUZE3000_SW1AB_SETP(13500);
-   ret = pmic_reg_write(p, PFUZE3000_SW1BVOLT, reg);
-   if (ret)
-   return ret;
-
-   /* set DDR_1_5V to 1.350V */
-   pmic_reg_read(p, PFUZE3000_SW3VOLT, ®);
-   reg &= ~0x0f;
-   reg |= PFUZE3000_SW3_SETP(1

[PATCH] ARM: dts: at91: sama7g5: fix signal name of pin PD8

2022-11-14 Thread Mihai Sain
The signal name of pin PD8 with function D is A22_NANDCLE
as it is defined in the datasheet.

Fixes: 558378a4cd ("ARM: mach-at91: add support for new SoC sama7g5")
Signed-off-by: Mihai Sain 
---
 arch/arm/dts/sama7g5-pinfunc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/dts/sama7g5-pinfunc.h b/arch/arm/dts/sama7g5-pinfunc.h
index b77185f8ed..a17707ba60 100644
--- a/arch/arm/dts/sama7g5-pinfunc.h
+++ b/arch/arm/dts/sama7g5-pinfunc.h
@@ -673,7 +673,7 @@
 #define PIN_PD8__GPIO  PINMUX_PIN(PIN_PD8, 0, 0)
 #define PIN_PD8__SDMMC2_DAT3   PINMUX_PIN(PIN_PD8, 1, 1)
 #define PIN_PD8__I2SMCC0_DIN0  PINMUX_PIN(PIN_PD8, 3, 1)
-#define PIN_PD8__A11_NANDCLE   PINMUX_PIN(PIN_PD8, 4, 2)
+#define PIN_PD8__A22_NANDCLE   PINMUX_PIN(PIN_PD8, 4, 2)
 #define PIN_PD8__TIOA2 PINMUX_PIN(PIN_PD8, 5, 2)
 #define PIN_PD8__FLEXCOM11_IO0 PINMUX_PIN(PIN_PD8, 6, 5)
 #define PIN_PD9105
-- 
2.38.1



RE: [TF-A] Re: [RFC] Proposed location to host the firmware handoff specification.

2022-11-14 Thread Jose Marinho
Hi,

We're glad to announce that the Firmware Handoff document sources are now 
available publicly from: https://github.com/FirmwareHandoff/firmware_handoff

Note that this does not constitute a full "1.0" release of the document.
There are still some topics raised in the ML that need to be aligned on before 
the full release -- I'll follow up on those with a separate e-mail.

Having the document hosted in a public repo allows for all discussions about 
the document to progress in the open more easily.

Regards,
Jose

-Original Message-
From: Simon Glass  
Sent: Sunday, September 18, 2022 4:05 AM
To: Dan Handley 
Cc: t...@lists.trustedfirmware.org; u-boot@lists.denx.de; 
boot-architect...@lists.linaro.org; nd 
Subject: Re: [TF-A] Re: [RFC] Proposed location to host the firmware handoff 
specification.

Hi,

I discussed this with Jose a white back. I am OK with this as an interim 
measure to get the initial doc agreed, so long as we move it to a more 
independent place when available.

Regards,
Simon



On Tue, 13 Sept 2022 at 09:48, Dan Handley  wrote:
>
> Hi all
>
> Just picking up this old thread again...
>
> There seemed to be general agreement to host the firmware hand-off spec in a 
> separate repo with separate maintainers at TrustedFirmware.org, at least 
> initially. Arm intends to progress with the initial population of this repo. 
> We intend to use the CC-BY-SA-4.0 
> (https://spdx.org/licenses/CC-BY-SA-4.0.html) license, the same as used for 
> EBBR (https://github.com/ARM-software/ebbr). Please say if you have any 
> objections to this. We will also seek approval from the TrustedFirmware.org 
> board.
>
> Regards
>
> Dan.
>
> ___
> boot-architecture mailing list -- boot-architect...@lists.linaro.org
> To unsubscribe send an email to 
> boot-architecture-le...@lists.linaro.org
___
boot-architecture mailing list -- boot-architect...@lists.linaro.org
To unsubscribe send an email to boot-architecture-le...@lists.linaro.org


Peculiar problem executing boot.scr

2022-11-14 Thread Tasos Terzidis
Hello,

I have a very peculiar problem.

I have a very simple boot.scr script so that u-boot can load it and run it.

My set up is a Raspberry 3 B (32 bit)

Sript is

Fatload mmc 0:1 ${kernel_addr_r} kernel7.img

Bootz ${kernel_addr_r} - ${fdt_addr}



When u-boot stops autocounting, finds the script loads it and the error
message is

-à‘ailed to find kernel7.img ß--



Instead of F for word Failed, prints ‘ailed.



If I stop auto counting and enter the commands of script by hand it runs
and loads kernel as expected



As a matter of fact whatever command I add to the script gives an error

Example : if I add printenv the error is “can not find command”



I can not understand what the problem is.



Has anyone encountered such a problem ??



Thank you



Tasos


Re: [PATCH 0/6] broken CVE fix (b85d130ea0ca)

2022-11-14 Thread Tom Rini
On Mon, Nov 14, 2022 at 10:35:51AM +0100, Rasmus Villemoes wrote:
> On 14/10/2022 19.43, Rasmus Villemoes wrote:
> > tl;dr: b85d130ea0ca didn't fix the CVE(s), but did break tftp of
> > certain file sizes - which is somewhat lucky, since that's how I
> > noticed in the first place.
> > 
> 
> At this point it seems unlikely that any more comments or reviews will
> come, so perhaps its time to get these (all 7) merged to master, so that
> they will get some wider testing before the January release?

Yes, I'd like to see a net PR with this and perhaps a few other mature
things?

-- 
Tom


signature.asc
Description: PGP signature


[PATCH] watchdog: designware: make reset really optional

2022-11-14 Thread Quentin Schulz
From: Quentin Schulz 

Checking for DM_RESET is not enough since not all watchdog
implementations use a reset lane. Such is the case for Rockchip
implementation for example. Since reset_assert_bulk will only succeed if
the resets property exists in the watchdog DT node, it needs to be
called only if a reset property is present.

This adds a condition on the resets property presence in the watchdog DT
node before assuming a reset lane needs to be fetched with
reset_assert_bulk, by calling ofnode_read_prop.

Cc: Quentin Schulz 
Signed-off-by: Quentin Schulz 
---
To: Stefan Roese 
Cc: u-boot@lists.denx.de
---
 drivers/watchdog/designware_wdt.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/designware_wdt.c 
b/drivers/watchdog/designware_wdt.c
index cad756aeaf..6155939f49 100644
--- a/drivers/watchdog/designware_wdt.c
+++ b/drivers/watchdog/designware_wdt.c
@@ -72,13 +72,13 @@ static int designware_wdt_reset(struct udevice *dev)
 static int designware_wdt_stop(struct udevice *dev)
 {
struct designware_wdt_priv *priv = dev_get_priv(dev);
+   __maybe_unused int ret;
 
designware_wdt_reset(dev);
writel(0, priv->base + DW_WDT_CR);
 
-if (CONFIG_IS_ENABLED(DM_RESET)) {
-   int ret;
-
+if (CONFIG_IS_ENABLED(DM_RESET) &&
+   ofnode_read_prop(dev_ofnode(dev), "resets", &ret)) {
ret = reset_assert_bulk(&priv->resets);
if (ret)
return ret;
@@ -135,7 +135,8 @@ static int designware_wdt_probe(struct udevice *dev)
priv->clk_khz = CONFIG_DW_WDT_CLOCK_KHZ;
 #endif
 
-   if (CONFIG_IS_ENABLED(DM_RESET)) {
+   if (CONFIG_IS_ENABLED(DM_RESET) &&
+   ofnode_read_prop(dev_ofnode(dev), "resets", &ret)) {
ret = reset_get_bulk(dev, &priv->resets);
if (ret)
goto err;

---
base-commit: 0cbeed4f6648e0e4966475e3544280a69ecb59d3
change-id: 20221114-dw-wdt-no-reset-2296a2bf37b3

Best regards,
-- 
Quentin Schulz 


[PATCH v2 9/9] MAINTAINERS: Adopt SanCloud boards

2022-11-14 Thread Paul Barker
Signed-off-by: Paul Barker 
Cc: Marc Murphy 
---
 MAINTAINERS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 8d3d528650a7..3ab1dca33a4a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -485,6 +485,12 @@ F: arch/arm/mach-exynos/
 F: arch/arm/mach-s5pc1xx/
 F: arch/arm/cpu/armv7/s5p-common/
 
+ARM SANCLOUD
+M: Paul Barker 
+R: Marc Murphy 
+S: Supported
+F: arch/arm/dts/am335x-sancloud*
+
 ARM SNAPDRAGON
 M: Ramon Fried 
 S: Maintained
-- 
2.25.1



[PATCH v2 5/9] am335x-evm: Fix spiboot configuration

2022-11-14 Thread Paul Barker
The advanced address translation provided by CONFIG_SPL_OF_TRANSLATE is
needed to determine the base address of the uart0 peripheral on am335x
platforms when CONFIG_SPL_OF_CONTROL is enabled.

If CONFIG_SPL_OF_CONTROL is enabled in the base (non-spiboot)
am335x_evm_defconfig, then CONFIG_SPL_OF_TRANSLATE will also need to be
enabled there. Unfortunately this cannot be done pre-emptively due to
the kconfig dependencies.

The TI clk-ctrl & TI sysc drivers are also required to bring up the SPI
bus on am335x platforms.

Signed-off-by: Paul Barker 
---
 configs/am335x_evm_spiboot_defconfig | 4 
 1 file changed, 4 insertions(+)

diff --git a/configs/am335x_evm_spiboot_defconfig 
b/configs/am335x_evm_spiboot_defconfig
index 3d04e6fa934a..2bc911cfd022 100644
--- a/configs/am335x_evm_spiboot_defconfig
+++ b/configs/am335x_evm_spiboot_defconfig
@@ -53,10 +53,14 @@ CONFIG_SPL_ENV_IS_NOWHERE=y
 CONFIG_VERSION_VARIABLE=y
 CONFIG_NET_RETRY_COUNT=10
 CONFIG_BOOTP_SEND_HOSTNAME=y
+CONFIG_SPL_OF_TRANSLATE=y
+CONFIG_SPL_TI_SYSC=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_SYS_BOOTCOUNT_BE=y
 CONFIG_CLK=y
+CONFIG_SPL_CLK=y
 CONFIG_CLK_CDCE9XX=y
+CONFIG_CLK_TI_CTRL=y
 CONFIG_DFU_TFTP=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_NAND=y
-- 
2.25.1



[PATCH v2 8/9] am335x-sancloud-bbe: Add -u-boot.dtsi files

2022-11-14 Thread Paul Barker
The SanCloud BBE requires the same dtb nodes to be present in the SPL as
the AM335x EVM.

The SanCloud BBE Lite also requires the SPI flash node and all
dependencies to be present in the SPL to support SPI boot.

Signed-off-by: Paul Barker 
---
 .../dts/am335x-sancloud-bbe-lite-u-boot.dtsi  | 44 +++
 arch/arm/dts/am335x-sancloud-bbe-u-boot.dtsi  |  6 +++
 2 files changed, 50 insertions(+)
 create mode 100644 arch/arm/dts/am335x-sancloud-bbe-lite-u-boot.dtsi
 create mode 100644 arch/arm/dts/am335x-sancloud-bbe-u-boot.dtsi

diff --git a/arch/arm/dts/am335x-sancloud-bbe-lite-u-boot.dtsi 
b/arch/arm/dts/am335x-sancloud-bbe-lite-u-boot.dtsi
new file mode 100644
index ..01c105ebb383
--- /dev/null
+++ b/arch/arm/dts/am335x-sancloud-bbe-lite-u-boot.dtsi
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2021 SanCloud Ltd
+ */
+
+#include "am335x-sancloud-bbe-u-boot.dtsi"
+
+&l4_wkup {
+   segment@20 {
+   target-module@0 {
+   u-boot,dm-pre-reloc;
+   };
+   };
+};
+
+&prcm {
+   u-boot,dm-pre-reloc;
+};
+
+&per_cm {
+   u-boot,dm-pre-reloc;
+};
+
+&l4ls_clkctrl {
+   u-boot,dm-pre-reloc;
+};
+
+&l4_per {
+   u-boot,dm-pre-reloc;
+   segment@0 {
+   u-boot,dm-pre-reloc;
+   target-module@3 {
+   u-boot,dm-pre-reloc;
+   };
+   };
+};
+
+&spi0 {
+   u-boot,dm-pre-reloc;
+   channel@0 {
+   u-boot,dm-pre-reloc;
+   };
+};
diff --git a/arch/arm/dts/am335x-sancloud-bbe-u-boot.dtsi 
b/arch/arm/dts/am335x-sancloud-bbe-u-boot.dtsi
new file mode 100644
index ..06e7554a63c8
--- /dev/null
+++ b/arch/arm/dts/am335x-sancloud-bbe-u-boot.dtsi
@@ -0,0 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2022 SanCloud Ltd
+ */
+
+#include "am335x-evm-u-boot.dtsi"
-- 
2.25.1



[PATCH v2 7/9] am335x-sancloud-bbe-lite: SPI flash is JEDEC compatible

2022-11-14 Thread Paul Barker
Signed-off-by: Paul Barker 
---
 arch/arm/dts/am335x-sancloud-bbe-lite.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/dts/am335x-sancloud-bbe-lite.dts 
b/arch/arm/dts/am335x-sancloud-bbe-lite.dts
index d6ef19311a91..8ffbc72dc57e 100644
--- a/arch/arm/dts/am335x-sancloud-bbe-lite.dts
+++ b/arch/arm/dts/am335x-sancloud-bbe-lite.dts
@@ -41,7 +41,7 @@
#address-cells = <1>;
#size-cells = <0>;
 
-   compatible = "micron,spi-authenta";
+   compatible = "micron,spi-authenta", "jedec,spi-nor";
 
reg = <0>;
spi-max-frequency = <1600>;
-- 
2.25.1



[PATCH v2 6/9] am335x-evm: Support STMicro/Micron SPI flash

2022-11-14 Thread Paul Barker
This change enables access to the SPI flash on the SanCloud BBE Lite
board.

Signed-off-by: Paul Barker 
---
 configs/am335x_evm_defconfig | 1 +
 configs/am335x_evm_spiboot_defconfig | 1 +
 2 files changed, 2 insertions(+)

diff --git a/configs/am335x_evm_defconfig b/configs/am335x_evm_defconfig
index f0fbe475b394..f73123e0b71d 100644
--- a/configs/am335x_evm_defconfig
+++ b/configs/am335x_evm_defconfig
@@ -92,6 +92,7 @@ CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
 CONFIG_SYS_NAND_U_BOOT_OFFS=0xc
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=2400
+CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_PHY_ATHEROS=y
 CONFIG_PHY_SMSC=y
diff --git a/configs/am335x_evm_spiboot_defconfig 
b/configs/am335x_evm_spiboot_defconfig
index 2bc911cfd022..7f422010c1c7 100644
--- a/configs/am335x_evm_spiboot_defconfig
+++ b/configs/am335x_evm_spiboot_defconfig
@@ -84,6 +84,7 @@ CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
 CONFIG_SYS_NAND_U_BOOT_OFFS=0xc
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=2400
+CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_PHY_ATHEROS=y
 CONFIG_PHY_SMSC=y
-- 
2.25.1



[PATCH v2 4/9] am335x-evm: Enable required dtb nodes in SPL

2022-11-14 Thread Paul Barker
For successful boot when CONFIG_SPL_OF_CONTROL=y, we need to ensure that
the board EEPROM on i2c0, the uart0 serial port and the relevant boot
device (mmc1 or mmc2) can be accessed in the SPL. We also need to
preserve the parent nodes for each required dtb node.

Signed-off-by: Paul Barker 
---
 arch/arm/dts/am335x-evm-u-boot.dtsi | 30 +++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/arch/arm/dts/am335x-evm-u-boot.dtsi 
b/arch/arm/dts/am335x-evm-u-boot.dtsi
index 4cf5f9928d58..8fc65df2ef9b 100644
--- a/arch/arm/dts/am335x-evm-u-boot.dtsi
+++ b/arch/arm/dts/am335x-evm-u-boot.dtsi
@@ -6,9 +6,9 @@
 #include "am33xx-u-boot.dtsi"
 
 &l4_per {
-
+   u-boot,dm-pre-reloc;
segment@30 {
-
+   u-boot,dm-pre-reloc;
target-module@e000 {
u-boot,dm-pre-reloc;
 
@@ -26,3 +26,29 @@
 &usb0 {
dr_mode = "peripheral";
 };
+
+&i2c0 {
+   u-boot,dm-pre-reloc;
+};
+
+&l4_wkup {
+   u-boot,dm-pre-reloc;
+   segment@20 {
+   u-boot,dm-pre-reloc;
+   target-module@9000 {
+   u-boot,dm-pre-reloc;
+   };
+   };
+};
+
+&uart0 {
+   u-boot,dm-pre-reloc;
+};
+
+&mmc1 {
+   u-boot,dm-pre-reloc;
+};
+
+&mmc2 {
+   u-boot,dm-pre-reloc;
+};
-- 
2.25.1



[PATCH v2 3/9] bus: Optionally include TI sysc driver in SPL/TPL

2022-11-14 Thread Paul Barker
The TI sysc bus driver is required to allow access to the SPI bus on
am335x platforms. To support SPI boot this driver needs to be enabled in
the SPL/TPL as appropriate.

Signed-off-by: Paul Barker 
---
 drivers/Makefile | 2 +-
 drivers/bus/Kconfig  | 7 +++
 drivers/bus/Makefile | 5 -
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/Makefile b/drivers/Makefile
index ac2d83af4e3f..6f1de58e0030 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -37,6 +37,7 @@ obj-$(CONFIG_$(SPL_)SYSINFO) += sysinfo/
 obj-$(CONFIG_$(SPL_TPL_)TPM) += tpm/
 obj-$(CONFIG_XEN) += xen/
 obj-$(CONFIG_$(SPL_)FPGA) += fpga/
+obj-y += bus/
 
 ifndef CONFIG_TPL_BUILD
 ifndef CONFIG_VPL_BUILD
@@ -77,7 +78,6 @@ ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),)
 
 obj-y += adc/
 obj-y += ata/
-obj-y += bus/
 obj-$(CONFIG_DM_DEMO) += demo/
 obj-$(CONFIG_BIOSEMU) += bios_emulator/
 obj-y += block/
diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig
index c607d24ecf60..e60aa722b97f 100644
--- a/drivers/bus/Kconfig
+++ b/drivers/bus/Kconfig
@@ -18,6 +18,13 @@ config TI_SYSC
  Generic driver for Texas Instruments interconnect target module
  found on many TI SoCs.
 
+config SPL_TI_SYSC
+   bool "Support TI sysc interconnect in SPL"
+   depends on SPL_DM && TI_SYSC
+   help
+ Generic driver for Texas Instruments interconnect target module
+ found on many TI SoCs.
+
 config UNIPHIER_SYSTEM_BUS
bool "UniPhier System Bus driver"
depends on ARCH_UNIPHIER
diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile
index a2e71c7b3b52..0802b9666bfc 100644
--- a/drivers/bus/Makefile
+++ b/drivers/bus/Makefile
@@ -3,6 +3,9 @@
 # Makefile for the bus drivers.
 #
 
+ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),)
 obj-$(CONFIG_TI_PWMSS) += ti-pwmss.o
-obj-$(CONFIG_TI_SYSC)  += ti-sysc.o
 obj-$(CONFIG_UNIPHIER_SYSTEM_BUS) += uniphier-system-bus.o
+endif
+
+obj-$(CONFIG_$(SPL_)TI_SYSC)   += ti-sysc.o
-- 
2.25.1



[PATCH v2 2/9] bus: TI sysc driver requires DM

2022-11-14 Thread Paul Barker
This driver does not build if CONFIG_DM is disabled as it uses the
function `dev_get_priv`.

Signed-off-by: Paul Barker 
---
 drivers/bus/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig
index d742ed333b16..c607d24ecf60 100644
--- a/drivers/bus/Kconfig
+++ b/drivers/bus/Kconfig
@@ -13,7 +13,7 @@ config TI_PWMSS
 
 config TI_SYSC
bool "TI sysc interconnect target module driver"
-   depends on ARCH_OMAP2PLUS
+   depends on DM && ARCH_OMAP2PLUS
help
  Generic driver for Texas Instruments interconnect target module
  found on many TI SoCs.
-- 
2.25.1



[PATCH v2 1/9] dm: core: Fix iteration over driver_info records

2022-11-14 Thread Paul Barker
We should only perform additional iteration steps when needed to
initialize the parent of a device. Other binding errors (such as a
missing driver) should not lead to additional iteration steps.

Unnecessary iteration steps can cause issues when memory is tightly
constrained (such as in the TPL/SPL) since device_bind_by_name()
unconditionally allocates memory for a struct udevice. On the SanCloud
BBE this led to boot failure caused by memory exhaustion in the SPL
when booting from SPI flash.

Signed-off-by: Paul Barker 
---
 drivers/core/lists.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/core/lists.c b/drivers/core/lists.c
index 3878957c9ef4..8034a8f48d99 100644
--- a/drivers/core/lists.c
+++ b/drivers/core/lists.c
@@ -120,10 +120,10 @@ int lists_bind_drivers(struct udevice *parent, bool 
pre_reloc_only)
int ret;
 
ret = bind_drivers_pass(parent, pre_reloc_only);
-   if (!ret)
-   break;
-   if (ret != -EAGAIN && !result)
+   if (!result || result == -EAGAIN)
result = ret;
+   if (ret != -EAGAIN)
+   break;
}
 
return result;
-- 
2.25.1



[PATCH v2 0/9] Fixes for SPI boot on SanCloud BBE Lite

2022-11-14 Thread Paul Barker
These changes fix SPI boot on the SanCloud BBE Lite and other AM335x
boards.

They also put us in a good place to enable SPL_OF_CONTROL for eMMC/SD
card boot on AM335x boards. Note that if SPL_OF_CONTROL is enabled, some
SPL features need to be dropped due to the limited amount of sram
available. In my testing I dropped NAND, NET & USB support.

This series has been build tested for all targets using buildman and no
errors were observed. It has been boot tested on the SanCloud BBE Lite
with the following configurations:

1) SD card boot using am335x_evm_defconfig with no config changes.

2) SD card boot using am335x_evm_defconfig with the following config
   changes:

CONFIG_SPL_OF_CONTROL=y
CONFIG_SPL_OF_TRANSLATE=y
CONFIG_SPL_MUSB_NEW=n
CONFIG_SPL_NAND_DRIVERS=n
CONFIG_SPL_NAND_ECC=n
CONFIG_SPL_NAND_BASE=n
CONFIG_SPL_NET=n
CONFIG_SPL_USB_GADGET=n

3) SPI boot using am335x_evm_spiboot_defconfig with the following
   config changes:

CONFIG_DEFAULT_DEVICE_TREE="am335x-sancloud-bbe-lite"
CONFIG_OF_LIST="am335x-sancloud-bbe-lite"

As discussed in my previous message [1], I can't see how to construct a
test case to accompany the first patch which fixes an SPL crash during
the pre-relocation lists_bind_drivers() call due to exhaustion of the
available memory. We can discuss this further though if anyone has any
ideas on how to write an appropriate test case.

[1]: 
https://lore.kernel.org/u-boot/d8182df9-1a09-81b9-dfbe-ebca4bad4...@sancloud.com/

Paul Barker (9):
  dm: core: Fix iteration over driver_info records
  bus: TI sysc driver requires DM
  bus: Optionally include TI sysc driver in SPL/TPL
  am335x-evm: Enable required dtb nodes in SPL
  am335x-evm: Fix spiboot configuration
  am335x-evm: Support STMicro/Micron SPI flash
  am335x-sancloud-bbe-lite: SPI flash is JEDEC compatible
  am335x-sancloud-bbe: Add -u-boot.dtsi files
  MAINTAINERS: Adopt SanCloud boards

 MAINTAINERS   |  6 +++
 arch/arm/dts/am335x-evm-u-boot.dtsi   | 30 -
 .../dts/am335x-sancloud-bbe-lite-u-boot.dtsi  | 44 +++
 arch/arm/dts/am335x-sancloud-bbe-lite.dts |  2 +-
 arch/arm/dts/am335x-sancloud-bbe-u-boot.dtsi  |  6 +++
 configs/am335x_evm_defconfig  |  1 +
 configs/am335x_evm_spiboot_defconfig  |  5 +++
 drivers/Makefile  |  2 +-
 drivers/bus/Kconfig   |  9 +++-
 drivers/bus/Makefile  |  5 ++-
 drivers/core/lists.c  |  6 +--
 11 files changed, 107 insertions(+), 9 deletions(-)
 create mode 100644 arch/arm/dts/am335x-sancloud-bbe-lite-u-boot.dtsi
 create mode 100644 arch/arm/dts/am335x-sancloud-bbe-u-boot.dtsi


base-commit: 0cbeed4f6648e0e4966475e3544280a69ecb59d3
-- 
2.25.1



[PATCH] imx: imx6ul: kontron-sl-mx6ul: Disable CONFIG_FSL_QSPI_AHB_FULL_MAP to fix SPI NAND read access

2022-11-14 Thread Frieder Schrempf
From: Frieder Schrempf 

The introduction of CONFIG_FSL_QSPI_AHB_FULL_MAP as default in:

def88bce094e ("spi: fsl_qspi: Support to use full AHB space on i.MX")

broke the SPI NAND read access on the Kontron SL i.MX6UL/ULL boards.
Reading data from the flash returns garbage instead of the actual
content. Fix this for now by disabling the introduced option.

In the long run this should be fixed globally.

Fixes: def88bce094e ("spi: fsl_qspi: Support to use full AHB space on i.MX")
Signed-off-by: Frieder Schrempf 
---
 configs/kontron-sl-mx6ul_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/kontron-sl-mx6ul_defconfig 
b/configs/kontron-sl-mx6ul_defconfig
index aa789fc6e5e..db4b684690f 100644
--- a/configs/kontron-sl-mx6ul_defconfig
+++ b/configs/kontron-sl-mx6ul_defconfig
@@ -95,6 +95,7 @@ CONFIG_MXC_UART=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_FSL_QSPI=y
+# CONFIG_FSL_QSPI_AHB_FULL_MAP is not set
 CONFIG_MXC_SPI=y
 CONFIG_IMX_THERMAL=y
 CONFIG_USB=y
-- 
2.38.1



Re: [PATCH] eficonfig: fix missing variable initialization

2022-11-14 Thread Ilias Apalodimas
On Mon, 14 Nov 2022 at 11:59, Masahisa Kojima
 wrote:
>
> The 'ret' variable must be initialized before use
> in eficonfig_delete_invalid_boot_option().
>
> Fixes: c416f1c0bc ("bootmenu: add removable media entries")
> Addresses-Coverity: 376207 ("Uninitialized variables")
> Signed-off-by: Masahisa Kojima 
> ---
>  cmd/eficonfig.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c
> index 2595dd9563..0a768d8013 100644
> --- a/cmd/eficonfig.c
> +++ b/cmd/eficonfig.c
> @@ -2280,10 +2280,10 @@ efi_status_t 
> eficonfig_delete_invalid_boot_option(struct eficonfig_media_boot_op
>  {
> u32 i, j;
> efi_uintn_t size;
> -   efi_status_t ret;
> void *load_option;
> struct efi_load_option lo;
> u16 varname[] = u"Boot";
> +   efi_status_t ret = EFI_SUCCESS;
>
> for (i = 0; i <= 0x; i++) {
> efi_uintn_t tmp;
> --
> 2.17.1
>

Reviewed-by: Ilias Apalodimas 


[PATCH] rockchip: clk: add watchdog clock to px30_clk_enable

2022-11-14 Thread Quentin Schulz
From: Quentin Schulz 

Add the PCLK_WDT_NS clock to px30_clk_enable so that the watchdog driver
can probe since it wants to enable this clock.

Cc: Quentin Schulz 
Signed-off-by: Quentin Schulz 
---
rockchip: clk: add watchdog clock to px30_clk_enable

This is required for px30 to be able to probe the Designware watchdog device.

To: Lukasz Majewski 
To: Sean Anderson 
To: Simon Glass 
To: Philipp Tomsich 
To: Kever Yang 
Cc: u-boot@lists.denx.de
---
 drivers/clk/rockchip/clk_px30.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/clk/rockchip/clk_px30.c b/drivers/clk/rockchip/clk_px30.c
index 5d467447a1..38cb90e512 100644
--- a/drivers/clk/rockchip/clk_px30.c
+++ b/drivers/clk/rockchip/clk_px30.c
@@ -1415,6 +1415,9 @@ static int px30_clk_enable(struct clk *clk)
case SCLK_GMAC_RMII:
/* Required to successfully probe the Designware GMAC driver */
return 0;
+   case PCLK_WDT_NS:
+   /* Required to successfully probe the Designware watchdog 
driver */
+   return 0;
}
 
debug("%s: unsupported clk %ld\n", __func__, clk->id);

---
base-commit: 0cbeed4f6648e0e4966475e3544280a69ecb59d3
change-id: 20221114-px30-wdt-clk-58c875b33d37

Best regards,
-- 
Quentin Schulz 


Pull request: u-boot-imx u-boot-imx-20221114

2022-11-14 Thread Stefano Babic

Hi Tom,

please pull from u-boot-imx, thanks !

The following changes since commit 88bd8ee106591eb900561715c44ad04441afc0e3:

  Prepare v2023.01-rc1 (2022-11-07 15:27:03 -0500)

are available in the Git repository at:

  https://gitlab.denx.de/u-boot/custodians/u-boot-imx.git 
tags/u-boot-imx-20221114


for you to fetch changes up to fc1c1760de38823edbdc2cdd9606dff938a07f6e:

  Revert "serial: mxc: have putc use the TXFIFO" (2022-11-12 14:16:26 
+0100)



For 2022.01
---

CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/14083

- Fix UART
- moved to binman (MX8 boards)
- Toradex: sync DTS with Linux
- Gateworks: fixes
- New boards : MSC SM2S iMX8MP


Adam Ford (7):
  regulator: bd718x7: Only bind children when PMIC_CHILDREN is enabled
  imx: imx8mn-beacon: Fix out of spec voltage
  imx: imx8mm_beacon: Eliminate a few extras to free up SPL space
  imx: imx8mm-beacon: Enable USB booting via SDP
  imx: imx8mm-beacon: Move Environment to eMMC partition 2
  configs: imx8mn_beacon: Re-align memory to standard imx8mn settings
  configs: imx8mn_beacon: Enable SPL_DM_PMIC_BD71837

Baruch Siach (1):
  mx6cuboxi: migrate to DM_SERIAL

Fabio Estevam (4):
  wandboard: Pass mmc aliases
  wandboard: Select DM_SERIAL
  imx8-u-boot: Fix SPL guard option
  Revert "serial: mxc: have putc use the TXFIFO"

Loic Poulain (1):
  configs: imx8m: Enable CONFIG_ARMV8_CRYPTO support

Marcel Ziswiler (8):
  vf610: synchronise device tree with linux
  imxrt1020: migrate to build system included -u-boot.dtsi
  imxrt1050: synchronise device tree with linux
  imx8ulp: synchronise device tree with linux
  imx8mq: synchronise device tree with linux
  imx8mp: synchronise device tree with linux
  imx8mn: synchronise device tree with linux
  imx8mm: synchronise device tree with linux

Marek Vasut (1):
  ARM: imx: Add version variable to DHSOM

Martyn Welch (5):
  imx8m: USDHC3 base address definition for i.MX8MP
  ARM: imx: imx8mp: Enable support for i2c5 and i2c6 on i.MX8MP
  drivers: power: pmic: Add support for rn5t568 PMIC
  drivers: power: pmic: Enable use of rn5t567 PMIC in SPL
  arm: imx8mp: Initial MSC SM2S iMX8MP support

Matthias Schiffer (1):
  ARM: mx7: psci: fix suspend/resume e10133 workaround

Oliver Graute (8):
  imx: imx8qm-rom7720: switch to binman
  imx: imx8qm: cgtqmx8: switch to binman
  imx: imx8qxp: imx8qxp_mek switch to binman
  imx: imx8qm: imx8qm_mek switch to binman
  imx: imx8qxp: giedi switch to binman
  imx: imx8qxp: deneb switch to binman
  imx: imx8x: colibri: switch to binman
  imx: imx8: apalis: switch to binman

Stefano Babic (1):
  Convert mx8 u-boot.dtsi to CONFIG_TEXT_BASE

Tim Harvey (6):
  board: gateworks: venice: remove redundance adjustment of thermal 
trip points

  configs: imx8mn_venice: fix include header protection
  configs: imx8mn_venice.h: remove unused ifdef
  configs: imx8m{m, n}_venice: remove unneeded CONFIG_FEC_MXC_PHYADDR
  imx: imx8m{m,n,p}_venice: migrate to CONFIG_EXTRA_ENV_TEXT
  configs: imx8m{m,n,p}_venice: disable autoload

 MAINTAINERS |9 +
 arch/arm/dts/Makefile   |1 +
 arch/arm/dts/fsl-imx8qm-apalis-u-boot.dtsi  |2 +
 arch/arm/dts/fsl-imx8qm-mek-u-boot.dtsi |2 +
 arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi|2 +
 arch/arm/dts/fsl-imx8qxp-mek-u-boot.dtsi|2 +
 arch/arm/dts/imx6dl-wandboard-revd1-u-boot.dtsi |1 +
 arch/arm/dts/imx6q-wandboard-revd1-u-boot.dtsi  |1 +
 arch/arm/dts/imx6qdl-hummingboard2-emmc-som-v15-u-boot.dtsi |   16 ++
 arch/arm/dts/imx6qdl-wandboard-u-boot.dtsi  |9 +
 arch/arm/dts/imx6qp-wandboard-revd1-u-boot.dtsi |1 +
 arch/arm/dts/imx8mm-beacon-baseboard.dtsi   |4 +-
 arch/arm/dts/imx8mm-beacon-kit-u-boot.dtsi  |   18 +-
 arch/arm/dts/imx8mm-evk.dtsi|   43 
 arch/arm/dts/imx8mm-icore-mx8mm.dtsi|   14 +-
 arch/arm/dts/imx8mm-mx8menlo.dts|   14 +-
 arch/arm/dts/imx8mm-u-boot.dtsi |2 +-
 arch/arm/dts/imx8mm-venice-gw700x.dtsi  |   24 +--
 arch/arm/dts/imx8mm-venice-gw7901.dts   |   12 +-
 arch/arm/dts/imx8mm-venice-gw7902.dts   |   14 +-
 arch/arm/dts/imx8mm-venice-gw7903.dts   |6 +-
 arch/arm/dts/imx8mm-venice-gw7904.dts   |4 +
 arch/arm/dts/imx8mm-verdin.dtsi |   50 +++--
 arch/a

Re: [PATCH v7 02/10] lib: uuid: introduce uuid_str_to_le_bin function

2022-11-14 Thread Abdellatif El Khlifi
On Fri, Nov 11, 2022 at 05:02:26PM +, Anders Dellien wrote:
> Hi Abdel,
> 
> From: U-Boot  on behalf of Abdellatif El Khlifi 
> 
> Date: Monday, 7 November 2022 at 19:22
> To: Abdellatif El Khlifi 
> Cc: Drew Reed , Achin Gupta , 
> ilias.apalodi...@linaro.org , 
> jens.wiklan...@linaro.org , nd , 
> s...@chromium.org , tr...@konsulko.com 
> , u-boot@lists.denx.de , Vishnu 
> Banavath , Xueliang Zhong 
> Subject: [PATCH v7 02/10] lib: uuid: introduce uuid_str_to_le_bin function
> convert UUID string to little endian binary data
> 
> Signed-off-by: Abdellatif El Khlifi 
> Cc: Tom Rini 
> Cc: Simon Glass 
> Cc: Ilias Apalodimas 
> Cc: Jens Wiklander 
> 
> ---
> 
> Changelog:
> ===
> 
> v7:
> 
> * rename be_uuid_str_to_le_bin() to uuid_str_to_le_bin()
> * make uuid_str_to_le_bin() implementation similar to uuid_str_to_bin()
>   by using same APIs
> 
> v4:
> 
> * rename ffa_uuid_str_to_bin to be_uuid_str_to_le_bin and put in
>   a standalone commit (the current)
> 
> v3:
> 
> * introduce ffa_uuid_str_to_bin (provided by
>   arm_ffa: introduce Arm FF-A low-level driver)
> 
> include/uuid.h |  8 
>  lib/uuid.c | 46 ++
>  2 files changed, 54 insertions(+)
> 
> diff --git a/include/uuid.h b/include/uuid.h
> index 4a4883d3b5..293a8eb0a5 100644
> --- a/include/uuid.h
> +++ b/include/uuid.h
> @@ -2,6 +2,8 @@
>  /*
>   * Copyright (C) 2014 Samsung Electronics
>   * Przemyslaw Marczak 
> + * (C) Copyright 2022 ARM Limited
> + * Abdellatif El Khlifi 
>   */
>  #ifndef __UUID_H__
>  #define __UUID_H__
> @@ -44,4 +46,10 @@ int uuid_guid_get_bin(const char *guid_str, unsigned char 
> *guid_bin);
>  const char *uuid_guid_get_str(const unsigned char *guid_bin);
>  void gen_rand_uuid(unsigned char *uuid_bin);
>  void gen_rand_uuid_str(char *uuid_str, int str_format);
> +
> +/**
> + * uuid_str_to_le_bin - Converts a UUID string to little endian binary data
> + */
> +int uuid_str_to_le_bin(const char *uuid_str, unsigned char *uuid_bin);
> +
>  #endif
> diff --git a/lib/uuid.c b/lib/uuid.c
> index 465e1ac38f..cde5ae2bb7 100644
> --- a/lib/uuid.c
> +++ b/lib/uuid.c
> @@ -1,6 +1,8 @@
>  // SPDX-License-Identifier: GPL-2.0+
>  /*
>   * Copyright 2011 Calxeda, Inc.
> + * (C) Copyright 2022 ARM Limited
> + * Abdellatif El Khlifi 
>   */
> 
>  #include 
> @@ -346,6 +348,50 @@ int uuid_str_to_bin(const char *uuid_str, unsigned char 
> *uuid_bin,
>  return 0;
>  }
> 
> +/**
> + * uuid_str_to_le_bin() - Convert string UUID to little endian binary data.
> + * @uuid_str:  pointer to UUID string
> + * @uuid_bin:  pointer to allocated array for little endian output [16B]
> + *
> + * UUID string is 36 characters (36 bytes):
> + *
> + * ----
> + *
> + * where x is a hexadecimal character. Fields are separated by '-'s.
> + * When converting to a little endian binary UUID, the string fields are 
> reversed.
> + *
> + * Return:
> + *
> + *uuid_bin filled with little endian UUID data
> + *On success 0 is returned. Otherwise, failure code.
> + */
> +int uuid_str_to_le_bin(const char *uuid_str, unsigned char *uuid_bin)
> +{
> +   u16 tmp16;
> +   u32 tmp32;
> +   u64 tmp64;
> +
> +   if (!uuid_str_valid(uuid_str) || !uuid_bin)
> +   return -EINVAL;
> +
> +   tmp32 = cpu_to_le32(hextoul(uuid_str, NULL));
> +   memcpy(uuid_bin, &tmp32, 4);
> +
> +   tmp16 = cpu_to_le16(hextoul(uuid_str + 9, NULL));
> +   memcpy(uuid_bin + 4, &tmp16, 2);
> +
> +   tmp16 = cpu_to_le16(hextoul(uuid_str + 14, NULL));
> +   memcpy(uuid_bin + 6, &tmp16, 2);
> +
> +   tmp16 = cpu_to_le16(hextoul(uuid_str + 19, NULL));
> +   memcpy(uuid_bin + 8, &tmp16, 2);
> +
> +   tmp64 = cpu_to_le64(hextoul(uuid_str + 24, NULL));
> +   memcpy(uuid_bin + 10, (char *)&tmp64, 6);
> 
> I think we might risk overflow here on platforms where “ulong” happens to be 
> 32 bits.

Thanks Anders, a very valid point.

I will use simple_strtoull() in place of hextoul()

I'll make the change in v8.

> 
> +
> +   return 0;
> +}
> +
>  /*
>   * uuid_bin_to_str() - convert big endian binary data to string UUID or GUID.
>   *
> --
> 2.17.1


[PATCH] eficonfig: fix missing variable initialization

2022-11-14 Thread Masahisa Kojima
The 'ret' variable must be initialized before use
in eficonfig_delete_invalid_boot_option().

Fixes: c416f1c0bc ("bootmenu: add removable media entries")
Addresses-Coverity: 376207 ("Uninitialized variables")
Signed-off-by: Masahisa Kojima 
---
 cmd/eficonfig.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c
index 2595dd9563..0a768d8013 100644
--- a/cmd/eficonfig.c
+++ b/cmd/eficonfig.c
@@ -2280,10 +2280,10 @@ efi_status_t 
eficonfig_delete_invalid_boot_option(struct eficonfig_media_boot_op
 {
u32 i, j;
efi_uintn_t size;
-   efi_status_t ret;
void *load_option;
struct efi_load_option lo;
u16 varname[] = u"Boot";
+   efi_status_t ret = EFI_SUCCESS;
 
for (i = 0; i <= 0x; i++) {
efi_uintn_t tmp;
-- 
2.17.1



Re: [PATCH 0/6] broken CVE fix (b85d130ea0ca)

2022-11-14 Thread Rasmus Villemoes
On 14/10/2022 19.43, Rasmus Villemoes wrote:
> tl;dr: b85d130ea0ca didn't fix the CVE(s), but did break tftp of
> certain file sizes - which is somewhat lucky, since that's how I
> noticed in the first place.
> 

At this point it seems unlikely that any more comments or reviews will
come, so perhaps its time to get these (all 7) merged to master, so that
they will get some wider testing before the January release?

Rasmus



[PATCH 1/1] Documentation: man-page for command bootd

2022-11-14 Thread Heinrich Schuchardt
Provide a man-page for the bootd command.

Signed-off-by: Heinrich Schuchardt 
---
 doc/usage/cmd/bootd.rst | 38 ++
 doc/usage/index.rst |  1 +
 2 files changed, 39 insertions(+)
 create mode 100644 doc/usage/cmd/bootd.rst

diff --git a/doc/usage/cmd/bootd.rst b/doc/usage/cmd/bootd.rst
new file mode 100644
index 00..380ef15283
--- /dev/null
+++ b/doc/usage/cmd/bootd.rst
@@ -0,0 +1,38 @@
+.. SPDX-License-Identifier: GPL-2.0+:
+
+bootd command
+=
+
+Synopsis
+
+
+::
+
+bootd
+
+Description
+---
+
+The bootd command executes the command stored in the environment variable
+*bootcmd*, i.e. it does the same thing as *run bootcmd*.
+
+Example
+---
+
+::
+
+=> setenv bootcmd 'echo Hello World'
+=> bootd
+Hello World
+=> setenv bootcmd true
+=> bootd; echo $?
+0
+=> setenv bootcmd false
+=> bootd; echo $?
+1
+
+Return value
+
+
+The return value $? of the bootd command is the return value of the command in
+the environment variable *bootcmd*.
diff --git a/doc/usage/index.rst b/doc/usage/index.rst
index f7f03aeac1..815b032247 100644
--- a/doc/usage/index.rst
+++ b/doc/usage/index.rst
@@ -23,6 +23,7 @@ Shell commands
cmd/addrmap
cmd/askenv
cmd/base
+   cmd/bootd
cmd/bootdev
cmd/bootefi
cmd/bootflow
-- 
2.37.2



[PATCH 1/1] sandbox: fix documentation of struct host_ops

2022-11-14 Thread Heinrich Schuchardt
The documentation of struct host_ops should be Sphinx compliant.

Fixes: 9bd1aa8af2ed ("dm: sandbox: Create a new HOST uclass")
Signed-off-by: Heinrich Schuchardt 
---
 include/sandbox_host.h | 19 ---
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/include/sandbox_host.h b/include/sandbox_host.h
index 2e37ede235..ebd7d99b47 100644
--- a/include/sandbox_host.h
+++ b/include/sandbox_host.h
@@ -23,26 +23,23 @@ struct host_sb_plat {
 
 /**
  * struct host_ops - operations supported by UCLASS_HOST
- *
- * @attach_file: Attach a new file to a device
- * @detach_file: Detach a file from a device
  */
 struct host_ops {
-   /*
-* attach_file() - Attach a new file to the device
+   /**
+* @attach_file: - Attach a new file to the device
 *
-* @dev: Device to update
-* @filename: Name of the file, e.g. "/path/to/disk.img"
-* Returns: 0 if OK, -EEXIST if a file is already attached, other -ve on
+* @attach_file.dev: Device to update
+* @attach_file.filename: Name of the file, e.g. "/path/to/disk.img"
+* @attach_file.Returns: 0 if OK, -EEXIST if a file is already 
attached, other -ve on
 * other error
 */
int (*attach_file)(struct udevice *dev, const char *filename);
 
/**
-* detach_file() - Detach a file from the device
+* @detach_file: - Detach a file from the device
 *
-* @dev: Device to detach from
-* Returns: 0 if OK, -ENOENT if no file is attached, other -ve on other
+* @detach_file.dev: Device to detach from
+* @detach_file.Returns: 0 if OK, -ENOENT if no file is attached, other 
-ve on other
 * error
 */
 int (*detach_file)(struct udevice *dev);
-- 
2.37.2



[PATCH 1/1] doc: fix documentation of enum gd_flags

2022-11-14 Thread Heinrich Schuchardt
Correct GD_FLG_CYCLIC_RUNNING documentation to match Sphinx style.

Fixes: d7de5ef62935 ("cyclic: use a flag in gd->flags for recursion protection")
Signed-off-by: Heinrich Schuchardt 
---
 include/asm-generic/global_data.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/asm-generic/global_data.h 
b/include/asm-generic/global_data.h
index 02ad8ca595..88829126fb 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -651,7 +651,7 @@ enum gd_flags {
 */
GD_FLG_FDT_CHANGED = 0x10,
/**
-* GD_FLG_CYCLIC_RUNNING: cyclic_run is in progress
+* @GD_FLG_CYCLIC_RUNNING: cyclic_run is in progress
 */
GD_FLG_CYCLIC_RUNNING = 0x20,
 };
-- 
2.37.2



Please pull u-boot-i2c

2022-11-14 Thread Heiko Schocher
Hello Tom,

please pull from u-boot-i2c:

The following changes since commit 0cbeed4f6648e0e4966475e3544280a69ecb59d3:

  Merge branch '2022-11-10-symbol-migrations' (2022-11-10 10:09:40 -0500)

are available in the Git repository at:

  https://source.denx.de/u-boot/custodians/u-boot-i2c.git tags/for-v2023.01-rc2

for you to fetch changes up to b0c485fd384b2706717d4c19fa9837c1d785e9e8:

  i2c: i2c-gpio: add newline (2022-11-14 07:24:47 +0100)


i2c Fixes for v2023.01-rc2

- i2c-gpio: add a missing new line in printed string
  detected and fixed by Sergei

- microchip i2c driver fixes from Conor
  - fix erroneous late ack send
  - fix ack sending logic


Conor Dooley (2):
  i2c: microchip: fix ack sending logic
  i2c: microchip: fix erroneous late ack send

Sergei Antonov (1):
  i2c: i2c-gpio: add newline

 drivers/i2c/i2c-gpio.c  |  2 +-
 drivers/i2c/i2c-microchip.c | 25 ++---
 2 files changed, 19 insertions(+), 8 deletions(-)


Azure builds shows no errors:

https://dev.azure.com/hs0298/hs/_build/results?buildId=85&view=results

Thanks!

bye,
Heiko
-- 
DENX Software Engineering GmbH,  Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: h...@denx.de


Re: [PATCH v1 2/2] i2c: microchip: fix erroneous late ack send

2022-11-14 Thread Heiko Schocher
Hello Conor,

On 26.10.22 09:49, Conor Dooley wrote:
> A late ack is currently being sent at the end of a transfer due to
> incorrect logic in mchp_corei2c_empty_rx(). Currently the Assert Ack
> bit is being written to the controller's control reg after the last
> byte has been received, causing it to sent another byte with the ack.
> Instead, the AA flag should be written to the control register when
> the penultimate byte is read so it is sent out for the last byte.
> 
> Reported-by: Andreas Buerkler 
> Fixes: 0dc0d1e094 ("i2c: Add Microchip PolarFire SoC I2C driver")
> Fixes: 0190d48488 ("i2c: microchip: fix ack sending logic")
> Signed-off-by: Conor Dooley 
> ---
>  drivers/i2c/i2c-microchip.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied after removing wrong Fixes tag to u-boot-i2c.git master

Thanks!

bye,
Heiko
-- 
DENX Software Engineering GmbH,  Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: h...@denx.de


Re: [PATCH v1 1/2] i2c: microchip: fix ack sending logic

2022-11-14 Thread Heiko Schocher
Hello Conor,

On 26.10.22 09:49, Conor Dooley wrote:
> "Master receive mode" was not correctly sending ACKs/NACKs in the
> interrupt handler. Bring the handling of M_SLAR_ACK, M_RX_DATA_ACKED &
> M_RX_DATA_NACKED in line with the Linux driver.
> 
> Fixes: 0dc0d1e094 ("i2c: Add Microchip PolarFire SoC I2C driver")
> Reported-by: Shravan Chippa 
> Signed-off-by: Conor Dooley 
> ---
>  drivers/i2c/i2c-microchip.c | 23 +--
>  1 file changed, 17 insertions(+), 6 deletions(-)

Applied to u-boot-i2c.git master

Thanks!

bye,
Heiko
-- 
DENX Software Engineering GmbH,  Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: h...@denx.de


Re: [PATCH] i2c: i2c-gpio: add newline

2022-11-14 Thread Heiko Schocher
Hello Sergei,

On 20.10.22 16:28, Sergei Antonov wrote:
> Add newline at the end of the printed string.
> 
> Signed-off-by: Sergei Antonov 
> ---
>  drivers/i2c/i2c-gpio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to u-boot-i2c.git master

Thanks!

bye,
Heiko


-- 
DENX Software Engineering GmbH,  Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: h...@denx.de


Re: Changing eMMC boot partition size

2022-11-14 Thread Jaehoon Chung
Hi,

On 11/9/22 03:30, Tom Rini wrote:
> On Tue, Nov 08, 2022 at 06:34:18PM +0100, Philip Oberfichtner wrote:
>> Hi everybody,
>>
>> I have a question regarding changing the eMMC boot partition size.
>> According the the JEDEC eMMC spec it is read-only (BOOT_SIZE_MULT
>> register).
>>
>> But we still have mmc_boot_partition_size_change() in
>> drivers/mmc/mmc_boot.c. It contains the comment
>>
>> /* Only use this command for raw EMMC moviNAND. Enter backdoor mode */
>>
>> What is moviNAND? My research pointed me to Samsung products only. So
>> is changing the boot partition size vendor specific or can it be used
>> more generally?
>>
>> To be specific, I use the Kioxia THGBMJG6C1LBAB7 eMMC chip.
> 
> Yes, moviNAND was some Samsung technology that may or may not still be
> used on some platforms. And yes, some eMMC parts do allow for boot
> partitions to be resized but such information is often under NDA, so
> contacting the hardware vendor or looking for eMMC chip documentation
> may be helpful here.

Thanks for replying this. As like Tom's comment, eMMC that is manufactured from 
Samsung was called MoviNand.
It's used with Reserved Command for manufacturer. 
So If you want to change your eMMC's boot partition size,  you need to check 
Kioxiz documentation.

Best Regards,
Jaehoon Chung

> 


Re: [PATCH] efi_loader: add missing EFI_CALL when closing a file

2022-11-14 Thread Heinrich Schuchardt

On 11/11/22 17:20, Ilias Apalodimas wrote:

Closing the files uses the EFI protocol and specifically it's .close
callback.  This needs to be wrapped on an EFI_CALL()

Signed-off-by: Ilias Apalodimas 
---
  lib/efi_loader/efi_file.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/efi_loader/efi_file.c b/lib/efi_loader/efi_file.c
index 9e6c2b118900..750d380ad967 100644
--- a/lib/efi_loader/efi_file.c
+++ b/lib/efi_loader/efi_file.c
@@ -1131,7 +1131,7 @@ struct efi_file_handle *efi_file_from_path(struct 
efi_device_path *fp)
  
  		if (!EFI_DP_TYPE(fp, MEDIA_DEVICE, FILE_PATH)) {

printf("bad file path!\n");
-   f->close(f);
+   EFI_CALL(f->close(f));
return NULL;
}
  


Reviewed-by: Heinrich Schuchardt 


Re: [PATCH] efi_loader: replace a u16_strdup with alloc + memcpy

2022-11-14 Thread Heinrich Schuchardt

On 11/11/22 19:04, Ilias Apalodimas wrote:

Heinrich reports that on RISC-V unaligned access is emulated by OpenSBI
which is very slow.  Performance wise it's better if we skip the calls
to u16_strdup() -- which in turn calls u16_strsize() and just allocate/copy the
memory directly.  The access to dp.length may still be unaligned, but that's
way less than what u16_strsize() would do

Signed-off-by: Ilias Apalodimas 
---
  lib/efi_loader/efi_file.c | 8 +++-
  1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/efi_loader/efi_file.c b/lib/efi_loader/efi_file.c
index 750d380ad967..ff731db6cb8c 100644
--- a/lib/efi_loader/efi_file.c
+++ b/lib/efi_loader/efi_file.c
@@ -1128,6 +1128,7 @@ struct efi_file_handle *efi_file_from_path(struct 
efi_device_path *fp)
container_of(fp, struct efi_device_path_file_path, dp);
struct efi_file_handle *f2;
u16 *filename;
+   size_t filename_sz;
  
  		if (!EFI_DP_TYPE(fp, MEDIA_DEVICE, FILE_PATH)) {

printf("bad file path!\n");
@@ -1140,9 +1141,14 @@ struct efi_file_handle *efi_file_from_path(struct 
efi_device_path *fp)
 * protocol member functions to be aligned.  So memcpy it
 * unconditionally
 */
-   filename = u16_strdup(fdp->str);
+   if (fdp->dp.length <= offsetof(struct 
efi_device_path_file_path, str))
+   return NULL;
+   filename_sz = fdp->dp.length -
+   offsetof(struct efi_device_path_file_path, str);
+   filename = calloc(1, filename_sz);


As we copy filename_sz bytes there is not need for zeroing out. We can 
use malloc() here.


Otherwise:
Reviewed-by: Heinrich Schuchardt 


if (!filename)
return NULL;
+   memcpy(filename, fdp->str, filename_sz);
EFI_CALL(ret = f->open(f, &f2, filename,
   EFI_FILE_MODE_READ, 0));
free(filename);




Re: [PATCH 2/2] test: cmd: fdt: Add fdt get value test case

2022-11-14 Thread Heinrich Schuchardt

On 11/13/22 21:45, Marek Vasut wrote:

Add test case for 'fdt get value' sub command.

The test case can be triggered using:
"
./u-boot -d u-boot.dtb -c 'ut fdt'
"

Signed-off-by: Marek Vasut 
---
Cc: Heinrich Schuchardt 
Cc: Simon Glass 
Cc: Tom Rini 
---
  test/cmd/fdt.c | 53 ++
  1 file changed, 53 insertions(+)

diff --git a/test/cmd/fdt.c b/test/cmd/fdt.c
index ba9eaa42c14..7974c88c0d6 100644
--- a/test/cmd/fdt.c
+++ b/test/cmd/fdt.c
@@ -142,6 +142,59 @@ static int fdt_test_resize(struct unit_test_state *uts)
  }
  FDT_TEST(fdt_test_resize, UT_TESTF_CONSOLE_REC);
  
+/* Test 'fdt get' reading an fdt */

+static int fdt_test_get(struct unit_test_state *uts)
+{
+   ulong addr;
+
+   addr = map_to_sysmem(gd->fdt_blob);
+   set_working_fdt_addr(addr);
+
+   /* Test getting default element of /clk-test node clock-names property 
*/
+   ut_assertok(console_record_reset_enable());
+   ut_assertok(run_command("fdt get value fdflt /clk-test clock-names", 
0));


The command 'fdt get value' is missing in doc/usage/cmd/fdt.rst.

Acked-by: Heinrich Schuchardt 


+   ut_asserteq_str("fixed", env_get("fdflt"));
+   ut_assertok(ut_check_console_end(uts));
+
+   /* Test getting 0th element of /clk-test node clock-names property */
+   ut_assertok(console_record_reset_enable());
+   ut_assertok(run_command("fdt get value fzero /clk-test clock-names 0", 
0));
+   ut_asserteq_str("fixed", env_get("fzero"));
+   ut_assertok(ut_check_console_end(uts));
+
+   /* Test getting 1st element of /clk-test node clock-names property */
+   ut_assertok(console_record_reset_enable());
+   ut_assertok(run_command("fdt get value fone /clk-test clock-names 1", 
0));
+   ut_asserteq_str("i2c", env_get("fone"));
+   ut_assertok(ut_check_console_end(uts));
+
+   /* Test getting 2nd element of /clk-test node clock-names property */
+   ut_assertok(console_record_reset_enable());
+   ut_assertok(run_command("fdt get value ftwo /clk-test clock-names 2", 
0));
+   ut_asserteq_str("spi", env_get("ftwo"));
+   ut_assertok(ut_check_console_end(uts));
+
+   /* Test missing 10th element of /clk-test node clock-names property */
+   ut_assertok(console_record_reset_enable());
+   ut_asserteq(1, run_command("fdt get value ftwo /clk-test clock-names 
10", 0));
+   ut_assertok(ut_check_console_end(uts));
+
+   /* Test getting default element of /clk-test node nonexistent property 
*/
+   ut_assertok(console_record_reset_enable());
+   ut_asserteq(1, run_command("fdt get value fnone /clk-test nonexistent", 
1));
+   ut_assert_nextline("libfdt fdt_getprop(): FDT_ERR_NOTFOUND");
+   ut_assertok(ut_check_console_end(uts));
+
+   /* Test getting default element of /nonexistent node */
+   ut_assertok(console_record_reset_enable());
+   ut_asserteq(1, run_command("fdt get value fnode /nonexistent 
nonexistent", 1));
+   ut_assert_nextline("libfdt fdt_path_offset() returned 
FDT_ERR_NOTFOUND");
+   ut_assertok(ut_check_console_end(uts));
+
+   return 0;
+}
+FDT_TEST(fdt_test_get, UT_TESTF_CONSOLE_REC);
+
  int do_ut_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
  {
struct unit_test *tests = UNIT_TEST_SUITE_START(fdt_test);




Re: [PATCH 1/2] cmd: fdt: Fix iteration over elements above index 2 in fdt get

2022-11-14 Thread Heinrich Schuchardt

On 11/13/22 21:45, Marek Vasut wrote:

Always increment both the iterator and pointer into the string
property value by length of the current element + 1 (to cater
for the string delimiter), otherwise the element extracted from
the string property value would be extracted from an offset that
is multiple of the length of the first element, instead of sum
of element lengths until select index.

This fixes 'fdt get value' operation for index above 2.


As '0' is the first index: %s/above 2/above 1/

Acked-by: Heinrich Schuchardt 



Fixes: 13982ced2cc ("cmd: fdt: Add support for reading stringlist property 
values")
Signed-off-by: Marek Vasut 
---
Cc: Heinrich Schuchardt 
Cc: Simon Glass 
Cc: Tom Rini 
---
  cmd/fdt.c | 9 ++---
  1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/cmd/fdt.c b/cmd/fdt.c
index 4b2dcfec863..8e51a431261 100644
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -60,11 +60,14 @@ static int fdt_value_env_set(const void *nodep, int len,
 * Iterate over all members in stringlist and find the one at
 * offset $index. If no such index exists, indicate failure.
 */
-   for (i = 0; i < len; i += strlen(nodec) + 1) {
-   if (index-- > 0)
+   for (i = 0; i < len; ) {
+   if (index-- > 0) {
+   i += strlen(nodec) + 1;
+   nodec += strlen(nodec) + 1;
continue;
+   }
  
-			env_set(var, nodec + i);

+   env_set(var, nodec);
return 0;
}