Re: [PATCH] spl: Align device tree blob address at 8-byte boundary

2021-07-11 Thread Bin Meng
On Mon, Jul 12, 2021 at 1:21 PM Reuben Dowle  wrote:
>
> I submitted an almost identical patch. See 
> https://github.com/u-boot/u-boot/commit/eb39d8ba5f0d1468b01b89a2a464d18612d3ea76
>
> This patch eventually had to be reverted 
> (https://github.com/u-boot/u-boot/commit/5675ed7cb645f5ec13958726992daeeed16fd114),
>  because it was causing issues on some platforms that had FIT on 32 bit 
> boundary. However I continue to use it in production code, as without it the 
> boot on my platform aborts.
>
> I don't have time to investigate why this was happening, but you need to 
> check this code won't just cause exactly the same faults.

Thanks for your information.

+Marek who did the revert

The revert commit message says:

"The commit breaks booting of fitImage by SPL, the system simply
hangs. This is because on arm32, the fitImage and all of its content
can be aligned to 4 bytes and U-Boot expects just that."

I don't understand this. If an address is aligned to 8, it is already
aligned to 4, so how did this commit make the system hang on arm32?

Note, as I indicated in this patch, now with libfdt 1.6.1, the
alignment to 8 byte is a must-have. So we have to do such alignment
anyway.

@Tom may fill in why libfdt commit commit 5e735860c478 ("libfdt: Check
for 8-byte address alignment in fdt_ro_probe_()") was made to have the
8-byte alignment requirement.

>
> -Original Message-
> > From: U-Boot  On Behalf Of Bin Meng
> > Sent: Monday, 12 July 2021 3:53 pm
> > To: Tom Rini ; Simon Glass ; u-
> > b...@lists.denx.de
> > Cc: Bin Meng 
> > Subject: [PATCH] spl: Align device tree blob address at 8-byte boundary
> >
> > Since libfdt v1.6.1, a new requirement on the device tree address via:
> >
> >   commit 5e735860c478 ("libfdt: Check for 8-byte address alignment in
> > fdt_ro_probe_()")
> >
> > must be met that the device tree must be loaded in to memory at an 8-byte
> > aligned address.
> >
> > Signed-off-by: Bin Meng 
> > ---
> >
> >  common/spl/spl_fit.c | 6 ++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index
> > f41abca0cc..9baf6aca9f 100644
> > --- a/common/spl/spl_fit.c
> > +++ b/common/spl/spl_fit.c
> > @@ -374,6 +374,12 @@ static int spl_fit_append_fdt(struct spl_image_info
> > *spl_image,
> >   */
> >  image_info.load_addr = spl_image->load_addr + spl_image->size;
> >
> > +/*
> > + * Since libfdt v1.6.1, the device tree must be loaded in to memory
> > + * at an 8-byte aligned address.
> > + */
> > +image_info.load_addr = roundup(image_info.load_addr, 8);
> > +
> >  /* Figure out which device tree the board wants to use */
> >  node = spl_fit_get_image_node(ctx, FIT_FDT_PROP, index++);
> >  if (node < 0) {
> > --

Regards,
Bin


RE: [PATCH] spl: Align device tree blob address at 8-byte boundary

2021-07-11 Thread Reuben Dowle
I submitted an almost identical patch. See 
https://github.com/u-boot/u-boot/commit/eb39d8ba5f0d1468b01b89a2a464d18612d3ea76

This patch eventually had to be reverted 
(https://github.com/u-boot/u-boot/commit/5675ed7cb645f5ec13958726992daeeed16fd114),
 because it was causing issues on some platforms that had FIT on 32 bit 
boundary. However I continue to use it in production code, as without it the 
boot on my platform aborts.

I don't have time to investigate why this was happening, but you need to check 
this code won't just cause exactly the same faults.

> -Original Message-
> From: U-Boot  On Behalf Of Bin Meng
> Sent: Monday, 12 July 2021 3:53 pm
> To: Tom Rini ; Simon Glass ; u-
> b...@lists.denx.de
> Cc: Bin Meng 
> Subject: [PATCH] spl: Align device tree blob address at 8-byte boundary
> 
> Since libfdt v1.6.1, a new requirement on the device tree address via:
> 
>   commit 5e735860c478 ("libfdt: Check for 8-byte address alignment in
> fdt_ro_probe_()")
> 
> must be met that the device tree must be loaded in to memory at an 8-byte
> aligned address.
> 
> Signed-off-by: Bin Meng 
> ---
> 
>  common/spl/spl_fit.c | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index
> f41abca0cc..9baf6aca9f 100644
> --- a/common/spl/spl_fit.c
> +++ b/common/spl/spl_fit.c
> @@ -374,6 +374,12 @@ static int spl_fit_append_fdt(struct spl_image_info
> *spl_image,
>*/
>   image_info.load_addr = spl_image->load_addr + spl_image->size;
> 
> + /*
> +  * Since libfdt v1.6.1, the device tree must be loaded in to memory
> +  * at an 8-byte aligned address.
> +  */
> + image_info.load_addr = roundup(image_info.load_addr, 8);
> +
>   /* Figure out which device tree the board wants to use */
>   node = spl_fit_get_image_node(ctx, FIT_FDT_PROP, index++);
>   if (node < 0) {
> --
> 2.25.1



Convert mvebu_mmc driver to driver model

2021-07-11 Thread Tony Dinh
In reference to:
https://lists.denx.de/pipermail/u-boot/2021-April/446664.html

DM MMC was tested to work fine on the Sheevaplug board.

Tested-by: Tony Dinh 


[PATCH 4/4] configs: ls2080ardb.h: Update mc size in env

2021-07-11 Thread Priyanka Jain
Set MC Firmware size in read commands in
env to 2MB.

Signed-off-by: Priyanka Jain 
---
 include/configs/ls2080ardb.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/configs/ls2080ardb.h b/include/configs/ls2080ardb.h
index 8626a1d5e6..3cc3b44678 100644
--- a/include/configs/ls2080ardb.h
+++ b/include/configs/ls2080ardb.h
@@ -319,11 +319,11 @@ unsigned long get_board_sys_clk(void);
"env exists secureboot && " \
"esbc_validate 0x8064 && "  \
"esbc_validate 0x8068; "\
-   "sf read 0x80a0 0xa0 0x30; "\
+   "sf read 0x80a0 0xa0 0x20; "\
"sf read 0x80e0 0xe0 0x10; "\
"fsl_mc start mc 0x80a0 0x80e0 \0"
 #define SD_MC_INIT_CMD \
-   "mmcinfo;mmc read 0x80a0 0x5000 0x1200;" \
+   "mmcinfo;mmc read 0x80a0 0x5000 0x1000;" \
"mmc read 0x80e0 0x7000 0x800;" \
"env exists secureboot && " \
"mmc read 0x8064 0x3200 0x20 && "   \
@@ -344,12 +344,12 @@ unsigned long get_board_sys_clk(void);
"env exists secureboot && " \
"esbc_validate 0x8064 && "  \
"esbc_validate 0x8068; "\
-   "sf read 0x80a0 0xa0 0x30; "\
+   "sf read 0x80a0 0xa0 0x20; "\
"sf read 0x80e0 0xe0 0x10; "\
"fsl_mc start mc 0x80a0 0x80e0 \0"
 #elif defined(CONFIG_SD_BOOT)
 #define MC_INIT_CMD \
-   "mcinitcmd=mmcinfo;mmc read 0x8000 0x5000 0x800;" \
+   "mcinitcmd=mmcinfo;mmc read 0x8000 0x5000 0x1000;" \
"mmc read 0x8010 0x7000 0x800;" \
"env exists secureboot && " \
"mmc read 0x8064 0x3200 0x20 && "   \
-- 
2.17.1



[PATCH 3/4] configs: ls2080aqds.h: Update mc size in env

2021-07-11 Thread Priyanka Jain
Set MC Firmware size in read commands in
env to 2MB.

Signed-off-by: Priyanka Jain 
---
 include/configs/ls2080aqds.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/configs/ls2080aqds.h b/include/configs/ls2080aqds.h
index b3fce1b7f7..64b0c78aba 100644
--- a/include/configs/ls2080aqds.h
+++ b/include/configs/ls2080aqds.h
@@ -345,7 +345,7 @@ unsigned long get_board_ddr_clk(void);
 #else
 #ifdef CONFIG_TFABOOT
 #define SD_MC_INIT_CMD \
-   "mmcinfo;mmc read 0x80a0 0x5000 0x1200;"  \
+   "mmcinfo;mmc read 0x80a0 0x5000 0x1000;"  \
"mmc read 0x80e0 0x7000 0x800;" \
"fsl_mc start mc 0x80a0 0x80e0\0"
 #define IFC_MC_INIT_CMD\
@@ -418,7 +418,7 @@ unsigned long get_board_ddr_clk(void);
"kernel_start=0x8000\0"  \
"kernel_load=0xa000\0"  \
"kernel_size=0x14000\0"   \
-   "mcinitcmd=mmcinfo;mmc read 0x8000 0x5000 0x800;"  \
+   "mcinitcmd=mmcinfo;mmc read 0x8000 0x5000 0x1000;"  \
"mmc read 0x8010 0x7000 0x800;" \
"fsl_mc start mc 0x8000 0x8010\0"   \
"mcmemsize=0x7000 \0"
-- 
2.17.1



[PATCH 2/4] configs: ls1088ardb.h: Update mc size in env

2021-07-11 Thread Priyanka Jain
Increase MC firmware size from 1MB to 2MB
in read commands in env.

Signed-off-by: Priyanka Jain 
---
 include/configs/ls1088ardb.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/configs/ls1088ardb.h b/include/configs/ls1088ardb.h
index 6f36dd417a..0df3b486e8 100644
--- a/include/configs/ls1088ardb.h
+++ b/include/configs/ls1088ardb.h
@@ -261,7 +261,7 @@
 /* Initial environment variables */
 #ifdef CONFIG_TFABOOT
 #define QSPI_MC_INIT_CMD   \
-   "sf probe 0:0;sf read 0x8000 0xA0 0x10;"\
+   "sf probe 0:0;sf read 0x8000 0xA0 0x20;"\
"sf read 0x8010 0xE0 0x10;" \
"env exists secureboot && " \
"sf read 0x8064 0x64 0x4 && "   \
@@ -270,7 +270,7 @@
"esbc_validate 0x8068 ;"\
"fsl_mc start mc 0x8000 0x8010\0"
 #define SD_MC_INIT_CMD \
-   "mmcinfo;mmc read 0x8000 0x5000 0x800;" \
+   "mmcinfo;mmc read 0x8000 0x5000 0x1000;"\
"mmc read 0x8010 0x7000 0x800;" \
"env exists secureboot && " \
"mmc read 0x8064 0x3200 0x20 && "   \
@@ -281,7 +281,7 @@
 #else
 #if defined(CONFIG_QSPI_BOOT)
 #define MC_INIT_CMD\
-   "mcinitcmd=sf probe 0:0;sf read 0x8000 0xA0 0x10;"  \
+   "mcinitcmd=sf probe 0:0;sf read 0x8000 0xA0 0x20;"  \
"sf read 0x8010 0xE0 0x10;" \
"env exists secureboot && " \
"sf read 0x8064 0x64 0x4 && "   \
@@ -292,7 +292,7 @@
"mcmemsize=0x7000\0"
 #elif defined(CONFIG_SD_BOOT)
 #define MC_INIT_CMD\
-   "mcinitcmd=mmcinfo;mmc read 0x8000 0x5000 0x800;"   \
+   "mcinitcmd=mmcinfo;mmc read 0x8000 0x5000 0x1000;"  \
"mmc read 0x8010 0x7000 0x800;" \
"env exists secureboot && " \
"mmc read 0x8064 0x3200 0x20 && "   \
-- 
2.17.1



[PATCH 1/4] configs: ls1088aqds.h: Update mc size in env

2021-07-11 Thread Priyanka Jain
Increase MC firmware size from 1MB to 2MB
in read commands in env.

Signed-off-by: Priyanka Jain 
---
 include/configs/ls1088aqds.h | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/configs/ls1088aqds.h b/include/configs/ls1088aqds.h
index 4d04833c50..3d83b6715a 100644
--- a/include/configs/ls1088aqds.h
+++ b/include/configs/ls1088aqds.h
@@ -387,7 +387,7 @@ unsigned long get_board_ddr_clk(void);
"kernel_start=0x100\0"  \
"kernel_load=0xa000\0"  \
"kernel_size=0x280\0"   \
-   "mcinitcmd=sf probe 0:0;sf read 0xa0a0 0xa0 0x10;"  \
+   "mcinitcmd=sf probe 0:0;sf read 0xa0a0 0xa0 0x20;"  \
"sf read 0xa064 0x64 0x4000; esbc_validate 0xa064;" \
"sf read 0xa0e0 0xe0 0x10;" \
"sf read 0xa068 0x68 0x4000;esbc_validate 0xa068;"  \
@@ -396,11 +396,11 @@ unsigned long get_board_ddr_clk(void);
 #else /* if !(CONFIG_NXP_ESBC) */
 #ifdef CONFIG_TFABOOT
 #define QSPI_MC_INIT_CMD   \
-   "sf probe 0:0;sf read 0x8000 0xA0 0x10;"\
+   "sf probe 0:0;sf read 0x8000 0xA0 0x20;"\
"sf read 0x8010 0xE0 0x10;" \
"fsl_mc start mc 0x8000 0x8010\0"
 #define SD_MC_INIT_CMD \
-   "mmcinfo;mmc read 0x8000 0x5000 0x800;"  \
+   "mmcinfo;mmc read 0x8000 0x5000 0x1000;"  \
"mmc read 0x8010 0x7000 0x800;" \
"fsl_mc start mc 0x8000 0x8010\0"
 #define IFC_MC_INIT_CMD\
@@ -422,7 +422,7 @@ unsigned long get_board_ddr_clk(void);
"kernel_load=0xa000\0"  \
"kernel_size=0x280\0"   \
"kernel_size_sd=0x14000\0"   \
-   "mcinitcmd=sf probe 0:0;sf read 0x8000 0xA0 0x10;"  \
+   "mcinitcmd=sf probe 0:0;sf read 0x8000 0xA0 0x20;"  \
"sf read 0x8010 0xE0 0x10;" \
"fsl_mc start mc 0x8000 0x8010\0"   \
"mcmemsize=0x7000 \0"   \
@@ -481,7 +481,7 @@ unsigned long get_board_ddr_clk(void);
"kernel_start=0x100\0"  \
"kernel_load=0xa000\0"  \
"kernel_size=0x280\0"   \
-   "mcinitcmd=sf probe 0:0;sf read 0x8000 0xA0 0x10;"  \
+   "mcinitcmd=sf probe 0:0;sf read 0x8000 0xA0 0x20;"  \
"sf read 0x8010 0xE0 0x10;" \
"fsl_mc start mc 0x8000 0x8010\0"   \
"mcmemsize=0x7000 \0"
@@ -499,7 +499,7 @@ unsigned long get_board_ddr_clk(void);
"kernel_start=0x8000\0"  \
"kernel_load=0xa000\0"  \
"kernel_size=0x14000\0"   \
-   "mcinitcmd=mmcinfo;mmc read 0x8000 0x5000 0x800;"  \
+   "mcinitcmd=mmcinfo;mmc read 0x8000 0x5000 0x1000;"  \
"mmc read 0x8010 0x7000 0x800;" \
"fsl_mc start mc 0x8000 0x8010\0"   \
"mcmemsize=0x7000 \0"
-- 
2.17.1



[PATCH] spl: Align device tree blob address at 8-byte boundary

2021-07-11 Thread Bin Meng
Since libfdt v1.6.1, a new requirement on the device tree address via:

  commit 5e735860c478 ("libfdt: Check for 8-byte address alignment in 
fdt_ro_probe_()")

must be met that the device tree must be loaded in to memory at an
8-byte aligned address.

Signed-off-by: Bin Meng 
---

 common/spl/spl_fit.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index f41abca0cc..9baf6aca9f 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -374,6 +374,12 @@ static int spl_fit_append_fdt(struct spl_image_info 
*spl_image,
 */
image_info.load_addr = spl_image->load_addr + spl_image->size;
 
+   /*
+* Since libfdt v1.6.1, the device tree must be loaded in to memory
+* at an 8-byte aligned address.
+*/
+   image_info.load_addr = roundup(image_info.load_addr, 8);
+
/* Figure out which device tree the board wants to use */
node = spl_fit_get_image_node(ctx, FIT_FDT_PROP, index++);
if (node < 0) {
-- 
2.25.1



Re: [PATCH 3/8] dtoc: Allow multiple warnings for a driver

2021-07-11 Thread Simon Glass
On Sun, 11 Jul 2021 at 17:00, Simon Glass  wrote:
>
> Hi Simon,
>
> On 7/4/21 3:19 PM, Simon Glass wrote:
> > At present we show when a driver is missing but this is not always that
> > useful. There are various reasons way a driver may appear to be missing,
>
> Did you mean "why" instead of "way"?
>
> > such as a parse error in the source code or a missing field in the driver
> > declaration.
> >
> > Update the implementation to record all warnings for each driver, showing
> > only those which relate to drivers that are actually used. This avoids
> > spamming the user with warnings related to a driver for a different board.
> >
> > Signed-off-by: Simon Glass 
> > ---
> >
> >   tools/dtoc/src_scan.py | 24 
> >   1 file changed, 20 insertions(+), 4 deletions(-)
>
> Reviewed-by: Walter Lozano 
>
> Thank you, it is indeed something worth to be added!
>
> Walter
>
> >
> Applied to u-boot-dm, thanks!

(Note: I fixed the nits in this patch and other other one when
applying...thanks for the review!)


[PATCH v3 7/7] vpl: Add Kconfig options for VPL

2021-07-11 Thread Simon Glass
Add VPL versions of commonly used Kconfig options.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 Kconfig  |  10 +++
 arch/sandbox/Kconfig |   8 ++
 common/Kconfig   |  67 ++
 common/spl/Kconfig   | 189 +++
 drivers/clk/Kconfig  |  10 +++
 drivers/core/Makefile|   2 +-
 drivers/gpio/Kconfig |  11 +++
 drivers/i2c/Kconfig  |  11 +++
 drivers/misc/Kconfig |  19 
 drivers/pinctrl/Kconfig  |  18 +++-
 drivers/rtc/Kconfig  |   9 ++
 drivers/serial/Kconfig   |  20 +
 drivers/sysreset/Kconfig |  10 +++
 drivers/timer/Kconfig|  10 +++
 lib/Kconfig  |  62 +
 15 files changed, 453 insertions(+), 3 deletions(-)

diff --git a/Kconfig b/Kconfig
index f8c1a77bedb..8cd8c59d045 100644
--- a/Kconfig
+++ b/Kconfig
@@ -264,6 +264,16 @@ config TPL_SYS_MALLOC_F_LEN
  particular needs this to operate, so that it can allocate the
  initial serial device and any others that are needed.
 
+config VPL_SYS_MALLOC_F_LEN
+   hex "Size of malloc() pool in VPL before relocation"
+   depends on SYS_MALLOC_F && VPL
+   default SYS_MALLOC_F_LEN
+   help
+ Before relocation, memory is very limited on many platforms. Still,
+ we can provide a small malloc() pool if needed. Driver model in
+ particular needs this to operate, so that it can allocate the
+ initial serial device and any others that are needed.
+
 menuconfig EXPERT
bool "Configure standard U-Boot features (expert users)"
default y
diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig
index f83282d9d56..e504b08b951 100644
--- a/arch/sandbox/Kconfig
+++ b/arch/sandbox/Kconfig
@@ -29,6 +29,14 @@ config SANDBOX_SPL
bool "Enable SPL for sandbox"
select SUPPORT_SPL
 
+config SANDBOX_TPL
+   bool "Enable TPL for sandbox"
+   select SUPPORT_TPL
+
+config SANDBOX_VPL
+   bool "Enable VPL for sandbox"
+   select SUPPORT_VPL
+
 config SYS_CONFIG_NAME
default "sandbox_spl" if SANDBOX_SPL
default "sandbox" if !SANDBOX_SPL
diff --git a/common/Kconfig b/common/Kconfig
index 26496f9a2e7..2a7f08af1dc 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -81,6 +81,15 @@ config TPL_LOGLEVEL
int
default LOGLEVEL
 
+config VPL_LOGLEVEL
+   int "loglevel for VPL"
+   default LOGLEVEL
+   help
+ All Messages with a loglevel smaller than the console loglevel will
+ be compiled in to VPL. See LOGLEVEL for a list of available log
+ levels. Setting this to a value above 4 may increase the code size
+ significantly.
+
 config SILENT_CONSOLE
bool "Support a silent console"
help
@@ -254,6 +263,15 @@ config LOG
 
 if LOG
 
+config VPL_LOG
+   bool "Enable logging support in VPL"
+   depends on LOG
+   help
+ This enables support for logging of status and debug messages. These
+ can be displayed on the console, recorded in a memory buffer, or
+ discarded if not needed. Logging supports various categories and
+ levels of severity.
+
 config LOG_MAX_LEVEL
int "Maximum log level to record"
default 6
@@ -415,6 +433,47 @@ config TPL_LOG_CONSOLE
 
 endif
 
+config VPL_LOG
+   bool "Enable logging support in VPL"
+   depends on LOG
+   help
+ This enables support for logging of status and debug messages. These
+ can be displayed on the console, recorded in a memory buffer, or
+ discarded if not needed. Logging supports various categories and
+ levels of severity.
+
+if VPL_LOG
+
+config VPL_LOG_MAX_LEVEL
+   int "Maximum log level to record in VPL"
+   default 3
+   help
+ This selects the maximum log level that will be recorded. Any value
+ higher than this will be ignored. If possible log statements below
+ this level will be discarded at build time. Levels:
+
+   0 - emergency
+   1 - alert
+   2 - critical
+   3 - error
+   4 - warning
+   5 - note
+   6 - info
+   7 - debug
+   8 - debug content
+   9 - debug hardware I/O
+
+config VPL_LOG_CONSOLE
+   bool "Allow log output to the console in VPL"
+   default y
+   help
+ Enables a log driver which writes log records to the console.
+ Generally the console is the serial port or LCD display. Only the
+ log message is shown - other details like level, category, file and
+ line number are omitted.
+
+endif
+
 config LOG_ERROR_RETURN
bool "Log all functions which return an error"
help
@@ -711,6 +770,14 @@ config TPL_BLOBLIST
  This enables a bloblist in TPL. The bloblist is set up in TPL and
  passed to SPL and U-Boot proper.
 
+config VPL_BLOBLIST
+   bool "Support for a bloblist in VPL"
+   depends on BLOBLIST
+   

[PATCH v3 6/7] Introduce Verifying Program Loader (VPL)

2021-07-11 Thread Simon Glass
Add support for VPL, a new phase of U-Boot. This runs after TPL. It is
responsible for selecting which SPL binary to run, based on a
verified-boot process.

Signed-off-by: Simon Glass 
---

Changes in v3:
- Move VPL Kconfig options to a separate patch
- Add full build support for VPL

Changes in v2:
- Add some more VPL Kconfig options

 Makefile  | 13 +
 common/spl/Kconfig| 15 ++-
 common/spl/spl.c  | 25 ++---
 doc/develop/spl.rst   |  6 +-
 include/bootstage.h   |  2 ++
 include/linux/kconfig.h   |  3 +++
 include/spl.h | 20 +---
 scripts/Kbuild.include|  4 
 scripts/Makefile.autoconf | 12 
 scripts/Makefile.build|  4 
 scripts/Makefile.lib  |  5 +
 scripts/Makefile.spl  | 35 ++-
 12 files changed, 127 insertions(+), 17 deletions(-)

diff --git a/Makefile b/Makefile
index f7f62979ae2..b2ba80ca5de 100644
--- a/Makefile
+++ b/Makefile
@@ -946,6 +946,7 @@ INPUTS-$(CONFIG_SPL_FRAMEWORK) += u-boot.img
 endif
 endif
 INPUTS-$(CONFIG_TPL) += tpl/u-boot-tpl.bin
+INPUTS-$(CONFIG_VPL) += vpl/u-boot-vpl.bin
 INPUTS-$(CONFIG_OF_SEPARATE) += u-boot.dtb
 INPUTS-$(CONFIG_BINMAN_STANDALONE_FDT) += u-boot.dtb
 ifeq ($(CONFIG_SPL_FRAMEWORK),y)
@@ -1986,6 +1987,18 @@ tpl/u-boot-tpl.bin: tools prepare \
$(Q)$(MAKE) obj=tpl -f $(srctree)/scripts/Makefile.spl all
$(TPL_SIZE_CHECK)
 
+tpl/u-boot-tpl: tools prepare \
+   $(if 
$(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_OF_HOSTFILE)$(CONFIG_TPL_OF_PLATDATA),dts/dt.dtb)
+   $(Q)$(MAKE) obj=tpl -f $(srctree)/scripts/Makefile.spl all
+
+vpl/u-boot-vpl.bin: vpl/u-boot-vpl
+   @:
+   $(VPL_SIZE_CHECK)
+
+vpl/u-boot-vpl: tools prepare \
+   $(if 
$(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_OF_HOSTFILE)$(CONFIG_VPL_OF_PLATDATA),dts/dt.dtb)
+   $(Q)$(MAKE) obj=vpl -f $(srctree)/scripts/Makefile.spl all
+
 TAG_SUBDIRS := $(patsubst %,$(srctree)/%,$(u-boot-dirs) include)
 
 FIND := find
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 10384b835b2..0443197cd55 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -1,4 +1,4 @@
-menu "SPL / TPL"
+menu "SPL / TPL / VPL"
 
 config SUPPORT_SPL
bool
@@ -6,6 +6,9 @@ config SUPPORT_SPL
 config SUPPORT_TPL
bool
 
+config SUPPORT_VPL
+   bool
+
 config SPL_DFU_NO_RESET
bool
 
@@ -280,6 +283,16 @@ config SPL_READ_ONLY
  writeable memory) of anything it wants to modify, such as
  device-private data.
 
+config TPL_SEPARATE_BSS
+   bool "BSS section is in a different memory region from text"
+   default y if SPL_SEPARATE_BSS
+   help
+ Some platforms need a large BSS region in TPL and can provide this
+ because RAM is already set up. In this case BSS can be moved to RAM.
+ This option should then be enabled so that the correct device tree
+ location is used. Normally we put the device tree at the end of BSS
+ but with this option enabled, it goes at _image_binary_end.
+
 config SPL_BANNER_PRINT
bool "Enable output of the SPL banner 'U-Boot SPL ...'"
default y
diff --git a/common/spl/spl.c b/common/spl/spl.c
index eba77cace6d..27ed855c018 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -55,6 +55,11 @@ binman_sym_declare(ulong, spl, image_pos);
 binman_sym_declare(ulong, spl, size);
 #endif
 
+#ifdef CONFIG_VPL
+binman_sym_declare(ulong, vpl, image_pos);
+binman_sym_declare(ulong, vpl, size);
+#endif
+
 /* Define board data structure */
 static struct bd_info bdata __attribute__ ((section(".data")));
 
@@ -139,21 +144,33 @@ void spl_fixup_fdt(void *fdt_blob)
 
 ulong spl_get_image_pos(void)
 {
-   return spl_phase() == PHASE_TPL ?
+#ifdef CONFIG_VPL
+   if (spl_next_phase() == PHASE_VPL)
+   return binman_sym(ulong, vpl, image_pos);
+#endif
+   return spl_next_phase() == PHASE_SPL ?
binman_sym(ulong, spl, image_pos) :
binman_sym(ulong, u_boot_any, image_pos);
 }
 
 ulong spl_get_image_size(void)
 {
-   return spl_phase() == PHASE_TPL ?
+#ifdef CONFIG_VPL
+   if (spl_next_phase() == PHASE_VPL)
+   return binman_sym(ulong, vpl, size);
+#endif
+   return spl_next_phase() == PHASE_SPL ?
binman_sym(ulong, spl, size) :
binman_sym(ulong, u_boot_any, size);
 }
 
 ulong spl_get_image_text_base(void)
 {
-   return spl_phase() == PHASE_TPL ? CONFIG_SPL_TEXT_BASE :
+#ifdef CONFIG_VPL
+   if (spl_next_phase() == PHASE_VPL)
+   return CONFIG_VPL_TEXT_BASE;
+#endif
+   return spl_next_phase() == PHASE_SPL ? CONFIG_SPL_TEXT_BASE :
CONFIG_SYS_TEXT_BASE;
 }
 
@@ -430,6 +447,8 @@ static enum bootstage_id get_bootstage_id(bool start)
 
if (IS_ENABLED(CONFIG_TPL_BUILD) && phase == PHASE_TPL)
return start ? 

[PATCH v3 5/7] binman: Add VPL support

2021-07-11 Thread Simon Glass
Add support for U-Boot's Verifying Program Loader phase.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 tools/binman/etype/u_boot_vpl.py   |  42 
 tools/binman/etype/u_boot_vpl_bss_pad.py   |  44 +
 tools/binman/etype/u_boot_vpl_dtb.py   |  28 ++
 tools/binman/etype/u_boot_vpl_expanded.py  |  45 +
 tools/binman/etype/u_boot_vpl_nodtb.py |  42 
 tools/binman/ftest.py  | 110 +
 tools/binman/state.py  |   3 +-
 tools/binman/test/082_fdt_update_all.dts   |   2 +
 tools/binman/test/201_u_boot_vpl.dts   |  11 +++
 tools/binman/test/202_u_boot_vpl_nodtb.dts |  13 +++
 tools/binman/test/203_fdt_incl_vpl.dts |  13 +++
 tools/binman/test/204_vpl_bss_pad.dts  |  17 
 12 files changed, 348 insertions(+), 22 deletions(-)
 create mode 100644 tools/binman/etype/u_boot_vpl.py
 create mode 100644 tools/binman/etype/u_boot_vpl_bss_pad.py
 create mode 100644 tools/binman/etype/u_boot_vpl_dtb.py
 create mode 100644 tools/binman/etype/u_boot_vpl_expanded.py
 create mode 100644 tools/binman/etype/u_boot_vpl_nodtb.py
 create mode 100644 tools/binman/test/201_u_boot_vpl.dts
 create mode 100644 tools/binman/test/202_u_boot_vpl_nodtb.dts
 create mode 100644 tools/binman/test/203_fdt_incl_vpl.dts
 create mode 100644 tools/binman/test/204_vpl_bss_pad.dts

diff --git a/tools/binman/etype/u_boot_vpl.py b/tools/binman/etype/u_boot_vpl.py
new file mode 100644
index 000..9daaca4f6fd
--- /dev/null
+++ b/tools/binman/etype/u_boot_vpl.py
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2016 Google, Inc
+# Written by Simon Glass 
+#
+# Entry-type module for vpl/u-boot-vpl.bin
+#
+
+from binman import elf
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
+
+class Entry_u_boot_vpl(Entry_blob):
+"""U-Boot VPL binary
+
+Properties / Entry arguments:
+- filename: Filename of u-boot-vpl.bin (default 'vpl/u-boot-vpl.bin')
+
+This is the U-Boot VPL (Verifying Program Loader) binary. This is a small
+binary which loads before SPL, typically into on-chip SRAM. It is
+responsible for locating, loading and jumping to SPL, the next-stage
+loader. Note that VPL is not relocatable so must be loaded to the correct
+address in SRAM, or written to run from the correct address if direct
+flash execution is possible (e.g. on x86 devices).
+
+SPL can access binman symbols at runtime. See:
+
+'Access to binman entry offsets at run time (symbols)'
+
+in the binman README for more information.
+
+The ELF file 'vpl/u-boot-vpl' must also be available for this to work, 
since
+binman uses that to look up symbols to write into the VPL binary.
+"""
+def __init__(self, section, etype, node):
+super().__init__(section, etype, node)
+self.elf_fname = 'vpl/u-boot-vpl'
+
+def GetDefaultFilename(self):
+return 'vpl/u-boot-vpl.bin'
+
+def WriteSymbols(self, section):
+elf.LookupAndWriteSymbols(self.elf_fname, self, section.GetImage())
diff --git a/tools/binman/etype/u_boot_vpl_bss_pad.py 
b/tools/binman/etype/u_boot_vpl_bss_pad.py
new file mode 100644
index 000..073833b3d0d
--- /dev/null
+++ b/tools/binman/etype/u_boot_vpl_bss_pad.py
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright 2021 Google LLC
+# Written by Simon Glass 
+#
+# Entry-type module for BSS padding for vpl/u-boot-vpl.bin. This padding
+# can be added after the VPL binary to ensure that anything concatenated
+# to it will appear to VPL to be at the end of BSS rather than the start.
+#
+
+from binman import elf
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
+from patman import tools
+
+class Entry_u_boot_vpl_bss_pad(Entry_blob):
+"""U-Boot VPL binary padded with a BSS region
+
+Properties / Entry arguments:
+None
+
+This holds the padding added after the VPL binary to cover the BSS (Block
+Started by Symbol) region. This region holds the various variables used by
+VPL. It is set to 0 by VPL when it starts up. If you want to append data to
+the VPL image (such as a device tree file), you must pad out the BSS region
+to avoid the data overlapping with U-Boot variables. This entry is useful 
in
+that case. It automatically pads out the entry size to cover both the code,
+data and BSS.
+
+The contents of this entry will a certain number of zero bytes, determined
+by __bss_size
+
+The ELF file 'vpl/u-boot-vpl' must also be available for this to work, 
since
+binman uses that to look up the BSS address.
+"""
+def __init__(self, section, etype, node):
+super().__init__(section, etype, node)
+
+def ObtainContents(self):
+fname = tools.GetInputFilename('vpl/u-boot-vpl')
+bss_size = elf.GetSymbolAddress(fname, '__bss_size')
+if not bss_size:
+

[PATCH v3 4/7] spl: Move TPL_HASH_SUPPORT down next to other TPL options

2021-07-11 Thread Simon Glass
This option should be next to other TPL options, not next to the SPL hash
option, so it matches the placement conventions in this file.

Move it.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 common/spl/Kconfig | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index fa80524cfb2..10384b835b2 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -519,17 +519,6 @@ config SPL_HASH_SUPPORT
  this option to build system-specific drivers for hash acceleration
  as part of an SPL build.
 
-config TPL_HASH_SUPPORT
-   bool "Support hashing drivers in TPL"
-   depends on TPL
-   select SHA1
-   select SHA256
-   help
- Enable hashing drivers in SPL. These drivers can be used to
- accelerate secure boot processing in secure applications. Enable
- this option to build system-specific drivers for hash acceleration
- as part of an SPL build.
-
 config SPL_DMA
bool "Support DMA drivers"
help
@@ -1491,6 +1480,17 @@ config TPL_GPIO_SUPPORT
  for example. Enable this option to build the drivers in
  drivers/gpio as part of an TPL build.
 
+config TPL_HASH_SUPPORT
+   bool "Support hashing drivers in TPL"
+   depends on TPL
+   select SHA1
+   select SHA256
+   help
+ Enable hashing drivers in SPL. These drivers can be used to
+ accelerate secure boot processing in secure applications. Enable
+ this option to build system-specific drivers for hash acceleration
+ as part of an SPL build.
+
 config TPL_I2C_SUPPORT
bool "Support I2C"
help
-- 
2.32.0.93.g670b81a890-goog



[PATCH v3 3/7] test: Tidy up test building with SPL

2021-07-11 Thread Simon Glass
We can in principle add tests to any SPL build, e.g. TPL or VPL. Update
the build rules to handle this.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 Makefile | 2 +-
 scripts/Makefile.spl | 2 +-
 test/test-main.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 0d3192cebad..f7f62979ae2 100644
--- a/Makefile
+++ b/Makefile
@@ -841,7 +841,7 @@ libs-$(CONFIG_API) += api/
 ifdef CONFIG_POST
 libs-y += post/
 endif
-libs-$(CONFIG_UNIT_TEST) += test/
+libs-$(CONFIG_$(SPL_TPL_)UNIT_TEST) += test/
 libs-$(CONFIG_UT_ENV) += test/env/
 libs-$(CONFIG_UT_OPTEE) += test/optee/
 libs-$(CONFIG_UT_OVERLAY) += test/overlay/
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 5be1a9ba1b1..ffe919dafab 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -109,7 +109,7 @@ libs-y += dts/
 libs-y += fs/
 libs-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/
 libs-$(CONFIG_SPL_NET_SUPPORT) += net/
-libs-$(CONFIG_SPL_UNIT_TEST) += test/
+libs-$(CONFIG_$(SPL_TPL_)UNIT_TEST) += test/
 
 head-y := $(addprefix $(obj)/,$(head-y))
 libs-y := $(addprefix $(obj)/,$(libs-y))
diff --git a/test/test-main.c b/test/test-main.c
index 7afe8741cf9..3cdf6849c57 100644
--- a/test/test-main.c
+++ b/test/test-main.c
@@ -45,7 +45,7 @@ static int dm_test_pre_run(struct unit_test_state *uts)
uts->force_fail_alloc = false;
uts->skip_post_probe = false;
gd->dm_root = NULL;
-   if (IS_ENABLED(CONFIG_UT_DM) && !CONFIG_IS_ENABLED(OF_PLATDATA))
+   if (CONFIG_IS_ENABLED(UT_DM) && !CONFIG_IS_ENABLED(OF_PLATDATA))
memset(dm_testdrv_op_count, '\0', sizeof(dm_testdrv_op_count));
arch_reset_for_test();
 
-- 
2.32.0.93.g670b81a890-goog



[PATCH v3 1/7] doc: Convert SPL documentation to ReST

2021-07-11 Thread Simon Glass
Move this documentation over to .rst format.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 doc/develop/index.rst   |  1 +
 doc/{README.SPL => develop/spl.rst} | 36 +++--
 2 files changed, 20 insertions(+), 17 deletions(-)
 rename doc/{README.SPL => develop/spl.rst} (87%)

diff --git a/doc/develop/index.rst b/doc/develop/index.rst
index 3edffbc6373..79f345c9331 100644
--- a/doc/develop/index.rst
+++ b/doc/develop/index.rst
@@ -14,6 +14,7 @@ Implementation
global_data
logging
menus
+   spl
uefi/index
version
 
diff --git a/doc/README.SPL b/doc/develop/spl.rst
similarity index 87%
rename from doc/README.SPL
rename to doc/develop/spl.rst
index 2beb6d8f11b..1165f95335f 100644
--- a/doc/README.SPL
+++ b/doc/develop/spl.rst
@@ -20,19 +20,19 @@ u-boot-spl.map.
 A config option named CONFIG_SPL_BUILD is enabled by Kconfig for SPL.
 Source files can therefore be compiled for SPL with different settings.
 
-For example:
+For example::
 
-ifeq ($(CONFIG_SPL_BUILD),y)
-obj-y += board_spl.o
-else
-obj-y += board.o
-endif
+   ifeq ($(CONFIG_SPL_BUILD),y)
+   obj-y += board_spl.o
+   else
+   obj-y += board.o
+   endif
 
-obj-$(CONFIG_SPL_BUILD) += foo.o
+   obj-$(CONFIG_SPL_BUILD) += foo.o
 
-#ifdef CONFIG_SPL_BUILD
-   foo();
-#endif
+   #ifdef CONFIG_SPL_BUILD
+   foo();
+   #endif
 
 
 The building of SPL images can be enabled by CONFIG_SPL option in Kconfig.
@@ -71,11 +71,13 @@ Device tree
 The U-Boot device tree is filtered by the fdtgrep tools during the build
 process to generate a much smaller device tree used in SPL (spl/u-boot-spl.dtb)
 with:
+
 - the mandatory nodes (/alias, /chosen, /config)
 - the nodes with one pre-relocation property:
   'u-boot,dm-pre-reloc' or 'u-boot,dm-spl'
 
 fdtgrep is also used to remove:
+
 - the properties defined in CONFIG_OF_SPL_REMOVE_PROPS
 - all the pre-relocation properties
   ('u-boot,dm-pre-reloc', 'u-boot,dm-spl' and 'u-boot,dm-tpl')
@@ -98,14 +100,14 @@ stack usage at various points in run sequence of SPL.  The 
-fstack-usage option
 to gcc will produce '.su' files (such as arch/arm/cpu/armv7/syslib.su) that
 will give stack usage information and cflow can construct program flow.
 
-Must have gcc 4.6 or later, which supports -fstack-usage
+Must have gcc 4.6 or later, which supports -fstack-usage:
 
-1) Build normally
-2) Perform the following shell command to generate a list of C files used in
-SPL:
-$ find spl -name '*.su' | sed -e 's:^spl/::' -e 's:[.]su$:.c:' > used-spl.list
-3) Execute cflow:
-$ cflow --main=board_init_r `cat used-spl.list` 2>&1 | $PAGER
+#. Build normally
+#. Perform the following shell command to generate a list of C files used in
+   SPL:
+#. `find spl -name '*.su' | sed -e 's:^spl/::' -e 's:[.]su$:.c:' > 
used-spl.list`
+#. Execute cflow:
+   `$ cflow --main=board_init_r $(cat used-spl.list) 2>&1 | $PAGER`
 
 cflow will spit out a number of warnings as it does not parse
 the config files and picks functions based on #ifdef.  Parsing the '.i'
-- 
2.32.0.93.g670b81a890-goog



[PATCH v3 2/7] doc: Expand SPL docs to explain the phase and config

2021-07-11 Thread Simon Glass
Add a bit more information about how to use SPL.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 doc/develop/spl.rst | 59 +++--
 1 file changed, 36 insertions(+), 23 deletions(-)

diff --git a/doc/develop/spl.rst b/doc/develop/spl.rst
index 1165f95335f..c2a29a8c0a4 100644
--- a/doc/develop/spl.rst
+++ b/doc/develop/spl.rst
@@ -42,29 +42,42 @@ configured by defining CONFIG_SPL_TEXT_BASE. The linker 
script has to be
 defined with CONFIG_SPL_LDSCRIPT.
 
 To support generic U-Boot libraries and drivers in the SPL binary one can
-optionally define CONFIG_SPL_XXX_SUPPORT. Currently following options
-are supported:
-
-CONFIG_SPL_LIBCOMMON_SUPPORT (common/libcommon.o)
-CONFIG_SPL_LIBDISK_SUPPORT (disk/libdisk.o)
-CONFIG_SPL_I2C_SUPPORT (drivers/i2c/libi2c.o)
-CONFIG_SPL_GPIO_SUPPORT (drivers/gpio/libgpio.o)
-CONFIG_SPL_MMC_SUPPORT (drivers/mmc/libmmc.o)
-CONFIG_SPL_SERIAL_SUPPORT (drivers/serial/libserial.o)
-CONFIG_SPL_SPI_FLASH_SUPPORT (drivers/mtd/spi/libspi_flash.o)
-CONFIG_SPL_SPI_SUPPORT (drivers/spi/libspi.o)
-CONFIG_SPL_FS_FAT (fs/fat/libfat.o)
-CONFIG_SPL_FS_EXT4
-CONFIG_SPL_LIBGENERIC_SUPPORT (lib/libgeneric.o)
-CONFIG_SPL_POWER_SUPPORT (drivers/power/libpower.o)
-CONFIG_SPL_NAND_SUPPORT (drivers/mtd/nand/raw/libnand.o)
-CONFIG_SPL_DRIVERS_MISC_SUPPORT (drivers/misc)
-CONFIG_SPL_DMA (drivers/dma/libdma.o)
-CONFIG_SPL_POST_MEM_SUPPORT (post/drivers/memory.o)
-CONFIG_SPL_NAND_LOAD (drivers/mtd/nand/raw/nand_spl_load.o)
-CONFIG_SPL_SPI_LOAD (drivers/mtd/spi/spi_spl_load.o)
-CONFIG_SPL_RAM_DEVICE (common/spl/spl.c)
-CONFIG_SPL_WATCHDOG_SUPPORT (drivers/watchdog/libwatchdog.o)
+optionally define CONFIG_SPL_XXX_SUPPORT (or CONFIG_SPL_XXX_SUPPORT for older
+options).
+
+Adding SPL-specific code
+
+
+To check whether a feature is enabled, use CONFIG_IS_ENABLED()::
+
+  if (CONFIG_IS_ENABLED(CLK))
+  ...
+
+This checks CONFIG_CLK for the main build, CONFIG_SPL_CLK for the SPL build,
+CONFIG_TPL_CLK for the TPL build, etc.
+
+U-Boot Phases
+-
+
+U-Boot boots through the following phases:
+
+TPL
+   Very early init, as tiny as possible. This loads SPL.
+
+SPL
+   Secondary program loader. Sets up SDRAM and loads U-Boot proper. It may also
+   load other firmware components.
+
+U-Boot
+   U-Boot proper, containing the command line and boot logic.
+
+
+Checking the boot phase
+---
+
+Use `spl_phase()` to find the current U-Boot phase, e.g. `PHASE_SPL`. You can
+also find the previous and next phase and get the phase name.
+
 
 Device tree
 ---
-- 
2.32.0.93.g670b81a890-goog



[PATCH v3 0/7] vpl: Introduce a verifying program loader

2021-07-11 Thread Simon Glass
U-Boot provides a verified-boot feature based around FIT, but there is
no standard way of implementing it for a board. At present the various
required pieces must be built up separately, to produce a working
implementation. In particular, there is no built-in support for selecting
A/B boot or recovery mode.

This series introduces VPL, a verified program loader. Its purpose is to
run the verified-boot process and decide which SPL binary should be run.
Adding VPL into the boot flow provides a standard way of implementing
verified boot. So far, only the phase itself is added along with some
Kconfig options. The next step is to create a build for sandbox.

Changes in v3:
- Move VPL Kconfig options to a separate patch
- Add full build support for VPL

Changes in v2:
- Add some more VPL Kconfig options

Simon Glass (7):
  doc: Convert SPL documentation to ReST
  doc: Expand SPL docs to explain the phase and config
  test: Tidy up test building with SPL
  spl: Move TPL_HASH_SUPPORT down next to other TPL options
  binman: Add VPL support
  Introduce Verifying Program Loader (VPL)
  vpl: Add Kconfig options for VPL

 Kconfig|  10 +
 Makefile   |  15 +-
 arch/sandbox/Kconfig   |   8 +
 common/Kconfig |  67 ++
 common/spl/Kconfig | 226 +++--
 common/spl/spl.c   |  25 ++-
 doc/develop/index.rst  |   1 +
 doc/{README.SPL => develop/spl.rst}|  99 +
 drivers/clk/Kconfig|  10 +
 drivers/core/Makefile  |   2 +-
 drivers/gpio/Kconfig   |  11 +
 drivers/i2c/Kconfig|  11 +
 drivers/misc/Kconfig   |  19 ++
 drivers/pinctrl/Kconfig|  18 +-
 drivers/rtc/Kconfig|   9 +
 drivers/serial/Kconfig |  20 ++
 drivers/sysreset/Kconfig   |  10 +
 drivers/timer/Kconfig  |  10 +
 include/bootstage.h|   2 +
 include/linux/kconfig.h|   3 +
 include/spl.h  |  20 +-
 lib/Kconfig|  62 ++
 scripts/Kbuild.include |   4 +
 scripts/Makefile.autoconf  |  12 ++
 scripts/Makefile.build |   4 +
 scripts/Makefile.lib   |   5 +
 scripts/Makefile.spl   |  37 +++-
 test/test-main.c   |   2 +-
 tools/binman/etype/u_boot_vpl.py   |  42 
 tools/binman/etype/u_boot_vpl_bss_pad.py   |  44 
 tools/binman/etype/u_boot_vpl_dtb.py   |  28 +++
 tools/binman/etype/u_boot_vpl_expanded.py  |  45 
 tools/binman/etype/u_boot_vpl_nodtb.py |  42 
 tools/binman/ftest.py  | 110 --
 tools/binman/state.py  |   3 +-
 tools/binman/test/082_fdt_update_all.dts   |   2 +
 tools/binman/test/201_u_boot_vpl.dts   |  11 +
 tools/binman/test/202_u_boot_vpl_nodtb.dts |  13 ++
 tools/binman/test/203_fdt_incl_vpl.dts |  13 ++
 tools/binman/test/204_vpl_bss_pad.dts  |  17 ++
 40 files changed, 997 insertions(+), 95 deletions(-)
 rename doc/{README.SPL => develop/spl.rst} (61%)
 create mode 100644 tools/binman/etype/u_boot_vpl.py
 create mode 100644 tools/binman/etype/u_boot_vpl_bss_pad.py
 create mode 100644 tools/binman/etype/u_boot_vpl_dtb.py
 create mode 100644 tools/binman/etype/u_boot_vpl_expanded.py
 create mode 100644 tools/binman/etype/u_boot_vpl_nodtb.py
 create mode 100644 tools/binman/test/201_u_boot_vpl.dts
 create mode 100644 tools/binman/test/202_u_boot_vpl_nodtb.dts
 create mode 100644 tools/binman/test/203_fdt_incl_vpl.dts
 create mode 100644 tools/binman/test/204_vpl_bss_pad.dts

-- 
2.32.0.93.g670b81a890-goog



[PATCH] arm: vexpress64: juno: Enable distro_bootcmd functionality

2021-07-11 Thread Andre Przywara
The ARM Juno boards can be used as somewhat decent machines to run
off-the-shelf distributions, with USB, SATA, GBit Ethernet and 8GB of
DRAM.

With stable DTs in the board's NOR flash this would work really nicely,
however the default boot command is to fetch a kernel and an initrd from
the on-board NOR flash, which sounds somewhat embedded.

Include the config_distro_bootcmd.h header and define the available
devices (starting with USB, to catch USB installer sticks) to make
distributions and UEFI work out of the box.
The NOR flash kernel functionality is still preserved as the last
resort, should all other methods fail.

Signed-off-by: Andre Przywara 
---
 include/configs/vexpress_aemv8a.h | 58 ++-
 1 file changed, 34 insertions(+), 24 deletions(-)

diff --git a/include/configs/vexpress_aemv8a.h 
b/include/configs/vexpress_aemv8a.h
index 7318fb6c585..54b5967a89d 100644
--- a/include/configs/vexpress_aemv8a.h
+++ b/include/configs/vexpress_aemv8a.h
@@ -126,6 +126,39 @@
 
 /* Initial environment variables */
 #ifdef CONFIG_TARGET_VEXPRESS64_JUNO
+/* Copy the kernel and FDT to DRAM memory and boot */
+#define BOOTENV_DEV_AFS(devtypeu, devtypel, instance) \
+   "bootcmd_afs="  \
+   "afs load ${kernel_name} ${kernel_addr_r} ;"\
+   "if test $? -eq 1; then "\
+   "  echo Loading ${kernel_alt_name} instead of ${kernel_name}; "\
+   "  afs load ${kernel_alt_name} ${kernel_addr_r};"\
+   "fi ; "\
+   "afs load ${fdtfile} ${fdt_addr_r} ;"\
+   "if test $? -eq 1; then "\
+   "  echo Loading ${fdt_alt_name} instead of ${fdtfile}; "\
+   "  afs load ${fdt_alt_name} ${fdt_addr_r}; "\
+   "fi ; "\
+   "fdt addr ${fdt_addr_r}; fdt resize; " \
+   "if afs load  ${ramdisk_name} ${ramdisk_addr_r} ; "\
+   "then "\
+   "  setenv ramdisk_param ${ramdisk_addr_r}; "\
+   "else "\
+   "  setenv ramdisk_param -; "\
+   "fi ; " \
+   "booti ${kernel_addr_r} ${ramdisk_param} ${fdt_addr_r}\0"
+#define BOOTENV_DEV_NAME_AFS(devtypeu, devtypel, instance) "afs "
+
+#define BOOT_TARGET_DEVICES(func)  \
+   func(USB, usb, 0)   \
+   func(SATA, sata, 0) \
+   func(SATA, sata, 1) \
+   func(PXE, pxe, na)  \
+   func(DHCP, dhcp, na)\
+   func(AFS, afs, na)
+
+#include 
+
 /*
  * Defines where the kernel and FDT exist in NOR flash and where it will
  * be copied into DRAM
@@ -139,30 +172,7 @@
"fdtfile=board.dtb\0" \
"fdt_alt_name=juno\0" \
"fdt_addr_r=0x8000\0" \
-
-#ifndef CONFIG_BOOTCOMMAND
-/* Copy the kernel and FDT to DRAM memory and boot */
-#define CONFIG_BOOTCOMMAND "afs load ${kernel_name} ${kernel_addr_r} ;"\
-   "if test $? -eq 1; then "\
-   "  echo Loading ${kernel_alt_name} instead of "\
-   "${kernel_name}; "\
-   "  afs load ${kernel_alt_name} 
${kernel_addr_r};"\
-   "fi ; "\
-   "afs load ${fdtfile} ${fdt_addr_r} ;"\
-   "if test $? -eq 1; then "\
-   "  echo Loading ${fdt_alt_name} instead of "\
-   "${fdtfile}; "\
-   "  afs load ${fdt_alt_name} ${fdt_addr_r}; "\
-   "fi ; "\
-   "fdt addr ${fdt_addr_r}; fdt resize; " \
-   "if afs load  ${ramdisk_name} ${ramdisk_addr_r} 
; "\
-   "then "\
-   "  setenv ramdisk_param ${ramdisk_addr_r}; "\
-   "  else setenv ramdisk_param -; "\
-   "fi ; " \
-   "booti ${kernel_addr_r} ${ramdisk_param} 
${fdt_addr_r}"
-#endif
-
+   BOOTENV
 
 #elif CONFIG_TARGET_VEXPRESS64_BASE_FVP
 #define CONFIG_EXTRA_ENV_SETTINGS  \
-- 
2.17.5



[PATCH] distro_boot: Fix block device after DHCP boot sequence

2021-07-11 Thread Andre Przywara
The generic distro boot sequence iterates over several types of devices,
trying one after another. In doing do, it starts with setting the
"devtype" variable, then uses this later in more generic commands.

Now most (block) device types use a local variable for that, but DHCP
puts the type into the environment, where it shadows any local variables.
As a consequence any boot attempt after bootcmd_dhcp has been run fails:
===
VExpress64# run bootcmd_dhcp
...
VExpress64# run bootcmd_sata0
SATA#0:
(3.0 Gbps)
SATA#1:
(No RDY)
Device 0: Model: 16GB SATA Flash Drive  
... is now current device
Couldn't find partition dhcp 0:1
===
This problem typically doesn't show, because DHCP is mostly the last
command to try, but is a problem when this order is different, or when
distro_bootcmd or bootcmd_xxx are run separately or multiple times.

Let bootcmd_dhcp use a local variable, as the other kids do, to make the
order of boot commands irrelevant, and allow repeated calls.

Signed-off-by: Andre Przywara 
---
 include/config_distro_bootcmd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index 2627c2a6a54..e70423f25dd 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -375,7 +375,7 @@
 #endif
 #define BOOTENV_DEV_DHCP(devtypeu, devtypel, instance) \
"bootcmd_dhcp=" \
-   "setenv devtype " #devtypel "; " \
+   "devtype=" #devtypel "; " \
BOOTENV_RUN_NET_USB_START \
BOOTENV_RUN_PCI_ENUM \
"if dhcp ${scriptaddr} ${boot_script_dhcp}; then " \
-- 
2.17.5



Re: [PATCH 1/8] dtoc: Avoid using subscripts on match objects

2021-07-11 Thread Simon Glass
Hi Simon,

On 7/4/21 3:19 PM, Simon Glass wrote:
> These are not supported before Python 3.6 so avoid them.
>
> Signed-off-by: Simon Glass 
> ---
>   tools/dtoc/src_scan.py | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Walter Lozano 

Thanks!

Walter

Applied to u-boot-dm, thanks!


Re: [PATCH 4/8] dtoc: Correct the re_compat regular expression

2021-07-11 Thread Simon Glass
Hi Simon,

On 7/4/21 3:19 PM, Simon Glass wrote:
> This expects a . before the field name (.e.g '.compatible = ...) but
> presently accepts anything at all. Fix it.
>
> Signed-off-by: Simon Glass 
> ---
>
>   tools/dtoc/src_scan.py | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Walter Lozano 

Thanks!

Walter


>
Applied to u-boot-dm, thanks!


Re: [PATCH 2/8] dtoc: Convert to use ArgumentParser

2021-07-11 Thread Simon Glass
Hi Simon,

On 7/4/21 3:19 PM, Simon Glass wrote:
> Use this parser instead of OptionParser, which is deprecated.
>
> Signed-off-by: Simon Glass 
> ---
>
>   tools/dtoc/main.py | 51 --
>   1 file changed, 27 insertions(+), 24 deletions(-)

Reviewed-by: Walter Lozano 

Thanks!

Walter

>
Applied to u-boot-dm, thanks!


Re: [PATCH 5/8] dtoc: Add a stdout check in test_normalized_name()

2021-07-11 Thread Simon Glass
This test captures output but does not always check it. Add the missing
code and drop the old comment.

Signed-off-by: Simon Glass 
---

 tools/dtoc/test_src_scan.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Applied to u-boot-dm, thanks!


Re: [PATCH 3/8] dtoc: Allow multiple warnings for a driver

2021-07-11 Thread Simon Glass
Hi Simon,

On 7/4/21 3:19 PM, Simon Glass wrote:
> At present we show when a driver is missing but this is not always that
> useful. There are various reasons way a driver may appear to be missing,

Did you mean "why" instead of "way"?

> such as a parse error in the source code or a missing field in the driver
> declaration.
>
> Update the implementation to record all warnings for each driver, showing
> only those which relate to drivers that are actually used. This avoids
> spamming the user with warnings related to a driver for a different board.
>
> Signed-off-by: Simon Glass 
> ---
>
>   tools/dtoc/src_scan.py | 24 
>   1 file changed, 20 insertions(+), 4 deletions(-)

Reviewed-by: Walter Lozano 

Thank you, it is indeed something worth to be added!

Walter

>
Applied to u-boot-dm, thanks!


Re: [PATCH 6/8] dtoc: Detect unexpected suffix on .of_match

2021-07-11 Thread Simon Glass
Some rockchip drivers use a suffix on the of_match line which is not
strictly valid. At present this causes the parsing to fail. Fix this
and offer a warning.

Signed-off-by: Simon Glass 
---

 tools/dtoc/src_scan.py  | 12 +++--
 tools/dtoc/test_src_scan.py | 92 +
 2 files changed, 101 insertions(+), 3 deletions(-)

Applied to u-boot-dm, thanks!


Re: [PATCH 8/8] dtoc: Update documentation to cover warnings in more detail

2021-07-11 Thread Simon Glass
Hi Simon,

On 7/4/21 3:19 PM, Simon Glass wrote:
> When things go wrong it can be confusing to figure out what to change.
> Add a few more details to the documentation.
>
> Fix a 'make htmldocs' warning while we are here.
>
> Signed-off-by: Simon Glass 
> ---
>
>   doc/develop/driver-model/of-plat.rst | 53 
>   1 file changed, 53 insertions(+)
>
Applied to u-boot-dm, thanks!


Re: [PATCH 7/8] dtoc: Detect drivers which do not parse correctly

2021-07-11 Thread Simon Glass
On 7/4/21 3:19 PM, Simon Glass wrote:
> At present if a driver is missing a uclass or compatible stirng, this
Most probably it should be "string"
> is silently ignored. This makes sense in most cases, particularly for
> the compatible string, since it is not required except when the driver
> is used with of-platdata.
>
> But it is also not very helpful. When there is some sort of problem
> with a driver, the missing compatible string (for example) may be the
> cause.
>
> Add a warning in this case, showing it only for drivers which are used
> by the build.
>
> Signed-off-by: Simon Glass 
> ---
>
>   tools/dtoc/src_scan.py  |  7 ++-
>   tools/dtoc/test_src_scan.py | 38 +
>   2 files changed, 44 insertions(+), 1 deletion(-)

Reviewed-by: Walter Lozano 

Thanks!

Walter

>
Applied to u-boot-dm, thanks!


Re: [PATCH] net: Use phys_addr_t for SMC net device addresses

2021-07-11 Thread Andre Przywara
On Fri,  9 Jul 2021 10:52:06 +0100
Peter Hoyes  wrote:

> From: Peter Hoyes 
> 
> Use same type as eth_device->iobase and support addresses greater
> than INT_MAX.

Indeed, a signed(!) int is really a poor choice for a base address.

> Signed-off-by: Peter Hoyes 

Reviewed-by: Andre Przywara 

Cheers,
Andre

> ---
>  drivers/net/smc9.c | 2 +-
>  drivers/net/smc911x.c  | 2 +-
>  include/netdev.h   | 4 ++--
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/smc9.c b/drivers/net/smc9.c
> index ec4e8e928c..61d7f3df69 100644
> --- a/drivers/net/smc9.c
> +++ b/drivers/net/smc9.c
> @@ -1269,7 +1269,7 @@ static void print_packet( byte * buf, int length )
>  }
>  #endif
>  
> -int smc9_initialize(u8 dev_num, int base_addr)
> +int smc9_initialize(u8 dev_num, phys_addr_t base_addr)
>  {
>   struct smc9_priv *priv;
>   struct eth_device *dev;
> diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
> index 3afebee440..8f420261fa 100644
> --- a/drivers/net/smc911x.c
> +++ b/drivers/net/smc911x.c
> @@ -478,7 +478,7 @@ static int smc911x_recv(struct eth_device *dev)
>   return ret;
>  }
>  
> -int smc911x_initialize(u8 dev_num, int base_addr)
> +int smc911x_initialize(u8 dev_num, phys_addr_t base_addr)
>  {
>   struct smc911x_priv *priv;
>   int ret;
> diff --git a/include/netdev.h b/include/netdev.h
> index b960c42106..00a0993a83 100644
> --- a/include/netdev.h
> +++ b/include/netdev.h
> @@ -70,8 +70,8 @@ int rtl8169_initialize(struct bd_info *bis);
>  int scc_initialize(struct bd_info *bis);
>  int sh_eth_initialize(struct bd_info *bis);
>  int skge_initialize(struct bd_info *bis);
> -int smc9_initialize(u8 dev_num, int base_addr);
> -int smc911x_initialize(u8 dev_num, int base_addr);
> +int smc9_initialize(u8 dev_num, phys_addr_t base_addr);
> +int smc911x_initialize(u8 dev_num, phys_addr_t base_addr);
>  int uec_standard_init(struct bd_info *bis);
>  int uli526x_initialize(struct bd_info *bis);
>  int armada100_fec_register(unsigned long base_addr);



Re: [PATCH v3 6/6] mmc: zynq_sdhci: Make variables/structure static

2021-07-11 Thread Jaehoon Chung
On 7/9/21 8:53 PM, Ashok Reddy Soma wrote:
> From: Michal Simek 
> 
> All these variables/structure are local and should be static.
> 
> Issues are reported by sparse:
> drivers/mmc/zynq_sdhci.c:49:11: warning: symbol 'zynqmp_iclk_phases' was not 
> declared. Should it be static?
> drivers/mmc/zynq_sdhci.c:50:11: warning: symbol 'zynqmp_oclk_phases' was not 
> declared. Should it be static?
> drivers/mmc/zynq_sdhci.c:53:11: warning: symbol 'versal_iclk_phases' was not 
> declared. Should it be static?
> drivers/mmc/zynq_sdhci.c:54:11: warning: symbol 'versal_oclk_phases' was not 
> declared. Should it be static?
> drivers/mmc/zynq_sdhci.c:546:24: warning: symbol 'arasan_ops' was not 
> declared. Should it be static?
> 
> Signed-off-by: Michal Simek 
> Signed-off-by: Ashok Reddy Soma 


Reviewed-by: Jaehoon Chung 

Best Regards,
Jaehoon Chung

> ---
> 
> (no changes since v1)
> 
>  drivers/mmc/zynq_sdhci.c | 16 ++--
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c
> index 47862c0bf5..ba87ee8dd5 100644
> --- a/drivers/mmc/zynq_sdhci.c
> +++ b/drivers/mmc/zynq_sdhci.c
> @@ -50,12 +50,16 @@ struct arasan_sdhci_priv {
>  
>  #if defined(CONFIG_ARCH_ZYNQMP) || defined(CONFIG_ARCH_VERSAL)
>  /* Default settings for ZynqMP Clock Phases */
> -const u32 zynqmp_iclk_phases[] = {0, 63, 63, 0, 63,  0,   0, 183, 54,  0, 0};
> -const u32 zynqmp_oclk_phases[] = {0, 72, 60, 0, 60, 72, 135, 48, 72, 135, 0};
> +static const u32 zynqmp_iclk_phases[] = {0, 63, 63, 0, 63,  0,
> +  0, 183, 54,  0, 0};
> +static const u32 zynqmp_oclk_phases[] = {0, 72, 60, 0, 60, 72,
> +  135, 48, 72, 135, 0};
>  
>  /* Default settings for Versal Clock Phases */
> -const u32 versal_iclk_phases[] = {0, 132, 132, 0, 132, 0, 0, 162, 90, 0, 0};
> -const u32 versal_oclk_phases[] = {0,  60, 48, 0, 48, 72, 90, 36, 60, 90, 0};
> +static const u32 versal_iclk_phases[] = {0, 132, 132, 0, 132,
> +  0, 0, 162, 90, 0, 0};
> +static const u32 versal_oclk_phases[] = {0,  60, 48, 0, 48, 72,
> +  90, 36, 60, 90, 0};
>  
>  static const u8 mode2timing[] = {
>   [MMC_LEGACY] = MMC_TIMING_LEGACY,
> @@ -541,8 +545,8 @@ static void arasan_sdhci_set_control_reg(struct 
> sdhci_host *host)
>   sdhci_set_uhs_timing(host);
>  }
>  
> -const struct sdhci_ops arasan_ops = {
> - .platform_execute_tuning = _sdhci_execute_tuning,
> +static const struct sdhci_ops arasan_ops = {
> + .platform_execute_tuning= _sdhci_execute_tuning,
>   .set_delay = _sdhci_set_tapdelay,
>   .set_control_reg = _sdhci_set_control_reg,
>  };
> 



Re: [PATCH v3 5/6] mmc: zynq_sdhci: Fix kernel doc warnings

2021-07-11 Thread Jaehoon Chung
On 7/9/21 8:53 PM, Ashok Reddy Soma wrote:
> From: Michal Simek 
> 
> Fix these kernel doc warnings:
> drivers/mmc/zynq_sdhci.c:181: warning: contents before sections
> drivers/mmc/zynq_sdhci.c:236: warning: contents before sections
> drivers/mmc/zynq_sdhci.c:291: warning: contents before sections
> drivers/mmc/zynq_sdhci.c:297: warning: Function parameter or member 'degrees' 
> not described in   'sdhci_versal_sdcardclk_set_phase'
> drivers/mmc/zynq_sdhci.c:354: warning: contents before sections
> drivers/mmc/zynq_sdhci.c:360: warning: Function parameter or member 'degrees' 
> not described in   'sdhci_versal_sampleclk_set_phase'
> drivers/mmc/zynq_sdhci.c:467: warning: contents before sections
> 
> Signed-off-by: Michal Simek 
> Signed-off-by: Ashok Reddy Soma 


Reviewed-by: Jaehoon Chung 

Best Regards,
Jaehoon Chung

> ---
> 
> Changes in v3:
>  - Change "@degree" to "@degrees:" in sdhci_zynqmp_sampleclk_set_phase()
>and sdhci_versal_sdcardclk_set_phase() and update description with
>these warnings.
> 
> Changes in v2:
>  - Removed @degree warning from commit description since it is fixed in
>patch 1/6.
> 
>  drivers/mmc/zynq_sdhci.c | 24 
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c
> index 95d42ccef4..47862c0bf5 100644
> --- a/drivers/mmc/zynq_sdhci.c
> +++ b/drivers/mmc/zynq_sdhci.c
> @@ -181,11 +181,11 @@ static int arasan_sdhci_execute_tuning(struct mmc *mmc, 
> u8 opcode)
>  /**
>   * sdhci_zynqmp_sdcardclk_set_phase - Set the SD Output Clock Tap Delays
>   *
> - * Set the SD Output Clock Tap Delays for Output path
> - *
>   * @host:Pointer to the sdhci_host structure.
>   * @degrees: The clock phase shift between 0 - 359.
>   * Return: 0
> + *
> + * Set the SD Output Clock Tap Delays for Output path
>   */
>  static int sdhci_zynqmp_sdcardclk_set_phase(struct sdhci_host *host,
>   int degrees)
> @@ -237,11 +237,11 @@ static int sdhci_zynqmp_sdcardclk_set_phase(struct 
> sdhci_host *host,
>  /**
>   * sdhci_zynqmp_sampleclk_set_phase - Set the SD Input Clock Tap Delays
>   *
> - * Set the SD Input Clock Tap Delays for Input path
> - *
>   * @host:Pointer to the sdhci_host structure.
>   * @degrees: The clock phase shift between 0 - 359.
>   * Return: 0
> + *
> + * Set the SD Input Clock Tap Delays for Input path
>   */
>  static int sdhci_zynqmp_sampleclk_set_phase(struct sdhci_host *host,
>   int degrees)
> @@ -293,11 +293,11 @@ static int sdhci_zynqmp_sampleclk_set_phase(struct 
> sdhci_host *host,
>  /**
>   * sdhci_versal_sdcardclk_set_phase - Set the SD Output Clock Tap Delays
>   *
> - * Set the SD Output Clock Tap Delays for Output path
> - *
>   * @host:Pointer to the sdhci_host structure.
> - * @degrees  The clock phase shift between 0 - 359.
> + * @degrees: The clock phase shift between 0 - 359.
>   * Return: 0
> + *
> + * Set the SD Output Clock Tap Delays for Output path
>   */
>  static int sdhci_versal_sdcardclk_set_phase(struct sdhci_host *host,
>   int degrees)
> @@ -355,11 +355,11 @@ static int sdhci_versal_sdcardclk_set_phase(struct 
> sdhci_host *host,
>  /**
>   * sdhci_versal_sampleclk_set_phase - Set the SD Input Clock Tap Delays
>   *
> - * Set the SD Input Clock Tap Delays for Input path
> - *
>   * @host:Pointer to the sdhci_host structure.
> - * @degrees  The clock phase shift between 0 - 359.
> + * @degrees: The clock phase shift between 0 - 359.
>   * Return: 0
> + *
> + * Set the SD Input Clock Tap Delays for Input path
>   */
>  static int sdhci_versal_sampleclk_set_phase(struct sdhci_host *host,
>   int degrees)
> @@ -467,9 +467,9 @@ static void arasan_dt_read_clk_phase(struct udevice *dev, 
> unsigned char timing,
>  /**
>   * arasan_dt_parse_clk_phases - Read Tap Delay values from DT
>   *
> - * Called at initialization to parse the values of Tap Delays.
> - *
>   * @dev:Pointer to our struct udevice.
> + *
> + * Called at initialization to parse the values of Tap Delays.
>   */
>  static void arasan_dt_parse_clk_phases(struct udevice *dev)
>  {
> 



Re: [PATCH v3 4/6] mmc: zynq_sdhci: Split set_tapdelay function to in and out

2021-07-11 Thread Jaehoon Chung
On 7/9/21 8:53 PM, Ashok Reddy Soma wrote:
> Split arasan_zynqmp_set_tapdelay() to handle input and output tapdelays
> separately. This is required to handle zero values for ITAP and OTAP
> values. If we dont split, we will have to remove the if() in the
> function, which makes ITAP values to be overwritten when OTAP values are
> called to set and vice-versa.
> 
> Restrict tap_delay value calculated to max allowed 8 bits for ITAP and 6
> bits for OTAP for ZynqMP.
> 
> Signed-off-by: Ashok Reddy Soma 


Reviewed-by: Jaehoon Chung 

Best Regards,
Jaehoon Chung

> ---
> 
> (no changes since v1)
> 
>  board/xilinx/zynqmp/tap_delays.c | 73 +---
>  drivers/mmc/zynq_sdhci.c | 10 -
>  include/zynqmp_tap_delay.h   |  7 +--
>  3 files changed, 50 insertions(+), 40 deletions(-)
> 
> diff --git a/board/xilinx/zynqmp/tap_delays.c 
> b/board/xilinx/zynqmp/tap_delays.c
> index 1cab25f00a..d16bbb8eff 100644
> --- a/board/xilinx/zynqmp/tap_delays.c
> +++ b/board/xilinx/zynqmp/tap_delays.c
> @@ -50,48 +50,51 @@ void zynqmp_dll_reset(u8 deviceid)
>   zynqmp_mmio_write(SD_DLL_CTRL, SD1_DLL_RST_MASK, 0x0);
>  }
>  
> -void arasan_zynqmp_set_tapdelay(u8 deviceid, u32 itap_delay, u32 otap_delay)
> +void arasan_zynqmp_set_in_tapdelay(u8 deviceid, u32 itap_delay)
>  {
>   if (deviceid == 0) {
> - zynqmp_mmio_write(SD_DLL_CTRL, SD0_DLL_RST_MASK,
> -   SD0_DLL_RST);
> - /* Program ITAP */
> - if (itap_delay) {
> - zynqmp_mmio_write(SD_ITAP_DLY, SD0_ITAPCHGWIN_MASK,
> -   SD0_ITAPCHGWIN);
> - zynqmp_mmio_write(SD_ITAP_DLY, SD0_ITAPDLYENA_MASK,
> -   SD0_ITAPDLYENA);
> - zynqmp_mmio_write(SD_ITAP_DLY, SD0_ITAPDLYSEL_MASK,
> -   itap_delay);
> - zynqmp_mmio_write(SD_ITAP_DLY, SD0_ITAPCHGWIN_MASK,
> -   0x0);
> - }
> + zynqmp_mmio_write(SD_DLL_CTRL, SD0_DLL_RST_MASK, SD0_DLL_RST);
>  
> - /* Program OTAP */
> - if (otap_delay)
> - zynqmp_mmio_write(SD_OTAP_DLY, SD0_OTAPDLYSEL_MASK,
> -   otap_delay);
> + /* Program ITAP delay */
> + zynqmp_mmio_write(SD_ITAP_DLY, SD0_ITAPCHGWIN_MASK,
> +   SD0_ITAPCHGWIN);
> + zynqmp_mmio_write(SD_ITAP_DLY, SD0_ITAPDLYENA_MASK,
> +   SD0_ITAPDLYENA);
> + zynqmp_mmio_write(SD_ITAP_DLY, SD0_ITAPDLYSEL_MASK, itap_delay);
> + zynqmp_mmio_write(SD_ITAP_DLY, SD0_ITAPCHGWIN_MASK, 0x0);
>  
>   zynqmp_mmio_write(SD_DLL_CTRL, SD0_DLL_RST_MASK, 0x0);
>   } else {
> - zynqmp_mmio_write(SD_DLL_CTRL, SD1_DLL_RST_MASK,
> -   SD1_DLL_RST);
> - /* Program ITAP */
> - if (itap_delay) {
> - zynqmp_mmio_write(SD_ITAP_DLY, SD1_ITAPCHGWIN_MASK,
> -   SD1_ITAPCHGWIN);
> - zynqmp_mmio_write(SD_ITAP_DLY, SD1_ITAPDLYENA_MASK,
> -   SD1_ITAPDLYENA);
> - zynqmp_mmio_write(SD_ITAP_DLY, SD1_ITAPDLYSEL_MASK,
> -   (itap_delay << 16));
> - zynqmp_mmio_write(SD_ITAP_DLY, SD1_ITAPCHGWIN_MASK,
> -   0x0);
> - }
> + zynqmp_mmio_write(SD_DLL_CTRL, SD1_DLL_RST_MASK, SD1_DLL_RST);
> +
> + /* Program ITAP delay */
> + zynqmp_mmio_write(SD_ITAP_DLY, SD1_ITAPCHGWIN_MASK,
> +   SD1_ITAPCHGWIN);
> + zynqmp_mmio_write(SD_ITAP_DLY, SD1_ITAPDLYENA_MASK,
> +   SD1_ITAPDLYENA);
> + zynqmp_mmio_write(SD_ITAP_DLY, SD1_ITAPDLYSEL_MASK,
> +   (itap_delay << 16));
> + zynqmp_mmio_write(SD_ITAP_DLY, SD1_ITAPCHGWIN_MASK, 0x0);
> +
> + zynqmp_mmio_write(SD_DLL_CTRL, SD1_DLL_RST_MASK, 0x0);
> + }
> +}
> +
> +void arasan_zynqmp_set_out_tapdelay(u8 deviceid, u32 otap_delay)
> +{
> + if (deviceid == 0) {
> + zynqmp_mmio_write(SD_DLL_CTRL, SD0_DLL_RST_MASK, SD0_DLL_RST);
> +
> + /* Program OTAP delay */
> + zynqmp_mmio_write(SD_OTAP_DLY, SD0_OTAPDLYSEL_MASK, otap_delay);
> +
> + zynqmp_mmio_write(SD_DLL_CTRL, SD0_DLL_RST_MASK, 0x0);
> + } else {
> + zynqmp_mmio_write(SD_DLL_CTRL, SD1_DLL_RST_MASK, SD1_DLL_RST);
>  
> - /* Program OTAP */
> - if (otap_delay)
> - zynqmp_mmio_write(SD_OTAP_DLY, SD1_OTAPDLYSEL_MASK,
> -   (otap_delay << 16));
> + /* Program OTAP delay */
> 

Re: [PATCH v3 3/6] mmc: zynq_sdhci: Use Mask writes for Tap delays

2021-07-11 Thread Jaehoon Chung
On 7/9/21 8:53 PM, Ashok Reddy Soma wrote:
> Restrict tap_delay value to the allowed size(8bits for itap and 6 bits
> for otap) before writing to the tap delay register.
> 
> Clear ITAP and OTAP delay bits before updating with the new tap value
> for Versal platform.
> 
> Signed-off-by: Ashok Reddy Soma 


Reviewed-by: Jaehoon Chung 

Best Regards,
Jaehoon Chung

> ---
> 
> Changes in v3:
>  - Updated macro's with BIT() and GENMASK() for readability
> 
>  drivers/mmc/zynq_sdhci.c | 58 +---
>  1 file changed, 31 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c
> index f65a87a4e1..bf638e9675 100644
> --- a/drivers/mmc/zynq_sdhci.c
> +++ b/drivers/mmc/zynq_sdhci.c
> @@ -19,11 +19,13 @@
>  #include 
>  #include 
>  
> -#define SDHCI_ARASAN_ITAPDLY_REGISTER   0xF0F8
> -#define SDHCI_ARASAN_OTAPDLY_REGISTER   0xF0FC
> -#define SDHCI_ITAPDLY_CHGWIN0x200
> -#define SDHCI_ITAPDLY_ENABLE0x100
> -#define SDHCI_OTAPDLY_ENABLE0x40
> +#define SDHCI_ARASAN_ITAPDLY_REGISTER0xF0F8
> +#define SDHCI_ARASAN_ITAPDLY_SEL_MASKGENMASK(7, 0)
> +#define SDHCI_ARASAN_OTAPDLY_REGISTER0xF0FC
> +#define SDHCI_ARASAN_OTAPDLY_SEL_MASKGENMASK(5, 0)
> +#define SDHCI_ITAPDLY_CHGWIN BIT(9)
> +#define SDHCI_ITAPDLY_ENABLE BIT(8)
> +#define SDHCI_OTAPDLY_ENABLE BIT(6)
>  
>  #define SDHCI_TUNING_LOOP_COUNT  40
>  #define MMC_BANK20x2
> @@ -297,6 +299,7 @@ static int sdhci_versal_sdcardclk_set_phase(struct 
> sdhci_host *host,
>   struct mmc *mmc = (struct mmc *)host->mmc;
>   u8 tap_delay, tap_max = 0;
>   int timing = mode2timing[mmc->selected_mode];
> + u32 regval;
>  
>   /*
>* This is applicable for SDHCI_SPEC_300 and above
> @@ -329,16 +332,16 @@ static int sdhci_versal_sdcardclk_set_phase(struct 
> sdhci_host *host,
>  
>   tap_delay = (degrees * tap_max) / 360;
>  
> + /* Limit output tap_delay value to 6 bits */
> + tap_delay &= SDHCI_ARASAN_OTAPDLY_SEL_MASK;
> +
>   /* Set the Clock Phase */
> - if (tap_delay) {
> - u32 regval;
> -
> - regval = sdhci_readl(host, SDHCI_ARASAN_OTAPDLY_REGISTER);
> - regval |= SDHCI_OTAPDLY_ENABLE;
> - sdhci_writel(host, regval, SDHCI_ARASAN_OTAPDLY_REGISTER);
> - regval |= tap_delay;
> - sdhci_writel(host, regval, SDHCI_ARASAN_OTAPDLY_REGISTER);
> - }
> + regval = sdhci_readl(host, SDHCI_ARASAN_OTAPDLY_REGISTER);
> + regval |= SDHCI_OTAPDLY_ENABLE;
> + sdhci_writel(host, regval, SDHCI_ARASAN_OTAPDLY_REGISTER);
> + regval &= ~SDHCI_ARASAN_OTAPDLY_SEL_MASK;
> + regval |= tap_delay;
> + sdhci_writel(host, regval, SDHCI_ARASAN_OTAPDLY_REGISTER);
>  
>   return 0;
>  }
> @@ -358,6 +361,7 @@ static int sdhci_versal_sampleclk_set_phase(struct 
> sdhci_host *host,
>   struct mmc *mmc = (struct mmc *)host->mmc;
>   u8 tap_delay, tap_max = 0;
>   int timing = mode2timing[mmc->selected_mode];
> + u32 regval;
>  
>   /*
>* This is applicable for SDHCI_SPEC_300 and above
> @@ -390,20 +394,20 @@ static int sdhci_versal_sampleclk_set_phase(struct 
> sdhci_host *host,
>  
>   tap_delay = (degrees * tap_max) / 360;
>  
> + /* Limit input tap_delay value to 8 bits */
> + tap_delay &= SDHCI_ARASAN_ITAPDLY_SEL_MASK;
> +
>   /* Set the Clock Phase */
> - if (tap_delay) {
> - u32 regval;
> -
> - regval = sdhci_readl(host, SDHCI_ARASAN_ITAPDLY_REGISTER);
> - regval |= SDHCI_ITAPDLY_CHGWIN;
> - sdhci_writel(host, regval, SDHCI_ARASAN_ITAPDLY_REGISTER);
> - regval |= SDHCI_ITAPDLY_ENABLE;
> - sdhci_writel(host, regval, SDHCI_ARASAN_ITAPDLY_REGISTER);
> - regval |= tap_delay;
> - sdhci_writel(host, regval, SDHCI_ARASAN_ITAPDLY_REGISTER);
> - regval &= ~SDHCI_ITAPDLY_CHGWIN;
> - sdhci_writel(host, regval, SDHCI_ARASAN_ITAPDLY_REGISTER);
> - }
> + regval = sdhci_readl(host, SDHCI_ARASAN_ITAPDLY_REGISTER);
> + regval |= SDHCI_ITAPDLY_CHGWIN;
> + sdhci_writel(host, regval, SDHCI_ARASAN_ITAPDLY_REGISTER);
> + regval |= SDHCI_ITAPDLY_ENABLE;
> + sdhci_writel(host, regval, SDHCI_ARASAN_ITAPDLY_REGISTER);
> + regval &= ~SDHCI_ARASAN_ITAPDLY_SEL_MASK;
> + regval |= tap_delay;
> + sdhci_writel(host, regval, SDHCI_ARASAN_ITAPDLY_REGISTER);
> + regval &= ~SDHCI_ITAPDLY_CHGWIN;
> + sdhci_writel(host, regval, SDHCI_ARASAN_ITAPDLY_REGISTER);
>  
>   return 0;
>  }
> 



Re: [PATCH v3 2/6] mmc: zynq_sdhci: Allow configuring zero Tap values

2021-07-11 Thread Jaehoon Chung
On 7/9/21 8:53 PM, Ashok Reddy Soma wrote:
> Allow configuring ITAP and OTAP values with zero to avoid failures in
> some cases (one of them is SD boot mode). Legacy, SDR12 modes require
> to program the ITAP and OTAP values as zero, whereas for SDR50 and SDR104
> modes ITAP value is zero.
> 
> In SD boot mode firmware configures the SD ITAP and OTAP values and
> in this case u-boot has to re-configure required tap values(including zero)
> based on the operating mode.
> 
> Signed-off-by: Ashok Reddy Soma 


Reviewed-by: Jaehoon Chung 

Best Regards,
Jaehoon Chung

> ---
> 
> (no changes since v1)
> 
>  drivers/mmc/zynq_sdhci.c | 16 
>  1 file changed, 4 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c
> index 5bad5cb9e7..f65a87a4e1 100644
> --- a/drivers/mmc/zynq_sdhci.c
> +++ b/drivers/mmc/zynq_sdhci.c
> @@ -198,9 +198,7 @@ static int sdhci_zynqmp_sdcardclk_set_phase(struct 
> sdhci_host *host,
>* ZynqMP does not set phase for <=25MHz clock.
>* If degrees is zero, no need to do anything.
>*/
> - if (SDHCI_GET_VERSION(host) < SDHCI_SPEC_300 ||
> - timing == MMC_TIMING_LEGACY ||
> - timing == MMC_TIMING_UHS_SDR12 || !degrees)
> + if (SDHCI_GET_VERSION(host) < SDHCI_SPEC_300)
>   return 0;
>  
>   switch (timing) {
> @@ -253,9 +251,7 @@ static int sdhci_zynqmp_sampleclk_set_phase(struct 
> sdhci_host *host,
>* ZynqMP does not set phase for <=25MHz clock.
>* If degrees is zero, no need to do anything.
>*/
> - if (SDHCI_GET_VERSION(host) < SDHCI_SPEC_300 ||
> - timing == MMC_TIMING_LEGACY ||
> - timing == MMC_TIMING_UHS_SDR12 || !degrees)
> + if (SDHCI_GET_VERSION(host) < SDHCI_SPEC_300)
>   return 0;
>  
>   switch (timing) {
> @@ -307,9 +303,7 @@ static int sdhci_versal_sdcardclk_set_phase(struct 
> sdhci_host *host,
>* Versal does not set phase for <=25MHz clock.
>* If degrees is zero, no need to do anything.
>*/
> - if (SDHCI_GET_VERSION(host) < SDHCI_SPEC_300 ||
> - timing == MMC_TIMING_LEGACY ||
> - timing == MMC_TIMING_UHS_SDR12 || !degrees)
> + if (SDHCI_GET_VERSION(host) < SDHCI_SPEC_300)
>   return 0;
>  
>   switch (timing) {
> @@ -370,9 +364,7 @@ static int sdhci_versal_sampleclk_set_phase(struct 
> sdhci_host *host,
>* Versal does not set phase for <=25MHz clock.
>* If degrees is zero, no need to do anything.
>*/
> - if (SDHCI_GET_VERSION(host) < SDHCI_SPEC_300 ||
> - timing == MMC_TIMING_LEGACY ||
> - timing == MMC_TIMING_UHS_SDR12 || !degrees)
> + if (SDHCI_GET_VERSION(host) < SDHCI_SPEC_300)
>   return 0;
>  
>   switch (timing) {
> 



Re: [PATCH v3 1/6] mmc: zynq_sdhci: Resolve uninitialized return value

2021-07-11 Thread Jaehoon Chung
On 7/9/21 8:53 PM, Ashok Reddy Soma wrote:
> set_phase() functions are not modifying the ret value and returning
> the same uninitialized ret, return 0 instead.
> 
> Keep the return type as int to return errors when the tapdelay's are
> set via xilinx_pm_request() in future.
> 
> Signed-off-by: Ashok Reddy Soma 

Reviewed-by: Jaehoon Chung 

Best Regards,
Jaehoon Chung

> ---
> 
> Changes in v3:
>  - Updated commmit description to explain why return type int is kept
>  - Change "@degree" to "@degrees:" in 5/6, so revert it in 1/6 from
>sdhci_zynqmp_sampleclk_set_phase() and sdhci_versal_sdcardclk_set_phase()
> 
> Changes in v2:
>  - Changed "@degree" to "@degrees:" in function descriptions of tap
>delay functions
> 
>  drivers/mmc/zynq_sdhci.c | 20 
>  1 file changed, 8 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c
> index b79c4021b6..5bad5cb9e7 100644
> --- a/drivers/mmc/zynq_sdhci.c
> +++ b/drivers/mmc/zynq_sdhci.c
> @@ -183,7 +183,7 @@ static int arasan_sdhci_execute_tuning(struct mmc *mmc, 
> u8 opcode)
>   *
>   * @host:Pointer to the sdhci_host structure.
>   * @degrees: The clock phase shift between 0 - 359.
> - * Return: 0 on success and error value on error
> + * Return: 0
>   */
>  static int sdhci_zynqmp_sdcardclk_set_phase(struct sdhci_host *host,
>   int degrees)
> @@ -191,7 +191,6 @@ static int sdhci_zynqmp_sdcardclk_set_phase(struct 
> sdhci_host *host,
>   struct arasan_sdhci_priv *priv = dev_get_priv(host->mmc->dev);
>   struct mmc *mmc = (struct mmc *)host->mmc;
>   u8 tap_delay, tap_max = 0;
> - int ret;
>   int timing = mode2timing[mmc->selected_mode];
>  
>   /*
> @@ -229,7 +228,7 @@ static int sdhci_zynqmp_sdcardclk_set_phase(struct 
> sdhci_host *host,
>  
>   arasan_zynqmp_set_tapdelay(priv->deviceid, 0, tap_delay);
>  
> - return ret;
> + return 0;
>  }
>  
>  /**
> @@ -239,7 +238,7 @@ static int sdhci_zynqmp_sdcardclk_set_phase(struct 
> sdhci_host *host,
>   *
>   * @host:Pointer to the sdhci_host structure.
>   * @degrees: The clock phase shift between 0 - 359.
> - * Return: 0 on success and error value on error
> + * Return: 0
>   */
>  static int sdhci_zynqmp_sampleclk_set_phase(struct sdhci_host *host,
>   int degrees)
> @@ -247,7 +246,6 @@ static int sdhci_zynqmp_sampleclk_set_phase(struct 
> sdhci_host *host,
>   struct arasan_sdhci_priv *priv = dev_get_priv(host->mmc->dev);
>   struct mmc *mmc = (struct mmc *)host->mmc;
>   u8 tap_delay, tap_max = 0;
> - int ret;
>   int timing = mode2timing[mmc->selected_mode];
>  
>   /*
> @@ -285,7 +283,7 @@ static int sdhci_zynqmp_sampleclk_set_phase(struct 
> sdhci_host *host,
>  
>   arasan_zynqmp_set_tapdelay(priv->deviceid, tap_delay, 0);
>  
> - return ret;
> + return 0;
>  }
>  
>  /**
> @@ -295,14 +293,13 @@ static int sdhci_zynqmp_sampleclk_set_phase(struct 
> sdhci_host *host,
>   *
>   * @host:Pointer to the sdhci_host structure.
>   * @degrees  The clock phase shift between 0 - 359.
> - * Return: 0 on success and error value on error
> + * Return: 0
>   */
>  static int sdhci_versal_sdcardclk_set_phase(struct sdhci_host *host,
>   int degrees)
>  {
>   struct mmc *mmc = (struct mmc *)host->mmc;
>   u8 tap_delay, tap_max = 0;
> - int ret;
>   int timing = mode2timing[mmc->selected_mode];
>  
>   /*
> @@ -349,7 +346,7 @@ static int sdhci_versal_sdcardclk_set_phase(struct 
> sdhci_host *host,
>   sdhci_writel(host, regval, SDHCI_ARASAN_OTAPDLY_REGISTER);
>   }
>  
> - return ret;
> + return 0;
>  }
>  
>  /**
> @@ -359,14 +356,13 @@ static int sdhci_versal_sdcardclk_set_phase(struct 
> sdhci_host *host,
>   *
>   * @host:Pointer to the sdhci_host structure.
>   * @degrees  The clock phase shift between 0 - 359.
> - * Return: 0 on success and error value on error
> + * Return: 0
>   */
>  static int sdhci_versal_sampleclk_set_phase(struct sdhci_host *host,
>   int degrees)
>  {
>   struct mmc *mmc = (struct mmc *)host->mmc;
>   u8 tap_delay, tap_max = 0;
> - int ret;
>   int timing = mode2timing[mmc->selected_mode];
>  
>   /*
> @@ -417,7 +413,7 @@ static int sdhci_versal_sampleclk_set_phase(struct 
> sdhci_host *host,
>   sdhci_writel(host, regval, SDHCI_ARASAN_ITAPDLY_REGISTER);
>   }
>  
> - return ret;
> + return 0;
>  }
>  
>  static void arasan_sdhci_set_tapdelay(struct sdhci_host *host)
> 



Re: [PATCH 04/17] Rename SPL_POWER_SUPPORT to SPL_POWER

2021-07-11 Thread Jaehoon Chung
On 7/11/21 12:14 PM, Simon Glass wrote:
> Rename this option so that CONFIG_IS_ENABLED can be used with it.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Jaehoon Chung 

Best Regards,
Jaehoon Chung



Re: [PATCH u-boot-mvebu 00/31] kwboot / kwbimage improvements

2021-07-11 Thread Chris Packham
On Fri, Jul 9, 2021 at 5:30 AM Marek Behún  wrote:
>
> Hi Stefan and others,
>
> this is a series of improvements to kwboot, kwbimage and mvebu.
>
> The main goal of this series is to correctly use BootROM's code
> for loading U-Boot from NOR / NAND: currently only SPL is read by
> BootROM and the main U-Boot is read by SPL. By using BootROM to also
> load main U-Boot we can reduce the size of SPL image, since it does
> not need to contain code for reading NOR / NAND.
>
> Before merging, this series should be tested on as many relevant
> boards as possible.

I've given the series a look over. Aside from a couple of typos in one
commit message which I replied to, the rest looked pretty good.

Review-by: Chris Packham 

For DB-88f6820-AMC and x530

Tested-by: Chris Packham 

>
> Marek & Pali
>
> Marek Behún (2):
>   tools: kwbimage: Add constant for SDIO bootfrom
>   tools: kwbimage: Cosmetic fix - remove redundant space character
>
> Pali Rohár (29):
>   tools: kwbimage: Fix compilation without CONFIG_SYS_U_BOOT_OFFS
>   tools: kwbimage: Simplify aligning and calculating checksum
>   tools: kwbimage: Align SPI and NAND images to 256 bytes
>   tools: kwbimage: Fix generation of SATA, SDIO and PCIe images
>   tools: kwbimage: Don't crash when binary file name does not contain
> '/'
>   tools: kwbimage: Fix check for v0 extended header checksum
>   tools: kwbimage: Validate extended headers of v1 images
>   tools: kwbimage: Validate data checksum of v1 images
>   tools: kwbimage: Print size of binary header in
> kwbimage_print_header()
>   tools: kwboot: Fix wrong parameter passed to read()
>   tools: kwboot: Fix restoring terminal
>   tools: kwboot: Print trailing newline after terminal is terminated
>   tools: kwboot: Cosmetic fix - add missing curly brackets
>   tools: kwboot: Check for v1 header size
>   tools: kwbimage: Use -a parameter (load address) for v1 images
>   arm: mvebu: Fix return_to_bootrom()
>   arm: mvebu: Mark return_to_bootrom() as a noreturn function
>   arm: mvebu: Implement return_to_bootrom() via U-Boot's SPL framework
>   arm: mvebu: Use U-Boot's SPL BootROM framework for booting from
> NAND/UART
>   arm: mvebu: Always use BootROM for loading the rest of U-Boot's binary
>   arm: mvebu: gdsys: Remove custom spl_board_init()
>   arm: mvebu: Remove legacy U-Boot header from kwbimage v1 files
>   tools: kwbimage: Remove v1 kwbimage SPL padding to
> CONFIG_SYS_U_BOOT_OFFS bytes
>   arm: mvebu: Remove unused macro CONFIG_SYS_U_BOOT_OFFS
>   tools: kwbimage: Add support for more BINARY headers
>   tools: kwbimage: Don't parse PAYLOAD keyword
>   tools: kwbimage: Add support for DATA command also for v1 images
>   tools: kwbimage: Add support for a new DATA_DELAY command
>   tools: kwbimage: Do not hide usage of secure header under
> CONFIG_ARMADA_38X
>
>  Makefile   |   2 +-
>  arch/arm/mach-mvebu/Kconfig|  16 +-
>  arch/arm/mach-mvebu/include/mach/cpu.h |   2 +-
>  arch/arm/mach-mvebu/lowlevel_spl.S |   3 +-
>  arch/arm/mach-mvebu/spl.c  |  90 +--
>  board/gdsys/a38x/Makefile  |   2 +-
>  board/gdsys/a38x/spl.c |  20 --
>  include/configs/clearfog.h |   6 +-
>  include/configs/controlcenterdc.h  |   8 +-
>  include/configs/db-88f6720.h   |   3 -
>  include/configs/db-88f6820-amc.h   |   5 -
>  include/configs/db-88f6820-gp.h|   6 -
>  include/configs/db-mv784mp-gp.h|   3 -
>  include/configs/ds414.h|   5 -
>  include/configs/helios4.h  |   6 +-
>  include/configs/theadorable.h  |   3 -
>  include/configs/turris_omnia.h |   6 -
>  include/configs/x530.h |   3 -
>  scripts/config_whitelist.txt   |   1 -
>  tools/Makefile |   8 -
>  tools/kwbimage.c   | 339 +
>  tools/kwbimage.h   |  30 ++-
>  tools/kwboot.c |  14 +-
>  23 files changed, 296 insertions(+), 285 deletions(-)
>  delete mode 100644 board/gdsys/a38x/spl.c
>
> --
> 2.31.1
>


[PATCH 16/17] i2c: Rename SPL/TPL_I2C_SUPPORT to I2C

2021-07-11 Thread Simon Glass
Rename these options so that CONFIG_IS_ENABLED can be used with them.

Signed-off-by: Simon Glass 
---

 arch/arm/cpu/armv8/fsl-layerscape/spl.c|  2 +-
 arch/arm/mach-omap2/Kconfig|  6 +++---
 arch/arm/mach-omap2/am33xx/Kconfig |  4 ++--
 arch/arm/mach-omap2/boot-common.c  |  2 +-
 arch/arm/mach-sunxi/board.c|  2 +-
 arch/powerpc/cpu/mpc83xx/Kconfig   | 14 +++---
 arch/riscv/cpu/fu740/Kconfig   |  2 +-
 board/freescale/ls1021aqds/ls1021aqds.c|  2 +-
 common/spl/Kconfig |  6 +++---
 configs/A10-OLinuXino-Lime_defconfig   |  2 +-
 configs/A10s-OLinuXino-M_defconfig |  2 +-
 configs/A13-OLinuXino_defconfig|  2 +-
 configs/A20-OLinuXino-Lime2-eMMC_defconfig |  2 +-
 configs/A20-OLinuXino-Lime2_defconfig  |  2 +-
 configs/A20-OLinuXino-Lime_defconfig   |  2 +-
 configs/A20-OLinuXino_MICRO-eMMC_defconfig |  2 +-
 configs/A20-OLinuXino_MICRO_defconfig  |  2 +-
 configs/A20-Olimex-SOM-EVB_defconfig   |  2 +-
 configs/A20-Olimex-SOM204-EVB-eMMC_defconfig   |  2 +-
 configs/A20-Olimex-SOM204-EVB_defconfig|  2 +-
 configs/Ainol_AW1_defconfig|  2 +-
 configs/Ampe_A76_defconfig |  2 +-
 configs/Auxtek-T003_defconfig  |  2 +-
 configs/Auxtek-T004_defconfig  |  2 +-
 configs/Bananapi_M2_Ultra_defconfig|  2 +-
 configs/Bananapi_defconfig |  2 +-
 configs/Bananapro_defconfig|  2 +-
 configs/CHIP_defconfig |  2 +-
 configs/CHIP_pro_defconfig |  2 +-
 configs/Chuwi_V7_CW0825_defconfig  |  2 +-
 configs/Cubieboard2_defconfig  |  2 +-
 configs/Cubieboard_defconfig   |  2 +-
 configs/Cubietruck_defconfig   |  2 +-
 configs/Empire_electronix_d709_defconfig   |  2 +-
 configs/Empire_electronix_m712_defconfig   |  2 +-
 configs/Hyundai_A7HD_defconfig |  2 +-
 configs/Itead_Ibox_A20_defconfig   |  2 +-
 configs/Lamobo_R1_defconfig|  2 +-
 configs/Linksprite_pcDuino3_Nano_defconfig |  2 +-
 configs/Linksprite_pcDuino3_defconfig  |  2 +-
 configs/Linksprite_pcDuino_defconfig   |  2 +-
 configs/MK808C_defconfig   |  2 +-
 configs/MSI_Primo73_defconfig  |  2 +-
 configs/Mele_A1000_defconfig   |  2 +-
 configs/Mele_M3_defconfig  |  2 +-
 configs/Mele_M5_defconfig  |  2 +-
 configs/Mini-X_defconfig   |  2 +-
 configs/Orangepi_defconfig |  2 +-
 configs/Orangepi_mini_defconfig|  2 +-
 configs/P1010RDB-PA_36BIT_NAND_defconfig   |  2 +-
 configs/P1010RDB-PA_36BIT_SDCARD_defconfig |  2 +-
 configs/P1010RDB-PA_36BIT_SPIFLASH_defconfig   |  2 +-
 configs/P1010RDB-PA_NAND_defconfig |  2 +-
 configs/P1010RDB-PA_SDCARD_defconfig   |  2 +-
 configs/P1010RDB-PA_SPIFLASH_defconfig |  2 +-
 configs/P1010RDB-PB_36BIT_NAND_defconfig   |  2 +-
 configs/P1010RDB-PB_36BIT_SDCARD_defconfig |  2 +-
 configs/P1010RDB-PB_36BIT_SPIFLASH_defconfig   |  2 +-
 configs/P1010RDB-PB_NAND_defconfig |  2 +-
 configs/P1010RDB-PB_SDCARD_defconfig   |  2 +-
 configs/P1010RDB-PB_SPIFLASH_defconfig |  2 +-
 configs/P1020RDB-PC_36BIT_NAND_defconfig   |  2 +-
 configs/P1020RDB-PC_36BIT_SDCARD_defconfig |  2 +-
 configs/P1020RDB-PC_36BIT_SPIFLASH_defconfig   |  2 +-
 configs/P1020RDB-PC_NAND_defconfig |  2 +-
 configs/P1020RDB-PC_SDCARD_defconfig   |  2 +-
 configs/P1020RDB-PC_SPIFLASH_defconfig |  2 +-
 configs/P1020RDB-PD_NAND_defconfig |  2 +-
 configs/P1020RDB-PD_SDCARD_defconfig   |  2 +-
 configs/P1020RDB-PD_SPIFLASH_defconfig |  2 +-
 configs/P2020RDB-PC_36BIT_NAND_defconfig   |  2 +-
 configs/P2020RDB-PC_36BIT_SDCARD_defconfig |  2 +-
 configs/P2020RDB-PC_36BIT_SPIFLASH_defconfig   |  2 +-
 configs/P2020RDB-PC_NAND_defconfig |  2 +-
 configs/P2020RDB-PC_SDCARD_defconfig   |  2 +-
 configs/P2020RDB-PC_SPIFLASH_defconfig |  2 +-
 configs/T1024RDB_NAND_defconfig|  2 +-
 configs/T1024RDB_SDCARD_defconfig  |  2 +-
 configs/T1024RDB_SPIFLASH_defconfig|  2 +-
 configs/T1042D4RDB_NAND_defconfig  |  2 +-
 configs/T1042D4RDB_SDCARD_defconfig|  2 +-
 

Re: [PATCH v2 3/6] dts: synquacer: Add partition information to the spi-nor

2021-07-11 Thread Marek Behun
On Sun, 11 Jul 2021 09:46:19 +0900
Masami Hiramatsu  wrote:

> Add partition information to the spi-nor flash.
> This is required for accessing NOR flash via mtdparts.
> 
> Signed-off-by: Masami Hiramatsu 
> ---
>  Changes in v2:
>   - Add new lines to separate the partitions.
> ---
>  .../dts/synquacer-sc2a11-developerbox-u-boot.dtsi  |   49 
> 
>  1 file changed, 49 insertions(+)
> 
> diff --git a/arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsi 
> b/arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsi
> index 2f13a42235..7a56116d6f 100644
> --- a/arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsi
> +++ b/arch/arm/dts/synquacer-sc2a11-developerbox-u-boot.dtsi
> @@ -31,6 +31,55 @@
>   spi-max-frequency = <3125>;
>   spi-rx-bus-width = <0x1>;
>   spi-tx-bus-width = <0x1>;
> +
> + partitions {
> + compatible = "fixed-partitions";
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + partition@0 {
> + label = "BootStrap-BL1";
> + reg = <0x0 0x7>;
> + read-only;
> + };
> +
> + partition@7 {
> + label = "Flash-Writer";
> + reg = <0x7 0x9>;
> + read-only;
> + };
> +
> + partition@10 {
> + label = "SCP-BL2";
> + reg = <0x10 0x8>;
> + read-only;
> + };
> +
> + partition@18 {
> + label = "FIP-TFA";
> + reg = <0x18 0x78000>;
> + };
> +
> + partition@1f8000 {
> + label = "Stage2Tables";
> + reg = <0x1f8000 0x8000>;
> + };
> +
> + partition@20 {
> + label = "U-Boot";
> + reg = <0x20 0x10>;
> + };
> +
> + partition@30 {
> + label = "UBoot-Env";
> + reg = <0x30 0x10>;
> + };
> +
> + partition@50 {
> + label = "Ex-OPTEE";
> + reg = <0x50 0x20>;
> + };
> + };
>   };
>   };
>  
> 

Reviewed-by: Marek Behún 


RE: [EXT] [PATCH 2/3] arm: a37xx: pci: Optimize a3700_fdt_fix_pcie_regions() when fixup offset is zero

2021-07-11 Thread Kostya Porotchkin


> -Original Message-
> From: Pali Rohár 
> Sent: Thursday, July 8, 2021 21:19
> To: Stefan Roese ; Kostya Porotchkin 
> Cc: Marek Behún ; u-boot@lists.denx.de
> Subject: [EXT] [PATCH 2/3] arm: a37xx: pci: Optimize
> a3700_fdt_fix_pcie_regions() when fixup offset is zero
> 
> External Email
> 
> --
> If fixup offset is zero then there is nothing to fix. All calculation in this 
> case just
> increase addresses by value zero which results in identity.
> So in this case skip whole fixup re-calculation as it is not needed.
> 
> This is just an optimization for special case when fix_offset is zero which 
> skips
> code path which does only identity operations (meaning nothing). No functional
> changes.
> 
> Signed-off-by: Pali Rohár 
> ---
>  arch/arm/mach-mvebu/armada3700/cpu.c | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/arm/mach-mvebu/armada3700/cpu.c b/arch/arm/mach-
> mvebu/armada3700/cpu.c
> index 4dd9de471b4e..64838b16c4d8 100644
> --- a/arch/arm/mach-mvebu/armada3700/cpu.c
> +++ b/arch/arm/mach-mvebu/armada3700/cpu.c
> @@ -339,6 +339,10 @@ int a3700_fdt_fix_pcie_regions(void *blob)
>   /* Calculate fixup offset from first child address (in last cell) */
>   fix_offset = base - fdt32_to_cpu(ranges[2]);
> 
> + /* If fixup offset is zero then there is nothing to fix */
> + if (!fix_offset)
> + return 0;
> +
>   /*
>* Fix address (last cell) of each child address and each parent
>* address
> --
> 2.20.1
Reviewed-by: Konstantin Porotchkin 



RE: [EXT] [PATCH 1/3] arm: a37xx: pci: Extend validation for PCIe resources and oubound windows

2021-07-11 Thread Kostya Porotchkin


> -Original Message-
> From: Pali Rohár 
> Sent: Thursday, July 8, 2021 21:19
> To: Stefan Roese ; Kostya Porotchkin 
> Cc: Marek Behún ; u-boot@lists.denx.de
> Subject: [EXT] [PATCH 1/3] arm: a37xx: pci: Extend validation for PCIe
> resources and oubound windows
> 
> External Email
> 
> --
> Remapped address of PCIe outbound window may have set only bits from the
> mask. Add additional check that remapped address which is calculated from
> PCIe bus address specified in DTS file is valid.
> 
> Remove also useless clearing of low 16 bits in win_mask. As win_size is power
> of two and is at least 0x1 it means that it always has zero low
> 16 bits.
> 
> Signed-off-by: Pali Rohár 
> ---
>  drivers/pci/pci-aardvark.c | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pci/pci-aardvark.c b/drivers/pci/pci-aardvark.c index
> 96aa039bdc26..77ce9d0c8d87 100644
> --- a/drivers/pci/pci-aardvark.c
> +++ b/drivers/pci/pci-aardvark.c
> @@ -609,21 +609,22 @@ static void pcie_advk_set_ob_region(struct
> pcie_advk *pcie, int *wins,
>* match with given mask.
>* So every PCIe window size must be a power of two and every start
>* address must be aligned to window size. Minimal size is 64 KiB
> -  * because lower 16 bits of mask must be zero.
> +  * because lower 16 bits of mask must be zero. Remapped address
> +  * may have set only bits from the mask.
>*/
>   while (*wins < OB_WIN_COUNT && size > 0) {
>   /* Calculate the largest aligned window size */
>   win_size = (1ULL << (fls64(size) - 1)) |
>  (phys_start ? (1ULL << __ffs64(phys_start)) : 0);
>   win_size = 1ULL << __ffs64(win_size);
> - if (win_size < 0x1)
> + win_mask = ~(win_size - 1);
> + if (win_size < 0x1 || (bus_start & ~win_mask))
>   break;
> 
>   dev_dbg(pcie->dev,
>   "Configuring PCIe window %d: [0x%llx-0x%llx] as
> 0x%x\n",
>   *wins, (u64)phys_start, (u64)phys_start + win_size,
>   actions);
> - win_mask = ~(win_size - 1) & ~0x;
>   pcie_advk_set_ob_win(pcie, *wins, phys_start, bus_start,
>win_mask, actions);
> 
> --
> 2.20.1
Reviewed-by: Konstantin Porotchkin 



RE: [EXT] [PATCH 3/3] arm: a37xx: pci: Fix typo in comment

2021-07-11 Thread Kostya Porotchkin


> -Original Message-
> From: Pali Rohár 
> Sent: Thursday, July 8, 2021 21:19
> To: Stefan Roese ; Kostya Porotchkin 
> Cc: Marek Behún ; u-boot@lists.denx.de
> Subject: [EXT] [PATCH 3/3] arm: a37xx: pci: Fix typo in comment
> 
> External Email
> 
> --
> Signed-off-by: Pali Rohár 
> ---
>  drivers/pci/pci-aardvark.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/pci-aardvark.c b/drivers/pci/pci-aardvark.c index
> 77ce9d0c8d87..1b9bae7cca72 100644
> --- a/drivers/pci/pci-aardvark.c
> +++ b/drivers/pci/pci-aardvark.c
> @@ -605,7 +605,7 @@ static void pcie_advk_set_ob_region(struct pcie_advk
> *pcie, int *wins,
> 
>   /*
>* The n-th PCIe window is configured by tuple (match, remap, mask)
> -  * and an access to address A uses this window it if A matches the
> +  * and an access to address A uses this window if A matches the
>* match with given mask.
>* So every PCIe window size must be a power of two and every start
>* address must be aligned to window size. Minimal size is 64 KiB
> --
> 2.20.1
Reviewed-by: Konstantin Porotchkin 



[PATCH] ARM: dts: rmobile: Disable RPC HF by default

2021-07-11 Thread Marek Vasut
The RPC HF might be locked by ATF, and any access to its register
space would result in complete hang. Disable the RPC HF by default.
The ATF should be patched to set RPC node status = "okay" in the DT
fragment it passes to U-Boot in case the RPC HF access is unlocked,
and that way U-Boot could access the RPC HF safely.

Signed-off-by: Marek Vasut 
---
ATF patch: https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/10622
---
 arch/arm/dts/r8a77950-salvator-x-u-boot.dts | 2 +-
 arch/arm/dts/r8a77950-ulcb-u-boot.dts   | 2 +-
 arch/arm/dts/r8a77960-salvator-x-u-boot.dts | 2 +-
 arch/arm/dts/r8a77960-ulcb-u-boot.dts   | 2 +-
 arch/arm/dts/r8a77965-salvator-x-u-boot.dts | 2 +-
 arch/arm/dts/r8a77965-ulcb-u-boot.dts   | 2 +-
 arch/arm/dts/r8a77990-ebisu-u-boot.dts  | 2 +-
 arch/arm/dts/r8a77995-draak-u-boot.dts  | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/arm/dts/r8a77950-salvator-x-u-boot.dts 
b/arch/arm/dts/r8a77950-salvator-x-u-boot.dts
index bb83bc1d7b..d94ad91973 100644
--- a/arch/arm/dts/r8a77950-salvator-x-u-boot.dts
+++ b/arch/arm/dts/r8a77950-salvator-x-u-boot.dts
@@ -27,7 +27,7 @@
 
  {
reg = <0 0xee20 0 0x100>, <0 0x0800 0 0x0400>;
-   status = "okay";
+   status = "disabled";
 };
 
  {
diff --git a/arch/arm/dts/r8a77950-ulcb-u-boot.dts 
b/arch/arm/dts/r8a77950-ulcb-u-boot.dts
index 16d9e38b70..ff00ccdb5b 100644
--- a/arch/arm/dts/r8a77950-ulcb-u-boot.dts
+++ b/arch/arm/dts/r8a77950-ulcb-u-boot.dts
@@ -39,7 +39,7 @@
 
  {
reg = <0 0xee20 0 0x100>, <0 0x0800 0 0x0400>;
-   status = "okay";
+   status = "disabled";
 };
 
  {
diff --git a/arch/arm/dts/r8a77960-salvator-x-u-boot.dts 
b/arch/arm/dts/r8a77960-salvator-x-u-boot.dts
index dda3567e9e..79a54f38c1 100644
--- a/arch/arm/dts/r8a77960-salvator-x-u-boot.dts
+++ b/arch/arm/dts/r8a77960-salvator-x-u-boot.dts
@@ -27,7 +27,7 @@
 
  {
reg = <0 0xee20 0 0x100>, <0 0x0800 0 0x0400>;
-   status = "okay";
+   status = "disabled";
 };
 
  {
diff --git a/arch/arm/dts/r8a77960-ulcb-u-boot.dts 
b/arch/arm/dts/r8a77960-ulcb-u-boot.dts
index e4f77ae262..1e9e8b87d5 100644
--- a/arch/arm/dts/r8a77960-ulcb-u-boot.dts
+++ b/arch/arm/dts/r8a77960-ulcb-u-boot.dts
@@ -39,7 +39,7 @@
 
  {
reg = <0 0xee20 0 0x100>, <0 0x0800 0 0x0400>;
-   status = "okay";
+   status = "disabled";
 };
 
  {
diff --git a/arch/arm/dts/r8a77965-salvator-x-u-boot.dts 
b/arch/arm/dts/r8a77965-salvator-x-u-boot.dts
index e651e889bc..4272ecc110 100644
--- a/arch/arm/dts/r8a77965-salvator-x-u-boot.dts
+++ b/arch/arm/dts/r8a77965-salvator-x-u-boot.dts
@@ -27,7 +27,7 @@
 
  {
reg = <0 0xee20 0 0x100>, <0 0x0800 0 0x0400>;
-   status = "okay";
+   status = "disabled";
 };
 
  {
diff --git a/arch/arm/dts/r8a77965-ulcb-u-boot.dts 
b/arch/arm/dts/r8a77965-ulcb-u-boot.dts
index 3574d6da6f..d9c680b171 100644
--- a/arch/arm/dts/r8a77965-ulcb-u-boot.dts
+++ b/arch/arm/dts/r8a77965-ulcb-u-boot.dts
@@ -39,7 +39,7 @@
 
  {
reg = <0 0xee20 0 0x100>, <0 0x0800 0 0x0400>;
-   status = "okay";
+   status = "disabled";
 };
 
  {
diff --git a/arch/arm/dts/r8a77990-ebisu-u-boot.dts 
b/arch/arm/dts/r8a77990-ebisu-u-boot.dts
index 7022a2ba84..55699bafc4 100644
--- a/arch/arm/dts/r8a77990-ebisu-u-boot.dts
+++ b/arch/arm/dts/r8a77990-ebisu-u-boot.dts
@@ -43,7 +43,7 @@
 
  {
reg = <0 0xee20 0 0x100>, <0 0x0800 0 0x0400>;
-   status = "okay";
+   status = "disabled";
 };
 
  {
diff --git a/arch/arm/dts/r8a77995-draak-u-boot.dts 
b/arch/arm/dts/r8a77995-draak-u-boot.dts
index 10fb9cb3b6..0ea2570c1d 100644
--- a/arch/arm/dts/r8a77995-draak-u-boot.dts
+++ b/arch/arm/dts/r8a77995-draak-u-boot.dts
@@ -10,5 +10,5 @@
 
  {
reg = <0 0xee20 0 0x100>, <0 0x0800 0 0x0400>;
-   status = "okay";
+   status = "disabled";
 };
-- 
2.30.2



[PATCH] ARM: dts: rmobile: Remove multiple unused DT properties on R-Car Gen3

2021-07-11 Thread Marek Vasut
Filter out dmas dma-names interrupt-parent interrupts interrupts-extended
interrupt-names interrupt-map interrupt-map-mask iommus DT properties on
R-Car Gen3, since they are not used by U-Boot and only take space.

Signed-off-by: Marek Vasut 
---
 configs/r8a77970_eagle_defconfig   | 2 ++
 configs/r8a77980_condor_defconfig  | 2 ++
 configs/r8a77990_ebisu_defconfig   | 2 ++
 configs/r8a77995_draak_defconfig   | 2 ++
 configs/rcar3_salvator-x_defconfig | 2 ++
 configs/rcar3_ulcb_defconfig   | 2 ++
 6 files changed, 12 insertions(+)

diff --git a/configs/r8a77970_eagle_defconfig b/configs/r8a77970_eagle_defconfig
index 2532154978..eb9f4ab663 100644
--- a/configs/r8a77970_eagle_defconfig
+++ b/configs/r8a77970_eagle_defconfig
@@ -31,6 +31,8 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_OF_CONTROL=y
+CONFIG_OF_DTB_PROPS_REMOVE=y
+CONFIG_OF_REMOVE_PROPS="dmas dma-names interrupt-parent interrupts 
interrupts-extended interrupt-names interrupt-map interrupt-map-mask iommus"
 CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
diff --git a/configs/r8a77980_condor_defconfig 
b/configs/r8a77980_condor_defconfig
index 02f008ad35..db260a34f2 100644
--- a/configs/r8a77980_condor_defconfig
+++ b/configs/r8a77980_condor_defconfig
@@ -32,6 +32,8 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_OF_CONTROL=y
+CONFIG_OF_DTB_PROPS_REMOVE=y
+CONFIG_OF_REMOVE_PROPS="dmas dma-names interrupt-parent interrupts 
interrupts-extended interrupt-names interrupt-map interrupt-map-mask iommus"
 CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
diff --git a/configs/r8a77990_ebisu_defconfig b/configs/r8a77990_ebisu_defconfig
index e5cab47f9f..295c1d89cb 100644
--- a/configs/r8a77990_ebisu_defconfig
+++ b/configs/r8a77990_ebisu_defconfig
@@ -33,6 +33,8 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_OF_CONTROL=y
+CONFIG_OF_DTB_PROPS_REMOVE=y
+CONFIG_OF_REMOVE_PROPS="dmas dma-names interrupt-parent interrupts 
interrupts-extended interrupt-names interrupt-map interrupt-map-mask iommus"
 CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
diff --git a/configs/r8a77995_draak_defconfig b/configs/r8a77995_draak_defconfig
index acae38a6c0..7a3d50851f 100644
--- a/configs/r8a77995_draak_defconfig
+++ b/configs/r8a77995_draak_defconfig
@@ -32,6 +32,8 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_OF_CONTROL=y
+CONFIG_OF_DTB_PROPS_REMOVE=y
+CONFIG_OF_REMOVE_PROPS="dmas dma-names interrupt-parent interrupts 
interrupts-extended interrupt-names interrupt-map interrupt-map-mask iommus"
 CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
diff --git a/configs/rcar3_salvator-x_defconfig 
b/configs/rcar3_salvator-x_defconfig
index 709e6435ae..a985345efe 100644
--- a/configs/rcar3_salvator-x_defconfig
+++ b/configs/rcar3_salvator-x_defconfig
@@ -35,6 +35,8 @@ CONFIG_OF_CONTROL=y
 CONFIG_OF_LIST="r8a77950-salvator-x-u-boot r8a77960-salvator-x-u-boot 
r8a77965-salvator-x-u-boot"
 CONFIG_MULTI_DTB_FIT_LZO=y
 CONFIG_MULTI_DTB_FIT_USER_DEFINED_AREA=y
+CONFIG_OF_DTB_PROPS_REMOVE=y
+CONFIG_OF_REMOVE_PROPS="dmas dma-names interrupt-parent interrupts 
interrupts-extended interrupt-names interrupt-map interrupt-map-mask iommus"
 CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
diff --git a/configs/rcar3_ulcb_defconfig b/configs/rcar3_ulcb_defconfig
index e0d72d940d..0ef1f2de08 100644
--- a/configs/rcar3_ulcb_defconfig
+++ b/configs/rcar3_ulcb_defconfig
@@ -35,6 +35,8 @@ CONFIG_OF_CONTROL=y
 CONFIG_OF_LIST="r8a77950-ulcb-u-boot r8a77960-ulcb-u-boot r8a77965-ulcb-u-boot"
 CONFIG_MULTI_DTB_FIT_LZO=y
 CONFIG_MULTI_DTB_FIT_USER_DEFINED_AREA=y
+CONFIG_OF_DTB_PROPS_REMOVE=y
+CONFIG_OF_REMOVE_PROPS="dmas dma-names interrupt-parent interrupts 
interrupts-extended interrupt-names interrupt-map interrupt-map-mask iommus"
 CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
-- 
2.30.2



Re: [PATCH u-boot-mvebu 00/31] kwboot / kwbimage improvements

2021-07-11 Thread Stefan Roese

On 10.07.21 02:59, Pali Rohár wrote:

On Saturday 10 July 2021 02:43:12 Pali Rohár wrote:

On Saturday 10 July 2021 02:31:32 Stefan Roese wrote:

Could you perhaps add this "SPL returns to BootROM" support as an
optional feature that can be selected on a per-board basis?


Hi Stefan! I was thinking about it and it should not be hard. Based on
defconfig options you decide if you want to use SPL NOR code or stick
with return to BootROM. It is acceptable?

What is needed is just to extend SPL SPI NOR code to parse also kwbimage
header (at offset zero) instead of legacy U-Boot header which is
removing by this patch series and which was on variable offset.


Anyway, this switch "return to BootROM" is done in patch 22. Previous
patches 01 - 21 can be applied and used without later patches. So
meanwhile could you look at patches 01 - 21 if they are OK and if they
could be merged independently of "return to BootROM" patches?


I'll try to find some time next week to review these patches.

Thanks,
Stefan


Re: [PATCH u-boot-mvebu 00/31] kwboot / kwbimage improvements

2021-07-11 Thread Stefan Roese

On 10.07.21 02:43, Pali Rohár wrote:

On Saturday 10 July 2021 02:31:32 Stefan Roese wrote:

Could you perhaps add this "SPL returns to BootROM" support as an
optional feature that can be selected on a per-board basis?


Hi Stefan! I was thinking about it and it should not be hard. Based on
defconfig options you decide if you want to use SPL NOR code or stick
with return to BootROM. It is acceptable?


I think so, yes. If you patches add features / enhancements for some
boards and this can be selected on a per-board basis to not affect other
targets then yes, this can be accepted AFAICT.


What is needed is just to extend SPL SPI NOR code to parse also kwbimage
header (at offset zero) instead of legacy U-Boot header which is
removing by this patch series and which was on variable offset.


It would be helpful, if you could add a Kconfig option to selectively
enable "return to BootROM" - disabled per default and enabled for your
targets to this patchset.

Thanks,
Stefan