platform/kernel/u-boot.git
16 months agoclk: at91: pmc: export clock setup to pmc
Claudiu Beznea [Wed, 8 Mar 2023 14:39:52 +0000 (16:39 +0200)]
clk: at91: pmc: export clock setup to pmc

Clock setup was intended for setting clocks at boot time on SAMA7G5,
e.g. for root clocks like PLLs, that were used to feed IPs needed alive
in u-boot (e.g. Ethernet clock feed by a PLL). Export this functionality
to all at91 clocks as it may be necessary on other SoCs.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
16 months agoclk: at91: sam9x60: Register the required clocks for USB
Sergiu Moga [Wed, 8 Mar 2023 14:39:51 +0000 (16:39 +0200)]
clk: at91: sam9x60: Register the required clocks for USB

Register into DM the clocks required to properly enable USB functionality
within the bootloader.

Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
16 months agoclk: at91: Add support for sam9x60 USB clock
Sergiu Moga [Wed, 8 Mar 2023 14:39:50 +0000 (16:39 +0200)]
clk: at91: Add support for sam9x60 USB clock

Implement sam9x60 USB clock driver. This clock has
three parents: PLLA, UPLL and MAINXTAL. The driver is
aware of the three possible parents with the help of the
two mux tables provied to the driver during the registration
of the clock.

Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
16 months agoMerge tag 'efi-next-20230325' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Sat, 25 Mar 2023 21:34:34 +0000 (17:34 -0400)]
Merge tag 'efi-next-20230325' of https://source.denx.de/u-boot/custodians/u-boot-efi into next

Pull request for efi-next-20230325

Documenation:

* add man-page for efi command

UEFI:

* Let EFI app call ExitBootServices() before legacy booting kernel
* Support zboot and bootm in the EFI app
* Let efi command show configuration tables
* Support booting a 64-bit kernel from 64-bit EFI app
* Allocate device-tree copy from high memory
* simplify efi_str_to_u16()

16 months agocmd: bootefi: allocate device-tree copy from high memory
Heinrich Schuchardt [Thu, 23 Feb 2023 19:27:38 +0000 (20:27 +0100)]
cmd: bootefi: allocate device-tree copy from high memory

The bootefi command creates a copy of the device-tree within the first
127 MiB of memory. This may lead to overwriting previously loaded binaries
(e.g. kernel, initrd).

Linux EFI stub itself copies U-Boot's copy of the device-tree. This means
there is not restriction for U-Boot to place the device-tree copy to any
address. (Restrictions existed for 32bit ARM before Linux commit
7a1be318f579 ("ARM: 9012/1: move device tree mapping out of linear region")
for legacy booting.

Reported-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Tested-by: Alexandre Ghiti <alexghiti@rivosinc.com>
16 months agoefI: Allow packaging a kernel in the debugging script
Simon Glass [Sun, 19 Mar 2023 19:30:16 +0000 (08:30 +1300)]
efI: Allow packaging a kernel in the debugging script

Add an option to package a kernel into the debugging script used for
EFI.

The name of the kernel must be added to the script. By default it is
assumed that the kernel is built in the /tmp/kernel directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agoefi: Support showing tables
Simon Glass [Sun, 19 Mar 2023 19:30:15 +0000 (08:30 +1300)]
efi: Support showing tables

Add a command (for the app and payload) to display the tables provided
by EFI. Note that for the payload the tables should always be present, so
an error message is unnecessary and would bloat the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agoefi: Split out table-listing code into a new file
Simon Glass [Sun, 19 Mar 2023 19:30:14 +0000 (08:30 +1300)]
efi: Split out table-listing code into a new file

This code is used with EFI_LOADER but is also useful (with some
modifications) for the EFI app and payload. Move it into a shared
file.

Show the address of the table so it can be examined if needed. Also show
the table name as unknown if necessary. Our list of GUIDs is fairly
small.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agodoc: Add help for the efi command
Simon Glass [Sun, 19 Mar 2023 19:30:13 +0000 (08:30 +1300)]
doc: Add help for the efi command

This command currently has no help. Add some.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agoefi: Include GUID names with EFI app and payload
Simon Glass [Sun, 19 Mar 2023 19:30:12 +0000 (08:30 +1300)]
efi: Include GUID names with EFI app and payload

These are currently only available when running with EFI_LOADER.
Expand this to include the app and payload, since it is useful to be
able to decode things there.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agoefi: Add another tranch of GUIDs
Simon Glass [Sun, 19 Mar 2023 19:30:11 +0000 (08:30 +1300)]
efi: Add another tranch of GUIDs

Provide information about the GUIDs supplied by QEMU, so far as it is
known.

These values are used in the 'efi table' command as well as the printf
format string %sU

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agox86: Support zboot and bootm in the EFI app
Simon Glass [Sun, 19 Mar 2023 19:30:10 +0000 (08:30 +1300)]
x86: Support zboot and bootm in the EFI app

These have been disabled due to the rudimentary support available. It is
a little better now, so enable these options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
16 months agox86: Exit EFI boot services before starting kernel
Simon Glass [Sun, 19 Mar 2023 19:30:09 +0000 (08:30 +1300)]
x86: Exit EFI boot services before starting kernel

When running the EFI app, we need to exit boot services before jumping
to Linux.

At some point it may be possible to jump to Linux and pass on the system
table, and:

  * install the device-tree as configuration table
  * use LoadImage() to load the kernel image (e.g. from memory)
  * start the image with StartImage()

This should allow the Linux efistub to be used. For now, this is not
implemented.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agox86: Support booting a 64-bit kernel from 64-bit U-Boot
Simon Glass [Sun, 19 Mar 2023 19:30:08 +0000 (08:30 +1300)]
x86: Support booting a 64-bit kernel from 64-bit U-Boot

Add the missing code to handle this. For a 64-bit kernel the entry
address is 0x200 bytes after the normal entry.

Rename the parameter to boot_linux_kernel() accordingly. Update the
comments to indicate that these are addresses, not pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agox86: Add return-value comment to cpu_jump_to_64bit()
Simon Glass [Sun, 19 Mar 2023 19:30:07 +0000 (08:30 +1300)]
x86: Add return-value comment to cpu_jump_to_64bit()

This does not mention what it returns. Add the missing documentation.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agox86: Adjust bootparam.h to be more like linux
Simon Glass [Sun, 19 Mar 2023 19:30:06 +0000 (08:30 +1300)]
x86: Adjust bootparam.h to be more like linux

This likely came from Linux originally, so update it to match v6.2 more.
This has no functional change.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agoefi: Set RUN_64BIT correctly for the EFI app
Simon Glass [Sun, 19 Mar 2023 19:30:05 +0000 (08:30 +1300)]
efi: Set RUN_64BIT correctly for the EFI app

The U-Boot EFI app can run as a 64-bit program, so set the Kconfig
correctly in that case. Make sure it doesn't build SPL, since there is
no need to switch from 32 to 64 bit when running.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agoefi_loader: simplify efi_str_to_u16()
Heinrich Schuchardt [Sun, 19 Mar 2023 08:20:23 +0000 (09:20 +0100)]
efi_loader: simplify efi_str_to_u16()

Use efi_alloc() to allocate memory.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agoefi_loader: move dp_alloc() to efi_alloc()
Heinrich Schuchardt [Sun, 19 Mar 2023 08:20:22 +0000 (09:20 +0100)]
efi_loader: move dp_alloc() to efi_alloc()

The incumbent function efi_alloc() is unused.

Replace dp_alloc() by a new function efi_alloc() that we can use more
widely.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
16 months agoefi_loader: move struct efi_device_path to efi.h
Heinrich Schuchardt [Sun, 19 Mar 2023 07:59:33 +0000 (08:59 +0100)]
efi_loader: move struct efi_device_path to efi.h

Avoid forward declaration of struct efi_device_path.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
16 months agoefi_loader: fix device-path for USB devices
Heinrich Schuchardt [Sun, 19 Mar 2023 15:18:09 +0000 (16:18 +0100)]
efi_loader: fix device-path for USB devices

EFI device paths for block devices must be unique. If a non-unique device
path is discovered, probing of the block device fails.

Currently we use UsbClass() device path nodes. As multiple devices may
have the same vendor and product id these are non-unique. Instead we
should use Usb() device path nodes. They include the USB port on the
parent hub. Hence they are unique.

A USB storage device may contain multiple logical units. These can be
modeled as Ctrl() nodes.

Reported-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agoefi_loader: support for Ctrl() device path node
Heinrich Schuchardt [Sun, 19 Mar 2023 15:18:08 +0000 (16:18 +0100)]
efi_loader: support for Ctrl() device path node

* Add the definitions for Ctrl() device path nodes.
* Implement Ctrl() nodes in the device path to text protocol.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
16 months agoMerge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-marvell into...
Tom Rini [Sat, 25 Mar 2023 02:25:28 +0000 (22:25 -0400)]
Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-marvell into next

- mvebu: kwboot: Fix UART booting (Pali)
- mvebu: doc: Misc updates / fixes (Pali)
- kirkwood: Early init enhancements, e.g. for DEBUG UART (Pali & Tony)
- mvebu: Enable NAND flash for Thecus N2350 board (Tony)
- mvebu: Set common SPI flash default speed and mode (Tony)

16 months agotools: kwboot: Document information about NOR XIP
Pali Rohár [Thu, 23 Mar 2023 20:00:07 +0000 (21:00 +0100)]
tools: kwboot: Document information about NOR XIP

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
16 months agotools: kwboot: Workaround A38x BootROM bug for images with a gap
Pali Rohár [Thu, 23 Mar 2023 19:57:55 +0000 (20:57 +0100)]
tools: kwboot: Workaround A38x BootROM bug for images with a gap

A38x BootROM has a bug which cause that BootROM loads data part of UART
image into RAM target address increased by one byte when source address
and header size stored in the image header are not same.

Workaround this bug by completely removing a gap between header and data
part of the UART image. Without gap, this BootROM bug is not triggered.

This gap can be present in SDIO or SATA image types which have aligned
start of the data part to the media sector size. With this workaround
kwboot should be able to convert and send SDIO or SATA images for UART
booting.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
16 months agotools: kwboot: Fix sending very small images
Pali Rohár [Thu, 23 Mar 2023 19:57:54 +0000 (20:57 +0100)]
tools: kwboot: Fix sending very small images

Sending of very small images (smaller than 128 bytes = xmodem block size)
cause out-of-bound memory read access. Fix this issue by ensuring that
hdrsz when sending image is not larger than total size of the image.
Issue was introduced in commit f8017c37799c ("tools: kwboot: Fix sending
Kirkwood v0 images"). Special case when total image is smaller than header
size aligned to multiply of xmodem size is already handled since that
commit.

Fixes: f8017c37799c ("tools: kwboot: Fix sending Kirkwood v0 images")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
16 months agotools: kwboot: Fix inserting UART data checksum without -B option
Pali Rohár [Thu, 23 Mar 2023 19:57:53 +0000 (20:57 +0100)]
tools: kwboot: Fix inserting UART data checksum without -B option

Commit 7665ed2fa04e ("tools: kwboot: Fix parsing UART image without data
checksum") added fixup code to insert place for data checksum if UART image
does not have it. Together with option -B (change baudrate), kwboot
calculates this checksum. Without option -B, it inserts only place for
checksum but does not calculate it.

This commit fix above logic and calculate data checksum also when kwboot is
used without -B option.

Fixes: 7665ed2fa04e ("tools: kwboot: Fix parsing UART image without data checksum")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
16 months agotools: kwboot: Fix invalid UART kwbimage v1 headersz
Pali Rohár [Thu, 23 Mar 2023 19:57:52 +0000 (20:57 +0100)]
tools: kwboot: Fix invalid UART kwbimage v1 headersz

Ensure that UART aligned header size is always stored into kwbimage v1
header. It is needed for proper UART booting. Calculation of headersz field
was broken in commit d656f5a0ee22 ("tools: kwboot: Calculate real used
space in kwbimage header when calling kwboot_img_grow_hdr()") which
introduced optimization of kwboot_img_grow_hdr() function.

Fixes: d656f5a0ee22 ("tools: kwboot: Calculate real used space in kwbimage header when calling kwboot_img_grow_hdr()")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
16 months agotools: kwbimage: Fix invalid UART kwbimage v1 headersz
Pali Rohár [Thu, 23 Mar 2023 19:57:51 +0000 (20:57 +0100)]
tools: kwbimage: Fix invalid UART kwbimage v1 headersz

Armada 385 BootROM ignores low 7 bits of headersz when parsing kwbimage
header of UART type, which effectively means that headersz is rounded down
to multiply of 128 bytes. For all other image types BootROM reads and use
all bits of headersz. Therefore fill into UART type of kwbimage v1 headersz
aligned to 128 bytes.

Fixes: 2b0980c24027 ("tools: kwbimage: Fill the real header size into the main header")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
16 months agoddr: marvell: a38x: Remove unused file seq_exec.h
Pali Rohár [Sat, 4 Mar 2023 12:26:46 +0000 (13:26 +0100)]
ddr: marvell: a38x: Remove unused file seq_exec.h

DDR code does not use seq_exec.h, so remove it.

Signed-off-by: Pali Rohár <pali@kernel.org>
16 months agoarm: kirkwood: Enable Debug UART for Zyxel NSA310S
Tony Dinh [Mon, 13 Mar 2023 03:35:51 +0000 (20:35 -0700)]
arm: kirkwood: Enable Debug UART for Zyxel NSA310S

It's useful to enable Debug UART for future DM Serial regression tests
for Kirkwood boards.

Also, see background discussion in this thread:
https://lists.denx.de/pipermail/u-boot/2023-March/512010.html

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
16 months agoarm: kirkwood: Move internal registers in arch_very_early_init() function
Pali Rohár [Sat, 11 Mar 2023 10:57:01 +0000 (11:57 +0100)]
arm: kirkwood: Move internal registers in arch_very_early_init() function

Same change as was done for mvebu in commit 5bb2c550b11e ("arm: mvebu: Move
internal registers in arch_very_early_init() function") but for kirkwood.

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
16 months agodoc/kwboot.1: Update Armada 38x BootROM bug description
Pali Rohár [Sat, 11 Mar 2023 10:42:16 +0000 (11:42 +0100)]
doc/kwboot.1: Update Armada 38x BootROM bug description

Replace SPI-NOR by default boot source location as bug is not SPI-NOR related.

Signed-off-by: Pali Rohár <pali@kernel.org>
16 months agoarm: mvebu: Set common SPI flash default speed and mode
Tony Dinh [Fri, 3 Mar 2023 03:27:29 +0000 (19:27 -0800)]
arm: mvebu: Set common SPI flash default speed and mode

CONFIG_SF_DEFAULT_SPEED is used in SPL SPI to configure and probe the
flash device during DM SPI uclass probing process, if the
spi-max-frequency is not available in the DTB. Currently the max
frequency is not available, because of the probing mechanism in SPI
uclass has not been fully updated to DM.

The CONFIG_SF_DEFAULT_SPEED is set to 1Mhz if a board defconfig
does not specify it. This speed is too slow and result in a few
seconds delay while the u-boot image is loaded from flash. Based on a
survey of the device tree specifications for MVEBU boards, a sane default
value should be 10Mhz. The default of 10Mhz enables an almost
instantaneously loading of the u-boot image.

Note that this patch depends on this patch series (has been merged to
u-boot-marvell/next):
https://lists.denx.de/pipermail/u-boot/2023-March/511038.html

- RESEND: correct spelling of SF_DEFAULT_MODE

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
16 months agoarm: mvebu: Enable NAND flash for Thecus N2350 board
Tony Dinh [Sat, 25 Feb 2023 03:23:23 +0000 (19:23 -0800)]
arm: mvebu: Enable NAND flash for Thecus N2350 board

Enable 512MB PXA3XX NAND flash when u-boot is running.

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Acked-by: Pali Rohár
16 months agoMerge branch '2023-03-22-assorted-minor-code-cleanups' into next
Tom Rini [Thu, 23 Mar 2023 00:57:39 +0000 (20:57 -0400)]
Merge branch '2023-03-22-assorted-minor-code-cleanups' into next

- Minor code cleanups based on problems found by clang or enabling LTO.

16 months agopurism: librem5: Fix a function declaration in spl.c
Tom Rini [Thu, 9 Mar 2023 16:22:11 +0000 (11:22 -0500)]
purism: librem5: Fix a function declaration in spl.c

Here we implement usb_gadget_handle_interrupts() but did not include
<linux/usb/gadget.h> so did not have the declaration correct. Fix this
and add the missing include.

Signed-off-by: Tom Rini <trini@konsulko.com>
16 months agoexamples: Don't use LTO for hello_world
Tom Rini [Thu, 9 Mar 2023 16:22:09 +0000 (11:22 -0500)]
examples: Don't use LTO for hello_world

If we're building U-Boot with LTO, we don't want to use that for
examples as it's more work than required.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agospl: Add function prototype for spl_mmc_get_uboot_raw_sector
Tom Rini [Thu, 9 Mar 2023 16:22:08 +0000 (11:22 -0500)]
spl: Add function prototype for spl_mmc_get_uboot_raw_sector

We did not add a prototype for spl_mmc_get_uboot_raw_sector to
include/spl.h before, so add and document one now. Correct the incorrect
prototype in board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c and
ensure that we have spl.h where we define a non-weak
spl_mmc_get_uboot_raw_sector as well.

Signed-off-by: Tom Rini <trini@konsulko.com>
16 months agoarm: Correct cpu_reset function prototype on some platforms
Tom Rini [Thu, 9 Mar 2023 16:22:07 +0000 (11:22 -0500)]
arm: Correct cpu_reset function prototype on some platforms

Some platforms were not including <cpu_func.h> which sets the prototype
for reset_cpu, and in turn had it set wrong. Correct these cases.

Signed-off-by: Tom Rini <trini@konsulko.com>
16 months agoproftool: Remove unused variables in make_flame_tree
Tom Rini [Mon, 27 Feb 2023 22:08:38 +0000 (17:08 -0500)]
proftool: Remove unused variables in make_flame_tree

With clang-15 we now get reported that in the make_flame_tree function,
neither the missing_count nor depth variables are used, only
incremenete/decremented. Remove these.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agoimx8image: Remove unused cont_img_count variable
Tom Rini [Mon, 27 Feb 2023 22:08:37 +0000 (17:08 -0500)]
imx8image: Remove unused cont_img_count variable

With clang-15, it is now reported that cont_img_count is unused. This is
true as the code will increment / reset this counter, but never
functionally use it. Remove it.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
16 months agozlib: trees.c: Fix a warning with clang-15
Tom Rini [Mon, 27 Feb 2023 22:08:36 +0000 (17:08 -0500)]
zlib: trees.c: Fix a warning with clang-15

With clang-15 we now will get warnings such as:

warning: a function declaration without a prototype is deprecated in all
versions of C [-Wstrict-prototypes]

And it is easy enough to address this warning here, even if we would
like to stay in sync more with upstream as it's a single location.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agolibavb: Fix a warning with clang-15
Tom Rini [Mon, 27 Feb 2023 22:08:35 +0000 (17:08 -0500)]
libavb: Fix a warning with clang-15

With clang-15 we now will get warnings such as:

warning: a function declaration without a prototype is deprecated in all
versions of C [-Wstrict-prototypes]

And it is easy enough to address this warning here, as we aren't
concerned with re-syncing with an upstream.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agodlmalloc: Fix a warning with clang-15
Tom Rini [Mon, 27 Feb 2023 22:08:34 +0000 (17:08 -0500)]
dlmalloc: Fix a warning with clang-15

With clang-15 we now will get warnings such as:

warning: a function declaration without a prototype is deprecated in all
versions of C [-Wstrict-prototypes]

And it is easy enough to address this warning here, as we aren't
concerned with re-syncing with an upstream.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agoglobal: Disable deprecated-non-prototype warning with clang
Tom Rini [Mon, 27 Feb 2023 22:08:33 +0000 (17:08 -0500)]
global: Disable deprecated-non-prototype warning with clang

We have a number of places in the code which use the following syntax:

void func(a, b, c)
    int a; /* Does a */
    something_t *b; /* Pointer to b */
    int c; /* Does c */
{
...
}

Which while not what we document as our coding style, this is also code
which we have imported from other projects, and would like to re-sync
with in the future. While the biggest example of this is the zlib code,
there are other places as well. For now, we will silence this warning.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agoMerge branch '2023-03-21-assorted-CI-updates' into next
Tom Rini [Wed, 22 Mar 2023 14:35:58 +0000 (10:35 -0400)]
Merge branch '2023-03-21-assorted-CI-updates' into next

- Assorted improvements to our GitLab and Azure infrastructure.

16 months agoCI: Allow a mirror to be specified for Docker Hub
Peter Hoyes [Fri, 10 Mar 2023 09:53:03 +0000 (09:53 +0000)]
CI: Allow a mirror to be specified for Docker Hub

To conserve bandwidth and potentially avoid rate limits, allow a local
mirror of Docker Hub to be specified globally. The default value is
unchanged.

Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
16 months agoCI: Allow job tag to be optionally set globally
Peter Hoyes [Fri, 10 Mar 2023 09:53:02 +0000 (09:53 +0000)]
CI: Allow job tag to be optionally set globally

The default behavior of Gitlab runners is to only run jobs which match
the configured tag, although there is an option to run untagged jobs
[1].

To support running the CI in more complex environments where different
types of runners may be present that support different tags, allow the
DEFAULT_TAG for all jobs in the pipeline to be set globally using an
environment variable. An empty default value is provided to retain
support for untagged runners.

[1] https://docs.gitlab.com/ee/ci/runners/configure_runners.html#use-tags-to-control-which-jobs-a-runner-can-run

Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
16 months agoCI: gitlab: Collect pytest artifacts
Marek Vasut [Fri, 3 Mar 2023 01:22:25 +0000 (02:22 +0100)]
CI: gitlab: Collect pytest artifacts

Copy build artifacts for all test.py tests, so they show up in
artifacts storage for later inspection. The test.py tests output
in CI is basically useless, but it is far more useful in the html
output for analysis and debugging.

Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Suggested-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
16 months agoAzure CI: Be explicit about pytest cache directory
Tom Rini [Tue, 28 Feb 2023 20:28:49 +0000 (15:28 -0500)]
Azure CI: Be explicit about pytest cache directory

The default pytest cache directory is in a read-only directory in Azure,
which results in a warning on the build page. Use the pytest command
line option to set the cache dir to somewhere writable.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agoAzure CI: Save pytest output automatically
Tom Rini [Tue, 28 Feb 2023 20:28:48 +0000 (15:28 -0500)]
Azure CI: Save pytest output automatically

Enable use of the python-azurepipelines package which provides automatic
formatting and uploading of the pytest output.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agoDockerfile: Update to latest "Jammy" tag
Tom Rini [Tue, 21 Mar 2023 19:31:19 +0000 (15:31 -0400)]
Dockerfile: Update to latest "Jammy" tag

Update to using the latest "Jammy" tag as our base.

Signed-off-by: Tom Rini <trini@konsulko.com>
16 months agoDockerfile: Add m68k-softmmu to qemu
Tom Rini [Tue, 21 Mar 2023 19:28:00 +0000 (15:28 -0400)]
Dockerfile: Add m68k-softmmu to qemu

Given efforts to add an m68k target to CI, build qemu for it.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
16 months agoMerge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-sh into next
Tom Rini [Mon, 20 Mar 2023 21:51:10 +0000 (17:51 -0400)]
Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-sh into next

16 months agoMerge branch '2023-03-17-improve-read-command-add-write-command' into next
Tom Rini [Mon, 20 Mar 2023 20:31:52 +0000 (16:31 -0400)]
Merge branch '2023-03-17-improve-read-command-add-write-command' into next

To quote the author:
The first patch simplies do_read somewhat by making use of an existing
helper instead of parsing the dev_part string manually. As a bonus
(and my actual motivation), it now understands dev#partname syntax -
hard-coded partition numbers are so last decade.

I also need the symmetrical operation, being able to write to a named
raw partition, and fortunately it doesn't require that many lines of
code to implement that.

There's a very minor change in the error reporting due to using
cmdtp->name to generate the new messages, but I don't think "Error
reading blocks" offers much that "read error" doesn't.

New in v2: the last three patches add documentation, ensure CMD_WRITE
is set for sandbox and adds some basic test cases for the various ways
of accessing the partitions (by number, name, or as raw offset within
the whole disk).

v3: Add Simon's R-b to patches 2, 4, 5, fixup whitespace in patch 5.

I don't want to duplicate the documentation, but I can see the value
in 'write' having its own entry in the TOC, so I added a stub
write.rst that just refers to the read.rst, which then explicitly
documents both.

16 months agoserial: sh: Make indent consistent
Marek Vasut [Tue, 28 Feb 2023 21:19:30 +0000 (22:19 +0100)]
serial: sh: Make indent consistent

Make the indent of these macro elements consistent with the
rest of this table. No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
16 months agoserial: sh: Add DEBUG_UART support
Marek Vasut [Tue, 28 Feb 2023 21:17:22 +0000 (22:17 +0100)]
serial: sh: Add DEBUG_UART support

Add support for debug output very early during boot using the DEBUG_UART
mechanism. This uses a static fixed UART port configuration selected via
Kconfig options and dedicated print functions from debug_uart.h. This is
useful e.g. when debugging problems so early during boot, that not even
the DM is initialized at that point, and thus DM_SERIAL is not available
either.

This functionality is disabled by default. To activate it, define the
following Kconfig options and select SCIF type using CFG_SCI/CFG_SCIF_A/
CFG_HSCIF/<nothing for regular SCIF>:

CONFIG_DEBUG_UART=y
CONFIG_DEBUG_UART_SCIF=y
CONFIG_DEBUG_UART_BASE=0xe6540000
CONFIG_DEBUG_UART_CLOCK=24000000

The later two options define the SCIF physical base address and SCIF
input clock in Hz. Optionally, to validate DEBUG_UART works, enable
the following as well to get early serial output message by default:

CONFIG_DEBUG_UART_ANNOUNCE=y

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
16 months agoserial: sh: Rename CONFIG_SCI and CONFIG_SCIF_USE_EXT_CLK to CFG_ variants
Marek Vasut [Tue, 28 Feb 2023 21:17:21 +0000 (22:17 +0100)]
serial: sh: Rename CONFIG_SCI and CONFIG_SCIF_USE_EXT_CLK to CFG_ variants

Both CONFIG_SCI and CONFIG_SCIF_USE_EXT_CLK options do not have a
matching Kconfig entry because they are internal to the SCIF driver.
Change their prefix to CFG_, i.e. CFG_SCIF_USE_EXT_CLK and CFG_SCI,
to reflect that and avoid interferring with Kconfig symbols. Since
neither of those options are defined elsewhere, no functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
16 months agopinctrl: renesas: Replace ifdeffery with IS_ENABLED()
Marek Vasut [Tue, 28 Feb 2023 06:25:52 +0000 (07:25 +0100)]
pinctrl: renesas: Replace ifdeffery with IS_ENABLED()

Switch ifdef in sh_gpio_get_value() to IS_ENABLED() macro.
The CONFIG_RCAR_GEN3 will never have SPL counterpart, so
the IS_ENABLED() macro is the right one here. No functional
change, except for improved build test coverage.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
16 months agonet: ravb: Support fixed PHY in R-Car
Mikhail Lappo [Mon, 27 Feb 2023 23:04:11 +0000 (00:04 +0100)]
net: ravb: Support fixed PHY in R-Car

Calling old U-Boot API doesn't allow to use fixed PHY.
Searching by mask is the part of new function, after
scanning FDT for a fixed PHY definition

Fixes: e821a7bdb13 ("net: ravb: Detect PHY correctly")
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Mikhail Lappo <mikhail.lappo@esrlabs.com>
Signed-off-by: Hai Pham <hai.pham.ud@renesas.com>
[Hai Pham: Drop phy_connect_dev since it's called in phy_connect]
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
[Marek: Use mask -1 instead of 0 to reinstate the search behavior
        over all PHY addresses. Add Fixes tag, sort the tag list.]

16 months agoi2c: rcar_i2c: Sort Kconfig depends list ascending
Marek Vasut [Mon, 27 Feb 2023 23:03:46 +0000 (00:03 +0100)]
i2c: rcar_i2c: Sort Kconfig depends list ascending

Sort the list of "depends" symbols in ascending order.
No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
16 months agoi2c: rcar_iic: Sort Kconfig depends list ascending
Marek Vasut [Mon, 27 Feb 2023 23:03:45 +0000 (00:03 +0100)]
i2c: rcar_iic: Sort Kconfig depends list ascending

Sort the list of "depends" symbols in ascending order.
No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
16 months agoclk: renesas: rcar-gen3: Replace SSCG caching with MDSEL/PE caching
Marek Vasut [Tue, 28 Feb 2023 06:25:11 +0000 (07:25 +0100)]
clk: renesas: rcar-gen3: Replace SSCG caching with MDSEL/PE caching

Do not cache the single CPG MODE register bit 12, instead cache the
entire register value, and only pick the matching bit from the cached
value when core clock of type MDSEL or PE are used. Both MDSEL and PE
clock type currently define .offset field as 12 on Gen3, which means
this code will use bit 12 on Gen3 again, however there are additional
clock on Gen4 which use different bits, and having this flexibility
in place now will be useful when adding Gen4.

No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
16 months agoARM: rmobile: Split R-Car Gen3 into separate Kconfig from common 64bit options
Marek Vasut [Tue, 28 Feb 2023 06:28:57 +0000 (07:28 +0100)]
ARM: rmobile: Split R-Car Gen3 into separate Kconfig from common 64bit options

There are multiple shared Kconfig options between R-Car Gen3 and Gen4.
Keep the common options in Kconfig.64 and move the R-Car Gen3 specific
options into separate Kconfig.rcar3 . The Kconfig.rcar3 contains SoC
and board list, which is limited to R-Car Gen3.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
16 months agoARM: rmobile: Introduce CONFIG_RCAR_64 symbol
Marek Vasut [Tue, 28 Feb 2023 06:28:56 +0000 (07:28 +0100)]
ARM: rmobile: Introduce CONFIG_RCAR_64 symbol

Introduce common Kconfig symbol for 64bit R-Car platforms and move
common configuration options into it. This is preparatory patch to
prevent duplication of Kconfig lists later on, when Gen4 is added.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
16 months agoARM: rmobile: Factor out SYS_SOC Kconfig option
Marek Vasut [Tue, 28 Feb 2023 06:28:55 +0000 (07:28 +0100)]
ARM: rmobile: Factor out SYS_SOC Kconfig option

Pull the SYS_SOC Kconfig option to avoid duplication of this option
in Kconfig.{32,64,rza1} . The default value is the same, so just set
it in one location.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
16 months agoARM: rmobile: Sort R-Car Gen3 Kconfig lists
Marek Vasut [Tue, 28 Feb 2023 06:28:54 +0000 (07:28 +0100)]
ARM: rmobile: Sort R-Car Gen3 Kconfig lists

Sort the 'imply' and 'select' lists in R-Car Gen3 Kconfig options.
No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
16 months agoARM: rmobile: Convert ifdef in rmobile_get_prr() to IS_ENABLED()
Marek Vasut [Tue, 28 Feb 2023 06:27:51 +0000 (07:27 +0100)]
ARM: rmobile: Convert ifdef in rmobile_get_prr() to IS_ENABLED()

Switch ifdef in rmobile_get_prr() to IS_ENABLED() macro.
The CONFIG_RCAR_GEN3 will never have SPL counterpart, so
the IS_ENABLED() macro is the right one here. No functional
change, except for improved build test coverage.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
16 months agoARM: renesas: falcon: Enable RWDT reset for V3U Falcon
Hai Pham [Mon, 27 Feb 2023 23:02:19 +0000 (00:02 +0100)]
ARM: renesas: falcon: Enable RWDT reset for V3U Falcon

Enable RWDT reset on Reset Controller so that it can be used as
reset trigger source for V3U Falcon.

Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Hai Pham <hai.pham.ud@renesas.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> # Use one current_el() in board_init
16 months agoARM: renesas: falcon: Initialize ARM generic timer and GICv3 if EL3
Hai Pham [Mon, 27 Feb 2023 23:02:18 +0000 (00:02 +0100)]
ARM: renesas: falcon: Initialize ARM generic timer and GICv3 if EL3

U-Boot executes at EL3 is required to initalize those settings.
In other cases, they will be done by prior-stage firmware instead.

This fixes crash when U-Boot is at non-secure exception level.

Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Hai Pham <hai.pham.ud@renesas.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
16 months agoARM: renesas: Enable DTO support by default on R-Car Gen3
Marek Vasut [Mon, 27 Feb 2023 23:00:19 +0000 (00:00 +0100)]
ARM: renesas: Enable DTO support by default on R-Car Gen3

All R-Car Gen3 defconfigs present in U-Boot do enable DTO support,
enable it for all of R-Car Gen3 by default in Kconfig instead, so
that no new boards would miss this functionality.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
16 months agoARM: renesas: Demote overlap memory nodes message to debug on Gen3
Hai Pham [Mon, 27 Feb 2023 23:00:01 +0000 (00:00 +0100)]
ARM: renesas: Demote overlap memory nodes message to debug on Gen3

The R-Car DTs might contains multiple /memory@* nodes from various
sources, i.e. prior firmware, u-boot itself or the OS

The duplicates are likely to happen so the messages are not meaningful
in the default setting since we have already handled that.

Reduce the message to debug level.

Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Hai Pham <hai.pham.ud@renesas.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
16 months agoARM: renesas: Remove defines for USB on Eagle/Condor
Hai Pham [Mon, 27 Feb 2023 22:59:32 +0000 (23:59 +0100)]
ARM: renesas: Remove defines for USB on Eagle/Condor

The Eagle board based on R-Car V3M, which does not support any USB
interfaces. The same applies for the Condor board based on R-Car V3H.

Remove the defines.

Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Hai Pham <hai.pham.ud@renesas.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
16 months agotest: add tests of 'read' and 'write' shell commands
Rasmus Villemoes [Thu, 2 Mar 2023 08:12:25 +0000 (09:12 +0100)]
test: add tests of 'read' and 'write' shell commands

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
16 months agosandbox: enable CMD_WRITE
Rasmus Villemoes [Thu, 2 Mar 2023 08:12:24 +0000 (09:12 +0100)]
sandbox: enable CMD_WRITE

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
16 months agodoc: document read/write commands
Rasmus Villemoes [Thu, 2 Mar 2023 08:12:23 +0000 (09:12 +0100)]
doc: document read/write commands

The read and write commands are, deliberately, implemented in the same
file, so that they stay feature-compatible (e.g. if someone implements
support for "read the full partition, however large that is", that
same syntax should also work for write). In order to ensure the
documentation for both are similarly kept in sync, and to avoid
duplication, document them both in read.rst, and add a stub write.rst
referring to read.rst.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agocmd: introduce 'write' command
Rasmus Villemoes [Thu, 2 Mar 2023 08:12:22 +0000 (09:12 +0100)]
cmd: introduce 'write' command

It's almost no extra code to hook up a buddy to the 'read' command. In
fact, since the command is passed its own 'struct cmd_tbl', we can use
the exact same callback, and let it figure out for itself whether it
was invoked as "read" or "write".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
16 months agocmd: read: use part_get_info_by_dev_and_name_or_num() instead of open-coded dev_part...
Rasmus Villemoes [Thu, 2 Mar 2023 08:12:21 +0000 (09:12 +0100)]
cmd: read: use part_get_info_by_dev_and_name_or_num() instead of open-coded dev_part parsing

Use the helper part_get_info_by_dev_and_name_or_num() for parsing a
dev[:part] string and obtaining the partition info in one go, instead
of open-coding all that.

As a bonus, this will automatically allow using the dev#partname
syntax as well, for accessing raw partitions by name.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
16 months agoMerge tag 'xilinx-for-v2023.07-rc1' of https://source.denx.de/u-boot/custodians/u...
Tom Rini [Thu, 16 Mar 2023 16:18:30 +0000 (12:18 -0400)]
Merge tag 'xilinx-for-v2023.07-rc1' of https://source.denx.de/u-boot/custodians/u-boot-microblaze into next

Xilinx changes for v2023.07-rc1

cmd:
- Print results in hex instead of dec in smc command

firmware:
- Cover missing ZYNQMP_FIRMWARE dependencies

fpga:
- fix loads for unencrypted use case

relocation
- Add support for BE systems

spi:
- Fix xilinx_spi init reset sequence

arasan nand:
- Remove hardcoded bbt option
- Set ofnode value

xilinx:
- Enable SMC command
- Fix some sparse issues

zynqmp:
- Remove cdns,zynq-gem compatible string
- Add optee node
- Some DT cleanups

zynq:
- Some DT cleanups

microblaze
- Remove MANUAL_RELOC option

16 months agoMerge tag 'fsl-qoriq-next-2023-3-14' of https://source.denx.de/u-boot/custodians...
Tom Rini [Thu, 16 Mar 2023 16:17:48 +0000 (12:17 -0400)]
Merge tag 'fsl-qoriq-next-2023-3-14' of https://source.denx.de/u-boot/custodians/u-boot-fsl-qoriq into next

Enable DM_SERIAL for freescale ls2080a
Drop non DM_ETH code for freescale:
  lx2160a/ls2080rdb/ls2080aqds/ls1088a

16 months agoRevert 9f62a472dfb2 ("video: Remove duplicate cursor-positioning function")
Tom Rini [Wed, 15 Mar 2023 15:58:58 +0000 (11:58 -0400)]
Revert 9f62a472dfb2 ("video: Remove duplicate cursor-positioning function")

This reverts commit 9f62a472dfb26ec14408a27938ddd2a25700009d.

The changes here aren't quite right, and on platforms such as Raspberry
Pi where we can have both serial and video output, the change above
causes output to change. This can be seen as the hush tests we have now
fail.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agoMerge tag 'dm-next-12mar23a' of git://git.denx.de/u-boot-dm into next
Tom Rini [Thu, 16 Mar 2023 16:16:14 +0000 (12:16 -0400)]
Merge tag 'dm-next-12mar23a' of git://git.denx.de/u-boot-dm into next

More tests and fixes for fdt command
binman signing feature
fix buildman -A bug introduced recently

Signed-off-by: Tom Rini <trini@konsulko.com>
16 months agobuildman: Fix CROSS_COMPILE output for sandbox
Simon Glass [Fri, 10 Mar 2023 20:48:51 +0000 (12:48 -0800)]
buildman: Fix CROSS_COMPILE output for sandbox

The previous attempt at fixing this broke the normal usage of the -A
flag.

At present, 'buildman -A sandbox' adds the path containing the
toolchain. We can assume that this is in the path and we don't want to
set CROSS_COMPILE=/bin/

Change this to align with what MakeEnvironment() does, but only for
sandbox boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agoRevert "buildman: Correct CROSS_COMPILE output for sandbox"
Simon Glass [Fri, 10 Mar 2023 20:48:50 +0000 (12:48 -0800)]
Revert "buildman: Correct CROSS_COMPILE output for sandbox"

This reverts commit bd0a548ad4a155fec29473d4cc8e135832926973.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agotools: add fdt_add_pubkey
Roman Kopytin [Wed, 8 Mar 2023 01:13:41 +0000 (01:13 +0000)]
tools: add fdt_add_pubkey

Having to use the -K option to mkimage to populate U-Boot's .dtb with the
public key while signing the kernel FIT image is often a little
awkward. In particular, when using a meta-build system such as
bitbake/Yocto, having the tasks of the kernel and U-Boot recipes
intertwined, modifying deployed artifacts and rebuilding U-Boot with
an updated .dtb is quite cumbersome. Also, in some scenarios one may
wish to build U-Boot complete with the public key(s) embedded in the
.dtb without the corresponding private keys being present on the same
build host.

So this adds a simple tool that allows one to disentangle the kernel
and U-Boot builds, by simply copy-pasting just enough of the mkimage
code to allow one to add a public key to a .dtb. When using mkimage,
some of the information is taken from the .its used to build the
kernel (algorithm and key name), so that of course needs to be
supplied on the command line.

Signed-off-by: Roman Kopytin <Roman.Kopytin@kaspersky.com>
Signed-off-by: Ivan Mikhaylov <fr0st61te@gmail.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
16 months agobinman: add tests for sign option
Ivan Mikhaylov [Wed, 8 Mar 2023 01:13:40 +0000 (01:13 +0000)]
binman: add tests for sign option

Add the test which provides sequence of actions:
  1. create the image from binman dts
  2. create public and private keys
  3. add public key into dtb with fdt_add_pubkey
  4. 1. sign FIT container with new sign option with extracting from
        image
     2. sign exact FIT container with replacing of it in image
  5. check with fit_check_sign

Signed-off-by: Ivan Mikhaylov <fr0st61te@gmail.com>
Renumber test file from 277 to 280;
   Move UpdateSignatures() to Entry base class;
   Don't allow missing mkimage as it doesn't make sense;
   Propagate --toolpath for CI;
   Call mark_build_done() to avoid regenerating FIT:
Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobinman: add sign option for binman
Ivan Mikhaylov [Wed, 8 Mar 2023 01:13:39 +0000 (01:13 +0000)]
binman: add sign option for binman

Introduce proof of concept for binman's new option which provides sign
and replace FIT containers in binary images.

Usage as example:

from:
mkimage -G privateky -r -o sha256,rsa4096 -F fit
binman replace -i flash.bin -f fit.fit fit

to:
binman sign -i flash.bin -k privatekey -a sha256,rsa4096 -f fit.fit fit

and to this one if it's need to be extracted, signed with key and put it
back in image:
binman sign -i flash.bin -k privatekey -a sha256,rsa4096 fit

Signed-off-by: Ivan Mikhaylov <fr0st61te@gmail.com>
16 months agobinman: add documentation for binman sign option
Ivan Mikhaylov [Wed, 8 Mar 2023 01:13:38 +0000 (01:13 +0000)]
binman: add documentation for binman sign option

Add the documentation about binman sign option and providing an
example.

Signed-off-by: Ivan Mikhaylov <fr0st61te@gmail.com>
Add a section about 'binman sign' at the bottom:
Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agotest: cmd: fdt: Test fdt apply
Marek Vasut [Thu, 2 Mar 2023 03:08:44 +0000 (04:08 +0100)]
test: cmd: fdt: Test fdt apply

Add 'fdt chosen' test which works as follows:
- Create basic DT, map it to sysmem
- Apply DTO which adds single property via fragment (without address spec)
- Apply DTO which adds more properties (string, u32, empty) and a subnode,
  with phandle via frament@0 and thus tests /__symbols__ node
- Apply DTO which modifies property of the previous DTO via phandle and thus
  tests the /__fixups__ node
- Print modified DT, verify it contains updates from DTOs

The test case can be triggered using:
"
./u-boot -Dc 'ut fdt'
"
To dump the full output from commands used during test, add '-v' flag.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agotest: cmd: fdt: Test fdt chosen
Marek Vasut [Thu, 2 Mar 2023 03:08:43 +0000 (04:08 +0100)]
test: cmd: fdt: Test fdt chosen

Add 'fdt chosen' test which works as follows:
- Create basic DT, map it to sysmem
- Print /chosen node, verify it is nonexistent
- Create chosen node
- Print /chosen node, verify it contains only version
- Create /chosen node with initrd entries
- Print /chosen node, verify it contains version and initrd entries

The test case can be triggered using:
"
./u-boot -Dc 'ut fdt'
"
To dump the full output from commands used during test, add '-v' flag.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agotest: cmd: fdt: Test fdt rsvmem
Marek Vasut [Thu, 2 Mar 2023 03:08:42 +0000 (04:08 +0100)]
test: cmd: fdt: Test fdt rsvmem

Add 'fdt rsvmem' test which works as follows:
- Create custom FDT with single reserved memory (rsvmem) entry, map it to sysmem
- Add new rsvmem entry
- Delete existing older rsvmem entry
- Add new rsvmem entry again
- Always print the rsvmem list and validate it

The test case can be triggered using:
"
./u-boot -Dc 'ut fdt'
"
To dump the full output from commands used during test, add '-v' flag.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agotest: cmd: fdt: Test fdt memory
Marek Vasut [Thu, 2 Mar 2023 03:08:41 +0000 (04:08 +0100)]
test: cmd: fdt: Test fdt memory

Add 'fdt memory' test which works as follows:
- Create custom FDT with /memory node, with select #*cells, map it to sysmem
- Perform memory fixup
- Read back the /memory node and validate its content

The test case can be triggered using:
"
./u-boot -Dc 'ut fdt'
"
To dump the full output from commands used during test, add '-v' flag.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agotest: cmd: fdt: Test fdt header
Marek Vasut [Thu, 2 Mar 2023 03:08:39 +0000 (04:08 +0100)]
test: cmd: fdt: Test fdt header

Add 'fdt header' test which works as follows:
- Create basic FDT, map it to sysmem
- Print the FDT header
- Get all members of the FDT header into variable and
  verify the variables contain correct data

The test case can be triggered using:
"
./u-boot -Dc 'ut fdt'
"
To dump the full output from commands used during test, add '-v' flag.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Merged in test: cmd: fdt: Drop unused fdt_test_header_get() fdt parameter:
Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agotest: cmd: fdt: Test fdt print and list
Marek Vasut [Thu, 2 Mar 2023 03:08:32 +0000 (04:08 +0100)]
test: cmd: fdt: Test fdt print and list

Add 'fdt print' and 'fdt list' test which works as follows:
- Create fuller FDT, map it to sysmem
- Print the entire FDT, parts of the FDT and select properties
- Compare output from the print or list

The test case can be triggered using:
"
./u-boot -Dc 'ut fdt'
"
To dump the full output from commands used during test, add '-v' flag.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agocmd: fdt: Drop the 0x prefix
Marek Vasut [Thu, 2 Mar 2023 03:04:40 +0000 (04:04 +0100)]
cmd: fdt: Drop the 0x prefix

The 'fdt get addr' is always assumed to be hex value, drop the prefix.
Since this might break existing users who depend on the existing
behavior with 0x prefix, this is a separate patch. Revert if this
breaks anything.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
16 months agoconsole: Use only 0x00 as line separator for console recording
Marek Vasut [Mon, 27 Feb 2023 19:55:39 +0000 (20:55 +0100)]
console: Use only 0x00 as line separator for console recording

In case character 0x20 (space) is used as line separator,
character 0x9 (tab) is treated end of line. Commands which
output a lot of tabs, i.e. various tree printing commands
like 'fdt print' then end up generating a lot of newlines
in the recorded output, and the recorded output is corrupted.

Use character 0x00 (NUL) as separator instead to treat the
tabs as valid part of recorded line.

Suggested-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agotest: cmd: fdt: Drop new unneeded curly brackets
Marek Vasut [Fri, 10 Mar 2023 03:33:14 +0000 (04:33 +0100)]
test: cmd: fdt: Drop new unneeded curly brackets

Drop no longer needed { } around ut_assert*() functions in FDT test.
No functional change.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
16 months agotest: Wrap assert macros in ({ ... }) and fix missing semicolons
Marek Vasut [Fri, 10 Mar 2023 03:33:13 +0000 (04:33 +0100)]
test: Wrap assert macros in ({ ... }) and fix missing semicolons

Wrap the assert macros in ({ ... }) so they can be safely used both as
right side argument as well as in conditionals without curly brackets
around them. In the process, find a bunch of missing semicolons, fix
them.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
16 months agoMerge tag 'v2023.04-rc4' into next
Tom Rini [Tue, 14 Mar 2023 14:58:41 +0000 (10:58 -0400)]
Merge tag 'v2023.04-rc4' into next

Prepare v2023.04-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>