platform/kernel/u-boot.git
2 years agobinman: Add installation instructions
Simon Glass [Mon, 10 Jan 2022 03:13:48 +0000 (20:13 -0700)]
binman: Add installation instructions

Explain how to install binman, since it is not obvious.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Correct path for fip_util
Simon Glass [Mon, 10 Jan 2022 03:13:47 +0000 (20:13 -0700)]
binman: Correct path for fip_util

This should be imported from the binman module. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Allow faked blobs in blob-ext-list
Simon Glass [Mon, 10 Jan 2022 03:13:46 +0000 (20:13 -0700)]
binman: Allow faked blobs in blob-ext-list

Since this is a list of blobs, each blob should have the ability to be
faked, as with blob-ext. Update the Entry base class to set allow_fake
and use the base class in the section code also, so that this propagagtes
to blob-ext-list, which is not a section.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Drop the image name from the fake-blob message
Simon Glass [Mon, 10 Jan 2022 03:13:45 +0000 (20:13 -0700)]
binman: Drop the image name from the fake-blob message

This is not really needed and it makes the message different from the
missing-blob message. Update it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agopatman: Add a function to find a tool on the path
Simon Glass [Mon, 10 Jan 2022 03:13:43 +0000 (20:13 -0700)]
patman: Add a function to find a tool on the path

The Run() function automatically uses the PATH variable to locate a tool
when running it. Add a function that does this manually, so we don't have
to run a tool to find out if it is present.

This is needed by the new Bintool class, which wants to check which tools
are present.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agopatman: Tidy up the download function a little
Simon Glass [Mon, 10 Jan 2022 03:13:42 +0000 (20:13 -0700)]
patman: Tidy up the download function a little

Reverse the order of the return tuple, so that the filename is first.
This seems more obvious than putting the temporary directory first.

Correct a bug that leaves a space on the final line.

Allow the caller to control the name of the temporary directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobuildman: Move the download function to tools
Simon Glass [Mon, 10 Jan 2022 03:13:41 +0000 (20:13 -0700)]
buildman: Move the download function to tools

This function is handy for binman as well. Move it into the shared 'tools'
module.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agopatman: Allow running a tool and returning the full result
Simon Glass [Mon, 10 Jan 2022 03:13:40 +0000 (20:13 -0700)]
patman: Allow running a tool and returning the full result

Add a new function which returns the entire result from running a tool,
not just stdout. Update Run() to use this and to return stdout on error,
if stderr is empty, since some unfortunate tools write their error
output to stdout rather than stderr.

Move building of the PATH to a separate function.

Make the exception catching more specific, to catch just ValueError, since
broad exceptions are a pain to debug.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Expand the external FIT test a little
Simon Glass [Mon, 10 Jan 2022 03:13:39 +0000 (20:13 -0700)]
binman: Expand the external FIT test a little

At present this does not check that the external data is in the expected
place. Use a non-zero offset for the external data and check it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agomkimage: Show the external-offset error
Simon Glass [Mon, 10 Jan 2022 03:13:38 +0000 (20:13 -0700)]
mkimage: Show the external-offset error

This is a debug message at present, which is not very helpful. Print out
the error so that action can be taken.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Tweak elf tests for a toolchain change
Simon Glass [Mon, 10 Jan 2022 03:13:37 +0000 (20:13 -0700)]
binman: Tweak elf tests for a toolchain change

Some newer toolchains do not create a symbol for the .ucode section that
this test relies on. Update the test to use the symbol that is explicitly
created, instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoMakefile: Fake external blobs by default with binman
Simon Glass [Mon, 10 Jan 2022 03:13:36 +0000 (20:13 -0700)]
Makefile: Fake external blobs by default with binman

This behaviour is necessary with boards where the binman description
requires processing external blobs, since these may be missing.

Enable it by default, so that CI is happy. Warnings indicate that a valid
image is not produced, as with the --allow-missing option.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodm: Fix OF_BAD_ADDR definition
Patrice Chotard [Tue, 4 Jan 2022 07:42:48 +0000 (08:42 +0100)]
dm: Fix OF_BAD_ADDR definition

When OF_LIVE flag is enabled on a 64 bits platform, there is an
issue when dev_read_addr() is called and need to perform an address
translation using __of_translate_address().

In case of error, __of_translate_address() return's value is OF_BAD_ADDR
(wich is defined in include/dm/of.h to ((u64)-1) = 0xffffffffffffffff).
The return value of dev_read_addr() is often compared to FDT_ADDR_T_NONE
which is defined as (-1U) = 0xffffffff.
In this case the comparison is always false.

To fix this issue, define FDT_ADDR_T_NONE to (ulong)(-1) in case of
AARCH64. Update accordingly related tests.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agointroduce CONFIG_DEVICE_TREE_INCLUDES
Rasmus Villemoes [Sun, 21 Nov 2021 13:52:51 +0000 (14:52 +0100)]
introduce CONFIG_DEVICE_TREE_INCLUDES

The build system already automatically looks for and includes an
in-tree *-u-boot.dtsi when building the control .dtb. However, there
are some things that are awkward to maintain in such an in-tree file,
most notably the metadata associated to public keys used for verified
boot.

The only "official" API to get that metadata into the .dtb is via
mkimage, as a side effect of building an actual signed image. But
there are multiple problems with that. First of all, the final U-Boot
(be it U-Boot proper or an SPL) image is built based on a binary
image, the .dtb, and possibly some other binary artifacts. So
modifying the .dtb after the build requires the meta-buildsystem
(Yocto, buildroot, whatnot) to know about and repeat some of the steps
that are already known to and handled by U-Boot's build system,
resulting in needless duplication of code. It's also somewhat annoying
and inconsistent to have a .dtb file in the build folder which is not
generated by the command listed in the corresponding .cmd file (that
of course applies to any generated file).

So the contents of the /signature node really needs to be baked into
the .dtb file when it is first created, which means providing the
relevant data in the form of a .dtsi file. One could in theory put
that data into the *-u-boot.dtsi file, but it's more convenient to be
able to provide it externally: For example, when developing for a
customer, it's common to use a set of dummy keys for development,
while the consultants do not (and should not) have access to the
actual keys used in production. For such a setup, it's easier if the
keys used are chosen via the meta-buildsystem and the path(s) patched
in during the configure step. And of course, nothing prevents anybody
from having DEVICE_TREE_INCLUDES point at files maintained in git, or
for that matter from including the public key metadata in the
*-u-boot.dtsi directly and ignore this feature.

There are other uses for this, e.g. in combination with ENV_IMPORT_FDT
it can be used for providing the contents of the /config/environment
node, so I don't want to tie this exclusively to use for verified
boot.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Fix doc formatting error (make htmldocs)
Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agousb: Use the first available device for ehci_gadget
Sean Anderson [Fri, 5 Nov 2021 16:52:55 +0000 (12:52 -0400)]
usb: Use the first available device for ehci_gadget

For whatever reason, usb_setup_ehci_gadget removes and probes USB device
0. However, not all systems have a device 0. Use the first device
instead.

The device probed should probably have something to do with the
controller (as specified by e.g. ums <controller> or fastboot
<controller>). In fact, I find it odd that we probe the USB device in
the first place, because this is just to set up the gadget itself.
Presumably, the controller should be probed by usb_gadget_initialize
somehow.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoacpi: Add myself as maintainer
Simon Glass [Wed, 1 Dec 2021 16:03:09 +0000 (09:03 -0700)]
acpi: Add myself as maintainer

Add myself as maintainer of the generic ACPI code, until someone else
steps up to take it on.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoacpi: Add some tables needed by ARM devices
Simon Glass [Wed, 1 Dec 2021 16:03:08 +0000 (09:03 -0700)]
acpi: Add some tables needed by ARM devices

Add some tables needed for ARM devices, including more MADT subtables,
a CSRT descriptor, GTDT and PPTT.

WIP: This needs comments added.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodoc: Add usage information for the acpi command
Simon Glass [Wed, 1 Dec 2021 16:03:07 +0000 (09:03 -0700)]
doc: Add usage information for the acpi command

Add some documentation for this command.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoacpi: Tidy up the table list
Simon Glass [Wed, 1 Dec 2021 16:03:06 +0000 (09:03 -0700)]
acpi: Tidy up the table list

At present this is really just a debugging aid, but it is a bit untidy.
Add proper columns so it is easier to read.

Sample output for coral:

    => acpi list
    Name      Base   Size  Detail
    ----  --------  -----  ------
    RSDP  79925000     24  v02 U-BOOT
    RSDT  79925030     48  v01 U-BOOT U-BOOTBL 20220101 INTL 0
    XSDT  799250e0     6c  v01 U-BOOT U-BOOTBL 20220101 INTL 0
    FACP  79929570     f4  v04 U-BOOT U-BOOTBL 20220101 INTL 1
    DSDT  79925280   32ea  v02 U-BOOT U-BOOTBL 20110725 INTL 20180105
    FACS  79925240     40
    MCFG  79929670     2c  v01 U-BOOT U-BOOTBL 20220101 INTL 0
    SPCR  799296a0     50  v02 U-BOOT U-BOOTBL 20220101 INTL 0
    TPM2  799296f0     4c  v04 U-BOOT U-BOOTBL 20220101 INTL 0
    APIC  79929740     6c  v02 U-BOOT U-BOOTBL 20220101 INTL 0
    SSDT  799297b0   1523  v02 U-BOOT U-BOOTBL 20220101 INTL 1
    NHLT  7992ace0    e60  v05 coral coral 3 INTL 0
    DBG2  7992db40     61  v00 U-BOOT U-BOOTBL 20220101 INTL 0
    HPET  7992dbb0     38  v01 U-BOOT U-BOOTBL 20220101 INTL 0

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoacpi: Tidy up the item list
Simon Glass [Wed, 1 Dec 2021 16:03:05 +0000 (09:03 -0700)]
acpi: Tidy up the item list

At present this is really just a debugging aid, but it is a bit untidy.
Add proper columns and display the type name instead of a number.

Sample output for coral:

   => acpi items
   Seq  Type       Addr  Size  Device/Writer
   ---  -----  --------  ----  -------------
     0  other  79925000    240  0base
     1  other  79925240     40  1facs
     2  dsdt   799252a4     58  board
     3  dsdt   799252fc     10  lpc
     4  other  79925280   32f0  3dsdt
     5  other  79928570   1000  4gnvs
     6  other  79929570    100  5fact
     7  other  79929670     30  5mcfg
     8  other  799296a0     50  5spcr
     9  other  799296f0     50  5tpm2
     a  other  79929740     70  5x86
     b  ssdt   799297d4     fe  maxim-codec
     c  ssdt   799298d2     28  i2c2@16,0
     d  ssdt   799298fa    270  da-codec
     e  ssdt   79929b6a     28  i2c2@16,1
     f  ssdt   79929b92     28  i2c2@16,2
    10  ssdt   79929bba     83  tpm@50
    11  ssdt   79929c3d     28  i2c2@16,3
    12  ssdt   79929c65    282  elan-touchscreen@10
    13  ssdt   79929ee7    285  raydium-touchscreen@39
    14  ssdt   7992a16c     28  i2c2@17,0
    15  ssdt   7992a194     d8  elan-touchpad@15
    16  ssdt   7992a26c    163  synaptics-touchpad@2c
    17  ssdt   7992a3cf     28  i2c2@17,1
    18  ssdt   7992a3f7    111  wacom-digitizer@9
    19  ssdt   7992a508     8f  sdmmc@1b,0
    1a  ssdt   7992a597     4b  wifi
    1b  ssdt   7992a5e2    1a0  cpu@0
    1c  ssdt   7992a782    1a0  cpu@1
    1d  ssdt   7992a922    1a0  cpu@2
    1e  ssdt   7992aac2    211  cpu@3
    1f  other  799297b0   1530  6ssdt
    20  other  7992ace0   2f10  8dev

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoacpi: Collect tables in the acpi_item list
Simon Glass [Wed, 1 Dec 2021 16:03:04 +0000 (09:03 -0700)]
acpi: Collect tables in the acpi_item list

At present this list is used to collect items within the DSDT and SSDT
tables. It is useful for it to collect the whole tables as well, so there
is a list of what was created and which write created each one.

Refactor the code accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agox86: Move acpi_get_rsdp_addr() ACPI tables to the writer
Simon Glass [Wed, 1 Dec 2021 16:03:03 +0000 (09:03 -0700)]
x86: Move acpi_get_rsdp_addr() ACPI tables to the writer

Move this over to use a writer file, moving the code from the x86
implementation.

There is no need to store a separate variable since we can simply access
the ACPI context.

With this, the original monolithic x86 function for writing ACPI tables
is gone.

Note that QEMU has its own implementation.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agox86: Move device-specific ACPI tables to a writer function
Simon Glass [Wed, 1 Dec 2021 16:03:02 +0000 (09:03 -0700)]
x86: Move device-specific ACPI tables to a writer function

Move this over to use a writer function, moving the code from the x86
implementation.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agox86: acpi: Update acpi_fill_csrt() to use acpi_ctx
Simon Glass [Wed, 1 Dec 2021 16:03:01 +0000 (09:03 -0700)]
x86: acpi: Update acpi_fill_csrt() to use acpi_ctx

Update this function to the newer style, so we can avoid passing and
returning an address through this function.

Also move this function out of the x86 code so it can be used by other
archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2 years agox86: Move CSRT table to a writer function
Simon Glass [Wed, 1 Dec 2021 16:03:00 +0000 (09:03 -0700)]
x86: Move CSRT table to a writer function

Move this table over to use a writer function, moving the code from the
x86 implementation.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agox86: Move TCPA table to a writer function
Simon Glass [Wed, 1 Dec 2021 16:02:59 +0000 (09:02 -0700)]
x86: Move TCPA table to a writer function

Move this table over to use a writer function, for x86 only.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agox86: Move MADT table to a writer function
Simon Glass [Wed, 1 Dec 2021 16:02:58 +0000 (09:02 -0700)]
x86: Move MADT table to a writer function

Move this table over to use a writer function, for x86 only.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agox86: Move TPM2 table to a writer function
Simon Glass [Wed, 1 Dec 2021 16:02:57 +0000 (09:02 -0700)]
x86: Move TPM2 table to a writer function

Move this table over to use a writer function, for x86 only.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agox86: Move SSDT table to a writer function
Simon Glass [Wed, 1 Dec 2021 16:02:56 +0000 (09:02 -0700)]
x86: Move SSDT table to a writer function

Move this table over to use a writer function, moving the code from the
x86 implementation.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agox86: Move FACP table into separate functions
Simon Glass [Wed, 1 Dec 2021 16:02:55 +0000 (09:02 -0700)]
x86: Move FACP table into separate functions

Each board has its own way of creating this table. Rather than calling the
acpi_create_fadt() function for each one from a common acpi_write_fadt()
function, just move the writer into the board-specific code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2 years agox86: Move FADT table to a writer function
Simon Glass [Wed, 1 Dec 2021 16:02:54 +0000 (09:02 -0700)]
x86: Move FADT table to a writer function

Move this table over to use a writer function, for x86 only.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agox86: Move GNVS table to a writer function
Simon Glass [Wed, 1 Dec 2021 16:02:53 +0000 (09:02 -0700)]
x86: Move GNVS table to a writer function

Move this table over to use a writer function, for x86 only. Handle the
two cases

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agox86: Move DSDT table to a writer function
Simon Glass [Wed, 1 Dec 2021 16:02:52 +0000 (09:02 -0700)]
x86: Move DSDT table to a writer function

Move this table over to use a writer function, moving the code from the
x86 implementation.

Add a pointer to the DSDT in struct acpi_ctx so we can reference it later.

Disable this table for sandbox since we don't actually compile real ASL
code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agox86: Move FACS table to a writer function
Simon Glass [Wed, 1 Dec 2021 16:02:51 +0000 (09:02 -0700)]
x86: Move FACS table to a writer function

Move this table over to use a writer function, moving the code from the
x86 implementation.

Add a pointer to the DSDT in struct acpi_ctx so we can reference it later.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agox86: Move base tables to a writer function
Simon Glass [Wed, 1 Dec 2021 16:02:50 +0000 (09:02 -0700)]
x86: Move base tables to a writer function

Use the new ACPI writer to write the base tables at the start of the area,
moving this code from the x86 implementation.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agox86: Use the ACPI table writer
Simon Glass [Wed, 1 Dec 2021 16:02:49 +0000 (09:02 -0700)]
x86: Use the ACPI table writer

Use the new ACPI writer to write the ACPI tables. At present this is all
done in one monolithic function. Future work will split this out.

Unfortunately the QFW write_acpi_tables() function conflicts with the
'writer' version, so disable that for sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agox86: acpi: Split out context creation from base tables
Simon Glass [Wed, 1 Dec 2021 16:02:48 +0000 (09:02 -0700)]
x86: acpi: Split out context creation from base tables

At present acpi_setup_base_tables() both sets up the ACPI context and
writes out the base tables.

We want to use an ACPI writer to write the base tables, so split this
function into two, with acpi_setup_ctx() doing the context set, and
acpi_setup_base_tables() just doing the base tables.

Disable the writer's write_acpi_tables() function for now, to avoid
build errors. It is enabled in a following patch.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoacpi: Add a linker list for ACPI tables
Simon Glass [Wed, 1 Dec 2021 16:02:47 +0000 (09:02 -0700)]
acpi: Add a linker list for ACPI tables

At present we call lots of functions to generate the required ACPI tables.
It would be better to standardise these functions and allow them to be
automatically collected and used when needed.

Add a linker list to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoacpi: Add a table start
Simon Glass [Wed, 1 Dec 2021 16:02:46 +0000 (09:02 -0700)]
acpi: Add a table start

It is useful to record the start of an ACPI table so that offsets from
that point can be easily calculated.

Add this to the context and set it before calling the writer method.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoacpi: Move acpi_fill_header() to the generic header
Simon Glass [Wed, 1 Dec 2021 16:02:45 +0000 (09:02 -0700)]
acpi: Move acpi_fill_header() to the generic header

This function is not x86-specific so move it into the common header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoacpi: Allow include files within the board directory
Simon Glass [Wed, 1 Dec 2021 16:02:44 +0000 (09:02 -0700)]
acpi: Allow include files within the board directory

Some .asl files include others using the iasl 'include' directive. This
needs to be able to find the files referenced.

For an out-of-tree build the source directory is not the current
directory. Moreover, U-Boot preprocesses the input file and puts the
result in the output directory. So iasl does not know where the real
source file came from.

Add a -I option to produce the correct behaviour. We could add an option
to not preprocess the .asl source, but for now that seems unnecessary.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoacpi: Use finer-grained control of ACPI-table generation
Simon Glass [Wed, 1 Dec 2021 16:02:43 +0000 (09:02 -0700)]
acpi: Use finer-grained control of ACPI-table generation

Rather than keying everything off ACPIGEN, use the main
GENERATE_ACPI_TABLE option to determine whether the core ACPI code
is included. Make sure these option are not enabled in SPL/TPL since we
never generate tables there.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoefi: Correct address handling with ACPI tables
Simon Glass [Wed, 1 Dec 2021 16:02:42 +0000 (09:02 -0700)]
efi: Correct address handling with ACPI tables

The current EFI implementation confuses pointers and addresses. Normally
we can get away with this but in the case of sandbox it causes failures.

Despite the fact that efi_allocate_pages() returns a u64, it is actually
a pointer, not an address. Add special handling to avoid a crash when
running 'bootefi hello'.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoefi: Correct call to write_acpi_tables()
Simon Glass [Wed, 1 Dec 2021 16:02:41 +0000 (09:02 -0700)]
efi: Correct call to write_acpi_tables()

This must be passed a ulong, not a u64. Fix it to avoid LTO warnings on
sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agosandbox: Allow building with GENERATE_ACPI_TABLE
Simon Glass [Wed, 1 Dec 2021 16:02:40 +0000 (09:02 -0700)]
sandbox: Allow building with GENERATE_ACPI_TABLE

At present this option is missing a header file, a function prototype and
the qfw driver needs a header included.

Fix these problems so we can enable this option on sandbox. This will
increase the build coverage.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agox86: Tidy up use of CONFIG_ACPIGEN
Simon Glass [Wed, 1 Dec 2021 16:02:39 +0000 (09:02 -0700)]
x86: Tidy up use of CONFIG_ACPIGEN

This is enabled for quite a few boards which don't create ACPI tables.
Tidy this up by dropping the option for some boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoarm: Allow supporting ACPI-table generation
Simon Glass [Wed, 1 Dec 2021 16:02:38 +0000 (09:02 -0700)]
arm: Allow supporting ACPI-table generation

Some ARM boards are using ACPI now. It seems that U-Boot should support
this method. Add ARM to the list of archs which can generate ACPI tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agox86: Move the acpi table to generic global_data
Simon Glass [Wed, 1 Dec 2021 16:02:37 +0000 (09:02 -0700)]
x86: Move the acpi table to generic global_data

Allow this to be used on any arch. Also convert to using macros so that
we can check the CONFIG option in C code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agox86: Allow any arch to generate ACPI tables
Simon Glass [Wed, 1 Dec 2021 16:02:36 +0000 (09:02 -0700)]
x86: Allow any arch to generate ACPI tables

These have sadly found their way to ARM now. Allow any arch to support
generating ACPI tables.

Disable this for the tools build.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoMerge branch '2022-01-24-assorted-updates'
Tom Rini [Tue, 25 Jan 2022 13:01:43 +0000 (08:01 -0500)]
Merge branch '2022-01-24-assorted-updates'

- A number of cleanups to Python code based on running pylint
- Integrate changes so that we can run "make pylint" and compare the
  results to a current baseline.  Keep this as a manual check for now.
- Improve functionality of moveconfig.py
- pci: iproc: Set all 24 bits of PCI class code

2 years agoconfigs: Resync with savedefconfig
Tom Rini [Mon, 24 Jan 2022 21:08:41 +0000 (21:08 +0000)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agomoveconfig: Fix some pylint errors
Simon Glass [Sat, 18 Dec 2021 21:54:35 +0000 (14:54 -0700)]
moveconfig: Fix some pylint errors

There are over 200 errors in this file. Fix some of them, starting at the
beginning of the file. Future work can continue this effort.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agomoveconfig: Use a function to read files
Simon Glass [Sat, 18 Dec 2021 21:54:34 +0000 (14:54 -0700)]
moveconfig: Use a function to read files

At present there is quite a bit of ad-hoc code reading from files. The
most common case is to read the file as lines. Put it in a function and
set the unicode encoding correctly.

Avoid writing back to a file when there are obviously no changes as this
speeds things up slightly.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agomoveconfig: Use a function to write files
Simon Glass [Sat, 18 Dec 2021 21:54:33 +0000 (14:54 -0700)]
moveconfig: Use a function to write files

At present there is quite a bit of ad-hoc code writing to files. The
treatment of newlines is different in some of them. Put it in a function
and set the unicode encoding correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agomoveconfig: Drop check for old Python
Simon Glass [Sat, 18 Dec 2021 21:54:32 +0000 (14:54 -0700)]
moveconfig: Drop check for old Python

Python 2 is not supported anymore and Python 3 has had subprocess.DEVNULL
since version 3.3 which was released in 2012. Drop the unnecessary check.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agomoveconfig: Convert to ArgumentParser
Simon Glass [Sat, 18 Dec 2021 21:54:31 +0000 (14:54 -0700)]
moveconfig: Convert to ArgumentParser

This is a newer library and is now preferred for Python scripts. Update
the code to use it instead of optparse

Use 'args' instead of 'options' throughout, since this is the term used
in that module. Also it helps to avoid confusion with CONFIG options, a
term that is used in this file.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agomoveconfig: Use single quotes
Simon Glass [Sat, 18 Dec 2021 21:54:30 +0000 (14:54 -0700)]
moveconfig: Use single quotes

Quite a few places use double quotes. Fix this to be consistent with
other Python code in U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agomoveconfig: Allow querying board configuration
Simon Glass [Sat, 18 Dec 2021 15:09:46 +0000 (08:09 -0700)]
moveconfig: Allow querying board configuration

It is useful to be able to find out which boards define a particular
option, or combination of options. This is not as easy as grepping the
defconfig files since many options are implied by others.

Add a -f option to the moveconfig tool to permit this. Update the
documentation to cover this, including a better title for the doc page.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agomoveconfig: Allow adding unit tests
Simon Glass [Sat, 18 Dec 2021 15:09:45 +0000 (08:09 -0700)]
moveconfig: Allow adding unit tests

Add a -t option to run unit tests in this program. So far, there is none.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agomoveconfig: Sort the options
Simon Glass [Sat, 18 Dec 2021 15:09:44 +0000 (08:09 -0700)]
moveconfig: Sort the options

Put the options in sorted order by their short name so it is easier to
find an option.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agomoveconfig: Read the database in a separate function
Simon Glass [Sat, 18 Dec 2021 15:09:43 +0000 (08:09 -0700)]
moveconfig: Read the database in a separate function

Move this code out into a function so it can be used elsewhere.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agomoveconfig: Correct operation of the 'imply' feature
Simon Glass [Sat, 18 Dec 2021 15:09:42 +0000 (08:09 -0700)]
moveconfig: Correct operation of the 'imply' feature

This doesn't work anymore, since the Kconfig update. The script has no
tests so we did not notice. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agotest: fix pylint warnings in test_env.py
Heinrich Schuchardt [Fri, 26 Nov 2021 22:30:27 +0000 (23:30 +0100)]
test: fix pylint warnings in test_env.py

* assert does not need parentheses
* add module docstring
* fix misspelled constant True
* limit lines to 100 characters

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoMakefile: Add a pylint checker to the build
Simon Glass [Mon, 22 Nov 2021 03:48:40 +0000 (20:48 -0700)]
Makefile: Add a pylint checker to the build

At present the Python code in U-Boot is somewhat inconsistent, with some
files passing pylint quite cleanly and others not.

Add a way to track progress on this clean-up, by checking that no module
has got any worse as a result of changes.

This can be used with 'make pylint'.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Re-generate pylint.base]

2 years agotools: Add init files for Python tools
Simon Glass [Mon, 22 Nov 2021 03:48:39 +0000 (20:48 -0700)]
tools: Add init files for Python tools

Add some empty __init__ files for binman, buildman and dtoc so that
pylint is able to recognise these as Python modules and produce more
useful pylint output.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agopatman: Update the list of modules
Simon Glass [Mon, 22 Nov 2021 03:48:38 +0000 (20:48 -0700)]
patman: Update the list of modules

Update the __init__ file to include recently added files.

Add a license header while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodtoc: Fix up a code comment that confuses pylint
Simon Glass [Mon, 22 Nov 2021 03:48:37 +0000 (20:48 -0700)]
dtoc: Fix up a code comment that confuses pylint

This produces a pylint error at present. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years ago.gitignore: Ignore any html coverage directory
Simon Glass [Mon, 22 Nov 2021 03:48:36 +0000 (20:48 -0700)]
.gitignore: Ignore any html coverage directory

This is created when checking code coverage of Python tools. Ignore it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agopci: iproc: Set all 24 bits of PCI class code
Pali Rohár [Wed, 5 Jan 2022 09:50:20 +0000 (10:50 +0100)]
pci: iproc: Set all 24 bits of PCI class code

Register 0x43c in its low 24 bits contains PCI class code.

Update code to set all 24 bits of PCI class code and not only upper 16 bits
of PCI class code.

Use standard U-Boot macro (PCI_CLASS_BRIDGE_PCI << 8) for constructing all
24-bits of PCI class for PCI bridge Normal decode.

Signed-off-by: Pali Rohár <pali@kernel.org>
Acked-by: Roman Bacik <roman.bacik@broadcom.com>
2 years agoMerge branch '2022-01-24-assorted-fixes-and-updates'
Tom Rini [Mon, 24 Jan 2022 15:39:28 +0000 (10:39 -0500)]
Merge branch '2022-01-24-assorted-fixes-and-updates'

- Assorted dumpimage/mkimage fixes, allow setting the signature
  algorithm on the command line with mkimage
- Bugfix to the misc uclass, CONFIG_MP / CMD_MP Kconfig logic improved,
  updated Xen platform MAINTAINERS entry and fixed vexpress_aemv8a_semi
  booting.

2 years agocmd: Add Kconfig option for multiprocessor cmds
Ashok Reddy Soma [Mon, 17 Jan 2022 09:16:50 +0000 (10:16 +0100)]
cmd: Add Kconfig option for multiprocessor cmds

Add Kconfig option(CONFIG_CMD_MP) to enable or disable multiprocessor
commands. Compile cmd/mp.c based on CONFIG_CMD_MP.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2 years agomkimage: struct stat.st_size may not be long
Heinrich Schuchardt [Sat, 15 Jan 2022 19:12:56 +0000 (20:12 +0100)]
mkimage: struct stat.st_size may not be long

The component st_size of struct stat is of type off_t. Depending on the
system printing it using %ld leads to a warning:

tools/mkimage.c:438:54: warning: format '%ld' expects argument of type
'long int', but argument 5 has type
'off_t' {aka 'long long int'} [-Wformat=]
  438 |     "%s: Bad size: \"%s\" is not valid image: size %ld < %u\n",
      |                                                    ~~^
      |                                                      |
      |                                                      long int
      |                                                    %lld

When comparing an off_t value to a 32bit integer we should not convert to
uint32_t but to off_t which may be wider.

Reported-by: Milan P. Stanić <mps@arvanta.net>
Fixes: 331f0800f1a3 ("mkimage: allow -l to work on block devices on Linux")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
2 years agoMAINTAINERS: Update e-mail in Xen maintainership
Anastasiia Lukianenko [Wed, 19 Jan 2022 20:49:21 +0000 (22:49 +0200)]
MAINTAINERS: Update e-mail in Xen maintainership

Changing e-mail because of leaving EPAM.

Signed-off-by: Anastasiia Lukianenko <vicooodin@gmail.com>
Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
2 years agomkimage: Allow to specify the signature algorithm on the command line
Jan Kiszka [Fri, 14 Jan 2022 09:21:19 +0000 (10:21 +0100)]
mkimage: Allow to specify the signature algorithm on the command line

This permits to prepare FIT image description that do not hard-code the
final choice of the signature algorithm, possibly requiring the user to
patch the sources.

When -o <algo> is specified, this information is used in favor of the
'algo' property in the signature node. Furthermore, that property is set
accordingly when writing the image.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2 years agomkimage: Drop unused OPT_STRING constant
Jan Kiszka [Fri, 14 Jan 2022 09:21:18 +0000 (10:21 +0100)]
mkimage: Drop unused OPT_STRING constant

The actual opt string is inlined - and different. Seems this was a
left-over from older versions of 603e26f76346.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoimage-fit: Make string of algo parameter constant
Jan Kiszka [Fri, 14 Jan 2022 09:21:17 +0000 (10:21 +0100)]
image-fit: Make string of algo parameter constant

Modifications would be invalid.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agomisc: mark write buffer const
John Keeping [Tue, 11 Jan 2022 17:04:49 +0000 (17:04 +0000)]
misc: mark write buffer const

The write operation in misc_ops already takes a "const void *" buffer,
but misc_write() takes a mutable "void *".  There's no reason for this,
so make misc_write() consistent with the standard write() prototype.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agotools/fitimage: make sure dumpimage still works when "@" are detected
Stefan Eichenberger [Mon, 10 Jan 2022 17:48:32 +0000 (18:48 +0100)]
tools/fitimage: make sure dumpimage still works when "@" are detected

fit_verify_header fails if it detects unit addresses "@". However, this
will break tools like dumpimage on fit images which worked with previous
versions of the tool (e.g. 2020.04 vs 2021.07). As an example the output
of:
dumpimage -l <fit image>
is:
FIT description: U-Boot fitImage for Linux Distribution
Created:         Thu Jan  1 01:00:00 1970
 Image 0 (kernel@1)
  Description:  Linux kernel
  Created:      Thu Jan  1 01:00:00 1970
  Type:         Kernel Image
  Compression:  gzip compressed
  Data Size:    6442456 Bytes = 6291.46 KiB = 6.14 MiB
  Architecture: AArch64
  OS:           Linux
  Load Address: 0x80080000
  Entry Point:  0x80080000
  Hash algo:    sha256
  Hash value:   ...
 Image 1 (fdt@freescale_fsl-s32g274a-evb.dtb)
  Description:  Flattened Device Tree blob
  Created:      Thu Jan  1 01:00:00 1970
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    39661 Bytes = 38.73 KiB = 0.04 MiB
  Architecture: AArch64
  Hash algo:    sha256
  Hash value:   ...
 Default Configuration: 'conf@freescale_fsl-s32g274a-evb.dtb'
 Configuration 0 (conf@freescale_fsl-s32g274a-evb.dtb)
  Description:  1 Linux kernel, FDT blob
  Kernel:       kernel@1
  FDT:          fdt@freescale_fsl-s32g274a-evb.dtb
  Hash algo:    sha256
  Hash value:   unavailable

But with newer version it shows:
dumpimage -l <fit image>
GP Header: Size d00dfeed LoadAddr 62f0a4

This commit will output a warning that unit addresses were detected but
will not fail:
dumpimage -l <fit image>
Image contains unit addresses @, this will break signing
...

Signed-off-by: Stefan Eichenberger <eichest@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agotools/fitimage: remove redundant format check
Stefan Eichenberger [Mon, 10 Jan 2022 17:48:31 +0000 (18:48 +0100)]
tools/fitimage: remove redundant format check

fit_extract_contents does a fit_check_format even thought it was already
checked during imagetool_verify_print_header.
Therefore, this check is not necessary. This commit removes the
redundancy.

Signed-off-by: Stefan Eichenberger <eichest@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agovexpress64: semi_defconfig: disable CRC32 support
Andre Przywara [Fri, 21 Jan 2022 16:36:04 +0000 (16:36 +0000)]
vexpress64: semi_defconfig: disable CRC32 support

Commit 270f8710f92f ("crc32: Add crc32 implementation using
__builtin_aarch64_crc32b") enabled the usage of ARMv8 CRC instructions
by default, for all arm64 builds. And indeed all Arm Ltd. v8 Cortex-A
cores support the instructions, and they are mandatory starting with
architecture revision v8.1, so realistically every known hardware
implementation should support them.

The Arm Fastmodel however defaults to the bare minimum ARMv8 feature set
by default, which means v8.0 without the CRC instructions, so U-Boot
hangs very early at the moment, without any output (the boot-wrapper or
TF-A printing the last visible lines).

Support for those instructions can be enabled on the model command line
by either:
-C cluster0.cpu0.enable_crc32=1 (for each core)
or by using a higher architecture revision by default:
-C cluster0.has_arm_v8-1=1 (for each cluster)
Of course any arch revision higher than v8.1 would work as well.

But for the sake of a smooth out-of-the-box experience, let's just
disable the usage of those instructions in the defconfig, to avoid
random hangs without any clues.

Reported-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Marek Vasut <marex@denx.de>
2 years agoMerge tag 'u-boot-stm32-20220124' of https://source.denx.de/u-boot/custodians/u-boot-stm
Tom Rini [Mon, 24 Jan 2022 13:19:31 +0000 (08:19 -0500)]
Merge tag 'u-boot-stm32-20220124' of https://source.denx.de/u-boot/custodians/u-boot-stm

- stm32mp15: sync DT with kernel v5.16
- stm32mp15: Enable OF_BOARD config flag
- DHCOM: sync DT with kernel 5.15.12
- stm32mp: Fix USB boot device
- stm32mp: Remove bootcount activation
- stm32mp: Fix board_get_alt_info_mmc()
- board: stm32mp1: solve compilation issue when ENV_IS_IN_MMC is deactivated
- stm32prog: add partition name in treat_partition_list error messages

2 years agoconfigs: stm32mp15: Enable OF_BOARD flag
Patrice Chotard [Thu, 20 Jan 2022 07:19:15 +0000 (08:19 +0100)]
configs: stm32mp15: Enable OF_BOARD flag

Since commit 985503439762 ("fdt: Don't call board_fdt_blob_setup()
 without OF_BOARD") board_fdt_blob_setup() is no more called on
STM32MP platforms in trusted boot which hangs during boot process.

Enable OF_BOARD flag to fix this issue.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agostm32prog: add partition name in treat_partition_list error messages
Patrick Delaunay [Tue, 18 Jan 2022 09:33:14 +0000 (10:33 +0100)]
stm32prog: add partition name in treat_partition_list error messages

Add the partition name and remove the line number in error messages
of treat_partition_list() to provide correct information to user of
STM32CubeProgrammer.

The "line number" value was confusing because it is incorrect here;
the index in  part_array[] is not aligned with the line number in
the parsed Layout file, because the empty lines and the lines beginning
by '#' are skipped during the first parsing in parse_flash_layout().

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoboard: stm32mp1: solve compilation issue when ENV_IS_IN_MMC is deactivated
Patrick Delaunay [Tue, 11 Jan 2022 15:37:21 +0000 (16:37 +0100)]
board: stm32mp1: solve compilation issue when ENV_IS_IN_MMC is deactivated

Solve compilation issue on undefined CONFIG_SYS_MMC_ENV_DEV when
CONFIG_ENV_IS_IN_MMC is deactivated on STMicroelectronics boards
defconfig

Fixes: 9f97193616f1 ("board: stm32mp1: use CONFIG_SYS_MMC_ENV_DEV when available")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agostm32mp: fix board_get_alt_info_mmc()
Heinrich Schuchardt [Tue, 11 Jan 2022 14:58:08 +0000 (15:58 +0100)]
stm32mp: fix board_get_alt_info_mmc()

MAX_SEARCH_PARTITIONS is the highest possible partition number.
Do not skip the last partition in board_get_alt_info_mmc().

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agoARM: dts: stm32: Synchronize DHCOM DTs with Linux 5.15.12
Marek Vasut [Thu, 30 Dec 2021 22:46:47 +0000 (23:46 +0100)]
ARM: dts: stm32: Synchronize DHCOM DTs with Linux 5.15.12

Synchronize DH DHCOM DTs with Linux commit 25960cafa06e ("Linux 5.15.12").
There is no functional change to the resulting DTs. The eeprom0 alias and
PHY reset GPIO are now reinstated in SoM u-boot dtsi.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agoARM: dts: stm32: Synchronize DHCOR DTs with Linux 5.15.12
Marek Vasut [Thu, 30 Dec 2021 22:46:46 +0000 (23:46 +0100)]
ARM: dts: stm32: Synchronize DHCOR DTs with Linux 5.15.12

Synchronize DH DHCOR DTs with Linux commit 25960cafa06e ("Linux 5.15.12").
There is no functional change to the resulting DTs. The eeprom0 alias is
now reinstated in SoM u-boot dtsi, the PHY reset GPIO is reinstated in AV96
u-boot dtsi.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agoarm: dts: stm32mp15: alignment with v5.16
Patrick Delaunay [Fri, 17 Dec 2021 15:30:22 +0000 (16:30 +0100)]
arm: dts: stm32mp15: alignment with v5.16

Device tree alignment with Linux kernel v5.16-rc5
- ARM: dts: stm32: set otg-rev on stm32mp151
- ARM: dts: stm32: use usbphyc ck_usbo_48m as USBH OHCI clock on stm32mp151
- ARM: dts: stm32: fix AV96 board SAI2 pin muxing on stm32mp15
- ARM: dts: stm32: fix SAI sub nodes register range
- ARM: dts: stm32: fix STUSB1600 Type-C irq level on stm32mp15xx-dkx

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agostm32mp: correct the dependency for bootcount configs
Patrick Delaunay [Tue, 7 Dec 2021 09:05:59 +0000 (10:05 +0100)]
stm32mp: correct the dependency for bootcount configs

Default value for CONFIG_SYS_BOOTCOUNT_SINGLEWORD and
CONFIG_SYS_BOOTCOUNT_ADDR are only needed when
CONFIG_BOOTCOUNT_GENERIC is used.

This patch avoids to define these configs when an other bootcount backend
is activated, for example for CONFIG_BOOTCOUNT_ENV.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agostm32mp: remove the bootcount activation
Patrick Delaunay [Tue, 7 Dec 2021 09:05:58 +0000 (10:05 +0100)]
stm32mp: remove the bootcount activation

Today the bootcount is not managed by the Linux kernel for STM32MP15 as
we don't have driver to update the used backup register in TAMP and the
recovery command still executes the normal bootcmd with
'altbootcmd=run bootcmd'.

So the bootcount feature is never used, the config CONFIG_BOOTCOUNT_LIMIT
and the associated environment variable 'altbootcmd' can be removed to
reduce the U-Boot size.

Each boards can re-enable this feature later in their defconfig, if it is
needed, with the expected backend, for example CONFIG_BOOTCOUNT_GENERIC
or CONFIG_BOOTCOUNT_ENV.

CC: Marek Vasut <marex@denx.de>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoARM: dts: stm32: Add DFU support for DHCOR recovery
Marek Vasut [Mon, 6 Dec 2021 20:58:09 +0000 (21:58 +0100)]
ARM: dts: stm32: Add DFU support for DHCOR recovery

This patch configures U-Boot SPL for DHCOR SoM to permit DFU upload of
SPL and subsequent u-boot.itb for recovery or commissioning purposes.

To start U-Boot on DHCOR based board, e.g. Avenger96, proceed as follows:
- Install dfu-util on the host PC (in debian this is package 'dfu-util')

- Power off the Avenger96 board.
- Connect both USB-serial console and USB-OTG microB ports to host PC.
- Switch Avenger96 to USB boot mode -- BOOT0..2 switches all set to 0.
- Power on the Avenger96 board.
- Verify using '$ dmesg' that a new device has been detected as follows:
    New USB device found, idVendor=0483, idProduct=df11, bcdDevice= 2.00
    New USB device strings: Mfr=1, Product=2, SerialNumber=3
    Product: DFU in HS Mode @Device ID /0x500, @Revision ID /0x0000
    Manufacturer: STMicroelectronics

- Upload U-Boot SPL:
$ dfu-util -a 1 -D u-boot-spl.stm32
- Upload U-Boot proper:
$ dfu-util -a 0 -D u-boot.itb

- At this point, SPL will wait for user to press "Ctrl-C" on serial
  console. When ready to interact with U-Boot, press Ctrl-C to start
  the bootloader.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoarm: stm32mp: Fix USB boot device report
Marek Vasut [Mon, 6 Dec 2021 20:58:08 +0000 (21:58 +0100)]
arm: stm32mp: Fix USB boot device report

In case the SoC reports the boot device type is USB, it means the SPL was
loaded via BootROM DFU mode. Currently the spl_boot_device() returns boot
device as USB host, change it to DFU instead, so the SPL can continue the
DFU boot and load U-Boot via DFU.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-sh
Tom Rini [Sun, 23 Jan 2022 14:54:49 +0000 (09:54 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-sh

- rzg2_beacon updates

2 years agoarm: dts: rz-g2-beacon-u-boot: Enable pinmux for QSPI
Adam Ford [Tue, 11 Jan 2022 13:21:06 +0000 (07:21 -0600)]
arm: dts: rz-g2-beacon-u-boot: Enable pinmux for QSPI

When booting from QSPI, the boot ROM appears to mux the QSPI
pins, but it's not guaranteed to be setup when booting from
eMMC.  Fix this by explicitly configuring the pinmux.

Signed-off-by: Adam Ford <aford173@gmail.com>
2 years agoarm: rmobile: rzg2_beacon: Migrate reset to SYSRESET_PSCI
Adam Ford [Fri, 17 Dec 2021 19:47:59 +0000 (13:47 -0600)]
arm: rmobile: rzg2_beacon: Migrate reset to SYSRESET_PSCI

Instead of a custom cpu_reset function, use the sysreset_psci
instead to reduce redundant code clutter.

Signed-off-by: Adam Ford <aford173@gmail.com>
2 years agoMerge tag 'efi-2022-04-rc1-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sat, 22 Jan 2022 20:43:36 +0000 (15:43 -0500)]
Merge tag 'efi-2022-04-rc1-2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2022-04-rc1-2

Documentation:

* describe printf() format codes

UEFI

* enable more algorithms for UEFI image verification, e.g. SHA256-RSA2048

General

* simplify printing short texts for GUIDs
* provide a unit test for printing GUIDs

2 years agoMerge branch '2022-01-21-Kconfig-migrations'
Tom Rini [Fri, 21 Jan 2022 19:01:41 +0000 (14:01 -0500)]
Merge branch '2022-01-21-Kconfig-migrations'

- Migrate CONFIG_KEEP_SERVERADDR, CONFIG_UDP_CHECKSUM, CONFIG_TIMESTAMP,
  CONFIG_BOOTP_SERVERIP, CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR,
  CONFIG_SYS_MAX_FLASH_BANKS_DETECT, CONFIG_SYS_MAX_FLASH_BANKS and
  CONFIG_AT91_EFLASH to Kconfig

2 years agoConvert CONFIG_AT91_EFLASH to Kconfig
Patrick Delaunay [Tue, 4 Jan 2022 13:24:01 +0000 (14:24 +0100)]
Convert CONFIG_AT91_EFLASH to Kconfig

This converts the following to Kconfig:
   CONFIG_AT91_EFLASH

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Acked-by: Eugen Hristev <eugen.hristev@microchip.com>
2 years agoconfigs: Migrate CONFIG_SYS_MAX_FLASH_BANKS to Kconfig
Patrick Delaunay [Tue, 4 Jan 2022 13:24:00 +0000 (14:24 +0100)]
configs: Migrate CONFIG_SYS_MAX_FLASH_BANKS to Kconfig

Use moveconfig.py script to convert define CONFIG_SYS_MAX_FLASH_BANKS
and CONFIG_SYS_MAX_FLASH_BANKS_DETECT to Kconfig and move these entries
to defconfigs.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
[trini: Re-switch to IS_ENABLED check in spi-nor-core.c, re-run migration]
Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agomtd: cfi: change CONFIG_SYS_MAX_FLASH_BANKS_DETECT as boolean
Patrick Delaunay [Tue, 4 Jan 2022 13:23:59 +0000 (14:23 +0100)]
mtd: cfi: change CONFIG_SYS_MAX_FLASH_BANKS_DETECT as boolean

Prepare migration to Kconfig.

CONFIG_SYS_MAX_FLASH_BANKS_DETECT becomes boolean and
CONFIG_SYS_MAX_FLASH_BANKS define the MAX size, also used
for detection when CONFIG_SYS_MAX_FLASH_BANKS_DETECT=y
(CFI_MAX_FLASH_BANKS = CONFIG_SYS_MAX_FLASH_BANKS).

CONFIG_SYS_MAX_FLASH_BANKS become mandatory when
CONFIG_SYS_MAX_FLASH_BANKS_DETECT is activated.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Stefan Roese <sr@denx.de>