Re: FIT image: load secure FPGA

2022-02-08 Thread Jorge Ramirez-Ortiz, Foundries
On 07/02/22, Adrian Fiergolski wrote:
> Hi Jorge and Oleksandr,
> 
> Thank you for sharing all the links. I found there a lot of inspiration to
> meet my target of using encrypted bitfiles.


thanks Adrian. Glad to hear that

> 
> I have also shared with the community a patch, on top of your changes,
> adding encrypted bitfile support in u-boot.


awesome. btw how is the bitstream decrypted? I didnt look into that, I
suppose there is probably a doc somewhere?


> 
> Regards,
> 
> Adrian
> 
> On 19.01.2022 18:48, Oleksandr Suvorov wrote:
> > Hi Adrian,
> > 
> > On Wed, Jan 19, 2022 at 7:23 PM Jorge Ramirez-Ortiz, Foundries
> >  wrote:
> > > On 19/01/22, Jorge Ramirez-Ortiz, Foundries wrote:
> > > > On 19/01/22, Jorge Ramirez-Ortiz, Foundries wrote:
> > > > > On 19/01/22, Adrian Fiergolski wrote:
> > > > > > Hi Jorge,
> > > > > hi Adrian,
> > > > > 
> > > > > > Have you succeeded to enable secure boot on ZynqMP with SPL (not 
> > > > > > Xilinx's
> > > > > > FSBL)? Is it documented somewhere? Any configuration files/yocto 
> > > > > > recipes?
> > > > > somewhere there:
> > > > > https://github.com/foundriesio/meta-lmp
> > > > > 
> > > > > > Have you managed to resolve problem of the bitstream loaded in such 
> > > > > > a case
> > > > > > by SPL?
> > > > > > 
> > > > > Yes. I wrote the docs here below:
> > > > > https://docs.foundries.io/latest/reference-manual/security/authentication-xilinx.html
> > > > > 
> > > > this might help you as well if you use OP-TEE and require RPMB access.
> > > > 
> > > > https://github.com/OP-TEE/optee_os/pull/4874
> > > > 
> > > > 
> > > forgot to add, the PR to load the bistream was followed up by Oleksandr 
> > > (in copy).
> > > but not totally sure if it was merged yet as Simon asked for tests and 
> > > those might be pending.
> > You can try this solution for the Xilinx u-boot 2020.07
> > https://github.com/foundriesio/u-boot/pull/116
> > or this one for the mainline u-boot:
> > https://patchwork.ozlabs.org/project/uboot/list/?series=276743
> > 
> > > > > > I need to use an encrypted bitstream. However, it required the use 
> > > > > > of
> > > > > > DeviceKeys in post-boot state which eventually requires secure boot.
> > > > > > 
> > > > > > Regards,
> > > > > hope that helps
> > > > > 
> > > > > > Adrian


RE: Compile error with SPL_FIT_FULL_CHECK and SPL_LOAD_FIT_FULL enabled

2022-02-08 Thread Johann Neuhauser
> -Original Message-
> From: Simon Glass [mailto:s...@chromium.org]
> Sent: Tuesday, February 8, 2022 6:13 PM
> 
> Hi Johann,
> 
Hi Simon,

thanks for your fast answer.

> On Tue, 8 Feb 2022 at 08:44, Johann Neuhauser
>  wrote:
> >
> > Dear developers and Simon,
> >
> > we wanna run secure boot with U-Boot's SPL_FIT_SIGNATURE and FIT_SIGNATURE 
> > on our STM32MP1 boards and discovered the CVE-2021-27097.
> 
> That is already fixed in 2021.04 so you can just use a mainline U-Boot
> to avoid it.
> 
So we don't need the FIT_FULL_CHECK config symbols to mitigate against
CVE-2021-27097 andwe're save if we use anything after 2021.04?

> > To mitigate this vulnerability we wanna enable SPL_LOAD_FIT_FULL and 
> > SPL_FIT_FULL_CHECK.
> > If I compile any U-Boot SPL with the mentioned config symbols after commit 
> > 6f3c2d8a, it fails always with the following error message:
> >
> > Used defconfig: stm32mp15_dhcom_basic_defconfig (+ mentioned configs 
> > enabled)
> > ```
> > ...
> >   LD  spl/lib/built-in.o
> >   LD  spl/u-boot-spl
> > /usr/bin/arm-linux-gnueabihf-ld.bfd: common/built-in.o: in function 
> > `fit_check_format':
> > /mnt/work/dev/u-boot/common/image-fit.c:1591: undefined reference to 
> > `fdt_check_full'
> > make[1]: *** [scripts/Makefile.spl:432: spl/u-boot-spl] Error 1
> > make: *** [Makefile:1941: spl/u-boot-spl] Error 2
> > ```
> > After diging around to find the cause, we're out of ideas.
> > Does anyone have a clue why the needed function is not compiled in libfdt 
> > for the spl build?
> 
> SPL_OF_LIBFDT_ASSUME_MASK is set to 0xff so this check is not enabled.
> I suspect that the value of that setting should change to 0 or 1 if
> the full check is enabled.
> 
I have come across this symbol before, but I did not pay any attention to it and
rather looked for the problem in Makefile's related to SPL build.
Many thanks for the hint.

> Regards,
> Simon

Best regards,
Johann


Re: [PATCH v4 01/11] FWU: Add FWU metadata structure and driver for accessing metadata

2022-02-08 Thread Michal Simek

Hi,

On 2/9/22 00:39, Masami Hiramatsu wrote:

Hi Michal,

2022年2月8日(火) 23:27 Michal Simek :




On 2/8/22 15:14, Masami Hiramatsu wrote:

2022年2月8日(火) 22:45 Michal Simek :




On 2/8/22 14:36, Masami Hiramatsu wrote:

2022年2月8日(火) 20:35 Sughosh Ganu :


On Tue, 8 Feb 2022 at 16:26, Michal Simek  wrote:


po 7. 2. 2022 v 19:21 odesílatel Sughosh Ganu  napsal:


In the FWU Multi Bank Update feature, the information about the
updatable images is stored as part of the metadata, which is stored on
a dedicated partition. Add the metadata structure, and a driver model
uclass which provides functions to access the metadata. These are
generic API's, and implementations can be added based on parameters
like how the metadata partition is accessed and what type of storage
device houses the metadata.

A device tree node fwu-mdata has been added, which is used for
pointing to the storage device which contains the FWU metadata. The
fwu-mdata node is u-boot specific, and can be added the platform's
u-boot dtsi file.

Signed-off-by: Sughosh Ganu 
---

Changes since V3:
* Move the FWU metadata access to driver model
* Get the storage device containing the metadata from a device tree
 property instead of a platform helper function

arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi  |   7 +
.../firmware/fwu-mdata.txt|  18 +
drivers/Kconfig   |   2 +
drivers/Makefile  |   1 +
drivers/fwu-mdata/Kconfig |   7 +
drivers/fwu-mdata/Makefile|   6 +
drivers/fwu-mdata/fwu-mdata-uclass.c  | 434 ++
include/dm/uclass-id.h|   1 +
include/fwu.h |  51 ++
include/fwu_mdata.h   |  67 +++
10 files changed, 594 insertions(+)
create mode 100644 doc/device-tree-bindings/firmware/fwu-mdata.txt
create mode 100644 drivers/fwu-mdata/Kconfig
create mode 100644 drivers/fwu-mdata/Makefile
create mode 100644 drivers/fwu-mdata/fwu-mdata-uclass.c
create mode 100644 include/fwu.h
create mode 100644 include/fwu_mdata.h

diff --git a/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi 
b/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi
index 06ef3a4095..3bec6107f7 100644
--- a/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi
+++ b/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi
@@ -4,3 +4,10 @@
 */

#include "stm32mp157a-dk1-u-boot.dtsi"
+
+/ {
+   fwu-mdata {
+   compatible = "u-boot,fwu-mdata";
+   fwu-mdata-store = <>;
+   };
+};
diff --git a/doc/device-tree-bindings/firmware/fwu-mdata.txt 
b/doc/device-tree-bindings/firmware/fwu-mdata.txt
new file mode 100644
index 00..c766b595ef
--- /dev/null
+++ b/doc/device-tree-bindings/firmware/fwu-mdata.txt
@@ -0,0 +1,18 @@
+FWU Metadata Access Devicetree Binding
+
+The FWU Multi Bank Update feature uses a metadata structure, stored on
+a separate partition for keeping information on the set of updatable
+images. The device tree node provides information on the storage
+device that contains the FWU metadata.
+
+Required properties :
+
+- compatible : "u-boot,fwu-mdata";
+- fwu-mdata-store : should point to the storage device which contains
+   the FWU metadata partition.


In 0/11 you are describing GPT partitions but I don't think this
binding is generic enough to describe
other cases. It is saying device but not where exactly it is.
I didn't read the whole series yet but arm spec recommends GPT but dt
binding should be generic enough to describe
also other cases.
We are saving this structure to qspi for example but current binding
can't be used for it.


I would wait to see Masami's implementation of this feature. If I am
not wrong, his platform too is enabling this feature with a spi as the
storage device. Maybe we can instead put a list of 
tuples which can then list the device and partition number of the
metadata partitions.


Yes, I would like to define new compatible for sf backend, e.g.
"u-boot,fwu-mdata-sf".


backend is fine. What does this compatible string have to do with it?
I didn't see any fwu-mdata-gpt in this series.


Sughosh made it "fwu-mdata" but I think it should be "fwu-mdata-gpt"
if the required parameters are different.




It will have the fwu-mdata-store to point the SPI flash device, and
will have a list of offset information for the metadata.


Can you describe it?

Something like for raw accesses?
fwu-mdta-store = < 0 >;


I'm still not sure what is the best way. What I thought was,

fwu-mdata-store = <>;
fwu-mdata-offsets = <50, 52>;


as I said. Before this is applied I think we should work on generic proposal how
to describe it. Because the same way can be used for u-boot variables and maybe
others.


Agreed. This also reminds me the dfu_alt_info. Currently the dfu_alt_info
is passed via u-boot variables, but this should be a (important) part of
firmware 

Re: [PATCH v4 02/11] FWU: Add FWU metadata access driver for GPT partitioned block devices

2022-02-08 Thread Masami Hiramatsu
Hi Sughosh,

While porting mdata-sf driver, I'm confusing on the devicetree
usage.

2022年2月8日(火) 3:21 Sughosh Ganu :

> +int fwu_get_mdata_device(struct udevice **mdata_dev)
> +{
> +   u32 phandle;
> +   int ret, size;
> +   struct udevice *dev, *child;
> +   ofnode fwu_mdata_node;
> +   const fdt32_t *phandle_p = NULL;
> +
> +   fwu_mdata_node = ofnode_path("/fwu-mdata");
> +   if (!ofnode_valid(fwu_mdata_node)) {
> +   log_err("fwu-node not found\n");
> +   return -ENOENT;
> +   }

So this seems to get the udevice from path, but I think fwu-mdata node
has "u-boot,fwu-mdata" compatible property, in that case probe function
already gets the node. Why would you search it again by path?

> +
> +   phandle_p = ofnode_get_property(fwu_mdata_node, "fwu-mdata-store",
> +   );
> +   if (!phandle_p) {
> +   log_err("fwu-mdata-store property not found\n");
> +   return -ENOENT;
> +   }
> +
> +   phandle = fdt32_to_cpu(*phandle_p);
> +
> +   ret = device_get_global_by_ofnode(ofnode_get_by_phandle(phandle),
> + );
> +   if (ret)
> +   return ret;
> +
> +   ret = -ENODEV;
> +   for (device_find_first_child(dev, ); child;
> +device_find_next_child()) {
> +   if (device_get_uclass_id(child) == UCLASS_BLK) {
> +   *mdata_dev = child;

I thought that the blk device node directly passed by the
"fwu-mdata-store" property. Would we need to search it from
children nodes?

BTW, if we can use the devicetree, can we define the number of banks
and the number of images can be described too?
Of course as I said in the other thread, I would like to put the
dfu_alt_info like information in the devicetree too.
(But it maybe different from this discussion)

Thank you,


> +   ret = 0;
> +   }
> +   }
> +
> +   return ret;
> +}
> +
> +static int fwu_mdata_gpt_blk_probe(struct udevice *dev)
> +{
> +   int ret;
> +   struct udevice *mdata_dev = NULL;
> +
> +   ret = fwu_get_mdata_device(_dev);
> +   if (ret)
> +   return ret;
> +
> +   dev_set_priv(dev, mdata_dev);
> +
> +   return 0;
> +}
> +
> +static const struct fwu_mdata_ops fwu_gpt_blk_ops = {
> +   .get_image_alt_num = fwu_gpt_get_image_alt_num,
> +   .mdata_check = fwu_gpt_mdata_check,
> +   .get_mdata = fwu_gpt_get_mdata,
> +   .update_mdata = fwu_gpt_update_mdata,
> +};
> +
> +static const struct udevice_id fwu_mdata_ids[] = {
> +   { .compatible = "u-boot,fwu-mdata" },

> +   { }
> +};
> +
> +U_BOOT_DRIVER(fwu_mdata_gpt_blk) = {
> +   .name   = "fwu-mdata-gpt-blk",
> +   .id = UCLASS_FWU_MDATA,
> +   .of_match   = fwu_mdata_ids,
> +   .ops= _gpt_blk_ops,
> +   .probe  = fwu_mdata_gpt_blk_probe,
> +};
> diff --git a/include/fwu.h b/include/fwu.h
> index 5a99c579fc..2c7db2dff9 100644
> --- a/include/fwu.h
> +++ b/include/fwu.h
> @@ -43,6 +43,8 @@ int fwu_get_active_index(u32 *active_idx);
>  int fwu_update_active_index(u32 active_idx);
>  int fwu_get_image_alt_num(efi_guid_t image_type_id, u32 update_bank,
>   int *alt_num);
> +int fwu_get_mdata_device(struct udevice **mdata_dev);
> +int fwu_verify_mdata(struct fwu_mdata *mdata, bool pri_part);
>  int fwu_mdata_check(void);
>  int fwu_revert_boot_index(void);
>  int fwu_accept_image(efi_guid_t *img_type_id, u32 bank);
> --
> 2.17.1
>


--
Masami Hiramatsu


Re: [PATCH v4 2/2] efi_loader: Reset system after CapsuleUpdate on disk

2022-02-08 Thread Masami Hiramatsu
Hi Takahiro,

2022年2月9日(水) 12:13 AKASHI Takahiro :
>
> On Thu, Feb 03, 2022 at 06:23:27PM +0900, Masami Hiramatsu wrote:
> > Add a cold reset soon after processing capsule update on disk.
> > This is required in UEFI specification 2.9 Section 8.5.5
> > "Delivery of Capsules via file on Mass Storage device" as;
> >
> > In all cases that a capsule is identified for processing the system is
> > restarted after capsule processing is completed.
>
> Once this behavior is enforced on U-Boot, CONFIG_EFI_CAPSULE_ON_DISK_EARLY
> will make little sense. This option will have to always be set.

Agreed. This option is recommended. I hope U-Boot scans the devices
before running this early capsule-on-disk so that it can find the
appropriate storage for ESP, but anyway it works.

> Otherwise, a user will see a sudden system reboot when he or she types
> any of efi commands, like "env print -e".

Yes if there is a capsule to be updated, and they will see the new
u-boot coming back soon.
I guess the reason why the capsule-on-disk runs at first, is to avoid
inconsistent status for users, or we can postpone the capsule update
until running "efidebug capsule disk" command. If that is correct,
shouldn't we avoid showing the firmware "to be updated" too?

Thank you,

>
> -Takahiro Akashi
>
>
> > This also reports the result of each capsule update so that the user can
> > notice that the capsule update has been succeeded or not from console log.
> >
> > Signed-off-by: Masami Hiramatsu 
> > ---
> >  Changes in v4:
> >   - Do not use sysreset because that is a warm reset.
> >   - Fix patch description.
> > ---
> >  lib/efi_loader/efi_capsule.c |   18 --
> >  1 file changed, 16 insertions(+), 2 deletions(-)
> >
> > diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
> > index 1ec7ea29ff..20d9490dbd 100644
> > --- a/lib/efi_loader/efi_capsule.c
> > +++ b/lib/efi_loader/efi_capsule.c
> > @@ -14,6 +14,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -1120,8 +1121,11 @@ efi_status_t efi_launch_capsules(void)
> >   if (ret == EFI_SUCCESS) {
> >   ret = efi_capsule_update_firmware(capsule);
> >   if (ret != EFI_SUCCESS)
> > - log_err("Applying capsule %ls failed\n",
> > + log_err("Applying capsule %ls failed.\n",
> >   files[i]);
> > + else
> > + log_info("Applying capsule %ls succeeded.\n",
> > +  files[i]);
> >
> >   /* create Capsule */
> >   set_capsule_result(index, capsule, ret);
> > @@ -1142,6 +1146,16 @@ efi_status_t efi_launch_capsules(void)
> >   free(files[i]);
> >   free(files);
> >
> > - return ret;
> > + /*
> > +  * UEFI spec requires to reset system after complete processing 
> > capsule
> > +  * update on the storage.
> > +  */
> > + log_info("Reboot after firmware update");
> > + /* Cold reset is required for loading the new firmware. */
> > + do_reset(NULL, 0, 0, NULL);
> > + hang();
> > + /* not reach here */
> > +
> > + return 0;
> >  }
> >  #endif /* CONFIG_EFI_CAPSULE_ON_DISK */
> >



-- 
Masami Hiramatsu


Re: [PATCH v4 2/2] efi_loader: Reset system after CapsuleUpdate on disk

2022-02-08 Thread AKASHI Takahiro
On Thu, Feb 03, 2022 at 06:23:27PM +0900, Masami Hiramatsu wrote:
> Add a cold reset soon after processing capsule update on disk.
> This is required in UEFI specification 2.9 Section 8.5.5
> "Delivery of Capsules via file on Mass Storage device" as;
> 
> In all cases that a capsule is identified for processing the system is
> restarted after capsule processing is completed.

Once this behavior is enforced on U-Boot, CONFIG_EFI_CAPSULE_ON_DISK_EARLY
will make little sense. This option will have to always be set.
Otherwise, a user will see a sudden system reboot when he or she types
any of efi commands, like "env print -e".

-Takahiro Akashi


> This also reports the result of each capsule update so that the user can
> notice that the capsule update has been succeeded or not from console log.
> 
> Signed-off-by: Masami Hiramatsu 
> ---
>  Changes in v4:
>   - Do not use sysreset because that is a warm reset.
>   - Fix patch description.
> ---
>  lib/efi_loader/efi_capsule.c |   18 --
>  1 file changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
> index 1ec7ea29ff..20d9490dbd 100644
> --- a/lib/efi_loader/efi_capsule.c
> +++ b/lib/efi_loader/efi_capsule.c
> @@ -14,6 +14,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -1120,8 +1121,11 @@ efi_status_t efi_launch_capsules(void)
>   if (ret == EFI_SUCCESS) {
>   ret = efi_capsule_update_firmware(capsule);
>   if (ret != EFI_SUCCESS)
> - log_err("Applying capsule %ls failed\n",
> + log_err("Applying capsule %ls failed.\n",
>   files[i]);
> + else
> + log_info("Applying capsule %ls succeeded.\n",
> +  files[i]);
>  
>   /* create Capsule */
>   set_capsule_result(index, capsule, ret);
> @@ -1142,6 +1146,16 @@ efi_status_t efi_launch_capsules(void)
>   free(files[i]);
>   free(files);
>  
> - return ret;
> + /*
> +  * UEFI spec requires to reset system after complete processing capsule
> +  * update on the storage.
> +  */
> + log_info("Reboot after firmware update");
> + /* Cold reset is required for loading the new firmware. */
> + do_reset(NULL, 0, 0, NULL);
> + hang();
> + /* not reach here */
> +
> + return 0;
>  }
>  #endif /* CONFIG_EFI_CAPSULE_ON_DISK */
> 


Re: [PATCH v4 10/11] mkeficapsule: Add support for generating empty capsules

2022-02-08 Thread AKASHI Takahiro
Hi Sughosh,

On Mon, Feb 07, 2022 at 11:50:00PM +0530, Sughosh Ganu wrote:
> The Dependable Boot specification describes the structure of the

What is this specification? Please specify the link to the doc.

> firmware accept and revert capsules. These are empty capsules which
> are used for signalling the acceptance or rejection of the updated
> firmware by the OS. Add support for generating these empty capsules.
> 
> Signed-off-by: Sughosh Ganu 
> ---
> 
> Changes since V3:
> * Add related documentation for empty capsules in the mkeficapsule man
>   page.
> * Add separate usage for empty capsules, with corresponding valid
>   options.
> * Use ternary operators where possible.
> * Put a exclusivity check for the empty capsule options.
> 
>  doc/mkeficapsule.1   |  23 +++-
>  tools/eficapsule.h   |   8 +++
>  tools/mkeficapsule.c | 131 ---
>  3 files changed, 139 insertions(+), 23 deletions(-)
> 
> diff --git a/doc/mkeficapsule.1 b/doc/mkeficapsule.1
> index 8babb27ee8..75fc15906a 100644
> --- a/doc/mkeficapsule.1
> +++ b/doc/mkeficapsule.1
> @@ -8,7 +8,7 @@ mkeficapsule \- Generate EFI capsule file for U-Boot
>  
>  .SH SYNOPSIS
>  .B mkeficapsule
> -.RI [ options "] " image-blob " " capsule-file
> +.RI [ options ] " " [ image-blob ] " " capsule-file

With this formatting, "capsule-file" will get italic.

=> .RI [ options "] [" image-blob "] " capsule-file

Right?

Furthermore, I think we can describe the command syntax of the two
different cases (normal or empty capsule) more specifically.

>  
>  .SH "DESCRIPTION"
>  .B mkeficapsule
> @@ -23,8 +23,13 @@ Optionally, a capsule file can be signed with a given 
> private key.
>  In this case, the update will be authenticated by verifying the signature
>  before applying.
>  
> +Additionally, an empty capsule file can be generated for acceptance or
> +rejection of firmware images by a governing component like an Operating
> +System. The empty capsules do not require an image-blob input file.
> +
> +
>  .B mkeficapsule
> -takes any type of image files, including:
> +takes any type of image files when generating non empty capsules, including:
>  .TP
>  .I raw image
>  format is a single binary blob of any type of firmware.
> @@ -43,7 +48,7 @@ specify a guid for the FMP driver.
>  .SH "OPTIONS"
>  One of
>  .BR --fit ", " --raw " or " --guid
> -option must be specified.
> +option must be specified for non empty capsules.
>  
>  .TP
>  .BR -f ", " --fit
> @@ -69,6 +74,18 @@ Specify an image index
>  .BI "-I\fR,\fB --instance " instance
>  Specify a hardware instance
>  
> +.PP
> +For generation of firmware accept empty capsule
> +.BR --guid
> +is mandatory

I don't still understand why we need GUID for accept empty capsule.
We should have only one choice, whether all the new firmware be
permanently applied or completely reverted.

That's A/B update, isn't it?

> +.TP
> +.BI "-A\fR,\fB --fw-accept "
> +Generate a firmware acceptance empty capsule
> +
> +.TP
> +.BI "-R\fR,\fB --fw-revert "
> +Generate a firmware revert empty capsule
> +
>  .TP
>  .BR -h ", " --help
>  Print a help message
> diff --git a/tools/eficapsule.h b/tools/eficapsule.h
> index 8c1560bb06..6001952bdc 100644
> --- a/tools/eficapsule.h
> +++ b/tools/eficapsule.h
> @@ -50,6 +50,14 @@ typedef struct {
>   EFI_GUID(0x4aafd29d, 0x68df, 0x49ee, 0x8a, 0xa9, \
>0x34, 0x7d, 0x37, 0x56, 0x65, 0xa7)
>  
> +#define FW_ACCEPT_OS_GUID \
> + EFI_GUID(0x0c996046, 0xbcc0, 0x4d04, 0x85, 0xec, \
> +  0xe1, 0xfc, 0xed, 0xf1, 0xc6, 0xf8)
> +
> +#define FW_REVERT_OS_GUID \
> + EFI_GUID(0xacd58b4b, 0xc0e8, 0x475f, 0x99, 0xb5, \
> +  0x6b, 0x3f, 0x7e, 0x07, 0xaa, 0xf0)
> +
>  /* flags */
>  #define CAPSULE_FLAGS_PERSIST_ACROSS_RESET  0x0001
>  
> diff --git a/tools/mkeficapsule.c b/tools/mkeficapsule.c
> index 161affdd15..e5dbec3a92 100644
> --- a/tools/mkeficapsule.c
> +++ b/tools/mkeficapsule.c
> @@ -29,6 +29,7 @@
>  #include "eficapsule.h"
>  
>  static const char *tool_name = "mkeficapsule";
> +unsigned char accept_fw_capsule, revert_fw_capsule, empty_capsule;

Bool? but those variables are redundant.

As Ilias suggested, introducing a new enum type here can
simplify the code in the following code.
enum {
CAPSULE_NORMAL_BLOB = 0,
CAPSULE_ACCEPT,
CAPSULE_REVERT,
} capsule_type;


>  
>  efi_guid_t efi_guid_fm_capsule = EFI_FIRMWARE_MANAGEMENT_CAPSULE_ID_GUID;
>  efi_guid_t efi_guid_image_type_uboot_fit =
> @@ -38,9 +39,9 @@ efi_guid_t efi_guid_image_type_uboot_raw =
>  efi_guid_t efi_guid_cert_type_pkcs7 = EFI_CERT_TYPE_PKCS7_GUID;
>  
>  #ifdef CONFIG_TOOLS_LIBCRYPTO

Please rebase your patch to my v10 or later.
I have already removed the dependency on openssl library.

> -static const char *opts_short = "frg:i:I:v:p:c:m:dh";
> +static const char *opts_short = "frg:i:I:v:p:c:m:dhAR";
>  #else
> -static const char *opts_short = "frg:i:I:v:h";
> +static const char *opts_short = 

[PATCH] arm: kirkwood: Pogoplug E02 : Convert Ethernet to Driver Model

2022-02-08 Thread Tony Dinh
The Pogoplug E02 board has the network chip Marvell 88E1116R. Convert
to Driver Model and use uclass mvgbe and the compatible driver M88E1118R
to bring up Ethernet.

- Add board_eth_init(), CONFIG_DM_ETH, and CONFIG_PHY_MARVELL
to bring up Ethernet.
- Currently, CONFIG_RESET_PHY_R symbol is used in
arch/arm/mach-kirkwood/include/mach/config.h for all Kirkwood
boards with mv8831116 PHY, with each board defines the function
reset_phy(). Undefine it for this board.
- As the result of the migration to Driver Model, this u-boot image has
grown substantially (about 100K, give or take). The old envs location
at 0x6 (384k) is no longer possible. Move it to 0xC (768K).
- Miscellaneous changes: Move constants to .c file and remove header file
board/cloudengines/pogo_e02/pogo_e02.h, use CONFIG_SYS_THUMB_BUILD to
keep u-boot image under 512K, use BIT macro, and cleanup comments.

Signed-off-by: Tony Dinh 
---

 board/cloudengines/pogo_e02/pogo_e02.c | 51 +++---
 board/cloudengines/pogo_e02/pogo_e02.h | 29 ---
 configs/pogo_e02_defconfig |  6 ++-
 include/configs/pogo_e02.h | 13 ++-
 4 files changed, 22 insertions(+), 77 deletions(-)
 delete mode 100644 board/cloudengines/pogo_e02/pogo_e02.h

diff --git a/board/cloudengines/pogo_e02/pogo_e02.c 
b/board/cloudengines/pogo_e02/pogo_e02.c
index 039fd6e3dd..59e1218b41 100644
--- a/board/cloudengines/pogo_e02/pogo_e02.c
+++ b/board/cloudengines/pogo_e02/pogo_e02.c
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
+ * Copyright (C) 2022 Tony Dinh 
  * Copyright (C) 2012
  * David Purdy 
  *
@@ -12,16 +13,21 @@
 #include 
 #include 
 #include 
-#include 
-#include 
+#include 
 #include 
 #include 
 #include 
 #include 
-#include "pogo_e02.h"
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
+/* GPIO configuration */
+#define POGO_E02_OE_LOW(~(0))
+#define POGO_E02_OE_HIGH   (~(0))
+#define POGO_E02_OE_VAL_LOWBIT(29)
+#define POGO_E02_OE_VAL_HIGH   0
+
 int board_early_init_f(void)
 {
/*
@@ -64,6 +70,11 @@ int board_early_init_f(void)
return 0;
 }
 
+int board_eth_init(struct bd_info *bis)
+{
+   return cpu_eth_init(bis);
+}
+
 int board_init(void)
 {
/* Boot parameters address */
@@ -71,37 +82,3 @@ int board_init(void)
 
return 0;
 }
-
-#ifdef CONFIG_RESET_PHY_R
-/* Configure and initialize PHY */
-void reset_phy(void)
-{
-   u16 reg;
-   u16 devadr;
-   char *name = "egiga0";
-
-   if (miiphy_set_current_dev(name))
-   return;
-
-   /* command to read PHY dev address */
-   if (miiphy_read(name, 0xEE, 0xEE, (u16 *) )) {
-   printf("Err..(%s) could not read PHY dev address\n", __func__);
-   return;
-   }
-
-   /*
-* Enable RGMII delay on Tx and Rx for CPU port
-* Ref: sec 4.7.2 of chip datasheet
-*/
-   miiphy_write(name, devadr, MV88E1116_PGADR_REG, 2);
-   miiphy_read(name, devadr, MV88E1116_MAC_CTRL_REG, );
-   reg |= (MV88E1116_RGMII_RXTM_CTRL | MV88E1116_RGMII_TXTM_CTRL);
-   miiphy_write(name, devadr, MV88E1116_MAC_CTRL_REG, reg);
-   miiphy_write(name, devadr, MV88E1116_PGADR_REG, 0);
-
-   /* reset the phy */
-   miiphy_reset(name, devadr);
-
-   debug("88E1116 Initialized on %s\n", name);
-}
-#endif /* CONFIG_RESET_PHY_R */
diff --git a/board/cloudengines/pogo_e02/pogo_e02.h 
b/board/cloudengines/pogo_e02/pogo_e02.h
deleted file mode 100644
index c8397b4d4f..00
--- a/board/cloudengines/pogo_e02/pogo_e02.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright (C) 2012
- * David Purdy 
- *
- * Based on Kirkwood support:
- * (C) Copyright 2009
- * Marvell Semiconductor 
- * Written-by: Prafulla Wadaskar 
- */
-
-#ifndef __POGO_E02_H
-#define __POGO_E02_H
-
-/* GPIO configuration */
-#define POGO_E02_OE_LOW(~(0))
-#define POGO_E02_OE_HIGH   (~(0))
-#define POGO_E02_OE_VAL_LOW(1 << 29)
-#define POGO_E02_OE_VAL_HIGH   0
-
-/* PHY related */
-#define MV88E1116_LED_FCTRL_REG10
-#define MV88E1116_CPRSP_CR3_REG21
-#define MV88E1116_MAC_CTRL_REG 21
-#define MV88E1116_PGADR_REG22
-#define MV88E1116_RGMII_TXTM_CTRL  (1 << 4)
-#define MV88E1116_RGMII_RXTM_CTRL  (1 << 5)
-
-#endif /* __POGO_E02_H */
diff --git a/configs/pogo_e02_defconfig b/configs/pogo_e02_defconfig
index 10f08a515d..7853cc7b24 100644
--- a/configs/pogo_e02_defconfig
+++ b/configs/pogo_e02_defconfig
@@ -2,13 +2,14 @@ CONFIG_ARM=y
 CONFIG_SKIP_LOWLEVEL_INIT=y
 CONFIG_SYS_DCACHE_OFF=y
 CONFIG_ARCH_CPU_INIT=y
+CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_KIRKWOOD=y
 CONFIG_SYS_KWD_CONFIG="board/cloudengines/pogo_e02/kwbimage.cfg"
 CONFIG_SYS_TEXT_BASE=0x60
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_TARGET_POGO_E02=y
 

Re: Running qemu tests on RISC-V

2022-02-08 Thread Simon Glass
Hi Heinrich,

On Tue, 8 Feb 2022 at 17:58, Heinrich Schuchardt  wrote:
>
>
>
> Am 8. Februar 2022 22:55:38 MEZ schrieb Simon Glass :
> >Hi Alper,
> >
> >On Tue, 8 Feb 2022 at 14:36, Alper Nebi Yasak  
> >wrote:
> >>
> >> On 08/02/2022 23:43, Simon Glass wrote:
> >> > Thanks for testing it. I don't see this on
> >> >
> >> > 8b139f4e1c0 (HEAD, us/master) Merge tag 'u-boot-imx-20220207' of
> >> > https://gitlab.denx.de/u-boot/custodians/u-boot-imx
> >> >
> >> > :
> >> >
> >> > tools/binman/binman   --toolpath ./tools  build -u -d u-boot.dtb -O .
> >> > -m --allow-missing --fake-ext-blobs -I . -I
> >> > /scratch/sglass/cosarm/src/third_party/u-boot/files -I
> >> > /scratch/sglass/cosarm/src/third_party/u-boot/files/board/emulation/qemu-riscv
> >> > -I arch/riscv/dts -a of-list="qemu-virt32"  -a atf-bl31-path= -a
> >> > opensbi-path= -a default-dt="qemu-virt32" -a scp-path= -a
> >> > spl-bss-pad=1 -a tpl-bss-pad=1 -a spl-dtb=y -a tpl-dtb=
> >>
> >> This command does print the warning for me at that commit (and I see it
> >> with `make` before that).
> >>
> >> If I run `touch fw_dynamic.bin` it no longer does, maybe check if such a
> >> file exists in your include paths.
> >
> >OK that is it, thanks.
> >
> >I think binman should remove the fake files before exiting. What do you 
> >think?
>
> What do you mean by fake file? Does your build fail if you put the correct 
> file there?

U-Boot writes fake files if needed to make the build works, e.g. for
mkimage which needs a real file to actually run.

Not yet but I'm sure it's just a case of finding the right binary
blob. For a brand-new platform too. So sad.

CROSS_COMPILE=~/.buildman-toolchains/gcc-9.2.0-nolibc/riscv32-linux/bin/riscv32-linux-
make PLATFORM=generic -j30

$ do-qemu-riscv_spl.sh help
+ test=help
+ OPENSBI=opensbi/build/platform/generic/firmware/fw_dynamic.bin
crosfw qemu-riscv32_spl
+ 
PATH=/home/sglass/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/sglass/bin:/sbin:/scratch/sglass/cosarm/depot_tools:/home/sglass/cosarm/chromite/bin:/home/sglass/.local/bin:/home/sglass/bin:/vid/software/devel/ubtest/u-boot-test-hooks/bin:/vid/software/devel/ubtest/u-boot-test-hooks/
test/py/test.py -B qemu-riscv32_spl --id na --build-dir
/tmp/b/qemu-riscv32_spl -k help
+u-boot-test-flash qemu-riscv32_spl na
= test session
starts =
platform linux -- Python 3.8.10, pytest-4.6.9, py-1.8.1, pluggy-0.13.0
hypothesis profile 'default' ->
database=DirectoryBasedExampleDatabase('/scratch/sglass/cosarm/src/third_party/u-boot/files/.hypothesis/examples')
rootdir: /scratch/sglass/cosarm/src/third_party/u-boot/files/test/py,
inifile: pytest.ini
plugins: forked-1.1.3, hypothesis-4.36.2, xdist-1.31.0
collected 344 items / 342 deselected / 2 selected

test/py/tests/test_fpga.py s
 [ 50%]
test/py/tests/test_help.py E
 [100%]

=== ERRORS

_ ERROR at setup of
test_help _
test/py/conftest.py:367: in u_boot_console
console.ensure_spawned()
test/py/u_boot_console_base.py:372: in ensure_spawned
m = self.p.expect([pattern_u_boot_main_signon] + self.bad_patterns)
test/py/u_boot_spawn.py:193: in expect
raise Timeout()
E   u_boot_spawn.Timeout
 Captured stdout
setup 
+u-boot-test-reset qemu-riscv32_spl na

U-Boot SPL 2022.04-rc1-1-gbddd3967b6f (Feb 08 2022 - 19:36:55 -0700)
Trying to boot from RAM
= 1 skipped, 342 deselected, 1
error in 31.47 seconds =


Regards,
Simon


Re: [PATCH] binman: Skip processing "hash" subnodes of FIT subsections

2022-02-08 Thread Simon Glass
Hi Alper,

On Tue, 8 Feb 2022 at 16:07, Alper Nebi Yasak  wrote:
>
> Binman's FIT entry type can have image subentries with "hash" subnodes
> intended to be processed by mkimage, but not binman. However, the Entry
> class and any subclass that reuses its implementation tries to process
> these unconditionally. This can lead to an error when boards specify
> hash algorithms that binman doesn't support, but mkimage supports.
>
> Let entries skip processing these "hash" subnodes based on an instance
> variable, and set this instance variable for FIT subsections. Also
> re-enable processing of calculated and missing properties of FIT entries
> which was disabled to mitigate this issue.
>
> Signed-off-by: Alper Nebi Yasak 
> ---
> This applies on top of u-boot-dm/master, and does not resend my
> "binman: Update image positions of FIT subentries" patch [1] which
> should be applied on top of this.
>
> [1] 
> https://patchwork.ozlabs.org/project/uboot/patch/20220207220809.4497-6-alpernebiya...@gmail.com/

Perfect, thanks

>
>  tools/binman/entry.py | 15 +++
>  tools/binman/etype/fit.py | 12 ++--
>  2 files changed, 13 insertions(+), 14 deletions(-)
>
> diff --git a/tools/binman/entry.py b/tools/binman/entry.py
> index dc26f8f167b0..6f98353c8569 100644
> --- a/tools/binman/entry.py
> +++ b/tools/binman/entry.py
> @@ -78,6 +78,8 @@ class Entry(object):
>  external: True if this entry contains an external binary blob
>  bintools: Bintools used by this entry (only populated for Image)
>  missing_bintools: List of missing bintools for this entry
> +update_hash: True if this entry's "hash" subnode should be
> +updated with a hash of the entry contents
>  """
>  def __init__(self, section, etype, node, name_prefix=''):
>  # Put this here to allow entry-docs and help to work without libfdt
> @@ -111,6 +113,7 @@ def __init__(self, section, etype, node, name_prefix=''):
>  self.allow_fake = False
>  self.bintools = {}
>  self.missing_bintools = []
> +self.update_hash = True
>
>  @staticmethod
>  def FindEntryClass(etype, expanded):
> @@ -315,9 +318,11 @@ def AddMissingProperties(self, have_image_pos):
>
>  if self.compress != 'none':
>  state.AddZeroProp(self._node, 'uncomp-size')
> -err = state.CheckAddHashProp(self._node)
> -if err:
> -self.Raise(err)
> +
> +if self.update_hash:
> +err = state.CheckAddHashProp(self._node)
> +if err:
> +self.Raise(err)
>
>  def SetCalculatedProperties(self):
>  """Set the value of device-tree properties calculated by binman"""
> @@ -333,7 +338,9 @@ def SetCalculatedProperties(self):
>  state.SetInt(self._node, 'orig-size', self.orig_size, True)
>  if self.uncomp_size is not None:
>  state.SetInt(self._node, 'uncomp-size', self.uncomp_size)
> -state.CheckSetHashValue(self._node, self.GetData)
> +
> +if self.update_hash:
> +state.CheckSetHashValue(self._node, self.GetData)
>
>  def ProcessFdt(self, fdt):
>  """Allow entries to adjust the device tree
> diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py
> index a56b0564f9a1..a979d0f1a613 100644
> --- a/tools/binman/etype/fit.py
> +++ b/tools/binman/etype/fit.py
> @@ -186,6 +186,8 @@ def _AddNode(base_node, depth, node):
>  # 'data' property later.
>  entry = Entry.Create(self.section, node, etype='section')
>  entry.ReadNode()
> +# The hash subnodes here are for mkimage, not binman.
> +entry.update_hash = False

I know it is less Pythonic but I would like to have this be a function
in Entry, like SetUpdateHash(bool), so that it feels more like that
class has control over things.

>  self._entries[rel_path] = entry
>

Also can you please add a test that uses a FIT containing hash{} nodes?

>  for subnode in node.subnodes:
> @@ -294,13 +296,3 @@ def _BuildInput(self, fdt):
>  def AddBintools(self, tools):
>  super().AddBintools(tools)
>  self.mkimage = self.AddBintool(tools, 'mkimage')
> -
> -def AddMissingProperties(self, have_image_pos):
> -# We don't want to interfere with any hash properties in the FIT, so
> -# disable this for now.
> -pass
> -
> -def SetCalculatedProperties(self):
> -# We don't want to interfere with any hash properties in the FIT, so
> -# disable this for now.
> -pass
> --
> 2.34.1
>

Regards,
Simon


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

2022-02-08 Thread Jaehoon Chung
Dear Tom,

Please pull u-boot-mmc master into u-boot master branch.
There is the fixing fsl_esdhc_imx issue.
If there is any problem, let me know, plz

Best Regards,
Jaehoon Chung

CI: https://source.denx.de/u-boot/custodians/u-boot-mmc/-/pipelines/10913

The following changes since commit 531c00894577a0a852431adf61ade76925f8b162:

  Merge branch '2022-02-08-TI-platform-updates' (2022-02-08 12:28:04 -0500)

are available in the Git repository at:

  g...@source.denx.de:u-boot/custodians/u-boot-mmc.git master

for you to fetch changes up to 14448e9c97f06717cac95888329ab7cf31929050:

  mmc: fsl_esdhc_imx: fix watermark level in dma (2022-02-09 08:33:28 +0900)


Marcel Ziswiler (1):
  mmc: fsl_esdhc_imx: fix watermark level in dma

Marek Vasut (1):
  cmd: mmc: Consider GP partitions in mmc hwpartition user enh start -

 cmd/mmc.c   | 22 --
 drivers/mmc/fsl_esdhc_imx.c |  5 ++---
 2 files changed, 22 insertions(+), 5 deletions(-)


Re: Running qemu tests on RISC-V

2022-02-08 Thread Heinrich Schuchardt



Am 8. Februar 2022 22:55:38 MEZ schrieb Simon Glass :
>Hi Alper,
>
>On Tue, 8 Feb 2022 at 14:36, Alper Nebi Yasak  wrote:
>>
>> On 08/02/2022 23:43, Simon Glass wrote:
>> > Thanks for testing it. I don't see this on
>> >
>> > 8b139f4e1c0 (HEAD, us/master) Merge tag 'u-boot-imx-20220207' of
>> > https://gitlab.denx.de/u-boot/custodians/u-boot-imx
>> >
>> > :
>> >
>> > tools/binman/binman   --toolpath ./tools  build -u -d u-boot.dtb -O .
>> > -m --allow-missing --fake-ext-blobs -I . -I
>> > /scratch/sglass/cosarm/src/third_party/u-boot/files -I
>> > /scratch/sglass/cosarm/src/third_party/u-boot/files/board/emulation/qemu-riscv
>> > -I arch/riscv/dts -a of-list="qemu-virt32"  -a atf-bl31-path= -a
>> > opensbi-path= -a default-dt="qemu-virt32" -a scp-path= -a
>> > spl-bss-pad=1 -a tpl-bss-pad=1 -a spl-dtb=y -a tpl-dtb=
>>
>> This command does print the warning for me at that commit (and I see it
>> with `make` before that).
>>
>> If I run `touch fw_dynamic.bin` it no longer does, maybe check if such a
>> file exists in your include paths.
>
>OK that is it, thanks.
>
>I think binman should remove the fake files before exiting. What do you think?

What do you mean by fake file? Does your build fail if you put the correct file 
there?

Best regards 

Heinrich 

>
>Regards,
>Simon


Re: ARM A53 and initial MMU mapping for EL0/1/2/3 ?

2022-02-08 Thread Andre Przywara
On Tue, 8 Feb 2022 22:05:00 +
Joakim Tjernlund  wrote:

Hi Joakim,

> Trying to figure out how I should map the MMU for normal RAM so it acessible
> from all ELx security states.

   ^^^

This does not make much sense. U-Boot is typically running in one
exception level only, and sets up the page table for exactly that EL.
Each EL uses a separate translation regime (with some twists for stage
2 EL2 and combined EL1/0, plus VHE). If you map your memory in EL3, then
drop to EL2, the EL3 page tables become irrelevant.

So in U-Boot we just set up the page tables for the EL we are running
in, and leave the paging for the lower exception levels to be set up at
the discretion of our payloads (kernels, hypervisors).

Please not that *secure* memory is a separate concept, and handled by
external hardware, typically using regions, not page tables.

> So far I have this mem_map: 
> 
>   /* memory mapped RAM. 32MB  */
>   .virt = 0x6000UL,
>   .phys = 0x6000UL,
>   .size = 0x0200UL,
>   .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_INNER_SHARE
> 
> but starting to doubt that is correct, can someone suggest what to put in the 
> .attrs field?

Those are the correct attributes for normal ("cache-able") memory.
However you probably need at least another mapping for MMIO accesses,
which MUST NOT be cacheable (MT_DEVICE_NGNRNE), but device memory.
See the beginning of arch/arm/mach-sunxi/board.c for an example.

Cheers,
Andre


Re: [PATCH] Nokia RX-51: Convert to CONFIG_DM_KEYBOARD

2022-02-08 Thread Pali Rohár
On Tuesday 08 February 2022 12:36:24 Tom Rini wrote:
> On Thu, Feb 03, 2022 at 07:38:50PM +0100, Pali Rohár wrote:
> 
> > Signed-off-by: Pali Rohár 
> 
> Applied to u-boot/master, thanks!
> 
> -- 
> Tom

Thank you Tom!


Re: [PATCH 03/19] mmc: call device_probe() after scanning

2022-02-08 Thread Jaehoon Chung
On 2/2/22 10:08, AKASHI Takahiro wrote:
> Every time a mmc bus/port is scanned and a new device is detected,
> we want to call device_probe() as it will give us a chance to run
> additional post-processings for some purposes.
> 
> In particular, support for creating partitions on a device will be added.
> 
> Signed-off-by: AKASHI Takahiro 
> ---
>  drivers/mmc/mmc-uclass.c | 12 
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
> index b80e838066ca..e918f58a212e 100644
> --- a/drivers/mmc/mmc-uclass.c
> +++ b/drivers/mmc/mmc-uclass.c
> @@ -467,6 +467,18 @@ static int mmc_blk_probe(struct udevice *dev)
>   return ret;
>   }
>  
> + ret = device_probe(dev);
> + if (ret) {
> + debug("Can't probe\n");

how about displaying return value to debug?

Best Regards,
Jaehoon Chung

> +
> + if (IS_ENABLED(CONFIG_MMC_UHS_SUPPORT) ||
> + IS_ENABLED(CONFIG_MMC_HS200_SUPPORT) ||
> + IS_ENABLED(CONFIG_MMC_HS400_SUPPORT))
> + mmc_deinit(mmc);
> +
> + return ret;
> + }
> +
>   return 0;
>  }
>  



Re: [PATCH v4 4/4] rockchip: sdhci: Add HS400 Enhanced Strobe support for RK3568

2022-02-08 Thread Jaehoon Chung
On 1/29/22 07:42, Alper Nebi Yasak wrote:
> On RK3568, a register bit must be set to enable Enhanced Strobe.
> However, it appears that the address of this register may differ from
> vendor to vendor and should be read from the underlying MMC IP. Let the
> Rockchip SDHCI driver read this address and set the relevant bit when
> Enhanced Strobe configuration is requested.
> 
> Additionally, a bit signifying that the connected hardware is an eMMC
> chip must be set to enable Data Strobe for HS400 and HS400ES modes. Also
> make the driver set this bit as appropriate.
> 
> This is partly ported from Linux's Synopsys DWC MSHC driver which
> happens to be the underlying IP. (drivers/mmc/host/sdhci-of-dwcmshc.c in
> Linux tree).
> 
> Signed-off-by: Alper Nebi Yasak 

Reviewed-by: Jaehoon Chung 

As you mentioned, if someone test this on RK3568 board, it will be more better.

Best Regards,
Jaehoon Chung

> ---
> Only build-tested as I don't have a RK3568 board.
> 
> (no changes since v3)
> 
> Changes in v3:
> - Set DWCMSHC_CARD_IS_EMMC bit in rk3568_emmc_phy_init()
> 
> Changes in v2:
> - Rename rk3568_set_enhanced_strobe -> rk3568_sdhci_set_enhanced_strobe
> - Let set_enhanced_strobe() unset the ES bit if mode is not HS400_ES
> 
>  drivers/mmc/rockchip_sdhci.c | 42 
>  1 file changed, 42 insertions(+)
> 
> diff --git a/drivers/mmc/rockchip_sdhci.c b/drivers/mmc/rockchip_sdhci.c
> index f4d5a59036a2..1d96c4696b6f 100644
> --- a/drivers/mmc/rockchip_sdhci.c
> +++ b/drivers/mmc/rockchip_sdhci.c
> @@ -45,6 +45,14 @@
>  #define ARASAN_VENDOR_REGISTER   0x78
>  #define ARASAN_VENDOR_ENHANCED_STROBEBIT(0)
>  
> +/* DWC IP vendor area 1 pointer */
> +#define DWCMSHC_P_VENDOR_AREA1   0xe8
> +#define DWCMSHC_AREA1_MASK   GENMASK(11, 0)
> +/* Offset inside the vendor area 1 */
> +#define DWCMSHC_EMMC_CONTROL 0x2c
> +#define DWCMSHC_CARD_IS_EMMC BIT(0)
> +#define DWCMSHC_ENHANCED_STROBE  BIT(8)
> +
>  /* Rockchip specific Registers */
>  #define DWCMSHC_EMMC_DLL_CTRL0x800
>  #define DWCMSHC_EMMC_DLL_CTRL_RESET  BIT(1)
> @@ -279,11 +287,25 @@ static int rk3568_emmc_phy_init(struct udevice *dev)
>  {
>   struct rockchip_sdhc *prv = dev_get_priv(dev);
>   struct sdhci_host *host = >host;
> + struct mmc *mmc = host->mmc;
>   u32 extra;
> + u32 vendor;
> + int reg;
>  
>   extra = DLL_RXCLK_NO_INVERTER << DWCMSHC_EMMC_DLL_RXCLK_SRCSEL;
>   sdhci_writel(host, extra, DWCMSHC_EMMC_DLL_RXCLK);
>  
> + /* set CARD_IS_EMMC bit to enable Data Strobe for HS400 and HS400ES */
> + reg = (sdhci_readl(host, DWCMSHC_P_VENDOR_AREA1) & DWCMSHC_AREA1_MASK)
> +   + DWCMSHC_EMMC_CONTROL;
> +
> + vendor = sdhci_readw(host, reg);
> + if (IS_MMC(mmc))
> + vendor |= DWCMSHC_CARD_IS_EMMC;
> + else
> + vendor &= ~DWCMSHC_CARD_IS_EMMC;
> + sdhci_writew(host, vendor, reg);
> +
>   return 0;
>  }
>  
> @@ -346,6 +368,25 @@ static int rk3568_emmc_get_phy(struct udevice *dev)
>   return 0;
>  }
>  
> +static int rk3568_sdhci_set_enhanced_strobe(struct sdhci_host *host)
> +{
> + struct mmc *mmc = host->mmc;
> + u32 vendor;
> + int reg;
> +
> + reg = (sdhci_readl(host, DWCMSHC_P_VENDOR_AREA1) & DWCMSHC_AREA1_MASK)
> +   + DWCMSHC_EMMC_CONTROL;
> +
> + vendor = sdhci_readl(host, reg);
> + if (mmc->selected_mode == MMC_HS_400_ES)
> + vendor |= DWCMSHC_ENHANCED_STROBE;
> + else
> + vendor &= ~DWCMSHC_ENHANCED_STROBE;
> + sdhci_writel(host, vendor, reg);
> +
> + return 0;
> +}
> +
>  static int rk3568_sdhci_set_ios_post(struct sdhci_host *host)
>  {
>   struct mmc *mmc = host->mmc;
> @@ -554,6 +595,7 @@ static const struct sdhci_data rk3568_data = {
>   .get_phy = rk3568_emmc_get_phy,
>   .emmc_phy_init = rk3568_emmc_phy_init,
>   .set_ios_post = rk3568_sdhci_set_ios_post,
> + .set_enhanced_strobe = rk3568_sdhci_set_enhanced_strobe,
>  };
>  
>  static const struct udevice_id sdhci_ids[] = {



Re: [PATCH v4 01/11] FWU: Add FWU metadata structure and driver for accessing metadata

2022-02-08 Thread Masami Hiramatsu
Hi Michal,

2022年2月8日(火) 23:27 Michal Simek :
>
>
>
> On 2/8/22 15:14, Masami Hiramatsu wrote:
> > 2022年2月8日(火) 22:45 Michal Simek :
> >>
> >>
> >>
> >> On 2/8/22 14:36, Masami Hiramatsu wrote:
> >>> 2022年2月8日(火) 20:35 Sughosh Ganu :
> 
>  On Tue, 8 Feb 2022 at 16:26, Michal Simek  wrote:
> >
> > po 7. 2. 2022 v 19:21 odesílatel Sughosh Ganu  
> > napsal:
> >>
> >> In the FWU Multi Bank Update feature, the information about the
> >> updatable images is stored as part of the metadata, which is stored on
> >> a dedicated partition. Add the metadata structure, and a driver model
> >> uclass which provides functions to access the metadata. These are
> >> generic API's, and implementations can be added based on parameters
> >> like how the metadata partition is accessed and what type of storage
> >> device houses the metadata.
> >>
> >> A device tree node fwu-mdata has been added, which is used for
> >> pointing to the storage device which contains the FWU metadata. The
> >> fwu-mdata node is u-boot specific, and can be added the platform's
> >> u-boot dtsi file.
> >>
> >> Signed-off-by: Sughosh Ganu 
> >> ---
> >>
> >> Changes since V3:
> >> * Move the FWU metadata access to driver model
> >> * Get the storage device containing the metadata from a device tree
> >> property instead of a platform helper function
> >>
> >>arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi  |   7 +
> >>.../firmware/fwu-mdata.txt|  18 +
> >>drivers/Kconfig   |   2 +
> >>drivers/Makefile  |   1 +
> >>drivers/fwu-mdata/Kconfig |   7 +
> >>drivers/fwu-mdata/Makefile|   6 +
> >>drivers/fwu-mdata/fwu-mdata-uclass.c  | 434 
> >> ++
> >>include/dm/uclass-id.h|   1 +
> >>include/fwu.h |  51 ++
> >>include/fwu_mdata.h   |  67 +++
> >>10 files changed, 594 insertions(+)
> >>create mode 100644 doc/device-tree-bindings/firmware/fwu-mdata.txt
> >>create mode 100644 drivers/fwu-mdata/Kconfig
> >>create mode 100644 drivers/fwu-mdata/Makefile
> >>create mode 100644 drivers/fwu-mdata/fwu-mdata-uclass.c
> >>create mode 100644 include/fwu.h
> >>create mode 100644 include/fwu_mdata.h
> >>
> >> diff --git a/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi 
> >> b/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi
> >> index 06ef3a4095..3bec6107f7 100644
> >> --- a/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi
> >> +++ b/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi
> >> @@ -4,3 +4,10 @@
> >> */
> >>
> >>#include "stm32mp157a-dk1-u-boot.dtsi"
> >> +
> >> +/ {
> >> +   fwu-mdata {
> >> +   compatible = "u-boot,fwu-mdata";
> >> +   fwu-mdata-store = <>;
> >> +   };
> >> +};
> >> diff --git a/doc/device-tree-bindings/firmware/fwu-mdata.txt 
> >> b/doc/device-tree-bindings/firmware/fwu-mdata.txt
> >> new file mode 100644
> >> index 00..c766b595ef
> >> --- /dev/null
> >> +++ b/doc/device-tree-bindings/firmware/fwu-mdata.txt
> >> @@ -0,0 +1,18 @@
> >> +FWU Metadata Access Devicetree Binding
> >> +
> >> +The FWU Multi Bank Update feature uses a metadata structure, stored on
> >> +a separate partition for keeping information on the set of updatable
> >> +images. The device tree node provides information on the storage
> >> +device that contains the FWU metadata.
> >> +
> >> +Required properties :
> >> +
> >> +- compatible : "u-boot,fwu-mdata";
> >> +- fwu-mdata-store : should point to the storage device which contains
> >> +   the FWU metadata partition.
> >
> > In 0/11 you are describing GPT partitions but I don't think this
> > binding is generic enough to describe
> > other cases. It is saying device but not where exactly it is.
> > I didn't read the whole series yet but arm spec recommends GPT but dt
> > binding should be generic enough to describe
> > also other cases.
> > We are saving this structure to qspi for example but current binding
> > can't be used for it.
> 
>  I would wait to see Masami's implementation of this feature. If I am
>  not wrong, his platform too is enabling this feature with a spi as the
>  storage device. Maybe we can instead put a list of 
>  tuples which can then list the device and partition number of the
>  metadata partitions.
> >>>
> >>> Yes, I would like to define new compatible for sf backend, e.g.
> >>> "u-boot,fwu-mdata-sf".
> >>
> >> backend is fine. What does this compatible string have to do with it?
> >> I didn't see any 

Re: [PATCH v4 3/4] rockchip: sdhci: Add HS400 Enhanced Strobe support for RK3399

2022-02-08 Thread Jaehoon Chung
On 1/29/22 07:42, Alper Nebi Yasak wrote:
> On RK3399, a register bit must be set to enable Enhanced Strobe.
> Let the Rockchip SDHCI driver set it when Enhanced Strobe configuration
> is requested. However, having it set makes the lower-speed modes stop
> working and makes reinitialization fail, so let it be unset as needed in
> set_control_reg().
> 
> This is mostly ported from Linux's Arasan SDHCI driver which happens
> to be the underlying IP. (drivers/mmc/host/sdhci-of-arasan.c in Linux
> tree).
> 
> Signed-off-by: Alper Nebi Yasak 

Reviewed-by: Jaehoon Chung 

Best Regards,
Jaehoon Chung

> ---
> 
> Changes in v4:
> - Add comment for Rockchip SDHCI set_enhanced_strobe() driver data op
> 
> Changes in v2:
> - Unset ES bit in rk3399 set_control_reg() to fix a reinit issue
> - Don't use unnecessary & for function pointer in ops struct
> - Rename rk3399_set_enhanced_strobe -> rk3399_sdhci_set_enhanced_strobe
> - Let set_enhanced_strobe() unset the ES bit if mode is not HS400_ES
> 
>  drivers/mmc/rockchip_sdhci.c | 53 
>  1 file changed, 53 insertions(+)
> 
> diff --git a/drivers/mmc/rockchip_sdhci.c b/drivers/mmc/rockchip_sdhci.c
> index b91df05de4ff..f4d5a59036a2 100644
> --- a/drivers/mmc/rockchip_sdhci.c
> +++ b/drivers/mmc/rockchip_sdhci.c
> @@ -42,6 +42,9 @@
>   x) >> PHYCTRL_DLLRDY_SHIFT) & PHYCTRL_DLLRDY_MASK) ==\
>   PHYCTRL_DLLRDY_DONE)
>  
> +#define ARASAN_VENDOR_REGISTER   0x78
> +#define ARASAN_VENDOR_ENHANCED_STROBEBIT(0)
> +
>  /* Rockchip specific Registers */
>  #define DWCMSHC_EMMC_DLL_CTRL0x800
>  #define DWCMSHC_EMMC_DLL_CTRL_RESET  BIT(1)
> @@ -117,6 +120,19 @@ struct sdhci_data {
>* Return: 0 if successful, -ve on error
>*/
>   int (*set_ios_post)(struct sdhci_host *host);
> +
> + /**
> +  * set_enhanced_strobe() - Set HS400 Enhanced Strobe config
> +  *
> +  * This is the set_enhanced_strobe() SDHCI operation that should
> +  * be used for the hardware this driver data is associated with.
> +  * Normally, this is used to set any host-specific configuration
> +  * necessary for HS400 ES.
> +  *
> +  * @host: SDHCI host structure
> +  * Return: 0 if successful, -ve on error
> +  */
> + int (*set_enhanced_strobe)(struct sdhci_host *host);
>  };
>  
>  static int rk3399_emmc_phy_init(struct udevice *dev)
> @@ -206,6 +222,21 @@ static int rk3399_emmc_get_phy(struct udevice *dev)
>   return 0;
>  }
>  
> +static int rk3399_sdhci_set_enhanced_strobe(struct sdhci_host *host)
> +{
> + struct mmc *mmc = host->mmc;
> + u32 vendor;
> +
> + vendor = sdhci_readl(host, ARASAN_VENDOR_REGISTER);
> + if (mmc->selected_mode == MMC_HS_400_ES)
> + vendor |= ARASAN_VENDOR_ENHANCED_STROBE;
> + else
> + vendor &= ~ARASAN_VENDOR_ENHANCED_STROBE;
> + sdhci_writel(host, vendor, ARASAN_VENDOR_REGISTER);
> +
> + return 0;
> +}
> +
>  static void rk3399_sdhci_set_control_reg(struct sdhci_host *host)
>  {
>   struct rockchip_sdhc *priv = container_of(host, struct rockchip_sdhc, 
> host);
> @@ -217,6 +248,15 @@ static void rk3399_sdhci_set_control_reg(struct 
> sdhci_host *host)
>   rk3399_emmc_phy_power_off(priv->phy);
>  
>   sdhci_set_control_reg(host);
> +
> + /*
> +  * Reinitializing the device tries to set it to lower-speed modes
> +  * first, which fails if the Enhanced Strobe bit is set, making
> +  * the device impossible to use. Set the correct value here to
> +  * let reinitialization attempts succeed.
> +  */
> + if (CONFIG_IS_ENABLED(MMC_HS400_ES_SUPPORT))
> + rk3399_sdhci_set_enhanced_strobe(host);
>  };
>  
>  static int rk3399_sdhci_set_ios_post(struct sdhci_host *host)
> @@ -409,10 +449,22 @@ static int rockchip_sdhci_execute_tuning(struct mmc 
> *mmc, u8 opcode)
>   return ret;
>  }
>  
> +static int rockchip_sdhci_set_enhanced_strobe(struct sdhci_host *host)
> +{
> + struct rockchip_sdhc *priv = container_of(host, struct rockchip_sdhc, 
> host);
> + struct sdhci_data *data = (struct sdhci_data 
> *)dev_get_driver_data(priv->dev);
> +
> + if (data->set_enhanced_strobe)
> + return data->set_enhanced_strobe(host);
> +
> + return -ENOTSUPP;
> +}
> +
>  static struct sdhci_ops rockchip_sdhci_ops = {
>   .set_ios_post   = rockchip_sdhci_set_ios_post,
>   .platform_execute_tuning = _sdhci_execute_tuning,
>   .set_control_reg = rockchip_sdhci_set_control_reg,
> + .set_enhanced_strobe = rockchip_sdhci_set_enhanced_strobe,
>  };
>  
>  static int rockchip_sdhci_probe(struct udevice *dev)
> @@ -495,6 +547,7 @@ static const struct sdhci_data rk3399_data = {
>   .emmc_phy_init = rk3399_emmc_phy_init,
>   .set_control_reg = rk3399_sdhci_set_control_reg,
>   .set_ios_post = rk3399_sdhci_set_ios_post,
> + .set_enhanced_strobe = rk3399_sdhci_set_enhanced_strobe,
>  };
>  
>  static 

Re: [PATCH] cmd: mmc: Consider GP partitions in mmc hwpartition user enh start -

2022-02-08 Thread Jaehoon Chung
On 1/27/22 08:16, Jaehoon Chung wrote:
> On 1/18/22 06:54, Marek Vasut wrote:
>> In case the eMMC contains any GP partitions or user sets up new GP
>> partitions, the size of these GP partitions reduce the size of the
>> USER partition. Subtract the size of those GP partitions from the
>> calculated size of USER partition when using `user enh start -`.
>>
>> The following test used to fail before:
>> ```
>> u-boot=> mmc hwpartition gp1 524288 enh user enh 0 - wrrel on check
>> Partition configuration:
>> User Enhanced Start: 0 Bytes
>> User Enhanced Size: 1.8 GiB
>> User partition write reliability: on
>> GP1 Capacity: 256 MiB ENH
>> No GP2 partition
>> No GP3 partition
>> No GP4 partition
>> Total enhanced size exceeds maximum (261 > 229)
>> Failed!
>> ```
>> The test now passes:
>> ```
>> u-boot=> mmc hwpartition gp1 524288 enh user enh 0 - wrrel on check
>> Partition configuration:
>> User Enhanced Start: 0 Bytes
>> User Enhanced Size: 1.5 GiB
>> User partition write reliability: on
>> GP1 Capacity: 256 MiB ENH
>> No GP2 partition
>> No GP3 partition
>> No GP4 partition
>> ```
>>
>> Signed-off-by: Marek Vasut 
>> Cc: Fabio Estevam 
>> Cc: Jaehoon Chung 
>> Cc: Peng Fan 
>> Cc: Stefano Babic 
> 
> Reviewed-by: Jaehoon Chung 

Applied on u-boot-mmc/master.

Thanks!

Best Regards,
Jaehoon Chung

> 
> Best Regards,
> Jaehoon Chung
> 
>> ---
>>  cmd/mmc.c | 22 --
>>  1 file changed, 20 insertions(+), 2 deletions(-)
>>
>> diff --git a/cmd/mmc.c b/cmd/mmc.c
>> index 96d81ffdf36..503dbb6199c 100644
>> --- a/cmd/mmc.c
>> +++ b/cmd/mmc.c
>> @@ -597,7 +597,7 @@ static void parse_hwpart_user_enh_size(struct mmc *mmc,
>> struct mmc_hwpart_conf *pconf,
>> char *argv)
>>  {
>> -int ret;
>> +int i, ret;
>>  
>>  pconf->user.enh_size = 0;
>>  
>> @@ -606,7 +606,7 @@ static void parse_hwpart_user_enh_size(struct mmc *mmc,
>>  ret = mmc_send_ext_csd(mmc, ext_csd);
>>  if (ret)
>>  return;
>> -/* This value is in 512B block units */
>> +/* The enh_size value is in 512B block units */
>>  pconf->user.enh_size =
>>  ((ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT + 2] << 16) +
>>  (ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT + 1] << 8) +
>> @@ -614,6 +614,24 @@ static void parse_hwpart_user_enh_size(struct mmc *mmc,
>>  ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE] *
>>  ext_csd[EXT_CSD_HC_WP_GRP_SIZE];
>>  pconf->user.enh_size -= pconf->user.enh_start;
>> +for (i = 0; i < ARRAY_SIZE(mmc->capacity_gp); i++) {
>> +/*
>> + * If the eMMC already has GP partitions set,
>> + * subtract their size from the maximum USER
>> + * partition size.
>> + *
>> + * Else, if the command was used to configure new
>> + * GP partitions, subtract their size from maximum
>> + * USER partition size.
>> + */
>> +if (mmc->capacity_gp[i]) {
>> +/* The capacity_gp is in 1B units */
>> +pconf->user.enh_size -= mmc->capacity_gp[i] >> 
>> 9;
>> +} else if (pconf->gp_part[i].size) {
>> +/* The gp_part[].size is in 512B units */
>> +pconf->user.enh_size -= pconf->gp_part[i].size;
>> +}
>> +}
>>  } else {
>>  pconf->user.enh_size = dectoul(argv, NULL);
>>  }
> 
> 



Re: [PATCH v1] mmc: fsl_esdhc_imx: fix watermark level in dma

2022-02-08 Thread Jaehoon Chung
On 2/1/22 07:08, Marcel Ziswiler wrote:
> From: Marcel Ziswiler 
> 
> Seems that we need the waterlevel setting not only for PIO mode as
> without this at least the i.MX 8M Mini won't boot anymore when being
> written by such a U-Boot. Corruption has also been observed both on
> the i.MX 6 as well as i.MX 8M Mini when using ums on the eMMC. Fix
> this by setting the watermark level again regardless of whether in
> DMA or PIO mode.
> 
> Fixes: 41c6a22fc296 ("mmc: fsl_esdhc_imx: simplify esdhc_setup_data()")
> Signed-off-by: Marcel Ziswiler 

Applied on u-boot-mmc/master.

Thanks!

Best Regards,
Jaehoon Chung

> 
> ---
> 
>  drivers/mmc/fsl_esdhc_imx.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c
> index 9299635f50..efa5ed0af7 100644
> --- a/drivers/mmc/fsl_esdhc_imx.c
> +++ b/drivers/mmc/fsl_esdhc_imx.c
> @@ -336,9 +336,8 @@ static int esdhc_setup_data(struct fsl_esdhc_priv *priv, 
> struct mmc *mmc,
>   }
>   }
>  
> - if (IS_ENABLED(CONFIG_SYS_FSL_ESDHC_USE_PIO))
> - esdhc_setup_watermark_level(priv, data);
> - else
> + esdhc_setup_watermark_level(priv, data);
> + if (!IS_ENABLED(CONFIG_SYS_FSL_ESDHC_USE_PIO))
>   esdhc_setup_dma(priv, data);
>  
>   /* Calculate the timeout period for data transactions */



Please pull u-boot-dm

2022-02-08 Thread Simon Glass
Hi Tom,

https://source.denx.de/u-boot/custodians/u-boot-dm/-/pipelines/10909


The following changes since commit 531c00894577a0a852431adf61ade76925f8b162:

  Merge branch '2022-02-08-TI-platform-updates' (2022-02-08 12:28:04 -0500)

are available in the Git repository at:

  git://git.denx.de/u-boot-dm.git tags/dm-pull-8feb22

for you to fetch changes up to 4add3c51458a92e6d8570047368df66110266b56:

  binman: Convert FIT entry type to a subclass of Section entry type
(2022-02-08 13:51:14 -0700)


patman snake-case conversion
binman fit improvements
ACPI fixes and making MCFG available to ARM


Alper Nebi Yasak (4):
  binman: Fix subentry expansion for FIT entry type
  binman: Register and check bintools from FIT subentries
  binman: Check missing bintools of Section subclasses
  binman: Convert FIT entry type to a subclass of Section entry type

Heiko Schocher (2):
  serial: remove nulldev_serial_input
  serial-uclass: fix build warning

Heinrich Schuchardt (1):
  sandbox: fix build failure with musl and SDL

Moritz Fischer (2):
  arch: x86: lib: acpi_table: Fix MCFG entries
  acpi: Move MCFG implementation to common lib

Rasmus Villemoes (1):
  dts: automatically build necessary .dtb files

Simon Glass (16):
  patman: Convert camel case in tools.py
  patman: Convert camel case in command.py
  patman: Convert camel case in checkpatch.py
  patman: Convert camel case in commit.py
  patman: Convert camel case in cros_subprocess.py
  patman: Convert camel case in func_test.py
  patman: Convert camel case in get_maintainer.py
  patman: Convert camel case in gitutil.py
  patman: Convert camel case in project.py
  patman: Convert camel case in test_checkpatch.py
  patman: Convert camel case in test_util.py
  patman: Convert camel case in tout.py
  patman: Rename Print() to Tprint()
  patman: Rename Color() method to build()
  patman: Convert camel case in terminal.py
  patman: Update with new pylint scores

Sughosh Ganu (1):
  dm: Use parenthesis for the device_get_ops macro argument

 arch/arc/dts/Makefile  |   2 +
 arch/arm/dts/Makefile  |   2 +
 arch/m68k/dts/Makefile |   2 +
 arch/microblaze/dts/Makefile   |   2 +
 arch/mips/dts/Makefile |   2 +
 arch/nds32/dts/Makefile|   2 +
 arch/nios2/dts/Makefile|   2 +
 arch/powerpc/dts/Makefile  |   2 +
 arch/riscv/dts/Makefile|   2 +
 arch/sandbox/Makefile  |   7 +
 arch/sandbox/cpu/Makefile  |  11 +-
 arch/sandbox/dts/Makefile  |   2 +
 arch/sh/dts/Makefile   |   2 +
 arch/x86/cpu/intel_common/acpi.c   |  15 +-
 arch/x86/cpu/tangier/acpi.c|  11 +-
 arch/x86/dts/Makefile  |   2 +
 arch/x86/include/asm/acpi_table.h  |   1 -
 arch/x86/lib/acpi_table.c  |  52 ---
 arch/xtensa/dts/Makefile   |   2 +
 drivers/serial/serial-uclass.c |   2 +-
 drivers/serial/serial_nulldev.c|   5 -
 dts/Kconfig|   8 +-
 include/dm/device.h|   2 +-
 lib/acpi/Makefile  |   1 +
 lib/acpi/mcfg.c|  64 
 scripts/Makefile.dts   |   3 +
 scripts/pylint.base|  26 ++--
 tools/binman/bintool.py|  30 ++--
 tools/binman/bintool_test.py   |  34 ++---
 tools/binman/btool/lz4.py  |   8 +-
 tools/binman/btool/lzma_alone.py   |  16 +-
 tools/binman/cbfs_util.py  |  12 +-
 tools/binman/cbfs_util_test.py |  20 +--
 tools/binman/control.py|  74 +-
 tools/binman/elf.py|  20 +--
 tools/binman/elf_test.py   |  20 +--
 tools/binman/entry.py  |  42 +++---
 tools/binman/entry_test.py |   4 +-
 tools/binman/etype/atf_fip.py  |   2 +-
 tools/binman/etype/blob.py |   4 +-
 tools/binman/etype/blob_ext_list.py|   2 +-
 tools/binman/etype/fdtmap.py   |   2 +-
 tools/binman/etype/files.py|   2 +-
 tools/binman/etype/fill.py |   2 +-
 tools/binman/etype/fit.py  |  77 +-
 tools/binman/etype/fmap.py |   6 +-
 tools/binman/etype/gbb.py  |  10 +-
 tools/binman/etype/intel_ifwi.py 

[PATCH 2/2] Add SCSI scan for ENV in EXT4 or FAT

2022-02-08 Thread Rogier Stam
When having environment stored in EXT4 or FAT
and using an AHCI or SCSI device / partition
the scan would not be performed early enough
and hence the device would not be recognized.
This change adds the scan when the interface
is "scsi" in a similar way to mmc_initialize.

Signed-off-by: Rogier Stam 
---
 env/ext4.c | 5 +
 env/fat.c  | 5 +
 2 files changed, 10 insertions(+)

diff --git a/env/ext4.c b/env/ext4.c
index 9f65afb..47e05a4 100644
--- a/env/ext4.c
+++ b/env/ext4.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -146,6 +147,10 @@ static int env_ext4_load(void)
if (!strcmp(ifname, "mmc"))
mmc_initialize(NULL);
 #endif
+#if defined(CONFIG_AHCI) || defined(CONFIG_SCSI)
+   if (!strcmp(ifname, "scsi"))
+   scsi_scan(true);
+#endif
 
part = blk_get_device_part_str(ifname, dev_and_part,
   _desc, , 1);
diff --git a/env/fat.c b/env/fat.c
index fdccd6c..dbd6a13 100644
--- a/env/fat.c
+++ b/env/fat.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -122,6 +123,10 @@ static int env_fat_load(void)
if (!strcmp(CONFIG_ENV_FAT_INTERFACE, "mmc"))
mmc_initialize(NULL);
 #endif
+#if defined(CONFIG_AHCI) || defined(CONFIG_SCSI)
+   if (!strcmp(CONFIG_ENV_FAT_INTERFACE, "scsi"))
+   scsi_scan(true);
+#endif
 
part = blk_get_device_part_str(CONFIG_ENV_FAT_INTERFACE,
env_fat_device_and_part(),
-- 
2.7.4



[PATCH 1/2] Fix Espressobin build for configs where ENV is not in SPI

2022-02-08 Thread Rogier Stam
When storing the UBoot Environment in for example EXT4,
the U-Boot build is broken for several reasons:
1. armada-385-turris-omnia-u-boot.dtsi will not allow
   CONFIG_ENV_OFFSET and CONFIG_ENV_SIZE to be undefined
2. armada-37xx/board.c ft_board_setup function does not
   exist if CONFIG_ENV_IS_IN_SPI_FLASH is not defined

This commit changes these files so that selecting a
different location for the environment is possible.

Signed-off-by: Rogier Stam 
---
 arch/arm/dts/armada-385-turris-omnia-u-boot.dtsi | 2 ++
 board/Marvell/mvebu_armada-37xx/board.c  | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/arm/dts/armada-385-turris-omnia-u-boot.dtsi 
b/arch/arm/dts/armada-385-turris-omnia-u-boot.dtsi
index 3ff76c9..008787e 100644
--- a/arch/arm/dts/armada-385-turris-omnia-u-boot.dtsi
+++ b/arch/arm/dts/armada-385-turris-omnia-u-boot.dtsi
@@ -38,6 +38,7 @@
};
 };
 
+#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
  {
u-boot,dm-pre-reloc;
 
@@ -56,6 +57,7 @@
};
};
 };
+#endif
 
  {
u-boot,dm-pre-reloc;
diff --git a/board/Marvell/mvebu_armada-37xx/board.c 
b/board/Marvell/mvebu_armada-37xx/board.c
index d7b6eca..5bace0c 100644
--- a/board/Marvell/mvebu_armada-37xx/board.c
+++ b/board/Marvell/mvebu_armada-37xx/board.c
@@ -328,9 +328,10 @@ int board_network_enable(struct mii_dev *bus)
return 0;
 }
 
-#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_ENV_IS_IN_SPI_FLASH)
+#ifdef CONFIG_OF_BOARD_SETUP
 int ft_board_setup(void *blob, struct bd_info *bd)
 {
+#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
int ret;
int spi_off;
int parts_off;
@@ -424,6 +425,7 @@ int ft_board_setup(void *blob, struct bd_info *bd)
return 0;
}
 
+#endif
return 0;
 }
 #endif
-- 
2.7.4



[PATCH 0/2] U-Boot ENV in EXT4 support for Expressobin (revised)

2022-02-08 Thread Rogier Stam
Hi

Per comments of Stefan I have split the patch in two:
- one for env file changes
- one for espressobin related changes

Let me know if any other changes are needed.

Regards

Rogier

Rogier Stam (2):
  Fix Espressobin build for configs where ENV is not in SPI
  Add SCSI scan for ENV in EXT4 or FAT

 arch/arm/dts/armada-385-turris-omnia-u-boot.dtsi | 2 ++
 board/Marvell/mvebu_armada-37xx/board.c  | 4 +++-
 env/ext4.c   | 5 +
 env/fat.c| 5 +
 4 files changed, 15 insertions(+), 1 deletion(-)

-- 
2.7.4



[PATCH] spi: dw: Fix broken dw_spi_mem_ops()

2022-02-08 Thread Niklas Cassel
From: Niklas Cassel 

The driver is currently using sizeof(op->cmd.opcode) in the op_len
calculation. Commit d15de623013c ("spi: spi-mem: allow specifying a
command's extension") changed op->cmd.opcode from one byte to two.

Instead, a new struct member op->cmd.nbytes is supposed to be used.
For regular commands op->cmd.nbytes will be one.

Commit d15de623013c ("spi: spi-mem: allow specifying a command's
extension") did update some drivers that overload the generic mem_ops()
implementation, but forgot to update dw_spi_mem_ops().

Calculating op_len incorrectly causes dw_spi_mem_ops() to misbehave, since
op_len is used to determine how many bytes that should be read/written.

On the canaan k210 board, this causes the probe of the SPI flash to fail.

Fix the op_len calculation in dw_spi_mem_ops(). Doing so results in
working SPI flash on the canaan k210 board.

Fixes: d15de623013c ("spi: spi-mem: allow specifying a command's extension")
Signed-off-by: Niklas Cassel 
---
 drivers/spi/designware_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/designware_spi.c b/drivers/spi/designware_spi.c
index 742121140d..fc22f540fe 100644
--- a/drivers/spi/designware_spi.c
+++ b/drivers/spi/designware_spi.c
@@ -572,7 +572,7 @@ static int dw_spi_exec_op(struct spi_slave *slave, const 
struct spi_mem_op *op)
int pos, i, ret = 0;
struct udevice *bus = slave->dev->parent;
struct dw_spi_priv *priv = dev_get_priv(bus);
-   u8 op_len = sizeof(op->cmd.opcode) + op->addr.nbytes + op->dummy.nbytes;
+   u8 op_len = op->cmd.nbytes + op->addr.nbytes + op->dummy.nbytes;
u8 op_buf[op_len];
u32 cr0;
 
-- 
2.34.1


[PATCH] binman: Skip processing "hash" subnodes of FIT subsections

2022-02-08 Thread Alper Nebi Yasak
Binman's FIT entry type can have image subentries with "hash" subnodes
intended to be processed by mkimage, but not binman. However, the Entry
class and any subclass that reuses its implementation tries to process
these unconditionally. This can lead to an error when boards specify
hash algorithms that binman doesn't support, but mkimage supports.

Let entries skip processing these "hash" subnodes based on an instance
variable, and set this instance variable for FIT subsections. Also
re-enable processing of calculated and missing properties of FIT entries
which was disabled to mitigate this issue.

Signed-off-by: Alper Nebi Yasak 
---
This applies on top of u-boot-dm/master, and does not resend my
"binman: Update image positions of FIT subentries" patch [1] which
should be applied on top of this.

[1] 
https://patchwork.ozlabs.org/project/uboot/patch/20220207220809.4497-6-alpernebiya...@gmail.com/

 tools/binman/entry.py | 15 +++
 tools/binman/etype/fit.py | 12 ++--
 2 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index dc26f8f167b0..6f98353c8569 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -78,6 +78,8 @@ class Entry(object):
 external: True if this entry contains an external binary blob
 bintools: Bintools used by this entry (only populated for Image)
 missing_bintools: List of missing bintools for this entry
+update_hash: True if this entry's "hash" subnode should be
+updated with a hash of the entry contents
 """
 def __init__(self, section, etype, node, name_prefix=''):
 # Put this here to allow entry-docs and help to work without libfdt
@@ -111,6 +113,7 @@ def __init__(self, section, etype, node, name_prefix=''):
 self.allow_fake = False
 self.bintools = {}
 self.missing_bintools = []
+self.update_hash = True
 
 @staticmethod
 def FindEntryClass(etype, expanded):
@@ -315,9 +318,11 @@ def AddMissingProperties(self, have_image_pos):
 
 if self.compress != 'none':
 state.AddZeroProp(self._node, 'uncomp-size')
-err = state.CheckAddHashProp(self._node)
-if err:
-self.Raise(err)
+
+if self.update_hash:
+err = state.CheckAddHashProp(self._node)
+if err:
+self.Raise(err)
 
 def SetCalculatedProperties(self):
 """Set the value of device-tree properties calculated by binman"""
@@ -333,7 +338,9 @@ def SetCalculatedProperties(self):
 state.SetInt(self._node, 'orig-size', self.orig_size, True)
 if self.uncomp_size is not None:
 state.SetInt(self._node, 'uncomp-size', self.uncomp_size)
-state.CheckSetHashValue(self._node, self.GetData)
+
+if self.update_hash:
+state.CheckSetHashValue(self._node, self.GetData)
 
 def ProcessFdt(self, fdt):
 """Allow entries to adjust the device tree
diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py
index a56b0564f9a1..a979d0f1a613 100644
--- a/tools/binman/etype/fit.py
+++ b/tools/binman/etype/fit.py
@@ -186,6 +186,8 @@ def _AddNode(base_node, depth, node):
 # 'data' property later.
 entry = Entry.Create(self.section, node, etype='section')
 entry.ReadNode()
+# The hash subnodes here are for mkimage, not binman.
+entry.update_hash = False
 self._entries[rel_path] = entry
 
 for subnode in node.subnodes:
@@ -294,13 +296,3 @@ def _BuildInput(self, fdt):
 def AddBintools(self, tools):
 super().AddBintools(tools)
 self.mkimage = self.AddBintool(tools, 'mkimage')
-
-def AddMissingProperties(self, have_image_pos):
-# We don't want to interfere with any hash properties in the FIT, so
-# disable this for now.
-pass
-
-def SetCalculatedProperties(self):
-# We don't want to interfere with any hash properties in the FIT, so
-# disable this for now.
-pass
-- 
2.34.1



Re: Compile error with SPL_FIT_FULL_CHECK and SPL_LOAD_FIT_FULL enabled

2022-02-08 Thread Simon Glass
Hi Philippe,

On Tue, 8 Feb 2022 at 10:12, Philippe REYNES
 wrote:
>
> Hi Johann,
>
> Le 08/02/2022 à 16:43, Johann Neuhauser a écrit :
> > Dear developers and Simon,
> >
> > we wanna run secure boot with U-Boot's SPL_FIT_SIGNATURE and FIT_SIGNATURE 
> > on our STM32MP1 boards and discovered the CVE-2021-27097.
> > To mitigate this vulnerability we wanna enable SPL_LOAD_FIT_FULL and 
> > SPL_FIT_FULL_CHECK.
> > If I compile any U-Boot SPL with the mentioned config symbols after commit 
> > 6f3c2d8a, it fails always with the following error message:
> >
> > Used defconfig: stm32mp15_dhcom_basic_defconfig (+ mentioned configs 
> > enabled)
> > ```
> > ...
> >LD  spl/lib/built-in.o
> >LD  spl/u-boot-spl
> > /usr/bin/arm-linux-gnueabihf-ld.bfd: common/built-in.o: in function 
> > `fit_check_format':
> > /mnt/work/dev/u-boot/common/image-fit.c:1591: undefined reference to 
> > `fdt_check_full'
> > make[1]: *** [scripts/Makefile.spl:432: spl/u-boot-spl] Error 1
> > make: *** [Makefile:1941: spl/u-boot-spl] Error 2
> > ```
> > After diging around to find the cause, we're out of ideas.
> > Does anyone have a clue why the needed function is not compiled in libfdt 
> > for the spl build?
> I have reproduced this issue with this config
> (stm32mp15_dhcom_basic_defconfig (+ mentioned configs enabled)).
> The function fdt_check_full is build conditionnaly:
>
> #if !defined(FDT_ASSUME_MASK) || FDT_ASSUME_MASK != 0xff
> int fdt_check_full(const void *fdt, size_t bufsize)
>
> {
>
> ...
>
> }
>
> In this config FDT_ASSUME_MASK is 0xff, so the function fdt_check_full
> is not compiled.
> I succeed to build (not tested) with this patch:
>
> --- a/scripts/dtc/libfdt/fdt_ro.c
> +++ b/scripts/dtc/libfdt/fdt_ro.c
> @@ -937,4 +937,9 @@ int fdt_check_full(const void *fdt, size_t bufsize)
>  }
>  }
>   }
> +#else
> +int fdt_check_full(const void *fdt, size_t bufsize)
> +{
> +   return 0;
> +}
>   #endif
>
>
> If simon agrees with this fix, I may sent a patch.

I suppose that is OK. It really should go upstream though, where this
code is slightly different at present.

Regards,
Simon


ARM A53 and initial MMU mapping for EL0/1/2/3 ?

2022-02-08 Thread Joakim Tjernlund
Trying to figure out how I should map the MMU for normal RAM so it acessible
from all ELx security states.
So far I have this mem_map: 

/* memory mapped RAM. 32MB  */
.virt = 0x6000UL,
.phys = 0x6000UL,
.size = 0x0200UL,
.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_INNER_SHARE

but starting to doubt that is correct, can someone suggest what to put in the 
.attrs field?

 Jocke


Re: Running qemu tests on RISC-V

2022-02-08 Thread Simon Glass
Hi Alper,

On Tue, 8 Feb 2022 at 14:36, Alper Nebi Yasak  wrote:
>
> On 08/02/2022 23:43, Simon Glass wrote:
> > Thanks for testing it. I don't see this on
> >
> > 8b139f4e1c0 (HEAD, us/master) Merge tag 'u-boot-imx-20220207' of
> > https://gitlab.denx.de/u-boot/custodians/u-boot-imx
> >
> > :
> >
> > tools/binman/binman   --toolpath ./tools  build -u -d u-boot.dtb -O .
> > -m --allow-missing --fake-ext-blobs -I . -I
> > /scratch/sglass/cosarm/src/third_party/u-boot/files -I
> > /scratch/sglass/cosarm/src/third_party/u-boot/files/board/emulation/qemu-riscv
> > -I arch/riscv/dts -a of-list="qemu-virt32"  -a atf-bl31-path= -a
> > opensbi-path= -a default-dt="qemu-virt32" -a scp-path= -a
> > spl-bss-pad=1 -a tpl-bss-pad=1 -a spl-dtb=y -a tpl-dtb=
>
> This command does print the warning for me at that commit (and I see it
> with `make` before that).
>
> If I run `touch fw_dynamic.bin` it no longer does, maybe check if such a
> file exists in your include paths.

OK that is it, thanks.

I think binman should remove the fake files before exiting. What do you think?

Regards,
Simon


Re: [PATCH] image: Control FIT signature verification at runtime

2022-02-08 Thread Andrew Jeffery



On Mon, 7 Feb 2022, at 11:37, ChiaWei Wang wrote:
> Hi Andrew,
>
> I am curious about the usage scenario.
> Is the runtime control required for production release?

Yes.

> As this control acts like a backdoor to bypass the chain-of-trust.

Right, just as strap pin controlling the SB ROM in the 2600 allows bypass.

It's just another one of these affecting a different boot stage.

> If it is for debugging/development purposes, should we encourage the 
> use of unsigned images under RD environments?
> Beyond this, I have no concern as the patch provides more flexibility.
>
>> From: Andrew Jeffery 
>> Sent: Monday, January 31, 2022 11:42 AM
>> 
>> Some platform designs include support for disabling secure-boot via a jumper
>> on the board. Sometimes this control can be separate from the mechanism
>> enabling the root-of-trust for the platform. Add support for this latter 
>> scenario
>> by allowing boards to implement board_fit_image_require_verfied(), which is
>> then invoked in the usual FIT verification paths.
>> 
>> Signed-off-by: Andrew Jeffery 
>> ---
>> Hi,
>> 
>> This patch is extracted from and motivated by a series adding run-time 
>> control
>> of FIT signature verification to u-boot in OpenBMC:
>> 
>> https://lore.kernel.org/openbmc/20220131012538.73021-1-and...@aj.id.au/
>> 
>> Unfortunately the OpenBMC u-boot tree is quite a way behind on tracking
>> upstream and contains a bunch of out-of-tree work as well. As such I'm 
>> looking
>> to upstream the couple of changes that make sense against master.
>> 
>> Please take a look!
>> 
>> Andrew
>> 
>>  boot/Kconfig |  8 
>>  boot/image-fit.c | 21 +  include/image.h  |  9
>> +
>>  3 files changed, 34 insertions(+), 4 deletions(-)
>> 
>> diff --git a/boot/Kconfig b/boot/Kconfig index c8d5906cd304..ec413151fd5a
>> 100644
>> --- a/boot/Kconfig
>> +++ b/boot/Kconfig
>> @@ -78,6 +78,14 @@ config FIT_SIGNATURE
>>format support in this case, enable it using
>>CONFIG_LEGACY_IMAGE_FORMAT.
>> 
>> +if FIT_SIGNATURE
>> +config FIT_RUNTIME_SIGNATURE
>> +bool "Control verification of FIT uImages at runtime"
>> +help
>> +  This option allows board support to disable verification of
>> +  signatures at runtime, for example through the state of a GPIO.
>> +endif # FIT_SIGNATURE
>> +
>
> Using "depends on" might be preferred for Kconfig dependency.

Yes, that's probably better.

Thanks for taking a look.

Andrew


Re: Running qemu tests on RISC-V

2022-02-08 Thread Alper Nebi Yasak
On 08/02/2022 23:43, Simon Glass wrote:
> Thanks for testing it. I don't see this on
> 
> 8b139f4e1c0 (HEAD, us/master) Merge tag 'u-boot-imx-20220207' of
> https://gitlab.denx.de/u-boot/custodians/u-boot-imx
> 
> :
> 
> tools/binman/binman   --toolpath ./tools  build -u -d u-boot.dtb -O .
> -m --allow-missing --fake-ext-blobs -I . -I
> /scratch/sglass/cosarm/src/third_party/u-boot/files -I
> /scratch/sglass/cosarm/src/third_party/u-boot/files/board/emulation/qemu-riscv
> -I arch/riscv/dts -a of-list="qemu-virt32"  -a atf-bl31-path= -a
> opensbi-path= -a default-dt="qemu-virt32" -a scp-path= -a
> spl-bss-pad=1 -a tpl-bss-pad=1 -a spl-dtb=y -a tpl-dtb=

This command does print the warning for me at that commit (and I see it
with `make` before that).

If I run `touch fw_dynamic.bin` it no longer does, maybe check if such a
file exists in your include paths.


[PATCH 1/1] iommu: Add M1 Pro/Max support to Apple DART driver

2022-02-08 Thread Janne Grunau
For the purpose of this driver (activating bypass mode) t6000-dart
and t8103-dart are fully compatible.

Signed-off-by: Janne Grunau 
Reviewed-by: Mark Kettenis 
---
 drivers/iommu/apple_dart.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iommu/apple_dart.c b/drivers/iommu/apple_dart.c
index ff8c5fa62c..f2e1700960 100644
--- a/drivers/iommu/apple_dart.c
+++ b/drivers/iommu/apple_dart.c
@@ -48,6 +48,7 @@ static int apple_dart_probe(struct udevice *dev)
 
 static const struct udevice_id apple_dart_ids[] = {
{ .compatible = "apple,t8103-dart" },
+   { .compatible = "apple,t6000-dart" },
{ /* sentinel */ }
 };
 
-- 
2.35.1



[PATCH v2 1/1] arm: apple: Switch to fully dynamic mem layout

2022-02-08 Thread Janne Grunau
Support for Apple M1 Pro and Max will allow using a single binary for
all M1 SoCs. The M1 Pro/Max have a different memory layout. The RAM
start address is 0x100__ instead of 0x8__.
Replace the hardcoded memory layout with dynamic initialized
environment variables in board_late_init().

Tested on Mac Mini (2020) and Macbook Pro 14-inch (2021).

Signed-off-by: Janne Grunau 
Reviewed-by: Mark Kettenis 
---

Changed in v2:
 - ensure adresses are aligned
 - added space between addresses at the top and stack
 - added loadaddr and set the default to 0
 - pick up Mark's Reviewed-by
 - whitespace fixes

 arch/arm/mach-apple/board.c | 31 +++
 configs/apple_m1_defconfig  |  3 ++-
 include/configs/apple.h |  5 -
 3 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-apple/board.c b/arch/arm/mach-apple/board.c
index b7e8d212f1..46877569af 100644
--- a/arch/arm/mach-apple/board.c
+++ b/arch/arm/mach-apple/board.c
@@ -136,3 +136,34 @@ ulong board_get_usable_ram_top(ulong total_size)
 */
return 0x98000;
 }
+
+int board_late_init(void)
+{
+   unsigned long base;
+   unsigned long top;
+   u32 status = 0;
+
+   /* Reserve 4M each for scriptaddr and pxefile_addr_r at the top of RAM
+* at least 1M below the stack.
+*/
+   top = gd->start_addr_sp - CONFIG_STACK_SIZE - SZ_8M - SZ_1M;
+   top = ALIGN_DOWN(top, SZ_8M);
+
+   status |= env_set_hex("scriptaddr", top + SZ_4M);
+   status |= env_set_hex("pxefile_addr_r", top);
+
+   /* somewhat based on the Linux Kernel boot requirements:
+* align by 2M and maximal FDT size 2M
+*/
+   base = ALIGN(gd->ram_base, SZ_2M);
+
+   status |= env_set_hex("fdt_addr_r", base);
+   status |= env_set_hex("kernel_addr_r", base + SZ_2M);
+   status |= env_set_hex("ramdisk_addr_r", base + SZ_128M);
+   status |= env_set_hex("loadaddr", base + SZ_2G);
+
+   if (status)
+   log_warning("late_init: Failed to set run time variables\n");
+
+   return 0;
+}
diff --git a/configs/apple_m1_defconfig b/configs/apple_m1_defconfig
index cb235e4e7d..b96d31db2c 100644
--- a/configs/apple_m1_defconfig
+++ b/configs/apple_m1_defconfig
@@ -4,10 +4,11 @@ CONFIG_DEFAULT_DEVICE_TREE="t8103-j274"
 CONFIG_DEBUG_UART_BASE=0x23520
 CONFIG_DEBUG_UART_CLOCK=24
 CONFIG_DEBUG_UART=y
-CONFIG_SYS_LOAD_ADDR=0x88000
+CONFIG_SYS_LOAD_ADDR=0x0
 CONFIG_USE_PREBOOT=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_BOARD_LATE_INIT=y
 # CONFIG_NET is not set
 # CONFIG_MMC is not set
 CONFIG_DEBUG_UART_ANNOUNCE=y
diff --git a/include/configs/apple.h b/include/configs/apple.h
index 3e5fb495f1..f73f4f047b 100644
--- a/include/configs/apple.h
+++ b/include/configs/apple.h
@@ -9,10 +9,6 @@
"stdout=serial,vidconsole\0" \
"stderr=serial,vidconsole\0"
 
-#define ENV_MEM_LAYOUT_SETTINGS \
-   "fdt_addr_r=0x96010\0" \
-   "kernel_addr_r=0x96020\0"
-
 #if CONFIG_IS_ENABLED(CMD_USB)
#define BOOT_TARGET_USB(func) func(USB, usb, 0)
 #else
@@ -26,7 +22,6 @@
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
ENV_DEVICE_SETTINGS \
-   ENV_MEM_LAYOUT_SETTINGS \
BOOTENV
 
 #endif
-- 
2.35.1



[PATCH] arm: apple: Add M1 Pro/Max support

2022-02-08 Thread Mark Kettenis
Choose the memory map based on the compatible property from the
device tree passed to us by m1n1. Since DRAM on the M1 Pro/Max
starts at a different address avoid hardcoding the top of usable
memory. Also make sure that the addresses entered into the memory
map are page aligned such that we don't crash in dcache_enable().

Signed-off-by: Mark Kettenis 
Tested on: Macbook M1 Max
Tested-by: Janne Grunau 
---
 arch/arm/mach-apple/board.c | 207 +---
 1 file changed, 168 insertions(+), 39 deletions(-)

diff --git a/arch/arm/mach-apple/board.c b/arch/arm/mach-apple/board.c
index b7e8d212f1..f9f8a2f278 100644
--- a/arch/arm/mach-apple/board.c
+++ b/arch/arm/mach-apple/board.c
@@ -14,12 +14,22 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static struct mm_region apple_mem_map[] = {
+/* Apple M1 */
+
+static struct mm_region t8103_mem_map[] = {
{
/* I/O */
.virt = 0x2,
.phys = 0x2,
-   .size = 8UL * SZ_1G,
+   .size = 2UL * SZ_1G,
+   .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+PTE_BLOCK_NON_SHARE |
+PTE_BLOCK_PXN | PTE_BLOCK_UXN
+   }, {
+   /* I/O */
+   .virt = 0x38000,
+   .phys = 0x38000,
+   .size = SZ_1G,
.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
 PTE_BLOCK_NON_SHARE |
 PTE_BLOCK_PXN | PTE_BLOCK_UXN
@@ -27,7 +37,7 @@ static struct mm_region apple_mem_map[] = {
/* I/O */
.virt = 0x5,
.phys = 0x5,
-   .size = 2UL * SZ_1G,
+   .size = SZ_1G,
.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
 PTE_BLOCK_NON_SHARE |
 PTE_BLOCK_PXN | PTE_BLOCK_UXN
@@ -63,15 +73,110 @@ static struct mm_region apple_mem_map[] = {
.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
 PTE_BLOCK_INNER_SHARE
}, {
-   /* Empty entry for framebuffer */
+   /* Framebuffer */
+   .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL_NC) |
+PTE_BLOCK_INNER_SHARE |
+PTE_BLOCK_PXN | PTE_BLOCK_UXN
+   }, {
+   /* List terminator */
0,
+   }
+};
+
+/* Apple M1 Pro/Max */
+
+static struct mm_region t6000_mem_map[] = {
+   {
+   /* I/O */
+   .virt = 0x28000,
+   .phys = 0x28000,
+   .size = SZ_1G,
+   .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+PTE_BLOCK_NON_SHARE |
+PTE_BLOCK_PXN | PTE_BLOCK_UXN
+   }, {
+   /* I/O */
+   .virt = 0x38000,
+   .phys = 0x38000,
+   .size = SZ_1G,
+   .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+PTE_BLOCK_NON_SHARE |
+PTE_BLOCK_PXN | PTE_BLOCK_UXN
+   }, {
+   /* I/O */
+   .virt = 0x58000,
+   .phys = 0x58000,
+   .size = SZ_512M,
+   .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+PTE_BLOCK_NON_SHARE |
+PTE_BLOCK_PXN | PTE_BLOCK_UXN
+   }, {
+   /* PCIE */
+   .virt = 0x5a000,
+   .phys = 0x5a000,
+   .size = SZ_512M,
+   .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRE) |
+PTE_BLOCK_INNER_SHARE |
+PTE_BLOCK_PXN | PTE_BLOCK_UXN
+   }, {
+   /* PCIE */
+   .virt = 0x5c000,
+   .phys = 0x5c000,
+   .size = SZ_1G,
+   .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRE) |
+PTE_BLOCK_INNER_SHARE |
+PTE_BLOCK_PXN | PTE_BLOCK_UXN
+   }, {
+   /* I/O */
+   .virt = 0x7,
+   .phys = 0x7,
+   .size = SZ_1G,
+   .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+PTE_BLOCK_NON_SHARE |
+PTE_BLOCK_PXN | PTE_BLOCK_UXN
+   }, {
+   /* I/O */
+   .virt = 0xb,
+   .phys = 0xb,
+   .size = SZ_1G,
+   .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+PTE_BLOCK_NON_SHARE |
+PTE_BLOCK_PXN | PTE_BLOCK_UXN
+   }, {
+   /* I/O */
+   .virt = 0xf,
+   .phys = 0xf,
+   .size = SZ_1G,
+   .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+PTE_BLOCK_NON_SHARE |
+PTE_BLOCK_PXN | PTE_BLOCK_UXN
+   }, {
+  

Re: Running qemu tests on RISC-V

2022-02-08 Thread Simon Glass
Hi Alper,

On Tue, 8 Feb 2022 at 11:20, Alper Nebi Yasak  wrote:
>
> On 08/02/2022 20:13, Simon Glass wrote:
> > Hi Heinrich,
> >
> > On Tue, 8 Feb 2022 at 08:34, Heinrich Schuchardt  wrote:
> >>
> >> On 2/8/22 15:52, Simon Glass wrote:
> >>> Hi Heinrich,
> >>>
> >>> On Tue, 8 Feb 2022 at 01:21, Heinrich Schuchardt  
> >>> wrote:
>  Hello Simon,
> 
>  The qemu-riscv32_spl_defconfig image built inside Docker with
> 
>  wget -O -
>  https://github.com/riscv/opensbi/releases/download/v0.9/opensbi-0.9-rv-bin.tar.xz
>  export
>  OPENSBI=/tmp/opensbi-0.9-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin
>  tools/buildman/buildman -o build -w -E -W -e --board qemu-riscv32_spl
> 
>  runs flawlessly on Ubuntu Jammy with:
> 
>  qemu-system-riscv32 -nographic -machine virt -bios spl/u-boot-spl \
>    -device loader,file=u-boot.itb,addr=0x8020 -smp cpus=4
> 
>  This is a QEMU 6.0
> 
>  Please, provide a reproducible instruction for your problem.
> >>>
> >>> I wonder if the problem is the OPENSBI thing. I am not providing that,
> >>> nor am I seeing a warning about it.
> >>
> >> OpenSBI is needed to emulate unaligned access, access to CSR registers
> >> and so forth. I assume you cannot run qemu-riscv32_spl_defconfig.
> >>
> >> A build warning if CONFIG_SPL_OPENSBI=y and OPENSBI is not defined might
> >> make sense.
> >
> > OK, it seems we need a binman test that we warn on external blobs that
> > are embedded in a FIT.
>
> I tried building qemu-riscv32_spl with buildman on current master from
> Debian unstable (outside the container). I am getting the "missing
> external blobs" binman warning when I don't pass OPENSBI as a make flag.
>
> The qemu-system-riscv32 command above works fine with that OPENSBI
> binary, but not without it. I get garbled output and errors including:
> Illegal instruction, Unhandled exception, Please RESET the board...

Thanks for testing it. I don't see this on

8b139f4e1c0 (HEAD, us/master) Merge tag 'u-boot-imx-20220207' of
https://gitlab.denx.de/u-boot/custodians/u-boot-imx

:

tools/binman/binman   --toolpath ./tools  build -u -d u-boot.dtb -O .
-m --allow-missing --fake-ext-blobs -I . -I
/scratch/sglass/cosarm/src/third_party/u-boot/files -I
/scratch/sglass/cosarm/src/third_party/u-boot/files/board/emulation/qemu-riscv
-I arch/riscv/dts -a of-list="qemu-virt32"  -a atf-bl31-path= -a
opensbi-path= -a default-dt="qemu-virt32" -a scp-path= -a
spl-bss-pad=1 -a tpl-bss-pad=1 -a spl-dtb=y -a tpl-dtb=


Regards,
Simon


Re: [PATCH v2 5/5] binman: Update image positions of FIT subentries

2022-02-08 Thread Simon Glass
Hi Alper,

On Mon, 7 Feb 2022 at 15:08, Alper Nebi Yasak  wrote:
>
> Binman keeps track of positions of each entry in the final image, but
> currently this data is wrong for things included in FIT entries,
> especially since a previous patch makes FIT a subclass of Section and
> inherit its implementation.
>
> There are three ways to put data into a FIT image. It can be directly
> included as a "data" property, or it can be external to the FIT image
> represented by an offset-size pair of properties. This external offset
> is either "data-position" from the start of the FIT or "data-offset"
> from the end of the FIT, and the size is "data-size" for both. However,
> binman doesn't use the "data-offset" method while building FIT entries.
>
> According to the Section docstring, its subclasses should calculate and
> set the correct offsets and sizes in SetImagePos() method. Do this for
> FIT subentries for the three ways mentioned above, and add tests for the
> two ways binman can pack them in.
>
> Signed-off-by: Alper Nebi Yasak 
> Reviewed-by: Simon Glass 
> ---
>
> Changes in v2:
> - Check missing_bintools list instead of catching Fdt exceptions
> - Add tag: "Reviewed-by: Simon Glass "
>
>  tools/binman/etype/fit.py |  51 +
>  tools/binman/ftest.py | 112 ++
>  2 files changed, 163 insertions(+)

As mentioned I had to change the previous patch in a minor way to get
it to apply.

I'd really like to get this in if possible, too. The issue is the
handling of hash nodes in a FIT, as I mentioned.

If you are able to rework this, please let me know.

I've gone ahead sent my fit series but will rebase it onto this patch
if you are able to fix it up.

Regards,
Simon


Re: [PATCH 11/17] patman: Convert camel case in test_util.py

2022-02-08 Thread Simon Glass
Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass 
---

 tools/binman/main.py  | 6 +++---
 tools/dtoc/main.py| 6 +++---
 tools/dtoc/test_fdt.py| 2 +-
 tools/patman/main.py  | 2 +-
 tools/patman/test_util.py | 6 +++---
 5 files changed, 11 insertions(+), 11 deletions(-)

Applied to u-boot-dm, thanks!


Re: [PATCH 16/17] patman: Update with new pylint scores

2022-02-08 Thread Simon Glass
Update the new baseline since various scores have improved.

Signed-off-by: Simon Glass 
---

 scripts/pylint.base | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

Applied to u-boot-dm, thanks!


Re: [RFC PATCH] dts: automatically build necessary .dtb files

2022-02-08 Thread Simon Glass
On Tue, 8 Feb 2022 at 08:15, Simon Glass  wrote:
>
> On Mon, 24 Jan 2022 at 14:15, Rasmus Villemoes
>  wrote:
> >
> > On 24/01/2022 18.57, Simon Glass wrote:
> > > Hi,
> > >
> > > On Mon, 24 Jan 2022 at 09:02, Tom Rini  wrote:
> > >>
> > >> On Mon, Jan 10, 2022 at 02:34:41PM +0100, Rasmus Villemoes wrote:
> > >>
> > >>> When building for a custom board, it is quite common to maintain a
> > >>> private branch which include some defconfig and .dts files. But to
> > >>> hook up those .dts files requires modifying a file "belonging" to
> > >>> upstream U-Boot, the arch/*/dts/Makefile. Forward-porting that branch
> > >>> to a newer upstream then often results in a conflict which, while it
> > >>> is trivial to resolve by hand, makes it harder to have a CI do "try to
> > >>> build our board against latest upstream".
> > >>>
> > >>> The .config usually includes information on precisely what .dtb(s) are
> > >>> needed, so to avoid having to modify the Makefile, simply add the
> > >>> files in (SPL_)OF_LIST to dtb-y.
> > >>>
> > >>> A technicality is that (SPL_)OF_LIST is not always defined, so rework
> > >>> the Kconfig symbols so that (SPL_)OF_LIST is always defined (when
> > >>> (SPL_)OF_CONTROL), but only prompted for in the cases which used to be
> > >>> their "depends on".
> > >>>
> > >>> nios2 and microblaze already have something like this in their
> > >>> dts/Makefile, and the rationale in commit 41f59f68539 is similar to
> > >>> the above. So this simply generalizes existing practice. Followup
> > >>> patches could remove the logic in those two makefiles, just as there's
> > >>> potential for moving some common boilerplate from all the
> > >>> arch/*/dts/Makefile files to the new scripts/Makefile.dts.
> > >>>
> > >>> Signed-off-by: Rasmus Villemoes 
> > >>> ---
> > >>>  arch/arc/dts/Makefile| 2 ++
> > >>>  arch/arm/dts/Makefile| 2 ++
> > >>>  arch/m68k/dts/Makefile   | 2 ++
> > >>>  arch/microblaze/dts/Makefile | 2 ++
> > >>>  arch/mips/dts/Makefile   | 2 ++
> > >>>  arch/nds32/dts/Makefile  | 2 ++
> > >>>  arch/nios2/dts/Makefile  | 2 ++
> > >>>  arch/powerpc/dts/Makefile| 2 ++
> > >>>  arch/riscv/dts/Makefile  | 2 ++
> > >>>  arch/sandbox/dts/Makefile| 2 ++
> > >>>  arch/sh/dts/Makefile | 2 ++
> > >>>  arch/x86/dts/Makefile| 2 ++
> > >>>  arch/xtensa/dts/Makefile | 2 ++
> > >>>  dts/Kconfig  | 8 
> > >>>  scripts/Makefile.dts | 3 +++
> > >>>  15 files changed, 33 insertions(+), 4 deletions(-)
> > >>>  create mode 100644 scripts/Makefile.dts
>
> Reviewed-by: Simon Glass 

Applied to u-boot-dm, thanks!


Re: [PATCH] dm: Use parenthesis for the device_get_ops macro argument

2022-02-08 Thread Simon Glass
On Sat, 29 Jan 2022 at 12:21, Sughosh Ganu  wrote:
>
> Use parenthesis for the device_get_ops macro argument. This prevents
> errors when using an expression for the parameter.
>
> Signed-off-by: Sughosh Ganu 
> ---
>  include/dm/device.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass 

Applied to u-boot-dm, thanks!


Re: [PATCH v2 1/1] sandbox: fix build failure with musl and SDL

2022-02-08 Thread Simon Glass
On 2/8/22 16:16, Simon Glass wrote:
> On Sat, 29 Jan 2022 at 07:17, Heinrich Schuchardt
>  wrote:
>>
>>
>>
>> On 1/28/22 10:08, Heinrich Schuchardt wrote:
>>> sdl.c is compiled against the SDL library.
>>>
>>> Trying to redefine wchar_t with -fshort-wchar is not necessary
>>> and leads to build failures when compiling against musl.
>>>
>>> Cc: Milan P. Stanić 
>>> Signed-off-by: Heinrich Schuchardt 
>>> ---
>
> Reviewed-by: Simon Glass 
>
> How do I compile against musl?

On Ubuntu install the musl-tools package and use musl-gcc as your compiler.

You can add a new alternative for cc with

sudo update-alternatives --install /usr/bin/cc cc
/usr/bin/x86_64-linux-musl-gcc 10

and choose the active alternative with

sudo update-alternatives --config cc

But this will give you problems with the include paths for libraries
like openssl.

A better choice is using a distro like Alpine which defaults to musl.
You can easily test it in docker.

Best regards

Heinrich

>
> Regards,
> Simon
>
>>> v2:
>>>fix a build error with clang by adding -fno-lto for building sdl.o
>>>
>>> A better longterm solution will be to eliminate -fshort-wchar completely.
>>> This will require replacing %ls printf() codes by something that gcc does
>>> not check, e.g. %pS. Further all L"" strings must be replaced by u""
>>> strings.
>>
>> %p will not work as a replacement for %ls:
>>
>> warning: precision used with ‘%p’ gnu_printf format [-Wformat=]
>> 298 | s += sprintf(s, "%-.*ps", slen, fp->str);
>> |  ^
>>
>> Best regards
>>
>> Heinrich


Applied to u-boot-dm, thanks!


Re: [PATCH 01/17] patman: Convert camel case in tools.py

2022-02-08 Thread Simon Glass
Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass 
---

 tools/binman/bintool.py |  10 +-
 tools/binman/bintool_test.py|  34 +--
 tools/binman/btool/lz4.py   |   8 +-
 tools/binman/btool/lzma_alone.py|  16 +-
 tools/binman/cbfs_util.py   |  12 +-
 tools/binman/cbfs_util_test.py  |  20 +-
 tools/binman/control.py |  30 +-
 tools/binman/elf.py |  12 +-
 tools/binman/elf_test.py|  14 +-
 tools/binman/entry.py   |  32 +-
 tools/binman/entry_test.py  |   4 +-
 tools/binman/etype/atf_fip.py   |   2 +-
 tools/binman/etype/blob.py  |   4 +-
 tools/binman/etype/blob_ext_list.py |   2 +-
 tools/binman/etype/fdtmap.py|   2 +-
 tools/binman/etype/files.py |   2 +-
 tools/binman/etype/fill.py  |   2 +-
 tools/binman/etype/fit.py   |  20 +-
 tools/binman/etype/fmap.py  |   4 +-
 tools/binman/etype/gbb.py   |  10 +-
 tools/binman/etype/intel_ifwi.py|  12 +-
 tools/binman/etype/mkimage.py   |   8 +-
 tools/binman/etype/section.py   |  16 +-
 tools/binman/etype/text.py  |   4 +-
 tools/binman/etype/u_boot_elf.py|   6 +-
 tools/binman/etype/u_boot_env.py|   4 +-
 tools/binman/etype/u_boot_spl_bss_pad.py|   4 +-
 tools/binman/etype/u_boot_tpl_bss_pad.py|   4 +-
 tools/binman/etype/u_boot_ucode.py  |   4 +-
 tools/binman/etype/u_boot_with_ucode_ptr.py |   2 +-
 tools/binman/etype/vblock.py|  10 +-
 tools/binman/fdt_test.py|   4 +-
 tools/binman/fip_util.py|  16 +-
 tools/binman/fip_util_test.py   |  36 +--
 tools/binman/fmap_util.py   |   2 +-
 tools/binman/ftest.py   | 320 ++--
 tools/binman/image.py   |  10 +-
 tools/binman/state.py   |  18 +-
 tools/buildman/control.py   |   2 +-
 tools/buildman/func_test.py |   2 +-
 tools/buildman/test.py  |   2 +-
 tools/buildman/toolchain.py |  10 +-
 tools/dtoc/fdt.py   |   4 +-
 tools/dtoc/fdt_util.py  |   8 +-
 tools/dtoc/test_dtoc.py |  76 ++---
 tools/dtoc/test_fdt.py  |  32 +-
 tools/dtoc/test_src_scan.py |  12 +-
 tools/patman/func_test.py   |   2 +-
 tools/patman/main.py|   2 +-
 tools/patman/tools.py   |  74 ++---
 50 files changed, 473 insertions(+), 473 deletions(-)

Applied to u-boot-dm, thanks!


Re: [PATCH 03/17] patman: Convert camel case in checkpatch.py

2022-02-08 Thread Simon Glass
Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass 
---

 tools/patman/checkpatch.py  | 22 +++---
 tools/patman/control.py |  2 +-
 tools/patman/test_checkpatch.py | 12 ++--
 3 files changed, 18 insertions(+), 18 deletions(-)

Applied to u-boot-dm, thanks!


Re: [PATCH 04/17] patman: Convert camel case in commit.py

2022-02-08 Thread Simon Glass
Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass 
---

 tools/patman/commit.py  | 10 +-
 tools/patman/patchstream.py |  8 
 tools/patman/series.py  |  2 +-
 3 files changed, 10 insertions(+), 10 deletions(-)

Applied to u-boot-dm, thanks!


Re: [PATCH 02/17] patman: Convert camel case in command.py

2022-02-08 Thread Simon Glass
Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass 
---

 tools/binman/bintool.py |  2 +-
 tools/binman/elf.py |  2 +-
 tools/binman/elf_test.py|  2 +-
 tools/binman/ftest.py   |  2 +-
 tools/buildman/builder.py   |  4 +--
 tools/buildman/builderthread.py | 10 +++
 tools/buildman/control.py   |  2 +-
 tools/buildman/func_test.py |  4 +--
 tools/buildman/toolchain.py |  6 ++---
 tools/dtoc/fdt_util.py  |  4 +--
 tools/patman/checkpatch.py  |  2 +-
 tools/patman/command.py | 28 ++--
 tools/patman/get_maintainer.py  |  2 +-
 tools/patman/gitutil.py | 46 -
 tools/patman/patchstream.py |  2 +-
 tools/patman/test_util.py   |  2 +-
 tools/patman/tools.py   |  4 +--
 tools/rmboard.py| 16 ++--
 18 files changed, 70 insertions(+), 70 deletions(-)

Applied to u-boot-dm, thanks!


Re: [PATCH 05/17] patman: Convert camel case in cros_subprocess.py

2022-02-08 Thread Simon Glass
Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass 
---

 tools/patman/command.py |  2 +-
 tools/patman/cros_subprocess.py | 59 +
 2 files changed, 31 insertions(+), 30 deletions(-)

Applied to u-boot-dm, thanks!


Re: [PATCH 06/17] patman: Convert camel case in func_test.py

2022-02-08 Thread Simon Glass
Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass 
---

 tools/patman/func_test.py | 50 +++
 1 file changed, 25 insertions(+), 25 deletions(-)

Applied to u-boot-dm, thanks!


Re: [PATCH 07/17] patman: Convert camel case in get_maintainer.py

2022-02-08 Thread Simon Glass
Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass 
---

 tools/patman/get_maintainer.py | 6 +++---
 tools/patman/series.py | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

Applied to u-boot-dm, thanks!


Re: [PATCH 08/17] patman: Convert camel case in gitutil.py

2022-02-08 Thread Simon Glass
Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass 
---

 tools/buildman/builder.py   |  12 ++--
 tools/buildman/builderthread.py |   2 +-
 tools/buildman/control.py   |  10 +--
 tools/buildman/func_test.py |   4 +-
 tools/patman/checkpatch.py  |   2 +-
 tools/patman/control.py |  12 ++--
 tools/patman/func_test.py   |   8 +--
 tools/patman/gitutil.py | 124 
 tools/patman/patchstream.py |   2 +-
 tools/patman/project.py |   2 +-
 tools/patman/series.py  |  16 ++---
 tools/patman/settings.py|   4 +-
 12 files changed, 99 insertions(+), 99 deletions(-)

Applied to u-boot-dm, thanks!


Re: [PATCH 09/17] patman: Convert camel case in project.py

2022-02-08 Thread Simon Glass
Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass 
---

 tools/patman/main.py| 2 +-
 tools/patman/project.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Applied to u-boot-dm, thanks!


Re: [PATCH 10/17] patman: Convert camel case in test_checkpatch.py

2022-02-08 Thread Simon Glass
Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass 
---

 tools/patman/test_checkpatch.py | 68 -
 1 file changed, 34 insertions(+), 34 deletions(-)

Applied to u-boot-dm, thanks!


Re: [PATCH 12/17] patman: Convert camel case in tout.py

2022-02-08 Thread Simon Glass
Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass 
---

 tools/binman/bintool.py   | 10 ++---
 tools/binman/control.py   | 44 +-
 tools/binman/elf.py   |  6 +--
 tools/binman/elf_test.py  |  4 +-
 tools/binman/entry.py | 10 ++---
 tools/binman/etype/fmap.py|  2 +-
 tools/binman/etype/section.py | 10 ++---
 tools/binman/etype/u_boot_spl_expanded.py |  2 +-
 tools/binman/etype/u_boot_tpl_expanded.py |  2 +-
 tools/binman/ftest.py |  2 +-
 tools/binman/image.py |  6 +--
 tools/binman/state.py | 16 +++
 tools/patman/status.py|  6 +--
 tools/patman/tools.py |  8 ++--
 tools/patman/tout.py  | 54 +++
 15 files changed, 91 insertions(+), 91 deletions(-)

Applied to u-boot-dm, thanks!


Re: [PATCH 14/17] patman: Rename Color() method to build()

2022-02-08 Thread Simon Glass
This method has the same name as its class which is confusing. It is also
annoying when searching the code.

It builds a string with a colour, so rename it to build().

Signed-off-by: Simon Glass 
---

 tools/binman/bintool.py |  8 
 tools/buildman/builder.py   | 24 
 tools/buildman/control.py   | 28 ++--
 tools/buildman/test.py  | 20 ++--
 tools/buildman/toolchain.py | 10 +-
 tools/patman/checkpatch.py  | 10 +-
 tools/patman/control.py |  6 +++---
 tools/patman/gitutil.py |  6 +++---
 tools/patman/series.py  | 12 ++--
 tools/patman/terminal.py| 14 +++---
 tools/patman/tout.py|  4 ++--
 11 files changed, 71 insertions(+), 71 deletions(-)

Applied to u-boot-dm, thanks!


Re: [PATCH 13/17] patman: Rename Print() to Tprint()

2022-02-08 Thread Simon Glass
Rename this function so that when we convert it to snake case it will not
conflict with the built-in print() function.

Signed-off-by: Simon Glass 
---

 tools/buildman/builder.py | 56 +++
 tools/buildman/control.py |  4 +--
 tools/patman/main.py  |  2 +-
 tools/patman/status.py| 16 +--
 tools/patman/terminal.py  |  4 +--
 5 files changed, 41 insertions(+), 41 deletions(-)

Applied to u-boot-dm, thanks!


Re: [PATCH 15/17] patman: Convert camel case in terminal.py

2022-02-08 Thread Simon Glass
Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass 
---

 tools/buildman/builder.py   | 68 ++---
 tools/buildman/control.py   |  4 +--
 tools/buildman/func_test.py | 10 +++---
 tools/buildman/test.py  |  8 ++---
 tools/patman/func_test.py   | 14 
 tools/patman/main.py|  2 +-
 tools/patman/status.py  | 16 -
 tools/patman/terminal.py| 42 +++
 8 files changed, 82 insertions(+), 82 deletions(-)

Applied to u-boot-dm, thanks!


Re: [PATCH] serial: remove nulldev_serial_input

2022-02-08 Thread Simon Glass
On Wed, 2 Feb 2022 at 05:53, Heiko Schocher  wrote:
>
> nulldev_serial_input is static and not used in this file,
> so remove it.
>
> Signed-off-by: Heiko Schocher 
> ---
> azure build is clean
> https://dev.azure.com/hs0298/hs/_build/results?buildId=78=results
>
>  drivers/serial/serial_nulldev.c | 5 -
>  1 file changed, 5 deletions(-)

Reviewed-by: Simon Glass 

Applied to u-boot-dm, thanks!


Re: [PATCH] serial-uclass: fix build warning

2022-02-08 Thread Simon Glass
On Wed, 2 Feb 2022 at 05:55, Heiko Schocher  wrote:
>
> if CONFIG_DM_STDIO is defined but SERIAL_PRESENT not,
> gcc drops warnings for serial_stub_* functions
> that they are defined but not used.
>
> Fix it.
>
> Signed-off-by: Heiko Schocher 
> ---
> azure build is clean
> https://dev.azure.com/hs0298/hs/_build/results?buildId=78=results
>
>  drivers/serial/serial-uclass.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass 

Applied to u-boot-dm, thanks!


Re: [PATCH 2/2] acpi: Move MCFG implementation to common lib

2022-02-08 Thread Simon Glass
Hi Moritz,

On Mon, 7 Feb 2022 at 13:49, Moritz Fischer  wrote:
>
> Hi Simon,
>
> On Mon, Feb 7, 2022 at 12:22 PM Simon Glass  wrote:
> >
> > Hi Moritz,
> >
> > On Sat, 5 Feb 2022 at 13:17, Moritz Fischer  wrote:
> > >
> > > MCFG tables are used on multiple arches. Move to common ACPI lib.
> > >
> > > Cc: Simon Glass 
> > > Signed-off-by: Moritz Fischer 
> > > ---
> > >
> > >  arch/x86/cpu/intel_common/acpi.c  | 15 +---
> > >  arch/x86/cpu/tangier/acpi.c   | 11 --
> > >  arch/x86/include/asm/acpi_table.h |  1 -
> > >  arch/x86/lib/acpi_table.c | 54 --
> > >  lib/acpi/Makefile |  1 +
> > >  lib/acpi/mcfg.c   | 64 +++
> > >  6 files changed, 81 insertions(+), 65 deletions(-)
> > >  create mode 100644 lib/acpi/mcfg.c
> > >
Applied to u-boot-dm, thanks!


Re: [PATCH 1/2] arch: x86: lib: acpi_table: Fix MCFG entries

2022-02-08 Thread Simon Glass
Hi Moritz,

On Sat, 5 Feb 2022 at 13:17, Moritz Fischer  wrote:
>
> Commit d953137526cc ("x86: Move SSDT table to a writer function")
> introduced a bug where the actual MCFG entries are no longer generated.
>
> Cc: Simon Glass 
> Fixes: d953137526cc ("x86: Move SSDT table to a writer function")
> Signed-off-by: Moritz Fischer 
> ---
>
> Hi Simon, Andriy,
>
> it looks like this got dropped when moving stuff around, I don't have HW
> to test this, but it seemed off.
>
> - Moritz
>
> ---
>
>  arch/x86/lib/acpi_table.c | 2 ++
>  1 file changed, 2 insertions(+)

Reviewed-by: Simon Glass 
Tested on: coral
Tested-by: Simon Glass 


>
Applied to u-boot-dm, thanks!


Re: [PATCH v2 2/5] binman: Register and check bintools from FIT subentries

2022-02-08 Thread Simon Glass
Binman keeps track of binary tools each entry wants to use. The
implementation of this for the FIT entry only adds "mkimage", but not
the tools that would be used by its subentries.

Register the binary tools that FIT subentries will use in addition to
the one FIT itself uses, and check their existence by copying the
appropriate method from Section entry type. Also add tests that check if
these subentries can use and warn about binary tools.

Signed-off-by: Alper Nebi Yasak 
Reviewed-by: Simon Glass 
---

Changes in v2:
- Add tag: "Reviewed-by: Simon Glass "

 tools/binman/etype/fit.py | 14 +++
 tools/binman/ftest.py | 25 
 .../binman/test/220_fit_subentry_bintool.dts  | 39 +++
 3 files changed, 78 insertions(+)
 create mode 100644 tools/binman/test/220_fit_subentry_bintool.dts

Applied to u-boot-dm, thanks!


Re: [PATCH v2 1/5] binman: Fix subentry expansion for FIT entry type

2022-02-08 Thread Simon Glass
On Mon, 7 Feb 2022 at 15:08, Alper Nebi Yasak  wrote:
>
> Binman tries to expand some entries into parts that make it up, e.g.
> 'u-boot' into a 'u-boot-expanded' section that contains 'u-boot-nodtb'
> and 'u-boot-dtb'. Entries with child entries must call ExpandEntries()
> on them to build a correct image, as it's possible that unexpanded child
> entries have no data of their own. The FIT entry type doesn't currently
> do this, which means putting a "u-boot" entry inside it doesn't work as
> expected.
>
> Implement ExpandEntries() for FIT and add a copy of a simple FIT image
> test that checks subentry expansion in FIT entries.
>
> Signed-off-by: Alper Nebi Yasak 
> ---
>
> Changes in v2:
> - Split reused testSimpleFit code into a helper function
>
>  tools/binman/etype/fit.py |  5 +
>  tools/binman/ftest.py | 33 -
>  2 files changed, 29 insertions(+), 9 deletions(-)

Reviewed-by: Simon Glass 

I missed the duplicate number on the dts, but will fix that when applying.

>
Applied to u-boot-dm, thanks!


Re: [PATCH v2 3/5] binman: Check missing bintools of Section subclasses

2022-02-08 Thread Simon Glass
Binman can check for missing binary tools and prints warnings if
anything required for an image is missing. The implementation of this
for the Section entry only checks the subentries, presumably because
Section does not use any binary tools itself. However, this means the
check is also skipped for subclasses of Section which might need binary
tools.

Make sure missing binary tools are checked for subclasses of the Section
entry type as well, by calling the parent class' implementation in
the relevant Section method.

Signed-off-by: Alper Nebi Yasak 
Reviewed-by: Simon Glass 
---
This starts being tested by testFitMissing in the next patch when FIT
becomes a Section subclass.

Changes in v2:
- Add tag: "Reviewed-by: Simon Glass "

 tools/binman/etype/section.py | 1 +
 1 file changed, 1 insertion(+)

Applied to u-boot-dm, thanks!


Re: [PATCH v2 4/5] binman: Convert FIT entry type to a subclass of Section entry type

2022-02-08 Thread Simon Glass
The binman FIT entry type shares some code with the Section entry type.
This shared code is bound to grow, since FIT entries are conceptually a
variation of Section entries.

Make FIT entry type a subclass of Section entry type, simplifying it a
bit and providing us the features that Section implements. Also fix the
subentry alignment test which now attempts to write symbols to a
nonexistent SPL ELF test file by creating it first.

Signed-off-by: Alper Nebi Yasak 
Reviewed-by: Simon Glass 
---

Changes in v2:
- Add tag: "Reviewed-by: Simon Glass "

 tools/binman/etype/fit.py | 70 +++
 tools/binman/ftest.py |  1 +
 2 files changed, 20 insertions(+), 51 deletions(-)

Applied to u-boot-dm, thanks!


[PATCH 00/24] binman: rockchip: Migrate from rockchip SPL_FIT_GENERATOR script

2022-02-08 Thread Simon Glass
At present rockchip 64-bit boards make use of a FIT-generator script
written in Python. The script supports splitting an ELF file into several
'loadable' nodes in the FIT. Binman does not current support this feature.

This series adds binman support for ELF splitting. This works by adding a
new 'fit,operation' property to the FIT subnodes, allowing this new way of
generating nodes.

Some other fixes and improvements are needed along the way.

A new, common binman description is added for 64-bit boards which includes
the required u-boot.itb file.

The existing script is removed, so that only a few zynq boards are now
using a SPL_FIT_GENERATOR script:

   avnet_ultrazedev_cc_v1_0_ultrazedev_som_v1_0
   xilinx_zynqmp_virt

Migration of those is hopefully in progress.

Note however that tools/k3_fit_atf.sh remains, used by a few boards that
enable CONFIG_TI_SECURE_DEVICE so this series is copied there too:

am335x_hs_evm
am335x_hs_evm_uart
am43xx_hs_evm
am57xx_hs_evm
am57xx_hs_evm_usb
am65x_hs_evm_a53
am65x_hs_evm_r5
dra7xx_hs_evm
dra7xx_hs_evm_usb
j721e_hs_evm_a72
j721e_hs_evm_r5
k2e_hs_evm
k2g_hs_evm
k2hk_hs_evm
k2l_hs_evm

Ivan Mikhaylov has sent a patch to help with these, but I need to take a
look at the testing side. In any case they should really be using binman
for the image generation.

This series also includes some moveconfig improvements that were used to
create board lists in this cover letter.


Simon Glass (24):
  moveconfig: Show the config name rather than the defconfig
  moveconfig: Allow regex matches when finding combinations
  spl: x86: Correct the binman symbols for SPL
  spl: Allow disabling binman symbols in SPL
  rockchip: evb-rk3288: Drop raw-image support
  dtoc: Support adding a string list to a device tree
  dtoc: Support deleting a node
  dtoc: Allow deleting nodes and adding them in the same sync
  dtoc: Support reading a list of arguments
  binman: Update docs to indicate mkimage is supported
  elf: Add a way to read segment information from an ELF file
  WIP: binman: Add support for OP-TEE
  binman: Add to the TODO
  binman: Support a list of strings with the mkimage etype
  binman: Add a ELF test file with disjoint text sections
  binman: Move entry-data collection into a Entry method
  binman: fit: Refactor to reduce function size
  binman: Tidy up the docs a little with fit
  binman: Allow different operations in FIT generator nodes
  binman: Support splitting an ELF file into multiple nodes
  rockchip: Include binman script in 64-bit boards
  rockchip: Support building the all output files in binman
  rockchip: Convert all boards to use binman
  rockchip: Drop the FIT generator script

 Makefile |  43 +-
 arch/arm/dts/px30-u-boot.dtsi|   2 +
 arch/arm/dts/rk3308-u-boot.dtsi  |   2 +
 arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi   |   2 +
 arch/arm/dts/rk3328-u-boot.dtsi  |   2 +
 arch/arm/dts/rk3368-u-boot.dtsi  |   1 +
 arch/arm/dts/rk3399-u-boot.dtsi  |   5 +-
 arch/arm/dts/rk3568-u-boot.dtsi  |   2 +
 arch/arm/dts/rockchip-u-boot.dtsi|  84 +++-
 arch/arm/mach-rockchip/Kconfig   |   6 +
 arch/arm/mach-rockchip/make_fit_atf.py   | 240 -
 arch/x86/dts/u-boot.dtsi |   2 +-
 boot/Kconfig |   3 +-
 common/spl/Kconfig   |  24 +
 common/spl/spl.c |  12 +-
 configs/evb-rk3288_defconfig |   1 +
 include/spl.h|   4 +-
 tools/binman/binman.rst  |  98 +++-
 tools/binman/elf.py  |  37 ++
 tools/binman/elf_test.py |  31 +-
 tools/binman/entries.rst | 260 +-
 tools/binman/entry.py|  28 ++
 tools/binman/etype/fit.py| 490 ---
 tools/binman/etype/mkimage.py|  27 +-
 tools/binman/etype/op_tee.py |  23 +
 tools/binman/ftest.py| 123 +
 tools/binman/missing-blob-help   |   4 +
 tools/binman/test/220_fit_bad_oper.dts   |  27 +
 tools/binman/test/221_fit_split_elf.dts  |  67 +++
 tools/binman/test/222_fit_bad_dir.dts|   9 +
 tools/binman/test/223_fit_bad_dir_config.dts |   9 +
 tools/binman/test/Makefile   |   6 +-
 tools/binman/test/elf_sections.c |  20 +
 tools/binman/test/elf_sections.lds   |  31 ++
 tools/dtoc/fdt.py|  37 ++
 tools/dtoc/fdt_util.py   |  12 +
 tools/dtoc/test/dtoc_test_simple.dts |   1 +
 tools/dtoc/test_fdt.py   |  43 ++
 tools/moveconfig.py  |  39 +-
 39 files changed, 1450 insertions(+), 407 deletions(-)
 delete mode 100755 

Re: k210 spi flash regression

2022-02-08 Thread Pratyush Yadav
On 07/02/22 12:23PM, Niklas Cassel wrote:
> Hello Pratyush,
> 
> I upgraded u-boot on my k210 maix bit board, and the SPI flash is no longer
> detected.
> 
> 
> I bisected the problem to commit:
> d15de623013c ("spi: spi-mem: allow specifying a command's extension")

Hm, this commit is not supposed to make any changes to how things work. 
It should just add a new field to struct spi_mem_op.cmd.

Can you dump the spi_mem_op passed to spi_mem_exec_op() for reading the 
ID? Let's see what changed before and after that commit.

> 
> 
> Before the commit in question, the following was printed:
> Loading Environment from SPIFlash... SF: Detected gd25lq128 with page size 
> 256 Bytes, 
> erase size 4 KiB, total 16 MiB
> *** Warning - bad CRC, using default environment
> 
> 
> After the commit in question, the following is printed:
> Loading Environment from SPIFlash... jedec_spi_nor spi-flash@0: unrecognized 
> JEDEC id 
> bytes: 60, 18, c8 
> 
> *** Warning - spi_flash_probe_bus_cs() failed, using default environment
> 
> 
> Looking at spi-nor-ids.c, the flash is defined like this:
> INFO("gd25lq128", 0xc86018, 0, 64 * 1024, 256,
>  SECT_4K | SPI_NOR_DUAL_READ |
>  SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
> 
> 
> So it appears that after your patch, the bytes are coming in the wrong order.
> 
> 
> Any suggestions?
> 
> 
> Kind regards,
> Niklas

-- 
Regards,
Pratyush Yadav
Texas Instruments Inc.


Re: [PATCH] boot: Update default on USE_SPL_FIT_GENERATOR

2022-02-08 Thread Simon Glass
Hi Tom,

On Tue, 8 Feb 2022 at 10:53, Tom Rini  wrote:
>
> On Tue, Feb 08, 2022 at 10:22:34AM -0500, Tom Rini wrote:
> > On Tue, Feb 08, 2022 at 08:13:33AM -0700, Simon Glass wrote:
> > > Hi Tom,
> > >
> > > On Mon, 31 Jan 2022 at 17:03, Tom Rini  wrote:
> > > >
> > > > The use of CONFIG_SPL_FIT_GENERATOR is deprecated and should not be
> > > > used.  Start by changing the current default option from enabled to only
> > > > enabled for the platforms still using it.
> > > >
> > > > Cc: Simon Glass 
> > > > Signed-off-by: Tom Rini 
> > > > ---
> > > > This change completes the migration for a number of platforms that were
> > > > tripping the warning before but not actually using a generator.
> > > > ---
> > > >  boot/Kconfig | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > Reviewed-by: Simon Glass 
> > >
> > > This landed in spam so I missed it. I have a similar patch in my
> > > series if I ever get time to finish it. But we can deal with any
> > > conflict later.
> >
> > OK.  Now that the first iMX PR has come through I _think_ the implicitly
> > depended on binman patches there have come in and so this patch won't
> > break anything.  I'll pick this up soon along with other Kconfig
> > migration/etc patches in the next day or two.
>
> So, I was wrong.  There's still:
> configs/cgtqmx8_defconfig
> configs/imx8mm-icore-mx8mm-ctouch2_defconfig
> configs/imx8mm-icore-mx8mm-edimm2.2_defconfig
> configs/imx8qm_rom7720_a1_4G_defconfig
> that need migration and only the last of which has a patch that I see
> right now:
> https://patchwork.ozlabs.org/project/uboot/patch/20220126155204.25099-1-oliver.gra...@kococonnector.com/
> but I assume the other 3 could be done fairly quickly.

See the cover letter for the series I just sent for another one that
is hidden in a Makefile.

My series disables the IMX8 stuff which might be good enough since it
is easy to migrate.

Regards,
Simon


Re: [PATCH] binman: Correct the error message for a bad hash algorithm

2022-02-08 Thread Simon Glass
Hi Alper,

On Tue, 8 Feb 2022 at 11:54, Alper Nebi Yasak  wrote:
>
> On 08/02/2022 20:59, Simon Glass wrote:
> > This shows an internal type at present, rather than the algorithm name.
> > Fix it and update the test to catch this.
> >
> > Signed-off-by: Simon Glass 
> > ---
> >
> >  tools/binman/ftest.py | 2 +-
> >  tools/binman/state.py | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
>
> Reviewed-by: Alper Nebi Yasak 
>
> I saw the failing build for my series [1]. Looks to me like binman
> doesn't support crc32 in hash nodes, and turning FIT into a Section
> simply exposed that. I tried a sloppy fix, see below.
>
> [1] https://source.denx.de/u-boot/custodians/u-boot-dm/-/jobs/388771
>
> > diff --git a/tools/binman/state.py b/tools/binman/state.py
> > index af0a65e841..843aefd28d 100644
> > --- a/tools/binman/state.py
> > +++ b/tools/binman/state.py
> > @@ -397,7 +397,7 @@ def CheckAddHashProp(node):
> >  if algo.value == 'sha256':
> >  size = 32
>
> If I add here:
>
>   +elif algo.value == 'crc32':
>   +size = 8
>
> and a crc32 implementation attempt to the next function:
>
> >  else:
> > -return "Unknown hash algorithm '%s'" % algo
> > +return "Unknown hash algorithm '%s'" % algo.value
> >  for n in GetUpdateNodes(hash_node):
> >  n.AddEmptyProp('value', size)
>
>def CheckSetHashValue(node, get_data_func):
>hash_node = node.FindNode('hash')
>if hash_node:
>algo = hash_node.props.get('algo').value
>if algo == 'sha256':
>m = hashlib.sha256()
>m.update(get_data_func())
>data = m.digest()
>   +elif algo == 'crc32':
>   +data = zlib.crc32(get_data_func()).to_bytes(8, 'little')
>for n in GetUpdateNodes(hash_node):
>n.SetData('value', data)
>
> the failing boards start building again. Not sure how correct this is
> though (especially the endianness). Do we need this and maybe a test
> with crc32 hash now?

I can get your series in without the final patch (testing at
u-boot-dm/testing now).

The thing is that mkimage creates the hashes so we don't want binman
doing that too.

My current feeling is that we need a way to tell sections not to add
calculated properties for hashes...but just for the FIT section
itself, so its children should still add these.

Regards,
Simon


Re: [PATCH] binman: Correct the error message for a bad hash algorithm

2022-02-08 Thread Alper Nebi Yasak
On 08/02/2022 20:59, Simon Glass wrote:
> This shows an internal type at present, rather than the algorithm name.
> Fix it and update the test to catch this.
> 
> Signed-off-by: Simon Glass 
> ---
> 
>  tools/binman/ftest.py | 2 +-
>  tools/binman/state.py | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Alper Nebi Yasak 

I saw the failing build for my series [1]. Looks to me like binman
doesn't support crc32 in hash nodes, and turning FIT into a Section
simply exposed that. I tried a sloppy fix, see below.

[1] https://source.denx.de/u-boot/custodians/u-boot-dm/-/jobs/388771

> diff --git a/tools/binman/state.py b/tools/binman/state.py
> index af0a65e841..843aefd28d 100644
> --- a/tools/binman/state.py
> +++ b/tools/binman/state.py
> @@ -397,7 +397,7 @@ def CheckAddHashProp(node):
>  if algo.value == 'sha256':
>  size = 32

If I add here:

  +elif algo.value == 'crc32':
  +size = 8

and a crc32 implementation attempt to the next function:

>  else:
> -return "Unknown hash algorithm '%s'" % algo
> +return "Unknown hash algorithm '%s'" % algo.value
>  for n in GetUpdateNodes(hash_node):
>  n.AddEmptyProp('value', size)

   def CheckSetHashValue(node, get_data_func):
   hash_node = node.FindNode('hash')
   if hash_node:
   algo = hash_node.props.get('algo').value
   if algo == 'sha256':
   m = hashlib.sha256()
   m.update(get_data_func())
   data = m.digest()
  +elif algo == 'crc32':
  +data = zlib.crc32(get_data_func()).to_bytes(8, 'little')
   for n in GetUpdateNodes(hash_node):
   n.SetData('value', data)

the failing boards start building again. Not sure how correct this is
though (especially the endianness). Do we need this and maybe a test
with crc32 hash now?


[PATCH 24/24] rockchip: Drop the FIT generator script

2022-02-08 Thread Simon Glass
This is not used anymore. Drop it.

Signed-off-by: Simon Glass 
---

 Makefile   |   3 -
 arch/arm/mach-rockchip/make_fit_atf.py | 240 -
 boot/Kconfig   |   1 -
 3 files changed, 244 deletions(-)
 delete mode 100755 arch/arm/mach-rockchip/make_fit_atf.py

diff --git a/Makefile b/Makefile
index c7f1cb3d2e..cc7d358148 100644
--- a/Makefile
+++ b/Makefile
@@ -1351,9 +1351,6 @@ $(U_BOOT_ITS): $(subst ",,$(CONFIG_SPL_FIT_SOURCE))
 else
 ifneq ($(CONFIG_USE_SPL_FIT_GENERATOR),)
 U_BOOT_ITS := u-boot.its
-ifeq ($(CONFIG_SPL_FIT_GENERATOR),"arch/arm/mach-rockchip/make_fit_atf.py")
-U_BOOT_ITS_DEPS += u-boot
-endif
 $(U_BOOT_ITS): $(U_BOOT_ITS_DEPS) FORCE
$(srctree)/$(CONFIG_SPL_FIT_GENERATOR) \
$(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) > $@
diff --git a/arch/arm/mach-rockchip/make_fit_atf.py 
b/arch/arm/mach-rockchip/make_fit_atf.py
deleted file mode 100755
index f3224d2555..00
--- a/arch/arm/mach-rockchip/make_fit_atf.py
+++ /dev/null
@@ -1,240 +0,0 @@
-#!/usr/bin/env python3
-"""
-# SPDX-License-Identifier: GPL-2.0+
-#
-# A script to generate FIT image source for rockchip boards
-# with ARM Trusted Firmware
-# and multiple device trees (given on the command line)
-#
-# usage: $0  [ [;
-
-   images {
-"""
-
-DT_UBOOT = """
-   uboot {
-   description = "U-Boot (64-bit)";
-   data = /incbin/("u-boot-nodtb.bin");
-   type = "standalone";
-   os = "U-Boot";
-   arch = "arm64";
-   compression = "none";
-   load = <0x%08x>;
-   };
-
-"""
-
-DT_IMAGES_NODE_END = """   };
-
-"""
-
-DT_END = "};"
-
-def append_bl31_node(file, atf_index, phy_addr, elf_entry):
-# Append BL31 DT node to input FIT dts file.
-data = 'bl31_0x%08x.bin' % phy_addr
-file.write('\t\tatf_%d {\n' % atf_index)
-file.write('\t\t\tdescription = \"ARM Trusted Firmware\";\n')
-file.write('\t\t\tdata = /incbin/("%s");\n' % data)
-file.write('\t\t\ttype = "firmware";\n')
-file.write('\t\t\tarch = "arm64";\n')
-file.write('\t\t\tos = "arm-trusted-firmware";\n')
-file.write('\t\t\tcompression = "none";\n')
-file.write('\t\t\tload = <0x%08x>;\n' % phy_addr)
-if atf_index == 1:
-file.write('\t\t\tentry = <0x%08x>;\n' % elf_entry)
-file.write('\t\t};\n')
-file.write('\n')
-
-def append_tee_node(file, atf_index, phy_addr, elf_entry):
-# Append TEE DT node to input FIT dts file.
-data = 'tee_0x%08x.bin' % phy_addr
-file.write('\t\tatf_%d {\n' % atf_index)
-file.write('\t\t\tdescription = \"TEE\";\n')
-file.write('\t\t\tdata = /incbin/("%s");\n' % data)
-file.write('\t\t\ttype = "tee";\n')
-file.write('\t\t\tarch = "arm64";\n')
-file.write('\t\t\tos = "tee";\n')
-file.write('\t\t\tcompression = "none";\n')
-file.write('\t\t\tload = <0x%08x>;\n' % phy_addr)
-file.write('\t\t\tentry = <0x%08x>;\n' % elf_entry)
-file.write('\t\t};\n')
-file.write('\n')
-
-def append_fdt_node(file, dtbs):
-# Append FDT nodes.
-cnt = 1
-for dtb in dtbs:
-dtname = os.path.basename(dtb)
-file.write('\t\tfdt_%d {\n' % cnt)
-file.write('\t\t\tdescription = "%s";\n' % dtname)
-file.write('\t\t\tdata = /incbin/("%s");\n' % dtb)
-file.write('\t\t\ttype = "flat_dt";\n')
-file.write('\t\t\tcompression = "none";\n')
-file.write('\t\t};\n')
-file.write('\n')
-cnt = cnt + 1
-
-def append_conf_section(file, cnt, dtname, segments):
-file.write('\t\tconfig_%d {\n' % cnt)
-file.write('\t\t\tdescription = "%s";\n' % dtname)
-file.write('\t\t\tfirmware = "atf_1";\n')
-file.write('\t\t\tloadables = "uboot"')
-if segments > 1:
-file.write(',')
-for i in range(1, segments):
-file.write('"atf_%d"' % (i + 1))
-if i != (segments - 1):
-file.write(',')
-else:
-file.write(';\n')
-if segments <= 1:
-file.write(';\n')
-file.write('\t\t\tfdt = "fdt_%d";\n' % cnt)
-file.write('\t\t};\n')
-file.write('\n')
-
-def append_conf_node(file, dtbs, segments):
-# Append configeration nodes.
-cnt = 1
-file.write('\tconfigurations {\n')
-file.write('\t\tdefault = "config_1";\n')
-for dtb in dtbs:
-dtname = os.path.basename(dtb)
-append_conf_section(file, cnt, dtname, segments)
-cnt = cnt + 1
-file.write('\t};\n')
-file.write('\n')
-
-def generate_atf_fit_dts_uboot(fit_file, uboot_file_name):
-segments = unpack_elf(uboot_file_name)
-if len(segments) != 1:
-raise ValueError("Invalid u-boot ELF image '%s'" % uboot_file_name)
-index, entry, p_paddr, data = segments[0]
-fit_file.write(DT_UBOOT % p_paddr)
-
-def generate_atf_fit_dts_bl31(fit_file, bl31_file_name, 

[PATCH 23/24] rockchip: Convert all boards to use binman

2022-02-08 Thread Simon Glass
Instead of the bash script, use binman to generate the FIT for arm64.

For 32-bit boards, use binman for all images, dropping the intermediate
files.

With this change, only Zynq is now using SPL_FIT_GENERATOR so update the
Kconfig rule accordingly.

Clean up the Makefile to the extent possible. Unfortunately, two boards
do not use SPL_FRAMEWORK so don't enable the u-boot.img rule:

   evb-rk3036
   kylin-rk3036

So a small remnant remains.

Signed-off-by: Simon Glass 
---

 Makefile | 39 ++-
 boot/Kconfig |  2 +-
 2 files changed, 3 insertions(+), 38 deletions(-)

diff --git a/Makefile b/Makefile
index ee1dc11e2f..c7f1cb3d2e 100644
--- a/Makefile
+++ b/Makefile
@@ -976,19 +976,8 @@ ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy)
 INPUTS-y += u-boot-with-dtb.bin
 endif
 
-ifeq ($(CONFIG_ARCH_ROCKCHIP),y)
-# On ARM64 this target is produced by binman so we don't need this dep
-ifeq ($(CONFIG_ARM64),y)
-ifeq ($(CONFIG_SPL),y)
-# TODO: Get binman to generate this too
-INPUTS-y += u-boot-rockchip.bin
-endif
-else
-ifeq ($(CONFIG_SPL),y)
-# Generate these inputs for binman which will create the output files
-INPUTS-y += idbloader.img u-boot.img
-endif
-endif
+ifeq ($(CONFIG_ARCH_ROCKCHIP)_$(CONFIG_SPL_FRAMEWORK),y_)
+INPUTS-y += u-boot.img
 endif
 
 INPUTS-$(CONFIG_X86) += u-boot-x86-start16.bin u-boot-x86-reset16.bin \
@@ -1472,30 +1461,6 @@ OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \
 u-boot-with-spl.bin: $(SPL_IMAGE) $(SPL_PAYLOAD) FORCE
$(call if_changed,pad_cat)
 
-ifeq ($(CONFIG_ARCH_ROCKCHIP),y)
-
-# TPL + SPL
-ifeq ($(CONFIG_SPL)$(CONFIG_TPL),yy)
-MKIMAGEFLAGS_u-boot-tpl-rockchip.bin = -n $(CONFIG_SYS_SOC) -T rksd
-tpl/u-boot-tpl-rockchip.bin: tpl/u-boot-tpl.bin FORCE
-   $(call if_changed,mkimage)
-idbloader.img: tpl/u-boot-tpl-rockchip.bin spl/u-boot-spl.bin FORCE
-   $(call if_changed,cat)
-else
-MKIMAGEFLAGS_idbloader.img = -n $(CONFIG_SYS_SOC) -T rksd
-idbloader.img: spl/u-boot-spl.bin FORCE
-   $(call if_changed,mkimage)
-endif
-
-ifeq ($(CONFIG_ARM64),y)
-OBJCOPYFLAGS_u-boot-rockchip.bin = -I binary -O binary \
-   --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff
-u-boot-rockchip.bin: idbloader.img u-boot.itb FORCE
-   $(call if_changed,pad_cat)
-endif # CONFIG_ARM64
-
-endif # CONFIG_ARCH_ROCKCHIP
-
 ifeq ($(CONFIG_ARCH_LPC32XX)$(CONFIG_SPL),yy)
 MKIMAGEFLAGS_lpc32xx-spl.img = -T lpc32xximage -a $(CONFIG_SPL_TEXT_BASE)
 
diff --git a/boot/Kconfig b/boot/Kconfig
index b83a4e8400..ae1a37ae92 100644
--- a/boot/Kconfig
+++ b/boot/Kconfig
@@ -275,7 +275,7 @@ config SPL_FIT_SOURCE
 
 config USE_SPL_FIT_GENERATOR
bool "Use a script to generate the .its script"
-   default y if SPL_FIT && (!ARCH_SUNXI && !RISCV)
+   default y if SPL_FIT && ARCH_ZYNQMP
 
 config SPL_FIT_GENERATOR
string ".its file generator script for U-Boot FIT image"
-- 
2.35.0.263.gb82422642f-goog



[PATCH 22/24] rockchip: Support building the all output files in binman

2022-02-08 Thread Simon Glass
Add the required binman images to replace the Makefile rules which are
currently used. This includes subsuming:

   - tpl/u-boot-tpl-rockchip.bin if TPL is enabled
   - idbloader.img if either or both of SPL and TPL are enabled
   - u-boot.itb2 if SPL_FIT is enabled
   - u-boot-rockchip.bin if SPL is used, either using u-boot.itb2 when
 SPL_FIT is enabled or u-boot.img when it isn't

For now u-boot.itb2 is used as the FIT filename to avoid conflicting with
the current u-boot.itb file. This will be updated in a future patch.

Note that the intermediate files are dropped with binman, since it
producing everything in one pass. This means that
tpl/u-boot-tpl-rockchip.bin is not created, for example.

Note that for some 32-bit rk3288 boards, rockchip-optee.dtsi is included.

Signed-off-by: Simon Glass 
---

 arch/arm/dts/rockchip-u-boot.dtsi | 84 ++-
 1 file changed, 82 insertions(+), 2 deletions(-)

diff --git a/arch/arm/dts/rockchip-u-boot.dtsi 
b/arch/arm/dts/rockchip-u-boot.dtsi
index eae3ee715d..6246ca12b7 100644
--- a/arch/arm/dts/rockchip-u-boot.dtsi
+++ b/arch/arm/dts/rockchip-u-boot.dtsi
@@ -17,13 +17,93 @@
filename = "u-boot-rockchip.bin";
pad-byte = <0xff>;
 
-   blob {
-   filename = "idbloader.img";
+#ifdef CONFIG_TPL
+   mkimage {
+   args = "-n", CONFIG_SYS_SOC, "-T rksd";
+
+   u-boot-tpl {
+   };
+   };
+
+   u-boot-spl {
};
+#elif defined(CONFIG_SPL) /* SPL only */
+   mkimage {
+   args = "-n", CONFIG_SYS_SOC, "-T rksd";
+
+   u-boot-spl {
+   };
+   };
+#endif
+#if defined(CONFIG_SPL_FIT) && defined(CONFIG_ARM64)
+   fit: fit {
+   description = "FIT image for U-Boot with bl31 (TF-A)";
+   #address-cells = <1>;
+   fit,fdt-list = "of-list";
+   fit,external-offset = ;
+   images {
+   u-boot {
+   description = "U-Boot (64-bit)";
+   type = "standalone";
+   os = "U-Boot";
+   arch = "arm64";
+   compression = "none";
+   load = ;
+   u-boot-nodtb {
+   };
+   };
 
+   @atf-SEQ {
+   fit,operation = "split-elf";
+   description = "ARM Trusted Firmware";
+   type = "firmware";
+   arch = "arm64";
+   os = "arm-trusted-firmware";
+   compression = "none";
+   fit,load;
+   fit,entry;
+   fit,data;
+
+   atf-bl31 {
+   };
+   };
+   @tee-SEQ {
+   fit,operation = "split-elf";
+   description = "TEE";
+   type = "tee";
+   arch = "arm64";
+   os = "tee";
+   compression = "none";
+   fit,load;
+   fit,entry;
+   fit,data;
+
+   op-tee {
+   };
+   };
+
+   @fdt-SEQ {
+   description = "fdt-NAME";
+   compression = "none";
+   type = "flat_dt";
+   };
+   };
+
+   configurations {
+   default = "@config-DEFAULT-SEQ";
+   @config-SEQ {
+   description = "NAME.dtb";
+   fdt = "fdt-SEQ";
+   firmware = "u-boot";
+   fit,loadables;
+   };
+   };
+   };
+#else
u-boot-img {
offset = ;
};
+#endif /* CONFIG_ARM64 */
};
 };
 #endif
-- 
2.35.0.263.gb82422642f-goog



[PATCH 20/24] binman: Support splitting an ELF file into multiple nodes

2022-02-08 Thread Simon Glass
Some boards need to load an ELF file using the 'loadables' property, but
the file has segments at different memory addresses. This means that it
cannot be supplied as a flat binary.

Allow generating a separate node in the FIT for each segment in the ELF,
with a different load address for each.

Signed-off-by: Simon Glass 
---

 tools/binman/entries.rst | 146 +++
 tools/binman/etype/fit.py| 259 ++-
 tools/binman/ftest.py| 116 +
 tools/binman/test/221_fit_split_elf.dts  |  67 +
 tools/binman/test/222_fit_bad_dir.dts|   9 +
 tools/binman/test/223_fit_bad_dir_config.dts |   9 +
 6 files changed, 594 insertions(+), 12 deletions(-)
 create mode 100644 tools/binman/test/221_fit_split_elf.dts
 create mode 100644 tools/binman/test/222_fit_bad_dir.dts
 create mode 100644 tools/binman/test/223_fit_bad_dir_config.dts

diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst
index d483169712..079fed1a9c 100644
--- a/tools/binman/entries.rst
+++ b/tools/binman/entries.rst
@@ -612,6 +612,9 @@ gen-fdt-nodes
 Generate FDT nodes as above. This is the default if there is no
 `fit,operation` property.
 
+split-elf
+Split an ELF file into a separate node for each segment.
+
 Generating nodes from an FDT list (gen-fdt-nodes)
 ~
 
@@ -655,6 +658,149 @@ for each of your two files.
 Note that if no devicetree files are provided (with '-a of-list' as above)
 then no nodes will be generated.
 
+Generating nodes from an ELF file (split-elf)
+~
+
+This uses the node as a template to generate multiple nodes. The following
+special properties are available:
+
+split-elf
+Split an ELF file into a separate node for each segment. This uses the
+node as a template to generate multiple nodes. The following special
+properties are available:
+
+fit,load
+Generates a `load = <...>` property with the load address of the
+segmnet
+
+fit,entry
+Generates a `entry = <...>` property with the entry address of the
+ELF. This is only produced for the first entry
+
+fit,data
+Generates a `data = <...>` property with the contents of the segment
+
+fit,loadables
+Generates a `loadable = <...>` property with a list of the generated
+nodes (including all nodes if this operation is used multiple times)
+
+
+Here is an example showing ATF, TEE and a device tree all combined::
+
+fit {
+description = "test-desc";
+#address-cells = <1>;
+fit,fdt-list = "of-list";
+
+images {
+u-boot {
+description = "U-Boot (64-bit)";
+type = "standalone";
+os = "U-Boot";
+arch = "arm64";
+compression = "none";
+load = ;
+u-boot-nodtb {
+};
+};
+@fdt-SEQ {
+description = "fdt-NAME.dtb";
+type = "flat_dt";
+compression = "none";
+};
+@atf-SEQ {
+fit,operation = "split-elf";
+description = "ARM Trusted Firmware";
+type = "firmware";
+arch = "arm64";
+os = "arm-trusted-firmware";
+compression = "none";
+fit,load;
+fit,entry;
+fit,data;
+
+atf-bl31 {
+};
+};
+
+@tee-SEQ {
+fit,operation = "split-elf";
+description = "TEE";
+type = "tee";
+arch = "arm64";
+os = "tee";
+compression = "none";
+fit,load;
+fit,entry;
+fit,data;
+
+op-tee {
+};
+};
+};
+
+configurations {
+default = "@config-DEFAULT-SEQ";
+@config-SEQ {
+description = "conf-NAME.dtb";
+fdt = "fdt-SEQ";
+firmware = "u-boot";
+fit,loadables;
+};
+};
+};
+
+If ATF-BL31 is available, this generates a node for each segment in the
+ELF file, for example::
+
+images {
+atf-1 {
+data = <...contents of first segment...>;
+data-offset = <0x>;
+entry = <0x0004>;
+load = <0x0004>;
+compression = "none";
+os = "arm-trusted-firmware";
+arch = "arm64";
+type = "firmware";
+description = "ARM Trusted Firmware";
+};
+atf-2 {
+data = <...contents of second segment...>;
+load = <0xff3b>;
+compression = "none";
+os = "arm-trusted-firmware";
+arch = 

[PATCH 21/24] rockchip: Include binman script in 64-bit boards

2022-02-08 Thread Simon Glass
Include the rockchip-u-boot.dtsi file with 64-bit boards and enable binman
so that these boards can also use it, rather than using special Makefile
rules and scripts.

This does not change the Makefile nor remove any scripts, but sets it up
so that this is possible.

Signed-off-by: Simon Glass 
---

 arch/arm/dts/px30-u-boot.dtsi  | 2 ++
 arch/arm/dts/rk3308-u-boot.dtsi| 2 ++
 arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi | 2 ++
 arch/arm/dts/rk3328-u-boot.dtsi| 2 ++
 arch/arm/dts/rk3368-u-boot.dtsi| 1 +
 arch/arm/dts/rk3399-u-boot.dtsi| 5 +++--
 arch/arm/dts/rk3568-u-boot.dtsi| 2 ++
 arch/arm/mach-rockchip/Kconfig | 6 ++
 8 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/arch/arm/dts/px30-u-boot.dtsi b/arch/arm/dts/px30-u-boot.dtsi
index f102b2aef4..462eaf68f8 100644
--- a/arch/arm/dts/px30-u-boot.dtsi
+++ b/arch/arm/dts/px30-u-boot.dtsi
@@ -3,6 +3,8 @@
  * (C) Copyright 2019 Rockchip Electronics Co., Ltd
  */
 
+#include "rockchip-u-boot.dtsi"
+
 / {
aliases {
mmc0 = 
diff --git a/arch/arm/dts/rk3308-u-boot.dtsi b/arch/arm/dts/rk3308-u-boot.dtsi
index 4bfad31fba..ab5bfc2ce9 100644
--- a/arch/arm/dts/rk3308-u-boot.dtsi
+++ b/arch/arm/dts/rk3308-u-boot.dtsi
@@ -3,6 +3,8 @@
  *(C) Copyright 2019 Rockchip Electronics Co., Ltd
  */
 
+#include "rockchip-u-boot.dtsi"
+
 / {
aliases {
mmc0 = 
diff --git a/arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi 
b/arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi
index 95f2652494..16c33735eb 100644
--- a/arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi
+++ b/arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi
@@ -3,6 +3,8 @@
  * Copyright (c) 2020 Theobroma Systems Design und Consulting GmbH
  */
 
+#include "rockchip-u-boot.dtsi"
+
 / {
chosen {
u-boot,spl-boot-order = 
diff --git a/arch/arm/dts/rk3328-u-boot.dtsi b/arch/arm/dts/rk3328-u-boot.dtsi
index 1633558264..d4a7540a92 100644
--- a/arch/arm/dts/rk3328-u-boot.dtsi
+++ b/arch/arm/dts/rk3328-u-boot.dtsi
@@ -3,6 +3,8 @@
  * (C) Copyright 2019 Rockchip Electronics Co., Ltd
  */
 
+#include "rockchip-u-boot.dtsi"
+
 / {
aliases {
mmc0 = 
diff --git a/arch/arm/dts/rk3368-u-boot.dtsi b/arch/arm/dts/rk3368-u-boot.dtsi
index 2767c2678d..b37da4e851 100644
--- a/arch/arm/dts/rk3368-u-boot.dtsi
+++ b/arch/arm/dts/rk3368-u-boot.dtsi
@@ -3,6 +3,7 @@
  * Copyright (c) 2020 Theobroma Systems Design und Consulting GmbH
  */
 
+#include "rockchip-u-boot.dtsi"
 #include 
 
 / {
diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-boot.dtsi
index 716b9a433a..fd4150e3f0 100644
--- a/arch/arm/dts/rk3399-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-u-boot.dtsi
@@ -60,8 +60,9 @@
 
 };
 
-#ifdef CONFIG_ROCKCHIP_SPI_IMAGE
  {
+   multiple-images;
+#ifdef CONFIG_ROCKCHIP_SPI_IMAGE
rom {
filename = "u-boot.rom";
size = <0x40>;
@@ -81,8 +82,8 @@
fdtmap {
};
};
-};
 #endif
+};
 
  {
u-boot,dm-pre-reloc;
diff --git a/arch/arm/dts/rk3568-u-boot.dtsi b/arch/arm/dts/rk3568-u-boot.dtsi
index 5a80dda275..fa9b6ae23b 100644
--- a/arch/arm/dts/rk3568-u-boot.dtsi
+++ b/arch/arm/dts/rk3568-u-boot.dtsi
@@ -3,6 +3,8 @@
  * (C) Copyright 2021 Rockchip Electronics Co., Ltd
  */
 
+#include "rockchip-u-boot.dtsi"
+
 / {
aliases {
mmc0 = 
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 92f35309e4..c8df65980f 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -15,6 +15,7 @@ config ROCKCHIP_PX30
select DEBUG_UART_BOARD_INIT
imply ROCKCHIP_COMMON_BOARD
imply SPL_ROCKCHIP_COMMON_BOARD
+   imply BINMAN
help
  The Rockchip PX30 is a ARM-based SoC with a quad-core Cortex-A35
  including NEON and GPU, Mali-400 graphics, several DDR3 options
@@ -146,6 +147,7 @@ config ROCKCHIP_RK3308
imply SPL_SERIAL
imply TPL_SERIAL
imply SPL_SEPARATE_BSS
+   imply BINMAN
help
  The Rockchip RK3308 is a ARM-based Soc which embedded with quad
  Cortex-A35 and highly integrated audio interfaces.
@@ -167,6 +169,7 @@ config ROCKCHIP_RK3328
select ENABLE_ARM_SOC_BOOT0_HOOK
select DEBUG_UART_BOARD_INIT
select SYS_NS16550
+   imply BINMAN
help
  The Rockchip RK3328 is a ARM-based SoC with a quad-core Cortex-A53.
  including NEON and GPU, 1MB L2 cache, Mali-T7 graphics, two
@@ -186,6 +189,7 @@ config ROCKCHIP_RK3368
imply SPL_SERIAL
imply TPL_SERIAL
imply TPL_ROCKCHIP_COMMON_BOARD
+   imply BINMAN
help
  The Rockchip RK3368 is a ARM-based SoC with a octa-core (organised
  into a big and little cluster with 4 cores each) Cortex-A53 including
@@ -244,6 +248,7 @@ config ROCKCHIP_RK3399
imply TPL_ROCKCHIP_COMMON_BOARD
   

[PATCH 19/24] binman: Allow different operations in FIT generator nodes

2022-02-08 Thread Simon Glass
At present we only support expanding out FDT nodes. Make the operation
into an @operation property, so that others can be supported.

Re-arrange and tidy up the documentation so that it has separate
headings for each topic.

Signed-off-by: Simon Glass 
---

 tools/binman/entries.rst   |  85 +++-
 tools/binman/etype/fit.py  | 136 -
 tools/binman/ftest.py  |   7 ++
 tools/binman/test/220_fit_bad_oper.dts |  27 +
 4 files changed, 206 insertions(+), 49 deletions(-)
 create mode 100644 tools/binman/test/220_fit_bad_oper.dts

diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst
index d4a1f333dc..d483169712 100644
--- a/tools/binman/entries.rst
+++ b/tools/binman/entries.rst
@@ -553,6 +553,68 @@ For example, this creates an image containing a FIT with 
U-Boot SPL::
 };
 };
 
+More complex setups can be created, with generated nodes, as described
+below.
+
+Properties (in the 'fit' node itself)
+~
+
+Special properties have a `fit,` prefix, indicating that they should be
+processed but not included in the final FIT.
+
+The top-level 'fit' node supports the following special properties:
+
+fit,external-offset
+Indicates that the contents of the FIT are external and provides the
+external offset. This is passed to mkimage via the -E and -p flags.
+
+fit,fdt-list
+Indicates the entry argument which provides the list of device tree
+files for the gen-fdt-nodes operation (as below). This is often
+`of-list` meaning that `-a of-list="dtb1 dtb2..."` should be passed
+to binman.
+
+Substitutions
+~
+
+Node names and property values support a basic string-substitution feature.
+Available substitutions for '@' nodes (and property values) are:
+
+SEQ:
+Sequence number of the generated fdt (1, 2, ...)
+NAME
+Name of the dtb as provided (i.e. without adding '.dtb')
+
+The `default` property, if present, will be automatically set to the name
+if of configuration whose devicetree matches the `default-dt` entry
+argument, e.g. with `-a default-dt=sun50i-a64-pine64-lts`.
+
+Available substitutions for property values in these nodes are:
+
+DEFAULT-SEQ:
+Sequence number of the default fdt, as provided by the 'default-dt'
+entry argument
+
+Available operations
+
+
+You can add an operation to an '@' node to indicate which operation is
+required::
+
+@fdt-SEQ {
+fit,operation = "gen-fdt-nodes";
+...
+};
+
+Available operations are:
+
+gen-fdt-nodes
+Generate FDT nodes as above. This is the default if there is no
+`fit,operation` property.
+
+Generating nodes from an FDT list (gen-fdt-nodes)
+~
+
 U-Boot supports creating fdt and config nodes automatically. To do this,
 pass an `of-list` property (e.g. `-a of-list=file1 file2`). This tells
 binman that you want to generates nodes for two files: `file1.dtb` and
@@ -590,32 +652,9 @@ You can create config nodes in a similar way::
 This tells binman to create nodes `config-1` and `config-2`, i.e. a config
 for each of your two files.
 
-Available substitutions for '@' nodes are:
-
-SEQ:
-Sequence number of the generated fdt (1, 2, ...)
-NAME
-Name of the dtb as provided (i.e. without adding '.dtb')
-
 Note that if no devicetree files are provided (with '-a of-list' as above)
 then no nodes will be generated.
 
-The 'default' property, if present, will be automatically set to the name
-if of configuration whose devicetree matches the 'default-dt' entry
-argument, e.g. with '-a default-dt=sun50i-a64-pine64-lts'.
-
-Available substitutions for '@' property values are
-
-DEFAULT-SEQ:
-Sequence number of the default fdt,as provided by the 'default-dt' entry
-argument
-
-Properties (in the 'fit' node itself):
-fit,external-offset: Indicates that the contents of the FIT are external
-and provides the external offset. This is passsed to mkimage via
-the -E and -p flags.
-
-
 
 
 Entry: fmap: An entry which contains an Fmap section
diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py
index bf84246904..6210deeef7 100644
--- a/tools/binman/etype/fit.py
+++ b/tools/binman/etype/fit.py
@@ -13,6 +13,12 @@ from dtoc import fdt_util
 from dtoc.fdt import Fdt
 from patman import tools
 
+# Supported operations, with the fit,operation property
+OP_GEN_FDT_NODES = range(1)
+OPERATIONS = {
+'gen-fdt-nodes': OP_GEN_FDT_NODES,
+}
+
 class Entry_fit(Entry):
 """Flat Image Tree (FIT)
 
@@ -46,6 +52,68 @@ class Entry_fit(Entry):
 };
 };
 
+More complex setups can be created, with generated nodes, as described
+below.
+
+Properties (in the 'fit' node itself)
+~
+
+Special properties have a `fit,` prefix, indicating that they should be
+processed but not 

[PATCH 18/24] binman: Tidy up the docs a little with fit

2022-02-08 Thread Simon Glass
Add a few quotes and clarify the data property.

Signed-off-by: Simon Glass 
---

 tools/binman/entries.rst  | 15 ---
 tools/binman/etype/fit.py | 15 ---
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst
index b32dc58933..d4a1f333dc 100644
--- a/tools/binman/entries.rst
+++ b/tools/binman/entries.rst
@@ -554,10 +554,10 @@ For example, this creates an image containing a FIT with 
U-Boot SPL::
 };
 
 U-Boot supports creating fdt and config nodes automatically. To do this,
-pass an of-list property (e.g. -a of-list=file1 file2). This tells binman
-that you want to generates nodes for two files: file1.dtb and file2.dtb
-The fit,fdt-list property (see above) indicates that of-list should be used.
-If the property is missing you will get an error.
+pass an `of-list` property (e.g. `-a of-list=file1 file2`). This tells
+binman that you want to generates nodes for two files: `file1.dtb` and
+`file2.dtb`. The `fit,fdt-list` property (see above) indicates that
+`of-list` should be used. If the property is missing you will get an error.
 
 Then add a 'generator node', a node with a name starting with '@'::
 
@@ -569,10 +569,11 @@ Then add a 'generator node', a node with a name starting 
with '@'::
 };
 };
 
-This tells binman to create nodes fdt-1 and fdt-2 for each of your two
+This tells binman to create nodes `fdt-1` and `fdt-2` for each of your two
 files. All the properties you specify will be included in the node. This
 node acts like a template to generate the nodes. The generator node itself
 does not appear in the output - it is replaced with what binman generates.
+A 'data' property is created with the contents of the FDT file.
 
 You can create config nodes in a similar way::
 
@@ -586,8 +587,8 @@ You can create config nodes in a similar way::
 };
 };
 
-This tells binman to create nodes config-1 and config-2, i.e. a config for
-each of your two files.
+This tells binman to create nodes `config-1` and `config-2`, i.e. a config
+for each of your two files.
 
 Available substitutions for '@' nodes are:
 
diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py
index b159844960..bf84246904 100644
--- a/tools/binman/etype/fit.py
+++ b/tools/binman/etype/fit.py
@@ -47,10 +47,10 @@ class Entry_fit(Entry):
 };
 
 U-Boot supports creating fdt and config nodes automatically. To do this,
-pass an of-list property (e.g. -a of-list=file1 file2). This tells binman
-that you want to generates nodes for two files: file1.dtb and file2.dtb
-The fit,fdt-list property (see above) indicates that of-list should be 
used.
-If the property is missing you will get an error.
+pass an `of-list` property (e.g. `-a of-list=file1 file2`). This tells
+binman that you want to generates nodes for two files: `file1.dtb` and
+`file2.dtb`. The `fit,fdt-list` property (see above) indicates that
+`of-list` should be used. If the property is missing you will get an error.
 
 Then add a 'generator node', a node with a name starting with '@'::
 
@@ -62,10 +62,11 @@ class Entry_fit(Entry):
 };
 };
 
-This tells binman to create nodes fdt-1 and fdt-2 for each of your two
+This tells binman to create nodes `fdt-1` and `fdt-2` for each of your two
 files. All the properties you specify will be included in the node. This
 node acts like a template to generate the nodes. The generator node itself
 does not appear in the output - it is replaced with what binman generates.
+A 'data' property is created with the contents of the FDT file.
 
 You can create config nodes in a similar way::
 
@@ -79,8 +80,8 @@ class Entry_fit(Entry):
 };
 };
 
-This tells binman to create nodes config-1 and config-2, i.e. a config for
-each of your two files.
+This tells binman to create nodes `config-1` and `config-2`, i.e. a config
+for each of your two files.
 
 Available substitutions for '@' nodes are:
 
-- 
2.35.0.263.gb82422642f-goog



[PATCH 16/24] binman: Move entry-data collection into a Entry method

2022-02-08 Thread Simon Glass
Collecting the data from a list of entries and putting it in a file is
a useful operation that will be needed by other entry types. Put this into
a method in the Entry class.

Add some documentation about how to collect data for an entry type.

Signed-off-by: Simon Glass 
---

 tools/binman/binman.rst   | 86 +++
 tools/binman/entry.py | 28 
 tools/binman/etype/mkimage.py | 14 ++
 3 files changed, 118 insertions(+), 10 deletions(-)

diff --git a/tools/binman/binman.rst b/tools/binman/binman.rst
index d6b95de1f5..771645380e 100644
--- a/tools/binman/binman.rst
+++ b/tools/binman/binman.rst
@@ -1358,6 +1358,92 @@ development, since dealing with exceptions and problems 
in threads is more
 difficult. This avoids any use of ThreadPoolExecutor.
 
 
+Collecting data for an entry type
+-
+
+Some entry types deal with data obtained from others. For example,
+`Entry_mkimage` calls the `mkimage` tool with data from its subnodes::
+
+mkimage {
+args = "-n test -T script";
+
+u-boot-spl {
+};
+
+u-boot {
+};
+};
+
+This shows mkimage being passed a file consisting of SPL and U-Boot proper. It
+is create by calling `Entry.collect_contents_to_file()`. Note that in this 
case,
+the data is passed to mkimage for processing but does not appear separately in
+the image. It may not appear at all, depending on what mkimage does. The
+contents of the `mkimage` entry are entirely dependent on the processing done
+by the entry, with the provided subnodes (`u-boot-spl` and `u-boot`) simply
+providing the input data for that processing.
+
+Note that `Entry.collect_contents_to_file()` simply concatenates the data from
+the different entries together, with no control over alignment, etc. Another
+approach is to subclass `Entry_section` so that those features become 
available,
+such as `size` and `pad-byte`. Then the contents of the entry can be obtained 
by
+calling `BuildSectionData()`.
+
+There are other ways to obtain data also, depending on the situation. If the
+entry type is simply signing data which exists elsewhere in the image, then
+you can use `Entry_collection`  as a base class. It lets you use a property
+called `content` which lists the entries containing data to be processed. This
+is used by `Entry_vblock`, for example::
+
+u_boot: u-boot {
+};
+vblock {
+content = <_boot >;
+keyblock = "firmware.keyblock";
+signprivate = "firmware_data_key.vbprivk";
+version = <1>;
+kernelkey = "kernel_subkey.vbpubk";
+preamble-flags = <1>;
+};
+
+dtb: u-boot-dtb {
+};
+
+which shows an image containing `u-boot` and `u-boot-dtb`, with the `vblock`
+image collecting their contents to produce input for its signing process,
+without affecting those entries, which still appear in the final image
+untouched.
+
+Another example is where an entry type needs several independent pieces of 
input
+to function. For example, `Entry_fip` allows a number of different binary blobs
+to be placed in their own individual places in a custom data structure in the
+output image. To make that work you can add subnodes for each of them and call
+`Entry.Create()` on each subnode, as `Entry_fip` does. Then the data for each
+blob can come from any suitable place, such as an `Entry_u_boot` or an
+`Entry_blob` or anything else::
+
+atf-fip {
+fip-hdr-flags = /bits/ 64 <0x123>;
+soc-fw {
+fip-flags = /bits/ 64 <0x123456789abcdef>;
+filename = "bl31.bin";
+};
+
+u-boot {
+fip-uuid = [fc 65 13 92 4a 5b 11 ec
+94 35 ff 2d 1c fc 79 9c];
+};
+};
+
+The `soc-fw` node is a `blob-ext` (i.e. it reads in a named binary file) 
whereas
+`u-boot` is a normal entry type. This works because `Entry_fip` selects the
+`blob-ext` entry type if the node name (here `soc-fw`) is recognised as being
+a known blob type.
+
+When adding new entry types you are encouraged to use subnodes to provide the
+data for processing, unless the `content` approach is more suitable. Ad-hoc
+properties and other methods of obtaining data are discouraged, since it adds 
to
+confusion for users.
+
 History / Credits
 -
 
diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index 08770ec5f0..3eafa078ae 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -1108,3 +1108,31 @@ features to produce new behaviours.
 btool = bintool.Bintool.create(name)
 tools[name] = btool
 return btool
+
+def collect_contents_to_file(self, entries, prefix):
+"""Put the contents of a list of entries into a file
+
+Args:
+entries (list of Entry): Entries to collect
+prefix (str): Filename prefix of file to write to
+
+If any entry does not have contents yet, this function returns False
+for the 

[PATCH 17/24] binman: fit: Refactor to reduce function size

2022-02-08 Thread Simon Glass
Split subnode and property processing into separate functions to make
the _AddNode() function a little smaller. Tweak a few comments.

This does not change any functionality.

Signed-off-by: Simon Glass 
---

 tools/binman/etype/fit.py | 116 --
 1 file changed, 73 insertions(+), 43 deletions(-)

diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py
index 6ad4a686df..b159844960 100644
--- a/tools/binman/etype/fit.py
+++ b/tools/binman/etype/fit.py
@@ -141,12 +141,82 @@ class Entry_fit(Entry):
 super().ReadNode()
 
 def ReadEntries(self):
+def _process_prop(pname, prop):
+"""Process special properties
+
+Handles properties with generated values. At present the only
+supported property is 'default', i.e. the default device tree in
+the configurations node.
+
+Args:
+pname (str): Name of property
+prop (Prop): Property to process
+"""
+if pname == 'default':
+val = prop.value
+# Handle the 'default' property
+if val.startswith('@'):
+if not self._fdts:
+return
+if not self._fit_default_dt:
+self.Raise("Generated 'default' node requires 
default-dt entry argument")
+if self._fit_default_dt not in self._fdts:
+self.Raise("default-dt entry argument '%s' not found 
in fdt list: %s" %
+   (self._fit_default_dt,
+', '.join(self._fdts)))
+seq = self._fdts.index(self._fit_default_dt)
+val = val[1:].replace('DEFAULT-SEQ', str(seq + 1))
+fsw.property_string(pname, val)
+return
+fsw.property(pname, prop.bytes)
+
+def _generate_node(subnode, depth, in_images):
+"""Generate nodes from a template
+
+This creates one node for each member of self._fdts using the
+provided template. If a property value contains 'NAME' it is
+replaced with the filename of the FDT. If a property value contains
+SEQ it is replaced with the node sequence number, where 1 is the
+first.
+
+Args:
+subnode (None): Generator node to process
+depth: Current node depth (0 is the base 'fit' node)
+in_images: True if this is inside the 'images' node, so that
+'data' properties should be generated
+"""
+if self._fdts:
+# Generate nodes for each FDT
+for seq, fdt_fname in enumerate(self._fdts):
+node_name = subnode.name[1:].replace('SEQ',
+ str(seq + 1))
+fname = tools.GetInputFilename(fdt_fname + '.dtb')
+with fsw.add_node(node_name):
+for pname, prop in subnode.props.items():
+val = prop.bytes.replace(
+b'NAME', tools.ToBytes(fdt_fname))
+val = val.replace(
+b'SEQ', tools.ToBytes(str(seq + 1)))
+fsw.property(pname, val)
+
+# Add data for 'images' nodes (but not 'config')
+if depth == 1 and in_images:
+fsw.property('data',
+ tools.ReadFile(fname))
+else:
+if self._fdts is None:
+if self._fit_list_prop:
+self.Raise("Generator node requires '%s' entry 
argument" %
+   self._fit_list_prop.value)
+else:
+self.Raise("Generator node requires 'fit,fdt-list' 
property")
+
 def _AddNode(base_node, depth, node):
 """Add a node to the FIT
 
 Args:
 base_node: Base Node of the FIT (with 'description' property)
-depth: Current node depth (0 is the base node)
+depth: Current node depth (0 is the base 'fit' node)
 node: Current node to process
 
 There are two cases to deal with:
@@ -156,23 +226,7 @@ class Entry_fit(Entry):
 """
 for pname, prop in node.props.items():
 if not pname.startswith('fit,'):
-if pname == 'default':
-val = prop.value
-# Handle the 'default' property
-if val.startswith('@'):
-if not self._fdts:
-continue
-if not self._fit_default_dt:
-   

[PATCH 15/24] binman: Add a ELF test file with disjoint text sections

2022-02-08 Thread Simon Glass
Add a file that has two text sections at different addresses, so we can
test this behaviour in binman, once added.

Signed-off-by: Simon Glass 
---

 tools/binman/test/Makefile |  6 +-
 tools/binman/test/elf_sections.c   | 20 +++
 tools/binman/test/elf_sections.lds | 31 ++
 3 files changed, 56 insertions(+), 1 deletion(-)
 create mode 100644 tools/binman/test/elf_sections.c
 create mode 100644 tools/binman/test/elf_sections.lds

diff --git a/tools/binman/test/Makefile b/tools/binman/test/Makefile
index 387ba16335..57057e2d58 100644
--- a/tools/binman/test/Makefile
+++ b/tools/binman/test/Makefile
@@ -29,11 +29,12 @@ LDS_BINMAN := -T $(SRC)u_boot_binman_syms.lds
 LDS_BINMAN_BAD := -T $(SRC)u_boot_binman_syms_bad.lds
 LDS_BINMAN_X86 := -T $(SRC)u_boot_binman_syms_x86.lds
 LDS_BINMAN_EMBED := -T $(SRC)u_boot_binman_embed.lds
+LDS_EFL_SECTIONS := -T $(SRC)elf_sections.lds
 
 TARGETS = u_boot_ucode_ptr u_boot_no_ucode_ptr bss_data \
u_boot_binman_syms u_boot_binman_syms.bin u_boot_binman_syms_bad \
u_boot_binman_syms_size u_boot_binman_syms_x86 embed_data \
-   u_boot_binman_embed u_boot_binman_embed_sm
+   u_boot_binman_embed u_boot_binman_embed_sm elf_sections
 
 all: $(TARGETS)
 
@@ -70,6 +71,9 @@ u_boot_binman_embed: u_boot_binman_embed.c
 u_boot_binman_embed_sm: CFLAGS += $(LDS_BINMAN_EMBED)
 u_boot_binman_embed_sm: u_boot_binman_embed_sm.c
 
+elf_sections: CFLAGS += $(LDS_EFL_SECTIONS)
+elf_sections: elf_sections.c
+
 clean:
rm -f $(TARGETS)
 
diff --git a/tools/binman/test/elf_sections.c b/tools/binman/test/elf_sections.c
new file mode 100644
index 00..9bcce9af02
--- /dev/null
+++ b/tools/binman/test/elf_sections.c
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Program containing two text sections
+ */
+
+int __attribute__((section(".sram_data"))) data[29];
+
+int __attribute__((section(".sram_code"))) calculate(int x)
+{
+   data[0] = x;
+
+   return x * x;
+}
+
+int main(void)
+{
+   return calculate(123);
+}
diff --git a/tools/binman/test/elf_sections.lds 
b/tools/binman/test/elf_sections.lds
new file mode 100644
index 00..7b6e932592
--- /dev/null
+++ b/tools/binman/test/elf_sections.lds
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (c) 2016 Google, Inc
+ */
+
+OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
+OUTPUT_ARCH(i386)
+ENTRY(_start)
+
+SECTIONS
+{
+   . = 0x0010;
+   _start = .;
+
+   . = ALIGN(4);
+   .text :
+   {
+   *(.text*)
+   }
+
+   . = 0x1000;
+   .sram :
+   {
+   *(.sram*)
+   }
+
+   /DISCARD/ : {
+   *(.comment)
+   *(.dyn*)
+   }
+}
-- 
2.35.0.263.gb82422642f-goog



[PATCH 12/24] WIP: binman: Add support for OP-TEE

2022-02-08 Thread Simon Glass
Add support for an Open Portable Trusted Execution Environment (OP-TEE)
blob which is used with ARM Trusted Firmware.

Note: This is a placeholder patch as Roger Quadros has already posted
one:

https://patchwork.ozlabs.org/project/uboot/patch/20220204130031.24610-1-rog...@kernel.org/

Signed-off-by: Simon Glass 
---

 Makefile   |  1 +
 tools/binman/entries.rst   | 13 +
 tools/binman/etype/op_tee.py   | 23 +++
 tools/binman/missing-blob-help |  4 
 4 files changed, 41 insertions(+)
 create mode 100644 tools/binman/etype/op_tee.py

diff --git a/Makefile b/Makefile
index a69cc088a7..ee1dc11e2f 100644
--- a/Makefile
+++ b/Makefile
@@ -1326,6 +1326,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if 
$(BINMAN_DEBUG),-D) \
-I arch/$(ARCH)/dts -a of-list=$(CONFIG_OF_LIST) \
$(foreach f,$(BINMAN_INDIRS),-I $(f)) \
-a atf-bl31-path=${BL31} \
+   -a op-tee-path=${TEE} \
-a opensbi-path=${OPENSBI} \
-a default-dt=$(default_dt) \
-a scp-path=$(SCP) \
diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst
index c47f7df098..0fb6d56296 100644
--- a/tools/binman/entries.rst
+++ b/tools/binman/entries.rst
@@ -933,6 +933,19 @@ binman.
 
 
 
+Entry: op-tee: Open Portable Trusted Execution Environment (OP-TEE) blob
+
+
+Properties / Entry arguments:
+- op-tee-path: Filename of file to read into entry. This is typically
+called tee.elf
+
+This entry holds the OP-TEE Elf file, typically started by U-Boot SPL.
+See the U-Boot README for your architecture or board for how to use it. See
+https://https://www.op-tee.org/ for more information about OP-TEE.
+
+
+
 Entry: opensbi: RISC-V OpenSBI fw_dynamic blob
 --
 
diff --git a/tools/binman/etype/op_tee.py b/tools/binman/etype/op_tee.py
new file mode 100644
index 00..b34f561622
--- /dev/null
+++ b/tools/binman/etype/op_tee.py
@@ -0,0 +1,23 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright 2022 Google LLC
+# Written by Simon Glass 
+#
+# Entry-type module for Open Portable Trusted Execution Environment (OP-TEE)
+#
+
+from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg
+
+class Entry_op_tee(Entry_blob_named_by_arg):
+"""Open Portable Trusted Execution Environment (OP-TEE) blob
+
+Properties / Entry arguments:
+- op-tee-path: Filename of file to read into entry. This is typically
+called tee.elf
+
+This entry holds the OP-TEE Elf file, typically started by U-Boot SPL.
+See the U-Boot README for your architecture or board for how to use it. See
+https://https://www.op-tee.org/ for more information about OP-TEE.
+"""
+def __init__(self, section, etype, node):
+super().__init__(section, etype, node, 'op-tee')
+self.external = True
diff --git a/tools/binman/missing-blob-help b/tools/binman/missing-blob-help
index 551ca87f6c..c8e6b84882 100644
--- a/tools/binman/missing-blob-help
+++ b/tools/binman/missing-blob-help
@@ -33,3 +33,7 @@ k3-rti-wdt-firmware:
 If CONFIG_WDT_K3_RTI_LOAD_FW is enabled, a firmware image is needed for
 the R5F core(s) to trigger the system reset. One possible source is
 https://github.com/siemens/k3-rti-wdt.
+
+op-tee:
+See the documentation for your board. You may need to build Open Portable
+Trusted Execution Environment (OP-TEE) with TEE=/path/to/tee.elf
-- 
2.35.0.263.gb82422642f-goog



[PATCH 14/24] binman: Support a list of strings with the mkimage etype

2022-02-08 Thread Simon Glass
At present the 'args' property of the mkimage entry type is a string. This
makes it difficult to include CONFIG options in that property. In
particular, this does not work:

   args = "-n CONFIG_SYS_SOC -E"

since the preprocessor does not operate within strings, nor does this:

   args = "-n" CONFIG_SYS_SOC" "-E"

since the device tree compiler does not understand string concatenation.

With this new feature, we can do:

   args = "-n", CONFIG_SYS_SOC, "-E";

Signed-off-by: Simon Glass 
---

 tools/binman/entries.rst  | 11 +++
 tools/binman/etype/mkimage.py | 13 -
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst
index 0fb6d56296..b32dc58933 100644
--- a/tools/binman/entries.rst
+++ b/tools/binman/entries.rst
@@ -931,6 +931,17 @@ This calls mkimage to create an imximage with 
u-boot-spl.bin as the input
 file. The output from mkimage then becomes part of the image produced by
 binman.
 
+To use CONFIG options in the arguments, use a string list instead, as in
+this example which also produces four arguments::
+
+mkimage {
+args = "-n", CONFIG_SYS_SOC, "-T imximage";
+
+u-boot-spl {
+};
+};
+
+
 
 
 Entry: op-tee: Open Portable Trusted Execution Environment (OP-TEE) blob
diff --git a/tools/binman/etype/mkimage.py b/tools/binman/etype/mkimage.py
index 201ee4b569..9ecd1c2548 100644
--- a/tools/binman/etype/mkimage.py
+++ b/tools/binman/etype/mkimage.py
@@ -31,10 +31,21 @@ class Entry_mkimage(Entry):
 This calls mkimage to create an imximage with u-boot-spl.bin as the input
 file. The output from mkimage then becomes part of the image produced by
 binman.
+
+To use CONFIG options in the arguments, use a string list instead, as in
+this example which also produces four arguments::
+
+mkimage {
+args = "-n", CONFIG_SYS_SOC, "-T imximage";
+
+u-boot-spl {
+};
+};
+
 """
 def __init__(self, section, etype, node):
 super().__init__(section, etype, node)
-self._args = fdt_util.GetString(self._node, 'args').split(' ')
+self._args = fdt_util.GetArgs(self._node, 'args')
 self._mkimage_entries = OrderedDict()
 self.align_default = None
 self.ReadEntries()
-- 
2.35.0.263.gb82422642f-goog



[PATCH 13/24] binman: Add to the TODO

2022-02-08 Thread Simon Glass
Add some ideas that have come to mind recently.

Signed-off-by: Simon Glass 
---

 tools/binman/binman.rst | 8 
 1 file changed, 8 insertions(+)

diff --git a/tools/binman/binman.rst b/tools/binman/binman.rst
index 9e39e678a3..d6b95de1f5 100644
--- a/tools/binman/binman.rst
+++ b/tools/binman/binman.rst
@@ -1402,6 +1402,14 @@ Some ideas:
 - Detect invalid properties in nodes
 - Sort the fdtmap by offset
 - Output temporary files to a different directory
+- Rationalise the fdt, fdt_util and pylibfdt modules which currently have some
+  overlapping and confusing functionality
+- Update the fdt library to use a better format for Prop.value (the current one
+  is useful for dtoc but not much else)
+- Figure out how to make Fdt support changing the node order, so that
+  Node.AddSubnode() can support adding a node before another, existing node.
+  Perhaps it should completely regenerate the flat tree?
+
 
 --
 Simon Glass 
-- 
2.35.0.263.gb82422642f-goog



[PATCH 11/24] elf: Add a way to read segment information from an ELF file

2022-02-08 Thread Simon Glass
Add a function which reads the segments and the entry address.

Also fix a comment nit in the tests while we are here.

Signed-off-by: Simon Glass 
---

 tools/binman/elf.py  | 37 +
 tools/binman/elf_test.py | 31 +--
 2 files changed, 66 insertions(+), 2 deletions(-)

diff --git a/tools/binman/elf.py b/tools/binman/elf.py
index de2bb4651f..2b83ac1876 100644
--- a/tools/binman/elf.py
+++ b/tools/binman/elf.py
@@ -20,6 +20,7 @@ from patman import tout
 ELF_TOOLS = True
 try:
 from elftools.elf.elffile import ELFFile
+from elftools.elf.elffile import ELFError
 from elftools.elf.sections import SymbolTableSection
 except:  # pragma: no cover
 ELF_TOOLS = False
@@ -369,3 +370,39 @@ def UpdateFile(infile, outfile, start_sym, end_sym, 
insert):
 newdata += data[syms[end_sym].offset:]
 tools.WriteFile(outfile, newdata)
 tout.Info('Written to offset %#x' % syms[start_sym].offset)
+
+def read_segments(data):
+"""Read segments from an ELF file
+
+Args:
+data (bytes): Contents of file
+
+Returns:
+tuple:
+list of segments, each:
+int: Segment number (0 = first)
+int: Start address of segment in memory
+bytes: Contents of segment
+int: entry address for image
+
+Raises:
+ValueError: elftools is not available
+"""
+if not ELF_TOOLS:
+raise ValueError('Python elftools package is not available')
+with io.BytesIO(data) as inf:
+try:
+elf = ELFFile(inf)
+except ELFError as err:
+raise ValueError(err)
+entry = elf.header['e_entry']
+segments = []
+for i in range(elf.num_segments()):
+segment = elf.get_segment(i)
+if segment['p_type'] != 'PT_LOAD' or not segment['p_memsz']:
+skipped = 1  # To make code-coverage see this line
+continue
+start = segment['p_offset']
+rend = start + segment['p_filesz']
+segments.append((i, segment['p_paddr'], data[start:rend]))
+return segments, entry
diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py
index f727258487..369260c17a 100644
--- a/tools/binman/elf_test.py
+++ b/tools/binman/elf_test.py
@@ -56,8 +56,8 @@ class FakeSection:
 def BuildElfTestFiles(target_dir):
 """Build ELF files used for testing in binman
 
-This compiles and links the test files into the specified directory. It the
-Makefile and source files in the binman test/ directory.
+This compiles and links the test files into the specified directory. It 
uses
+the Makefile and source files in the binman test/ directory.
 
 Args:
 target_dir: Directory to put the files into
@@ -258,6 +258,33 @@ class TestElf(unittest.TestCase):
 offset = elf.GetSymbolFileOffset(fname, ['missing_sym'])
 self.assertEqual({}, offset)
 
+def test_read_segments(self):
+"""Test for read_segments()"""
+if not elf.ELF_TOOLS:
+self.skipTest('Python elftools not available')
+fname = self.ElfTestFile('embed_data')
+segments, entry = elf.read_segments(tools.ReadFile(fname))
+
+def test_read_segments_fail(self):
+"""Test for read_segments() without elftools"""
+try:
+old_val = elf.ELF_TOOLS
+elf.ELF_TOOLS = False
+fname = self.ElfTestFile('embed_data')
+with self.assertRaises(ValueError) as e:
+elf.read_segments(tools.ReadFile(fname))
+self.assertIn('Python elftools package is not available',
+  str(e.exception))
+finally:
+elf.ELF_TOOLS = old_val
+
+def test_read_segments_bad_data(self):
+"""Test for read_segments() with an invalid ELF file"""
+fname = self.ElfTestFile('embed_data')
+with self.assertRaises(ValueError) as e:
+elf.read_segments(tools.GetBytes(100, 100))
+self.assertIn('Magic number does not match', str(e.exception))
+
 
 if __name__ == '__main__':
 unittest.main()
-- 
2.35.0.263.gb82422642f-goog



[PATCH 10/24] binman: Update docs to indicate mkimage is supported

2022-02-08 Thread Simon Glass
Now that there is a mkimage entry-type, update the docs to remove the
future reference.

Signed-off-by: Simon Glass 
---

 tools/binman/binman.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/binman/binman.rst b/tools/binman/binman.rst
index ab5a5e06b1..9e39e678a3 100644
--- a/tools/binman/binman.rst
+++ b/tools/binman/binman.rst
@@ -163,8 +163,8 @@ Consider sunxi. It has the following steps:
 
 Binman is intended to replace the last step. The U-Boot build system builds
 u-boot.bin and sunxi-spl.bin. Binman can then take over creation of
-sunxi-spl.bin (by calling mksunxiboot, or hopefully one day mkimage). In any
-case, it would then create the image from the component parts.
+sunxi-spl.bin by calling mksunxiboot or mkimage. In any case, it would then
+create the image from the component parts.
 
 This simplifies the U-Boot Makefile somewhat, since various pieces of logic
 can be replaced by a call to binman.
-- 
2.35.0.263.gb82422642f-goog



[PATCH 06/24] dtoc: Support adding a string list to a device tree

2022-02-08 Thread Simon Glass
Add a new function to add a string list.

Signed-off-by: Simon Glass 
---

 tools/dtoc/fdt.py  | 18 ++
 tools/dtoc/test_fdt.py |  8 
 2 files changed, 26 insertions(+)

diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index 32a7aa9829..e7197f8f12 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -501,6 +501,24 @@ class Node:
 val = bytes(val, 'utf-8')
 return self.AddData(prop_name, val + b'\0')
 
+def AddStringList(self, prop_name, val):
+"""Add a new string-list property to a node
+
+The device tree is marked dirty so that the value will be written to
+the blob on the next sync.
+
+Args:
+prop_name: Name of property to add
+val (list of str): List of strings to add
+
+Returns:
+Prop added
+"""
+out = b''
+for string in val:
+out += bytes(string, 'utf-8') + b'\0'
+return self.AddData(prop_name, out)
+
 def AddInt(self, prop_name, val):
 """Add a new integer property to a node
 
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index 55b70e9876..1a7e73ffce 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -531,6 +531,14 @@ class TestProp(unittest.TestCase):
 self.node.AddData('data', tools.GetBytes(65, 2))
 self.dtb.Sync(auto_resize=True)
 
+def test_string_list(self):
+"""Test adding string-list property to a node"""
+val = ['123', '456']
+self.node.AddStringList('stringlist', val)
+self.dtb.Sync(auto_resize=True)
+data = self.fdt.getprop(self.node.Offset(), 'stringlist')
+self.assertEqual(b'123\x00456\0', data)
+
 def testFromData(self):
 dtb2 = fdt.Fdt.FromData(self.dtb.GetContents())
 self.assertEqual(dtb2.GetContents(), self.dtb.GetContents())
-- 
2.35.0.263.gb82422642f-goog



[PATCH 09/24] dtoc: Support reading a list of arguments

2022-02-08 Thread Simon Glass
It is helpful to support a string or stringlist containing a list of
space-separated arguments, for example:

   args = "-n fred", "-a", "123";

This resolves to the list:

   -n fred -a 123

which can be passed to a program as arguments.

Add a helper to do the required processing.

Signed-off-by: Simon Glass 
---

 tools/dtoc/fdt_util.py   | 12 
 tools/dtoc/test/dtoc_test_simple.dts |  1 +
 tools/dtoc/test_fdt.py   | 15 +++
 3 files changed, 28 insertions(+)

diff --git a/tools/dtoc/fdt_util.py b/tools/dtoc/fdt_util.py
index 19eb13aef3..59e065884f 100644
--- a/tools/dtoc/fdt_util.py
+++ b/tools/dtoc/fdt_util.py
@@ -184,6 +184,18 @@ def GetStringList(node, propname, default=None):
 return [strval]
 return value
 
+def GetArgs(node, propname):
+prop = node.props.get(propname)
+if not prop:
+raise ValueError(f"Node '{node.path}': Expected property '{propname}'")
+if prop.bytes:
+value = GetStringList(node, propname)
+else:
+value = []
+lists = [v.split() for v in value]
+args = [x for l in lists for x in l]
+return args
+
 def GetBool(node, propname, default=False):
 """Get an boolean from a property
 
diff --git a/tools/dtoc/test/dtoc_test_simple.dts 
b/tools/dtoc/test/dtoc_test_simple.dts
index 4c2c70af22..2d321fb034 100644
--- a/tools/dtoc/test/dtoc_test_simple.dts
+++ b/tools/dtoc/test/dtoc_test_simple.dts
@@ -62,5 +62,6 @@
 
orig-node {
orig = <1 23 4>;
+   args = "-n first", "second", "-p", "123,456", "-x";
};
 };
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index c8fe5fc1de..5d46e69b8b 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -652,6 +652,21 @@ class TestFdtUtil(unittest.TestCase):
 self.assertEqual(['test'],
  fdt_util.GetStringList(self.node, 'missing', 
['test']))
 
+def testGetArgs(self):
+node = self.dtb.GetNode('/orig-node')
+self.assertEqual(['message'], fdt_util.GetArgs(self.node, 'stringval'))
+self.assertEqual(
+['multi-word', 'message'],
+fdt_util.GetArgs(self.node, 'stringarray'))
+self.assertEqual([], fdt_util.GetArgs(self.node, 'boolval'))
+self.assertEqual(['-n', 'first', 'second', '-p', '123,456', '-x'],
+ fdt_util.GetArgs(node, 'args'))
+with self.assertRaises(ValueError) as exc:
+fdt_util.GetArgs(self.node, 'missing')
+self.assertIn(
+"Node '/spl-test': Expected property 'missing'",
+str(exc.exception))
+
 def testGetBool(self):
 self.assertEqual(True, fdt_util.GetBool(self.node, 'boolval'))
 self.assertEqual(False, fdt_util.GetBool(self.node, 'missing'))
-- 
2.35.0.263.gb82422642f-goog



[PATCH 08/24] dtoc: Allow deleting nodes and adding them in the same sync

2022-02-08 Thread Simon Glass
This does not work at present, since the current algorithm assumes that
either there are no nodes or all nodes have an offset. If a node is new,
but an old node is still in the tree, then syncing fails due to this
assumption.

Fix it and add a test.

Signed-off-by: Simon Glass 
---

 tools/dtoc/fdt.py  |  2 ++
 tools/dtoc/test_fdt.py | 11 +++
 2 files changed, 13 insertions(+)

diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index 8108a86c09..98d6e636ea 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -356,6 +356,8 @@ class Node:
 
 offset = fdt_obj.first_subnode(self._offset, QUIET_NOTFOUND)
 for subnode in self.subnodes:
+if subnode._offset is None:
+continue
 if subnode.name != fdt_obj.get_name(offset):
 raise ValueError('Internal error, node name mismatch %s != %s' 
%
  (subnode.name, fdt_obj.get_name(offset)))
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index 22e23c40f5..c8fe5fc1de 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -272,6 +272,17 @@ class TestNode(unittest.TestCase):
 
 self.dtb.Sync(auto_resize=True)
 
+def testAddOneNode(self):
+"""Testing deleting and adding a subnode before syncing"""
+subnode = self.node.AddSubnode('subnode')
+self.node.AddSubnode('subnode2')
+self.dtb.Sync(auto_resize=True)
+
+# Delete a node and add a new one
+subnode.Delete()
+self.node.AddSubnode('subnode3')
+self.dtb.Sync()
+
 def testRefreshNameMismatch(self):
 """Test name mismatch when syncing nodes and properties"""
 prop = self.node.AddInt('integer-a', 12)
-- 
2.35.0.263.gb82422642f-goog



[PATCH 07/24] dtoc: Support deleting a node

2022-02-08 Thread Simon Glass
Add a function to delete a node. This is synced to the tree when
requested.

Signed-off-by: Simon Glass 
---

 tools/dtoc/fdt.py  | 17 +
 tools/dtoc/test_fdt.py |  9 +
 2 files changed, 26 insertions(+)

diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index e7197f8f12..8108a86c09 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -548,6 +548,23 @@ class Node:
 self.subnodes.append(subnode)
 return subnode
 
+def Delete(self):
+"""Delete a node
+
+The node is deleted and the offset cache is invalidated.
+
+Args:
+node (Node): Node to delete
+
+Raises:
+ValueError if the node does not exist
+"""
+CheckErr(self._fdt._fdt_obj.del_node(self.Offset()),
+ "Node '%s': delete" % self.path)
+parent = self.parent
+self._fdt.Invalidate()
+parent.subnodes.remove(self)
+
 def Sync(self, auto_resize=False):
 """Sync node changes back to the device tree
 
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index 1a7e73ffce..22e23c40f5 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -539,6 +539,15 @@ class TestProp(unittest.TestCase):
 data = self.fdt.getprop(self.node.Offset(), 'stringlist')
 self.assertEqual(b'123\x00456\0', data)
 
+def test_delete_node(self):
+"""Test deleting a node"""
+old_offset = self.fdt.path_offset('/spl-test')
+self.assertGreater(old_offset, 0)
+self.node.Delete()
+self.dtb.Sync()
+new_offset = self.fdt.path_offset('/spl-test', libfdt.QUIET_NOTFOUND)
+self.assertEqual(-libfdt.NOTFOUND, new_offset)
+
 def testFromData(self):
 dtb2 = fdt.Fdt.FromData(self.dtb.GetContents())
 self.assertEqual(dtb2.GetContents(), self.dtb.GetContents())
-- 
2.35.0.263.gb82422642f-goog



[PATCH 05/24] rockchip: evb-rk3288: Drop raw-image support

2022-02-08 Thread Simon Glass
This boards uses SPL_FIT so does not need to support loading a raw image.
Drop it to avoid binman trying to insert a symbol which has no value.

Signed-off-by: Simon Glass 
---

 configs/evb-rk3288_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/evb-rk3288_defconfig b/configs/evb-rk3288_defconfig
index 97d4c14f65..6143c4d989 100644
--- a/configs/evb-rk3288_defconfig
+++ b/configs/evb-rk3288_defconfig
@@ -24,6 +24,7 @@ CONFIG_USE_PREBOOT=y
 CONFIG_DEFAULT_FDT_FILE="rk3288-evb-rk808.dtb"
 CONFIG_SILENT_CONSOLE=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
+# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x1
 CONFIG_SPL_OPTEE_IMAGE=y
-- 
2.35.0.263.gb82422642f-goog



[PATCH 04/24] spl: Allow disabling binman symbols in SPL

2022-02-08 Thread Simon Glass
When CONFIG_SPL_FIT is enabled we do not access U-Boot directly in
the image, since it is embedded in a FIT which is parsed at runtime.

Provide a CONFIG option to drop the symbols in this case.

Signed-off-by: Simon Glass 
---

 common/spl/Kconfig | 24 
 common/spl/spl.c   |  4 
 2 files changed, 28 insertions(+)

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index e0d0a6f77b..9418d37b2e 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -101,6 +101,18 @@ config SPL_SHOW_ERRORS
 
  This adds a small amount to SPL code size, perhaps 100 bytes.
 
+config SPL_BINMAN_SYMBOLS
+   bool "Declare binman symbols in SPL"
+   depends on SPL_FRAMEWORK && BINMAN
+   default y
+   help
+ This enables use of symbols in SPL which refer to U-Boot, enabling SPL
+ to obtain the location of U-Boot simply by calling spl_get_image_pos()
+ and spl_get_image_size().
+
+ For this to work, you must have a U-Boot image in the binman image, so
+ binman can update SPL with the location of it.
+
 menu "PowerPC and LayerScape SPL Boot options"
 
 config SPL_NAND_BOOT
@@ -1321,6 +1333,18 @@ config TPL_SIZE_LIMIT
  Specifies the maximum length of the U-Boot TPL image.
  If this value is zero, it is ignored.
 
+config TPL_BINMAN_SYMBOLS
+   bool "Declare binman symbols in SPL"
+   depends on SPL_FRAMEWORK && BINMAN
+   default y
+   help
+ This enables use of symbols in TPL which refer to U-Boot, enabling SPL
+ to obtain the location of U-Boot simply by calling spl_get_image_pos()
+ and spl_get_image_size().
+
+ For this to work, you must have a U-Boot image in the binman image, so
+ binman can update SPL with the location of it.
+
 config TPL_FRAMEWORK
bool "Support TPL based upon the common SPL framework"
default y if SPL_FRAMEWORK
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 444907432c..b452d4feeb 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -49,9 +49,11 @@ DECLARE_GLOBAL_DATA_PTR;
 
 u32 *boot_params_ptr = NULL;
 
+#if CONFIG_IS_ENABLED(BINMAN_SYMBOLS)
 /* See spl.h for information about this */
 binman_sym_declare(ulong, u_boot_any, image_pos);
 binman_sym_declare(ulong, u_boot_any, size);
+#endif
 
 #ifdef CONFIG_TPL
 binman_sym_declare(ulong, u_boot_spl, image_pos);
@@ -140,6 +142,7 @@ void spl_fixup_fdt(void *fdt_blob)
 #endif
 }
 
+#if CONFIG_IS_ENABLED(BINMAN_SYMBOLS)
 ulong spl_get_image_pos(void)
 {
return spl_phase() == PHASE_TPL ?
@@ -153,6 +156,7 @@ ulong spl_get_image_size(void)
binman_sym(ulong, u_boot_spl, size) :
binman_sym(ulong, u_boot_any, size);
 }
+#endif /* BINMAN_SYMBOLS */
 
 ulong spl_get_image_text_base(void)
 {
-- 
2.35.0.263.gb82422642f-goog



[PATCH 03/24] spl: x86: Correct the binman symbols for SPL

2022-02-08 Thread Simon Glass
These symbols are incorrect, meaning that binman cannot find the
associated entry. This leads to errors like:

binman: Section '/binman/simple-bin': Symbol '_binman_spl_prop_size'
   in entry '/binman/simple-bin/u-boot-spl/u-boot-spl-nodtb':
   Entry 'spl' not found in list (mkimage,u-boot-spl-nodtb,
   u-boot-spl-bss-pad,u-boot-spl-dtb,u-boot-spl,u-boot-img,main-section)

Fix it.

Signed-off-by: Simon Glass 
---

 arch/x86/dts/u-boot.dtsi | 2 +-
 common/spl/spl.c | 8 
 include/spl.h| 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/x86/dts/u-boot.dtsi b/arch/x86/dts/u-boot.dtsi
index ca84d18ad9..24e692f988 100644
--- a/arch/x86/dts/u-boot.dtsi
+++ b/arch/x86/dts/u-boot.dtsi
@@ -37,7 +37,7 @@
u-boot-tpl-dtb {
};
 #endif
-   spl {
+   u-boot-spl {
type = "u-boot-spl";
offset = ;
};
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 884102bdea..444907432c 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -54,8 +54,8 @@ binman_sym_declare(ulong, u_boot_any, image_pos);
 binman_sym_declare(ulong, u_boot_any, size);
 
 #ifdef CONFIG_TPL
-binman_sym_declare(ulong, spl, image_pos);
-binman_sym_declare(ulong, spl, size);
+binman_sym_declare(ulong, u_boot_spl, image_pos);
+binman_sym_declare(ulong, u_boot_spl, size);
 #endif
 
 /* Define board data structure */
@@ -143,14 +143,14 @@ void spl_fixup_fdt(void *fdt_blob)
 ulong spl_get_image_pos(void)
 {
return spl_phase() == PHASE_TPL ?
-   binman_sym(ulong, spl, image_pos) :
+   binman_sym(ulong, u_boot_spl, image_pos) :
binman_sym(ulong, u_boot_any, image_pos);
 }
 
 ulong spl_get_image_size(void)
 {
return spl_phase() == PHASE_TPL ?
-   binman_sym(ulong, spl, size) :
+   binman_sym(ulong, u_boot_spl, size) :
binman_sym(ulong, u_boot_any, size);
 }
 
diff --git a/include/spl.h b/include/spl.h
index bb92bc6ec6..8ceb3c0f09 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -269,8 +269,8 @@ struct spl_load_info {
  */
 binman_sym_extern(ulong, u_boot_any, image_pos);
 binman_sym_extern(ulong, u_boot_any, size);
-binman_sym_extern(ulong, spl, image_pos);
-binman_sym_extern(ulong, spl, size);
+binman_sym_extern(ulong, u_boot_spl, image_pos);
+binman_sym_extern(ulong, u_boot_spl, size);
 
 /**
  * spl_get_image_pos() - get the image position of the next phase
-- 
2.35.0.263.gb82422642f-goog



[PATCH 02/24] moveconfig: Allow regex matches when finding combinations

2022-02-08 Thread Simon Glass
It is useful to be able to search for CONFIG options that match a regex,
such as this, which lists boards which define SPL_FIT_GENERATOR and
anything not starting with ROCKCHIP:

   ./tools/moveconfig.py -f SPL_FIT_GENERATOR ~ROCKCHIP.*

Add support for this.

Signed-off-by: Simon Glass 
---

 tools/moveconfig.py | 24 ++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/tools/moveconfig.py b/tools/moveconfig.py
index 5ef5a95eb6..cff1e30658 100755
--- a/tools/moveconfig.py
+++ b/tools/moveconfig.py
@@ -1606,12 +1606,31 @@ def do_imply_config(config_list, add_imply, 
imply_flags, skip_added,
 for linenum in sorted(linenums, reverse=True):
 add_imply_rule(config[CONFIG_LEN:], fname, linenum)
 
+def defconfig_matches(configs, re_match):
+"""Check if any CONFIG option matches a regex
+
+The match must be complete, i.e. from the start to end of the CONFIG 
option.
+
+Args:
+configs (dict): Dict of CONFIG options:
+key: CONFIG option
+value: Value of option
+re_match (re.Pattern): Match to check
+
+Returns:
+bool: True if any CONFIG matches the regex
+"""
+for cfg in configs:
+m_cfg = re_match.match(cfg)
+if m_cfg and m_cfg.span()[1] == len(cfg):
+return True
+return False
 
 def do_find_config(config_list):
 """Find boards with a given combination of CONFIGs
 
 Params:
-config_list: List of CONFIG options to check (each a string consisting
+config_list: List of CONFIG options to check (each a regex consisting
 of a config option, with or without a CONFIG_ prefix. If an option
 is preceded by a tilde (~) then it must be false, otherwise it must
 be true)
@@ -1643,8 +1662,9 @@ def do_find_config(config_list):
 # running for the next stage
 in_list = out
 out = set()
+re_match = re.compile(cfg)
 for defc in in_list:
-has_cfg = cfg in config_db[defc]
+has_cfg = defconfig_matches(config_db[defc], re_match)
 if has_cfg == want:
 out.add(defc)
 if adhoc:
-- 
2.35.0.263.gb82422642f-goog



[PATCH 01/24] moveconfig: Show the config name rather than the defconfig

2022-02-08 Thread Simon Glass
The _defconfig suffix is unnecessary when showing matching boards. Drop
it.

Signed-off-by: Simon Glass 
---

 tools/moveconfig.py | 15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/tools/moveconfig.py b/tools/moveconfig.py
index 1bcf58caf1..5ef5a95eb6 100755
--- a/tools/moveconfig.py
+++ b/tools/moveconfig.py
@@ -91,7 +91,20 @@ SIZES = {
 'SZ_4G':  0x1
 }
 
+RE_REMOVE_DEFCONFIG = re.compile(r'(.*)_defconfig')
+
 ### helper functions ###
+def remove_defconfig(defc):
+"""Drop the _defconfig suffix on a string
+
+Args:
+defc (str): String to convert
+
+Returns:
+str: string with the '_defconfig' suffix removed
+"""
+return RE_REMOVE_DEFCONFIG.match(defc)[1]
+
 def check_top_directory():
 """Exit if we are not at the top of source directory."""
 for fname in 'README', 'Licenses':
@@ -1638,7 +1651,7 @@ def do_find_config(config_list):
 print(f"Error: Not in Kconfig: %s" % ' '.join(adhoc))
 else:
 print(f'{len(out)} matches')
-print(' '.join(out))
+print(' '.join([remove_defconfig(item) for item in out]))
 
 
 def prefix_config(cfg):
-- 
2.35.0.263.gb82422642f-goog



[PATCH] common: spl: spl_mmc: Add full FIT image support for kernel/OS loading during Falcon boot mode while booting via MMC

2022-02-08 Thread Nathan Barrett-Morrison
Hi Tom,

This patch adds support for Falcon mode boot via MMC flash boot devices
with full FIT images.

While attempting to use Falcon boot mode with FIT images on MMC flash boot
devices, I've found the following additional code to be required.

Patch attached and also added inline below:

Sincerely,
Nathan

>From a3d066656df60856950c9cbb28914d02d57c9364 Mon Sep 17 00:00:00 2001
From: Nathan Barrett-Morrison 
Date: Tue, 8 Feb 2022 13:16:24 -0500
Subject: [PATCH] common: spl: spl_mmc: Add full FIT image support for
 kernel/OS loading during Falcon boot mode while booting via MMC

Signed-off-by: Nathan Barrett-Morrison 
Cc: Tom Rini 
---
 common/spl/spl_mmc.c | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index e1a7d25bd0..7fb2505c33 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -94,7 +94,19 @@ int mmc_load_image_raw_sector(struct spl_image_info
*spl_image,
  goto end;
  }

- if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
+ if (IS_ENABLED(CONFIG_SPL_LOAD_FIT_FULL) &&
+image_get_magic(header) == FDT_MAGIC) {
+ u32 image_size_sectors;
+
+ debug("Found FIT\n");
+
+ image_size_sectors = (roundup(fdt_totalsize(header), 4) +
mmc->read_bl_len - 1) /
+ mmc->read_bl_len;
+ count = blk_dread(bd, sector, image_size_sectors, CONFIG_SYS_LOAD_ADDR);
+ debug("hdr read sector %lx, count=%lu\n", sector, count);
+
+ ret = spl_parse_image_header(spl_image, CONFIG_SYS_LOAD_ADDR);
+ } else if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
 image_get_magic(header) == FDT_MAGIC) {
  struct spl_load_info load;

-- 
2.30.2
From a3d066656df60856950c9cbb28914d02d57c9364 Mon Sep 17 00:00:00 2001
From: Nathan Barrett-Morrison 
Date: Tue, 8 Feb 2022 13:16:24 -0500
Subject: [PATCH] common: spl: spl_mmc: Add full FIT image support for
 kernel/OS loading during Falcon boot mode while booting via MMC

Signed-off-by: Nathan Barrett-Morrison 
Cc: Tom Rini 
---
 common/spl/spl_mmc.c | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index e1a7d25bd0..7fb2505c33 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -94,7 +94,19 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
 		goto end;
 	}
 
-	if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
+	if (IS_ENABLED(CONFIG_SPL_LOAD_FIT_FULL) &&
+	image_get_magic(header) == FDT_MAGIC) {
+		u32 image_size_sectors;
+
+		debug("Found FIT\n");
+
+		image_size_sectors = (roundup(fdt_totalsize(header), 4) + mmc->read_bl_len - 1) /
+ mmc->read_bl_len;
+		count = blk_dread(bd, sector, image_size_sectors, CONFIG_SYS_LOAD_ADDR);
+		debug("hdr read sector %lx, count=%lu\n", sector, count);
+
+		ret = spl_parse_image_header(spl_image, CONFIG_SYS_LOAD_ADDR);
+	} else if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
 	image_get_magic(header) == FDT_MAGIC) {
 		struct spl_load_info load;
 
-- 
2.30.2



Re: Running qemu tests on RISC-V

2022-02-08 Thread Alper Nebi Yasak
On 08/02/2022 20:13, Simon Glass wrote:
> Hi Heinrich,
> 
> On Tue, 8 Feb 2022 at 08:34, Heinrich Schuchardt  wrote:
>>
>> On 2/8/22 15:52, Simon Glass wrote:
>>> Hi Heinrich,
>>>
>>> On Tue, 8 Feb 2022 at 01:21, Heinrich Schuchardt  wrote:
 Hello Simon,

 The qemu-riscv32_spl_defconfig image built inside Docker with

 wget -O -
 https://github.com/riscv/opensbi/releases/download/v0.9/opensbi-0.9-rv-bin.tar.xz
 export
 OPENSBI=/tmp/opensbi-0.9-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin
 tools/buildman/buildman -o build -w -E -W -e --board qemu-riscv32_spl

 runs flawlessly on Ubuntu Jammy with:

 qemu-system-riscv32 -nographic -machine virt -bios spl/u-boot-spl \
   -device loader,file=u-boot.itb,addr=0x8020 -smp cpus=4

 This is a QEMU 6.0

 Please, provide a reproducible instruction for your problem.
>>>
>>> I wonder if the problem is the OPENSBI thing. I am not providing that,
>>> nor am I seeing a warning about it.
>>
>> OpenSBI is needed to emulate unaligned access, access to CSR registers
>> and so forth. I assume you cannot run qemu-riscv32_spl_defconfig.
>>
>> A build warning if CONFIG_SPL_OPENSBI=y and OPENSBI is not defined might
>> make sense.
> 
> OK, it seems we need a binman test that we warn on external blobs that
> are embedded in a FIT.

I tried building qemu-riscv32_spl with buildman on current master from
Debian unstable (outside the container). I am getting the "missing
external blobs" binman warning when I don't pass OPENSBI as a make flag.

The qemu-system-riscv32 command above works fine with that OPENSBI
binary, but not without it. I get garbled output and errors including:
Illegal instruction, Unhandled exception, Please RESET the board...


[PATCH] common: spl: spl_spi: Add in FIT image support for kernel/OS loading during Falcon boot mode while booting via SPI

2022-02-08 Thread Nathan Barrett-Morrison
Hi Tom,

This patch adds support for Falcon mode boot via SPI flash boot devices
with FIT images.

While attempting to use Falcon boot mode with FIT images on SPI flash boot
devices, I've found the following additional code to be required.

Patch attached and also added inline below:

Sincerely,
Nathan

>From b93c9122114ee701f13a62af63d74a0644fcef92 Mon Sep 17 00:00:00 2001
From: Nathan Barrett-Morrison 
Date: Tue, 8 Feb 2022 13:05:34 -0500
Subject: [PATCH] common: spl: spl_spi: Add in FIT image support for
kernel/OS
 loading during Falcon boot mode while booting via SPI

Signed-off-by: Nathan Barrett-Morrison 
Cc: Tom Rini 
---
 common/spl/spl_spi.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c
index 4e20a23dea..82b396fc62 100644
--- a/common/spl/spl_spi.c
+++ b/common/spl/spl_spi.c
@@ -29,6 +29,18 @@ static int spi_load_image_os(struct spl_image_info
*spl_image,
 {
  int err;

+#if CONFIG_IS_ENABLED(LOAD_FIT_FULL) || CONFIG_IS_ENABLED(LOAD_FIT)
+ spi_flash_read(flash, CONFIG_SYS_SPI_KERNEL_OFFS, sizeof(struct
fdt_header),
+   (void *)header);
+
+ if (image_get_magic(header) == FDT_MAGIC)
+ spi_flash_read(flash, CONFIG_SYS_SPI_KERNEL_OFFS,
+   roundup(fdt_totalsize(header), 4), CONFIG_SYS_LOAD_ADDR);
+
+ err = spl_parse_image_header(spl_image, CONFIG_SYS_LOAD_ADDR);
+ if (err)
+ return err;
+#else
  /* Read for a header, parse or error out. */
  spi_flash_read(flash, CONFIG_SYS_SPI_KERNEL_OFFS, sizeof(*header),
(void *)header);
@@ -47,6 +59,7 @@ static int spi_load_image_os(struct spl_image_info
*spl_image,
  spi_flash_read(flash, CONFIG_SYS_SPI_ARGS_OFFS,
CONFIG_SYS_SPI_ARGS_SIZE,
(void *)CONFIG_SYS_SPL_ARGS_ADDR);
+#endif

  return 0;
 }
-- 
2.30.2
From b93c9122114ee701f13a62af63d74a0644fcef92 Mon Sep 17 00:00:00 2001
From: Nathan Barrett-Morrison 
Date: Tue, 8 Feb 2022 13:05:34 -0500
Subject: [PATCH] common: spl: spl_spi: Add in FIT image support for kernel/OS
 loading during Falcon boot mode while booting via SPI

Signed-off-by: Nathan Barrett-Morrison 
Cc: Tom Rini 
---
 common/spl/spl_spi.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c
index 4e20a23dea..82b396fc62 100644
--- a/common/spl/spl_spi.c
+++ b/common/spl/spl_spi.c
@@ -29,6 +29,18 @@ static int spi_load_image_os(struct spl_image_info *spl_image,
 {
 	int err;
 
+#if CONFIG_IS_ENABLED(LOAD_FIT_FULL) || CONFIG_IS_ENABLED(LOAD_FIT)
+	spi_flash_read(flash, CONFIG_SYS_SPI_KERNEL_OFFS, sizeof(struct fdt_header),
+		   (void *)header);
+
+	if (image_get_magic(header) == FDT_MAGIC)
+		spi_flash_read(flash, CONFIG_SYS_SPI_KERNEL_OFFS,
+		   roundup(fdt_totalsize(header), 4), CONFIG_SYS_LOAD_ADDR);
+
+	err = spl_parse_image_header(spl_image, CONFIG_SYS_LOAD_ADDR);
+	if (err)
+		return err;
+#else
 	/* Read for a header, parse or error out. */
 	spi_flash_read(flash, CONFIG_SYS_SPI_KERNEL_OFFS, sizeof(*header),
 		   (void *)header);
@@ -47,6 +59,7 @@ static int spi_load_image_os(struct spl_image_info *spl_image,
 	spi_flash_read(flash, CONFIG_SYS_SPI_ARGS_OFFS,
 		   CONFIG_SYS_SPI_ARGS_SIZE,
 		   (void *)CONFIG_SYS_SPL_ARGS_ADDR);
+#endif
 
 	return 0;
 }
-- 
2.30.2



[PATCH] binman: Correct the error message for a bad hash algorithm

2022-02-08 Thread Simon Glass
This shows an internal type at present, rather than the algorithm name.
Fix it and update the test to catch this.

Signed-off-by: Simon Glass 
---

 tools/binman/ftest.py | 2 +-
 tools/binman/state.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 5400f76c67..3e15de63d5 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -2073,7 +2073,7 @@ class TestFunctional(unittest.TestCase):
 def testHashBadAlgo(self):
 with self.assertRaises(ValueError) as e:
 self._DoReadFileDtb('092_hash_bad_algo.dts', update_dtb=True)
-self.assertIn("Node '/binman/u-boot': Unknown hash algorithm",
+self.assertIn("Node '/binman/u-boot': Unknown hash algorithm 
'invalid'",
   str(e.exception))
 
 def testHashSection(self):
diff --git a/tools/binman/state.py b/tools/binman/state.py
index af0a65e841..843aefd28d 100644
--- a/tools/binman/state.py
+++ b/tools/binman/state.py
@@ -397,7 +397,7 @@ def CheckAddHashProp(node):
 if algo.value == 'sha256':
 size = 32
 else:
-return "Unknown hash algorithm '%s'" % algo
+return "Unknown hash algorithm '%s'" % algo.value
 for n in GetUpdateNodes(hash_node):
 n.AddEmptyProp('value', size)
 
-- 
2.35.0.263.gb82422642f-goog



Re: [PATCH] boot: Update default on USE_SPL_FIT_GENERATOR

2022-02-08 Thread Tom Rini
On Tue, Feb 08, 2022 at 10:22:34AM -0500, Tom Rini wrote:
> On Tue, Feb 08, 2022 at 08:13:33AM -0700, Simon Glass wrote:
> > Hi Tom,
> > 
> > On Mon, 31 Jan 2022 at 17:03, Tom Rini  wrote:
> > >
> > > The use of CONFIG_SPL_FIT_GENERATOR is deprecated and should not be
> > > used.  Start by changing the current default option from enabled to only
> > > enabled for the platforms still using it.
> > >
> > > Cc: Simon Glass 
> > > Signed-off-by: Tom Rini 
> > > ---
> > > This change completes the migration for a number of platforms that were
> > > tripping the warning before but not actually using a generator.
> > > ---
> > >  boot/Kconfig | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > Reviewed-by: Simon Glass 
> > 
> > This landed in spam so I missed it. I have a similar patch in my
> > series if I ever get time to finish it. But we can deal with any
> > conflict later.
> 
> OK.  Now that the first iMX PR has come through I _think_ the implicitly
> depended on binman patches there have come in and so this patch won't
> break anything.  I'll pick this up soon along with other Kconfig
> migration/etc patches in the next day or two.

So, I was wrong.  There's still:
configs/cgtqmx8_defconfig
configs/imx8mm-icore-mx8mm-ctouch2_defconfig
configs/imx8mm-icore-mx8mm-edimm2.2_defconfig
configs/imx8qm_rom7720_a1_4G_defconfig
that need migration and only the last of which has a patch that I see
right now:
https://patchwork.ozlabs.org/project/uboot/patch/20220126155204.25099-1-oliver.gra...@kococonnector.com/
but I assume the other 3 could be done fairly quickly.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v2 06/25] phy: cadence: Sierra: Add array of input clocks in "struct cdns_sierra_phy"

2022-02-08 Thread Tom Rini
On Fri, Jan 28, 2022 at 01:41:33PM +0530, Aswath Govindraju wrote:

> From: Kishon Vijay Abraham I 
> 
> Instead of having separate structure members for each input clock, add
> an array for the input clocks within "struct cdns_sierra_phy". This is
> in preparation for adding more input clocks required for supporting
> additional clock combination.
> 
> Signed-off-by: Kishon Vijay Abraham I 
> Signed-off-by: Aswath Govindraju 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] Nokia RX-51: Convert to CONFIG_DM_KEYBOARD

2022-02-08 Thread Tom Rini
On Thu, Feb 03, 2022 at 07:38:50PM +0100, Pali Rohár wrote:

> Signed-off-by: Pali Rohár 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v2 25/25] include: configs: j721e_evm: Add support to boot ethfw core in j721e

2022-02-08 Thread Tom Rini
On Fri, Jan 28, 2022 at 01:41:52PM +0530, Aswath Govindraju wrote:

> Add configs to enable booting ethfw core in j721e
> 
> Signed-off-by: Aswath Govindraju 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


  1   2   3   >