]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
23 months agobootstd: Read the Operating System name for distro/scripts
Simon Glass [Fri, 6 Jan 2023 14:52:33 +0000 (08:52 -0600)]
bootstd: Read the Operating System name for distro/scripts

Add the concept of an OS name to the bootflow. This typically includes the
OS name, version and kernel version.

Implement this for the distro and script bootmeths so that it works with
Armbian and older version of Fedora.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agovideo: Add font functions to the vidconsole API
Simon Glass [Fri, 6 Jan 2023 14:52:32 +0000 (08:52 -0600)]
video: Add font functions to the vidconsole API

Support for fonts currently depends on the type of vidconsole in use. Add
two new methods to enumerate fonts and to set the font.

Fix a few other method comments while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agovideo: Fix unchnaged typo
Simon Glass [Fri, 6 Jan 2023 14:52:31 +0000 (08:52 -0600)]
video: Fix unchnaged typo

Fix this typo in the header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
23 months agovideo: truetype: Rename the metrics function
Simon Glass [Fri, 6 Jan 2023 14:52:30 +0000 (08:52 -0600)]
video: truetype: Rename the metrics function

This should really have a 'truetype' prefix. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agovideo: Enable VIDEO_ANSI by default only with EFI
Simon Glass [Fri, 6 Jan 2023 14:52:29 +0000 (08:52 -0600)]
video: Enable VIDEO_ANSI by default only with EFI

This is not generally needed unless EFI_LOADER is used. Adjust the default
setting to reduce the size of the U-Boot build.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agoimage: Move common image code to image_board and command
Simon Glass [Fri, 6 Jan 2023 14:52:28 +0000 (08:52 -0600)]
image: Move common image code to image_board and command

We should use the cmd/ directory for commands rather than for common code
used elsewhere in U-Boot. Move the common 'source' code into
image-board.c to achieve this.

The image_source_script() function needs to call run_command_list()  so
seems to belong better in the command library. Move and rename it.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agoimage: Add a function to find a script in an image
Simon Glass [Fri, 6 Jan 2023 14:52:27 +0000 (08:52 -0600)]
image: Add a function to find a script in an image

Split this functionality out of the 'source' command so it can be used
from another place. For now leave it where it is, but a future patch will
move it out of cmd/

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agomenu: Make use of CLI character processing
Simon Glass [Fri, 6 Jan 2023 14:52:26 +0000 (08:52 -0600)]
menu: Make use of CLI character processing

Avoid duplicating some of the escape-sequence processing here and use the
CLI function instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agomenu: Use a switch statement
Simon Glass [Fri, 6 Jan 2023 14:52:25 +0000 (08:52 -0600)]
menu: Use a switch statement

Convert the long line of if() statements to a switch() since this makes
better use of the C language.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agomenu: Update bootmenu_loop() to return the code
Simon Glass [Fri, 6 Jan 2023 14:52:24 +0000 (08:52 -0600)]
menu: Update bootmenu_loop() to return the code

Use the return value to save having to pass around a pointer. This also
resolves any ambiguity about what *key contains when the function is
called.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agomenu: Update bootmenu_autoboot_loop() to return the code
Simon Glass [Fri, 6 Jan 2023 14:52:23 +0000 (08:52 -0600)]
menu: Update bootmenu_autoboot_loop() to return the code

Use the return value to save having to pass around a pointer. This also
resolves any ambiguity about what *key contains when the function is
called.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agomenu: Rename KEY_... to BKEY_...
Simon Glass [Fri, 6 Jan 2023 14:52:22 +0000 (08:52 -0600)]
menu: Rename KEY_... to BKEY_...

This enum values conflict with linux/input.h so rename them.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobootmenu: Add a few comments
Simon Glass [Fri, 6 Jan 2023 14:52:21 +0000 (08:52 -0600)]
bootmenu: Add a few comments

The behaviour of these two functions is completely undocumented. Add some
notes so the poor, suffering dev can figure out what is going on.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agocli: Move readline character-processing to a state machine
Simon Glass [Fri, 6 Jan 2023 14:52:20 +0000 (08:52 -0600)]
cli: Move readline character-processing to a state machine

The current cread_line() function is very long. It handles the escape
processing inline. The menu command does similar processing but at the
character level, so there is some duplication.

Split the character processing into a new function cli_ch_process() which
processes individual characters and returns the resulting input character,
taking account of escape sequences. It requires the caller to set up and
maintain its state.

Update cread_line() to use this new function.

The only intended functional change is that an invalid escape sequence
does not add invalid/control characters into the input buffer, but instead
discards these.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agosandbox: Enable mmc command and legacy images
Simon Glass [Fri, 6 Jan 2023 14:52:19 +0000 (08:52 -0600)]
sandbox: Enable mmc command and legacy images

The mmc command is useful for testing mmc disk images in sandbox, so
enable it. We also need to enable legacy images so that we can run tests
which use them.

Disable it for a few avb tests since MMC is not implemented there yet.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-sh
Tom Rini [Sun, 15 Jan 2023 15:31:17 +0000 (10:31 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-sh

23 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Sun, 15 Jan 2023 15:31:00 +0000 (10:31 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-usb

23 months agousb: gadget: dwc2_udc_otg: implement pullup()
Mattijs Korpershoek [Wed, 11 Jan 2023 08:19:27 +0000 (09:19 +0100)]
usb: gadget: dwc2_udc_otg: implement pullup()

Pullup is used by the usb framework in order to do software-controlled
usb_gadget_connect() and usb_gadget_disconnect().

Implement pullup() for dwc2 using the SOFT_DISCONNECT bit in the dctl
register:
* when pullup is on, clear SOFT_DISCONNECT
* when pullup is off, set SOFT_DISCONNECT

This is especially useful when a gadget disconnection is initiated but
no board_usb_cleanup() is called.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
23 months agousb: gadget: fastboot: detach usb just before rebooting
Dario Binacchi [Sat, 7 Jan 2023 16:48:07 +0000 (17:48 +0100)]
usb: gadget: fastboot: detach usb just before rebooting

The patch fixes the following error when updating a BSH SMM S2 board:
3:72>Start Cmd:FB[-t 8000]: ucmd nand write ${loadaddr} nanddtb ${filesize}
3:72>Okay (0.023s)
3:72>Start Cmd:FB: reboot
3:72>Fail Bulk(R):LIBUSB_ERROR_IO(0s)

The "fastboot reboot" command detaches the USB when it still needs to be
used. So let's detach the USB just before the reset.

CC: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Fixes: 5f7e01e9d5d800 ("usb: gadget: fastboot: detach usb on reboot commands")
Suggested-by: Michael Trimarchi <michael@amarulasolutions.com>
Co-developed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
23 months agousb: hub: allow to increase HUB_DEBOUNCE_TIMEOUT
Patrick Delaunay [Fri, 9 Sep 2022 09:45:23 +0000 (11:45 +0200)]
usb: hub: allow to increase HUB_DEBOUNCE_TIMEOUT

Add a new CONFIG_USB_HUB_DEBOUNCE_TIMEOUT to increase the
HUB_DEBOUNCE_TIMEOUT value, for example to 2s because some usb device
needs around 1.5s or more to make the hub port status to be
connected steadily after being powered off and powered on.

This 2s value is aligned with Linux driver and avoids to configure
"usb_pgood_delay" as a workaround for connection timeout on
some USB device; normally the env variable "usb_pgood_delay" is used
to delay the first query after power ON and thus the device answer,
but this variable not used to increase the connection timeout delay.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
23 months agoconfigs: r8a77980: Condor: Enable MMC support by default
Andrey Dolnikov [Thu, 22 Dec 2022 21:18:25 +0000 (22:18 +0100)]
configs: r8a77980: Condor: Enable MMC support by default

This enables MMC support, which is available
on Condor board, by default.

Signed-off-by: Andrey Dolnikov <andrey.dolnikov@cogentembedded.com>
Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
Signed-off-by: Hai Pham <hai.pham.ud@renesas.com>
23 months agoARM: renesas: condor: switch eMMC bus to 1V8
Hai Pham [Thu, 22 Dec 2022 21:18:01 +0000 (22:18 +0100)]
ARM: renesas: condor: switch eMMC bus to 1V8

The eMMC card has two supplies, VCC and VCCQ. The VCC supplies the NAND
array and the VCCQ supplies the bus. On Condor, the VCC is connected to
3.3V rail, while the VCCQ is connected to 1.8V rail. Adjust the pinmux
to match the bus, which is always operating in 1.8V mode.

Based on Linux commit 69efe4bbeda50745 ("arm64: dts: renesas: condor:
Switch eMMC bus to 1V8") from Wolfram Sang

Signed-off-by: Hai Pham <hai.pham.ud@renesas.com>
23 months agoARM: dts: renesas: condor: Enable SPI NOR fast-read
Marek Vasut [Thu, 22 Dec 2022 21:17:20 +0000 (22:17 +0100)]
ARM: dts: renesas: condor: Enable SPI NOR fast-read

This board requires SPI NOR fast-read, otherwise the SPI NOR
access returns corrupted data. Enable the fast-read explicitly
in DT as it has been disabled in the MTD subsystem by commit
d008190920 ("mtd: spi-nor: Mask out fast read if not requested in DT")

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
23 months agoARM: renesas: ulcb: Set CONFIG_TEXT_BASE=0x0 on R-Car Gen3 ULCB
Marek Vasut [Thu, 22 Dec 2022 21:06:46 +0000 (22:06 +0100)]
ARM: renesas: ulcb: Set CONFIG_TEXT_BASE=0x0 on R-Car Gen3 ULCB

Since R-Car Gen3 already enables position independent build, also set
CONFIG_TEXT_BASE=0x0 to finalize the switch. This is possible since
534f0fbd65 ("arm64: Fix relocation of env_addr if POSITION_INDEPENDENT=y")
fixed current env_get_char() crash with CONFIG_TEXT_BASE=0x0 .

This change permits us to start U-Boot from any location in DRAM instead
of specific TEXT_BASE.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
23 months agoARM: renesas: condor: Set CONFIG_TEXT_BASE=0x0 on R-Car Gen3 Condor
Marek Vasut [Thu, 22 Dec 2022 21:07:08 +0000 (22:07 +0100)]
ARM: renesas: condor: Set CONFIG_TEXT_BASE=0x0 on R-Car Gen3 Condor

Since R-Car Gen3 already enables position independent build, also set
CONFIG_TEXT_BASE=0x0 to finalize the switch. This is possible since
534f0fbd65 ("arm64: Fix relocation of env_addr if POSITION_INDEPENDENT=y")
fixed current env_get_char() crash with CONFIG_TEXT_BASE=0x0 .

This change permits us to start U-Boot from any location in DRAM instead
of specific TEXT_BASE.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
23 months agoARM: renesas: Enable LTO on R-Car3 Falcon
Marek Vasut [Thu, 22 Dec 2022 21:13:15 +0000 (22:13 +0100)]
ARM: renesas: Enable LTO on R-Car3 Falcon

Enable LTO (link time optimization) to improve optimization
and reduce code size by cca. 30 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
23 months agoARM: renesas: Enable LTO on R-Car3 Draak
Marek Vasut [Thu, 22 Dec 2022 21:13:14 +0000 (22:13 +0100)]
ARM: renesas: Enable LTO on R-Car3 Draak

Enable LTO (link time optimization) to improve optimization
and reduce code size by cca. 29 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
23 months agoARM: renesas: Enable LTO on R-Car3 Ebisu
Marek Vasut [Thu, 22 Dec 2022 21:13:13 +0000 (22:13 +0100)]
ARM: renesas: Enable LTO on R-Car3 Ebisu

Enable LTO (link time optimization) to improve optimization
and reduce code size by cca. 34 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
23 months agoARM: renesas: Enable LTO on R-Car3 Condor
Marek Vasut [Thu, 22 Dec 2022 21:13:12 +0000 (22:13 +0100)]
ARM: renesas: Enable LTO on R-Car3 Condor

Enable LTO (link time optimization) to improve optimization
and reduce code size by cca. 32 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
23 months agoARM: renesas: Enable LTO on R-Car3 Eagle
Marek Vasut [Thu, 22 Dec 2022 21:13:11 +0000 (22:13 +0100)]
ARM: renesas: Enable LTO on R-Car3 Eagle

Enable LTO (link time optimization) to improve optimization
and reduce code size by cca. 32 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
23 months agoARM: renesas: Enable LTO on R-Car3 ULCB
Marek Vasut [Thu, 22 Dec 2022 21:13:10 +0000 (22:13 +0100)]
ARM: renesas: Enable LTO on R-Car3 ULCB

Enable LTO (link time optimization) to improve optimization
and reduce code size by cca. 31 kiB.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
23 months agoMerge tag 'u-boot-stm32-20230113' of https://source.denx.de/u-boot/custodians/u-boot-stm
Tom Rini [Fri, 13 Jan 2023 14:56:19 +0000 (09:56 -0500)]
Merge tag 'u-boot-stm32-20230113' of https://source.denx.de/u-boot/custodians/u-boot-stm

Add driver to manage onboard hub supplies
Add calibration support for stm32-adc
Linux kernel v6.1 DT synchronization for stm32mp151.dtsi
stm32mp157a-dk1-scmi-u-boot.dtsi update
Add support of OP-TEE and STM32MP13x in bsec driver
ECDSA various fixes for stm32mp

23 months agoMerge tag 'efi-2023-04-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Fri, 13 Jan 2023 13:37:32 +0000 (08:37 -0500)]
Merge tag 'efi-2023-04-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2023-04-rc1

Documentation:

* build infodocs target on Gitlab CI, Azure

UEFI:

* fix function descriptions
* add .rela sections to .text on arm64
* use EFI_EXIT in efi_riscv_get_boot_hartid
* improve specification conformance of set_keyboard_layout()

23 months agoARM: stm32: Make ECDSA authentication available to U-Boot
Marek Vasut [Thu, 12 Jan 2023 17:58:42 +0000 (18:58 +0100)]
ARM: stm32: Make ECDSA authentication available to U-Boot

With U-Boot having access to ROM API call table, it is possible to use
the ROM API call it authenticate e.g. signed kernel fitImages using the
BootROM ECDSA support. Make this available by pulling the ECDSA BootROM
call support from SPL-only guard.

Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Marek Vasut <marex@denx.de>
23 months agoARM: stm32: Pass ROM API table pointer to U-Boot proper
Marek Vasut [Thu, 12 Jan 2023 17:58:41 +0000 (18:58 +0100)]
ARM: stm32: Pass ROM API table pointer to U-Boot proper

The ROM API table pointer is no longer accessible from U-Boot, fix
this by passing the ROM API pointer through. This makes it possible
for U-Boot to call ROM API functions to authenticate payload like
signed fitImages.

Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Marek Vasut <marex@denx.de>
23 months agoARM: stm32: Factor out save_boot_params
Marek Vasut [Thu, 12 Jan 2023 17:58:40 +0000 (18:58 +0100)]
ARM: stm32: Factor out save_boot_params

The STM32MP15xx platform currently comes with two incompatible
implementations of save_boot_params() weak function override.
Factor the save_boot_params() implementation into common cpu.c
code and provide accessors to read out both ROM API table address
and DT address from any place in the code instead.

Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Marek Vasut <marex@denx.de>
23 months agoARM: stm32: Fix ECDSA authentication with Dcache enabled
Marek Vasut [Thu, 12 Jan 2023 17:58:39 +0000 (18:58 +0100)]
ARM: stm32: Fix ECDSA authentication with Dcache enabled

In case Dcache is enabled while the ECDSA authentication function is
called via BootROM ROM API, the MMU tables are set up and the BootROM
region is not marked as executable, so an attempt to run code from it
results in a hang. Mark the BootROM region as executable as suggested
by Patrick to prevent the hang.

Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Marek Vasut <marex@denx.de>
23 months agoefi_loader: provide agent_handle to efi_disk_add_dev()
Heinrich Schuchardt [Sat, 8 Oct 2022 07:11:54 +0000 (09:11 +0200)]
efi_loader: provide agent_handle to efi_disk_add_dev()

In efi_disk_add_dev() we have to open protocols with BY_DRIVER and
BY_CHILD_CONTROLLER. Provide the handle of the EFI block driver. The actual
usage of the value will follow in a later patch.

Change function descriptions to Sphinx style.

Remove a TODO: tag.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
23 months agoefi_selftest: add hii set keyboard layout test case
Vincent Stehlé [Fri, 6 Jan 2023 09:46:41 +0000 (10:46 +0100)]
efi_selftest: add hii set keyboard layout test case

Add a test for the case when the HII database protocol
set_keyboard_layout() function is called with a NULL key_guid argument.

Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
23 months agoefi_loader: refine set_keyboard_layout() status
Vincent Stehlé [Fri, 6 Jan 2023 09:46:40 +0000 (10:46 +0100)]
efi_loader: refine set_keyboard_layout() status

As per the EFI specification, the HII database protocol function
set_keyboard_layout() must return EFI_INVALID_PARAMETER when it is called
with a NULL key_guid argument. Modify the function accordingly to improve
conformance.

Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
23 months agoefi_loader: use EFI_EXIT in efi_riscv_get_boot_hartid
Heinrich Schuchardt [Wed, 11 Jan 2023 18:08:01 +0000 (19:08 +0100)]
efi_loader: use EFI_EXIT in efi_riscv_get_boot_hartid

After calling EFI_ENTRY we have to call EFI_EXIT before returning.

Add a missing EFI_EXIT().

Fixes: 1ccf87165e38 ("efi_loader: Enable RISCV_EFI_BOOT_PROTOCOL support")
Reported-by: Dave Jones <dave.jones@canonical.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
23 months agoefi_loader: add .rela sections to .text on arm64
Heinrich Schuchardt [Sun, 8 Jan 2023 18:00:47 +0000 (19:00 +0100)]
efi_loader: add .rela sections to .text on arm64

_relocate() needs the information in .rela* for self relocation
of the EFI binary.

Fixes: d7ddeb66a6ce ("efi_loader: fix building aarch64 EFI binaries")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
23 months agoefi_loader: fix description of memory functions
Heinrich Schuchardt [Sun, 8 Jan 2023 00:00:00 +0000 (01:00 +0100)]
efi_loader: fix description of memory functions

* Add missing function descriptions
* Adjust to Sphinx style

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
23 months agodoc: build infodocs target on Gitlab CI, Azure
Heinrich Schuchardt [Thu, 12 Jan 2023 19:30:58 +0000 (20:30 +0100)]
doc: build infodocs target on Gitlab CI, Azure

Add infodocs target to CI testing.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
23 months agodoc: fix description of u16_strcasecmp()
Heinrich Schuchardt [Sat, 7 Jan 2023 23:23:06 +0000 (00:23 +0100)]
doc: fix description of u16_strcasecmp()

Remove non-existent parameter 'n' from function description.

Fixes: 7a9b366cd9b7 ("lib: add function u16_strcasecmp()")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
23 months agoMerge branch '2023-01-12-further-assorted-general-updates'
Tom Rini [Thu, 12 Jan 2023 22:05:41 +0000 (17:05 -0500)]
Merge branch '2023-01-12-further-assorted-general-updates'

- Bring in a number of assorted updates, some of which have been waiting
  around for a bit.  Make silent console really be silent, get rid of
  gpio_hog_probe_all, add RNG for imx6, make net/fm use fs_loader, get
  rid of a bad __weak usage and set distro_bootpart_uuid in another case.

23 months agogpio: Get rid of gpio_hog_probe_all()
Marek Vasut [Thu, 22 Sep 2022 15:53:26 +0000 (17:53 +0200)]
gpio: Get rid of gpio_hog_probe_all()

The gpio_hog_probe_all() functionality can be perfectly well replaced by
DM_FLAG_PROBE_AFTER_BIND DM flag, which would trigger .probe() callback
of each GPIO hog driver instance after .bind() and thus configure the
hogged GPIO accordingly.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
23 months agodm: fix probing of all devices that have u-boot, dm-pre-reloc in SPL/TPL
Quentin Schulz [Thu, 22 Sep 2022 15:53:25 +0000 (17:53 +0200)]
dm: fix probing of all devices that have u-boot, dm-pre-reloc in SPL/TPL

Currently, dm_probe_devices checks that the flags of the device contains
DM_FLAG_PRE_RELOC. However DM_FLAG_PRE_RELOC is a driver - and not a
device - flag. This means that the check in pre_reloc_only mode would
always fail.

Instead, what was aimed to be checked is that either the driver of the
device has the flag set, or that the device has the u-boot,dm-pre-reloc
Device Tree property set.

So let's fix the check to allow u-boot,dm-pre-reloc devices to be
probed.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
23 months agodistro_bootcmd: Set distro_bootpart_uuid for block devices
Marek Vasut [Thu, 5 Jan 2023 13:08:23 +0000 (14:08 +0100)]
distro_bootcmd: Set distro_bootpart_uuid for block devices

The assignment of block device nodes in Linux is not deterministic by
default, i.e. a newly added eMMC controller or other block device can
change the assignment of /dev/mmcblkN (or other block device node like
e.g. /dev/sdXy) and prevent the system from picking the correct block
device for root filesystem in case the root filesystem is specified on
kernel command line using 'root=/dev/mmcblkNpM' (or 'root=/dev/sdXy'
etc.).

One way out is to derive PARTUUID in U-Boot, which is unique identifier
of a partition, and pass that as root=PARTUUID=<partuuid> to Linux via
kernel command line. Linux would then find the partition using PARTUUID,
no matter on which block device the partition resides and which node was
assigned to that block device.

Derive the PARTUUID before scanning for extlinux presence and assign it
into distro_bootpart_uuid environment variable, which can then be used
in extlinux.conf kernel command line specifier.

Note that it is not possible to do this in scan_dev_for_extlinux script
because this script is called from scan_dev_for_boot script, which is
called for both block devices as well as UBI volumes, and we can not
derive PARTUUID for UBI volumes.

Signed-off-by: Marek Vasut <marex@denx.de>
23 months agoRevert "time: add weak annotation to timer_read_counter declaration"
Harald Seiler [Thu, 5 Jan 2023 00:08:47 +0000 (01:08 +0100)]
Revert "time: add weak annotation to timer_read_counter declaration"

This reverts commit 65ba7add0d609bbd035b8d42fafdaf428ac24751.

A weak extern is a nasty sight to behold: If the symbol is never
defined, on ARM, the linker will replace the function call with a NOP.
This behavior isn't well documented but there are at least some hints
to it [1].

When timer_read_counter() is not defined, this obviously does the wrong
thing here and it does so silently.  The consequence is that a board
without timer_read_counter() will sleep for random amounts and generally
have erratic get_ticks() values.

Drop the __weak annotation of the extern so a linker error is raised
when timer_read_counter() is not defined.  This is okay, the original
reason for the reverted change - breaking the sandbox build - no longer
applies.

Final sidenote:  This was the only weak extern in the entire tree at
this time as far as I can tell.  I guess we should avoid introduction of
them again as they are obviously a very big footgun.

[1]: https://stackoverflow.com/questions/31203402/gcc-behavior-for-unresolved-weak-functions

Fixes: 65ba7add0d60 ("time: add weak annotation to timer_read_counter declaration")
Reported-by: Serge Bazanski <q3k@q3k.org>
Signed-off-by: Harald Seiler <hws@denx.de>
23 months agonet: fm: Support loading firmware from a filesystem
Sean Anderson [Thu, 29 Dec 2022 16:53:01 +0000 (11:53 -0500)]
net: fm: Support loading firmware from a filesystem

This adds a new method to load Fman firmware from a filesystem. This
allows users to use regular files instead of hard-coded offsets for the
firmware.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
23 months agonet: fm: Add firmware name parameter
Sean Anderson [Thu, 29 Dec 2022 16:53:00 +0000 (11:53 -0500)]
net: fm: Add firmware name parameter

In order to read the firmware from the filesystem, we need a file name.
Read the firmware name from the device tree, using the firmware-name
property. This property is commonly used in Linux to determine the
correct name to use (and can be seen in several device trees in U-Boot).

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
23 months agomisc: fs_loader: Add function to get the chosen loader
Sean Anderson [Thu, 29 Dec 2022 16:52:59 +0000 (11:52 -0500)]
misc: fs_loader: Add function to get the chosen loader

The fs_loader device is used to pull in settings via the chosen node.
However, there was no library function for this, so arria10 was doing it
explicitly. This function subsumes that, and uses ofnode_get_chosen_node
instead of navigating the device tree directly. Because fs_loader pulls
its config from the environment by default, it's fine to create a device
with nothing backing it at all. Doing this allows enabling
CONFIG_FS_LOADER without needing to modify the device tree.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
23 months agoAdded configs required for dcp_rng driver
Kshitiz Varshney [Thu, 22 Dec 2022 08:50:29 +0000 (09:50 +0100)]
Added configs required for dcp_rng driver

This commit adds configs required for using dcp_rng driver in imx6ull
defconfig files.

Signed-off-by: Kshitiz Varshney <kshitiz.varshney@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
23 months agoAdded dcp_rng driver initialization code
Kshitiz Varshney [Thu, 22 Dec 2022 08:50:28 +0000 (09:50 +0100)]
Added dcp_rng driver initialization code

This commit initializes dcp_rng device driver inside
arch_misc_init() function.

Signed-off-by: Kshitiz Varshney <kshitiz.varshney@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
23 months agoUboot RNG Driver using Data Co-processor
Kshitiz Varshney [Thu, 22 Dec 2022 08:50:27 +0000 (09:50 +0100)]
Uboot RNG Driver using Data Co-processor

This commit introduces Random number generator to uboot. It uses DCP
driver for number generation.
RNG driver can be invoked by using below command on uboot prompt:-
           rng <number of bytes>

Signed-off-by: Kshitiz Varshney <kshitiz.varshney@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
23 months agocommon: spl: ram: fix return code
Nikita Shubin [Mon, 12 Dec 2022 08:03:35 +0000 (11:03 +0300)]
common: spl: ram: fix return code

Instead of always retuning success, return actual result of
load_simple_fit_image or spl_parse_image_header, otherwise we
might end up jumping on uninitialized spl_image->entry_point.

Signed-off-by: Nikita Shubin <n.shubin@yadro.com>
Reviewed-by: Stefan Roese <sr@denx.de>
23 months agocmd: spi: Judge the number of added parameters
chenzhipeng [Tue, 6 Dec 2022 09:24:38 +0000 (17:24 +0800)]
cmd: spi: Judge the number of added parameters

When only sspi is entered, help information can be printed.

Signed-off-by: chenzhipeng <chenzhipeng@eswincomputing.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
23 months agoconsole: Add option to keep it silent until env is loaded
Harald Seiler [Wed, 6 Jul 2022 11:19:10 +0000 (13:19 +0200)]
console: Add option to keep it silent until env is loaded

Add a config-option which forces the console to stay silent until the
proper environment is loaded from flash.

This is important when the default environment does not silence the
console but no output must be printed when 'silent' is set in the flash
environment.

After the environment from flash is loaded, the console will be
silenced/unsilenced depending on it.  If PRE_CONSOLE_BUFFER is also
used, the buffer will now be flushed if the console should not be
silenced.

Signed-off-by: Harald Seiler <hws@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
23 months agoconfigs: stm32mp13: Activate command stm32key
Patrick Delaunay [Fri, 6 Jan 2023 12:20:19 +0000 (13:20 +0100)]
configs: stm32mp13: Activate command stm32key

Activate the command stm32key with CONFIG_CMD_STM32KEY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
23 months agoboard: st: Add support of STM32MP13x boards in stm32board cmd
Patrick Delaunay [Fri, 6 Jan 2023 12:20:18 +0000 (13:20 +0100)]
board: st: Add support of STM32MP13x boards in stm32board cmd

Add board identifiers for STMicroelectronics STM32MP13x boards:
- DISCO board: MB1635

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
23 months agoconfigs: stm32mp13: Activate CONFIG_CMD_FUSE
Patrick Delaunay [Fri, 6 Jan 2023 12:20:17 +0000 (13:20 +0100)]
configs: stm32mp13: Activate CONFIG_CMD_FUSE

Activate the command fuse to access on STM32MP13x OTP with
the BSEC driver.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
23 months agostm32mp: Add support of STM32MP13x in bsec driver
Patrick Delaunay [Fri, 6 Jan 2023 12:20:16 +0000 (13:20 +0100)]
stm32mp: Add support of STM32MP13x in bsec driver

Add support for "st,stm32mp13-bsec" for STM32MP13x in the
bsec driver based on OP-TEE pseudo TA STM32MP BSEC.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
23 months agostm32mp: Add OP-TEE support in bsec driver
Patrick Delaunay [Fri, 6 Jan 2023 12:20:15 +0000 (13:20 +0100)]
stm32mp: Add OP-TEE support in bsec driver

When OP-TEE is used, the SMC for BSEC management are not available and
the STM32MP BSEC pseudo TA must be used (it is mandatory for STM32MP13
and it is a new feature for STM32MP15x).

The BSEC driver try to open a session to this PTA BSEC at probe
and use it for OTP read or write access to fuse or to shadow.

This patch also adapts the commands stm32key and stboard to handle
the BSEC_LOCK_PERM lock value instead of 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
23 months agostm32mp: cosmetic: Update of bsec driver
Patrick Delaunay [Fri, 6 Jan 2023 12:20:14 +0000 (13:20 +0100)]
stm32mp: cosmetic: Update of bsec driver

Remove unnecessary return in stm32mp_bsec_write_lock and replace tab
by space for plat_auto opts.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
23 months agoARM: dts: stm32: Add timer interrupts on stm32mp15
Patrick Delaunay [Wed, 14 Dec 2022 15:25:01 +0000 (16:25 +0100)]
ARM: dts: stm32: Add timer interrupts on stm32mp15

The timer units in the stm32mp15x CPUs have interrupts, depending on the
timer flavour either one "global" or four dedicated ones. Add the irqs
to the timer units on stm32mp15x.

Sync the DT Files with linux kernel v6.1 and with commit a9b70102253ce
("ARM: dts: stm32: Add timer interrupts on stm32mp15")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
23 months agoARM: dts: stm32mp15: fix typo in stm32mp15xx-dkx.dtsi
Patrick Delaunay [Wed, 14 Dec 2022 15:25:00 +0000 (16:25 +0100)]
ARM: dts: stm32mp15: fix typo in stm32mp15xx-dkx.dtsi

Remove unnecessary space in device tree stm32mp15xx-dkx.dtsi.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
23 months agoARM: dts: stm32mp15: remove clksrc include in SCMI dtsi file
Patrick Delaunay [Wed, 14 Dec 2022 15:24:59 +0000 (16:24 +0100)]
ARM: dts: stm32mp15: remove clksrc include in SCMI dtsi file

The include file stm32mp1-clksrc.h is not necessary for the SCMI STM32MP15
dtsi files as the clock tree is not defined in the U-Boot SCMI device tree;
these SCMI device tree only support TFABOOT with stm32mp15_defconfig,
SPL with the basic boot defconfig is not supported.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
23 months agoadc: stm32mp15: add calibration support
Olivier Moysan [Thu, 15 Dec 2022 12:51:10 +0000 (13:51 +0100)]
adc: stm32mp15: add calibration support

Add support of offset and linear calibration for STM32MP15.
The calibration is performed once at probe. The ADC is set in power on
state for calibration. It remains in this state after calibration,
to give to the kernel the opportunity to retrieve calibration data,
directly from the ADC.

Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
23 months agoARM: dts: stm32: add support for USB2514B onboard hub on stm32mp157c-ev1
Fabrice Gasnier [Mon, 12 Dec 2022 10:44:37 +0000 (11:44 +0100)]
ARM: dts: stm32: add support for USB2514B onboard hub on stm32mp157c-ev1

Add support for USB2514B onboard hub on stm32mp157c EV1 board. The HUB
is supplied by a 3v3 PMIC regulator.

[backport from linux ad9591b01d24]
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
23 months agoconfigs: stm32: enable USB onboard HUB driver
Fabrice Gasnier [Mon, 12 Dec 2022 10:44:36 +0000 (11:44 +0100)]
configs: stm32: enable USB onboard HUB driver

Activate the USB onboard HUB driver, that is used to enable the HUB supply
on STM32MP15 EVAL, DK1 and DK2 boards.
This avoids marking the 3v3 corresponding regulator as always-on.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
23 months agousb: onboard-hub: add driver to manage onboard hub supplies
Fabrice Gasnier [Mon, 12 Dec 2022 10:44:35 +0000 (11:44 +0100)]
usb: onboard-hub: add driver to manage onboard hub supplies

The main issue the driver addresses is that a USB hub needs to be
powered before it can be discovered. This is often solved by using
"regulator-always-on".

This driver is inspired by the Linux v6.1 driver. It only enables (or
disables) the hub vdd (3v3) supply, so it can be enumerated.
Scanning of the device tree is done in a similar manner to the sandbox,
by the usb-uclass. DT part looks like:

&usbh_ehci {
...
#address-cells = <1>;
#size-cells = <0>;
hub@1 {
compatible = "usb424,2514";
reg = <1>;
vdd-supply = <&v3v3>;
};
};

When the bus gets probed, the driver is automatically probed/removed from
the bus tree, as an example on stm32:
STM32MP> usb start
starting USB...
STM32MP> dm tree
 Class     Index  Probed  Driver                Name
-----------------------------------------------------------
 usb           0  [ + ]   ehci_generic          |   |-- usb@5800d000
 usb_hub       0  [ + ]   usb_onboard_hub       |   |   `-- hub@1
 usb_hub       1  [ + ]   usb_hub               |   |       `-- usb_hub

STM32MP> usb tree
USB device tree:
  1  Hub (480 Mb/s, 0mA)
  |  u-boot EHCI Host Controller
  |
  +-2  Hub (480 Mb/s, 2mA)

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
23 months agoMerge branch '2023-01-11-assorted-general-updates'
Tom Rini [Thu, 12 Jan 2023 15:15:24 +0000 (10:15 -0500)]
Merge branch '2023-01-11-assorted-general-updates'

- Assorted Kconfig cleanups, code clean ups, env+ubi updates, correct
  return value propagation out of environment scripts, and update CI to
  latest "jammy" tag.

23 months agoARM: dts: stm32: update vbus-supply of usbphyc_port0 on stm32mp157c-ev1
Fabrice Gasnier [Mon, 12 Dec 2022 10:32:42 +0000 (11:32 +0100)]
ARM: dts: stm32: update vbus-supply of usbphyc_port0 on stm32mp157c-ev1

phy-stm32-usbphyc bindings uses a connector node with vbus-supply
property.

[backport from linux 43e55d778a6b]
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
23 months agoCI/Docker: Update to jammy-20221130 tag
Tom Rini [Wed, 11 Jan 2023 17:24:57 +0000 (12:24 -0500)]
CI/Docker: Update to jammy-20221130 tag

Update to the latest "jammy" tag. This requires us to list libc6-i386 as
a required package to install (for nokia_rx51 tests) that was previously
implicit.

Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agoUse `grep -E` or plain `grep` instead of `egrep`
Ville Skyttä [Sun, 1 Jan 2023 16:41:42 +0000 (18:41 +0200)]
Use `grep -E` or plain `grep` instead of `egrep`

`egrep` has been deprecated in GNU grep since 2007,
and since 3.8 it emits obsolescence warnings:
https://git.savannah.gnu.org/cgit/grep.git/commit/?id=a9515624709865d480e3142fd959bccd1c9372d1
Acked-by: Dhruva Gole <d-gole@ti.com>
23 months agoKconfig: move NXP specific stuff into a sub-menu
Heinrich Schuchardt [Fri, 30 Dec 2022 23:08:47 +0000 (00:08 +0100)]
Kconfig: move NXP specific stuff into a sub-menu

Having NXP specific items in the main menu is confusing. Especially
the comment line

   *** Other functionality shared between NXP SoCs ***

is simply misleading.

Move all NXP stuff into a separate sub-menu.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
23 months agoKconfig: clean up skipping low-level initialization
Heinrich Schuchardt [Fri, 30 Dec 2022 18:41:28 +0000 (19:41 +0100)]
Kconfig: clean up skipping low-level initialization

Put all entries for skipping low-level initialization into a sub-menu.
Use different titles for main U-Boot, SPL, TPL.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
23 months agoDockerfile: add package texinfo
Heinrich Schuchardt [Fri, 30 Dec 2022 04:41:01 +0000 (05:41 +0100)]
Dockerfile: add package texinfo

In preparation of adding the infodocs target to our CI install the
prerequisite texinfo software package.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
23 months agofs/btrfs: handle data extents, which crosss stripe boundaries, correctly
Qu Wenruo [Fri, 30 Dec 2022 01:07:05 +0000 (09:07 +0800)]
fs/btrfs: handle data extents, which crosss stripe boundaries, correctly

[BUG]
Since btrfs supports single device RAID0 at mkfs time after btrfs-progs
v5.14, if we create a single device raid0 btrfs, and created a file
crossing stripe boundary:

  # mkfs.btrfs -m dup -d raid0 test.img
  # mount test.img mnt
  # xfs_io -f -c "pwrite 0 128K" mnt/file
  # umount mnt

Since btrfs is using 64K as stripe length, above 128K data write is
definitely going to cross at least one stripe boundary.

Then u-boot would fail to read above 128K file:

 => host bind 0 /home/adam/test.img
 => ls host 0
 <   >     131072  Fri Dec 30 00:18:25 2022  file
 => load host 0 0 file
 BTRFS: An error occurred while reading file file
 Failed to load 'file'

[CAUSE]
Unlike tree blocks read, data extent reads doesn't consider cases in which
one data extent can cross stripe boundary.

In read_data_extent(), we just call btrfs_map_block() once and read the
first mapped range.

And if the first mapped range is smaller than the desired range, it
would return error.

But since even single device btrfs can utilize RAID0 profiles, the first
mapped range can only be at most 64K for RAID0 profiles, and cause false
error.

[FIX]
Just like read_whole_eb(), we should call btrfs_map_block() in a loop
until we read all data.

Since we're here, also add extra error messages for the following cases:

- btrfs_map_block() failure
  We already have the error message for it.

- Missing device
  This should not happen, as we only support single device for now.

- __btrfs_devread() failure

With this bug fixed, btrfs driver of u-boot can properly read the above
128K file, and have the correct content:

 => host bind 0 /home/adam/test.img
 => ls host 0
 <   >     131072  Fri Dec 30 00:18:25 2022  file
 => load host 0 0 file
 131072 bytes read in 0 ms
 => md5sum 0 0x20000
 md5 for 00000000 ... 0001ffff ==> d48858312a922db7eb86377f638dbc9f
 ^^^ Above md5sum also matches.

Reported-by: Sam Winchenbach <swichenbach@tethers.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
23 months agoata: Fix dependency for CONFIG_SATA_SIL
Pali Rohár [Thu, 29 Dec 2022 17:15:35 +0000 (18:15 +0100)]
ata: Fix dependency for CONFIG_SATA_SIL

sata_sil.c is PCI driver and without CONFIG_PCI is building of U-Boot failing:

      LD      u-boot
    ld.bfd: drivers/ata/sata_sil.o: in function `sil_exec_cmd':
    drivers/ata/sata_sil.c:148: undefined reference to `dm_pci_phys_to_bus'
    ld.bfd: drivers/ata/sata_sil.o: in function `sil_pci_probe':
    drivers/ata/sata_sil.c:687: undefined reference to `dm_pci_get_bdf'
    ld.bfd: drivers/ata/sata_sil.c:691: undefined reference to `dm_pci_read_config16'
    ld.bfd: drivers/ata/sata_sil.c:701: undefined reference to `dm_pci_map_bar'
    ld.bfd: drivers/ata/sata_sil.c:704: undefined reference to `dm_pci_map_bar'
    ld.bfd: drivers/ata/sata_sil.c:713: undefined reference to `dm_pci_write_config16'
    ld.bfd: drivers/ata/sata_sil.c:717: undefined reference to `dm_pci_read_config16'
    ld.bfd: drivers/ata/sata_sil.o: in function `sil_cmd_identify_device':
    drivers/ata/sata_sil.c:256: undefined reference to `dm_pci_phys_to_bus'
    ld.bfd: drivers/ata/sata_sil.o: in function `sil_sata_rw_cmd':
    drivers/ata/sata_sil.c:330: undefined reference to `dm_pci_phys_to_bus'
    ld.bfd: drivers/ata/sata_sil.o: in function `sil_sata_rw_cmd_ext':
    drivers/ata/sata_sil.c:377: undefined reference to `dm_pci_phys_to_bus'
    make: *** [Makefile:1778: u-boot] Error 1

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
23 months agotest: compression: use ut_assert for errors
Brandon Maier [Wed, 28 Dec 2022 22:53:52 +0000 (16:53 -0600)]
test: compression: use ut_assert for errors

Use the ut_assert macros for more useful error messages.

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
23 months agotest: compression: check with trailing garbage in input
Brandon Maier [Wed, 28 Dec 2022 22:53:51 +0000 (16:53 -0600)]
test: compression: check with trailing garbage in input

The Linux kernel appends 4 bytes to the end of compressed kernel Images
containing the uncompressed image size. They are used to make
self-decompressing Images easier. However for archs that don't support
self-decompression, like ARM64, U-Boot must be able to decompress the
image with the garbage data.

The existing decompressors already support this. This unit test was
added while working on zstd support as upstream zstd will error if there
is garbage data in the input buffer, and special care was needed to
support this.

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
23 months agofs/squashfs: Only use export table if available
David Oberhollenzer [Sun, 25 Dec 2022 10:05:24 +0000 (11:05 +0100)]
fs/squashfs: Only use export table if available

For a squashfs filesystem, the fragment table is followed by
the following tables: NFS export table, ID table, xattr table.

The export and xattr tables are both completely optional, but
the ID table is mandatory. The Linux implementation refuses to
mount the image if the ID table is missing. Tables that are no
present have their location in the super block set
to 0xFFFFFFFFFFFFFFFF.

The u-boot implementation previously assumed that it can always
rely on the export table location as an upper bound for the fragment
table, trying (and failing) to read past filesystem bounds if it
is not present.

This patch changes the driver to use the ID table instead and only
use the export table location if it lies between the two.

Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
23 months agotest: cmd: exit: Add unit test for exit and partly run commands
Marek Vasut [Tue, 20 Dec 2022 06:26:00 +0000 (07:26 +0100)]
test: cmd: exit: Add unit test for exit and partly run commands

Add a test which validates that exit from environment script works as
expected, including return value propagation and clipping to positive
integers.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marex@denx.de>
23 months agocmd: exit: Fix return value propagation out of environment scripts
Marek Vasut [Tue, 20 Dec 2022 06:25:59 +0000 (07:25 +0100)]
cmd: exit: Fix return value propagation out of environment scripts

Make sure the 'exit' command as well as 'exit $val' command exits
from environment scripts immediately and propagates return value
out of those scripts fully. That means the following behavior is
expected:

"
=> setenv foo 'echo bar ; exit 1' ; run foo ; echo $?
bar
1
=> setenv foo 'echo bar ; exit 0' ; run foo ; echo $?
bar
0
=> setenv foo 'echo bar ; exit -2' ; run foo ; echo $?
bar
0
"

As well as the followin behavior:

"
=> setenv foo 'echo bar ; exit 3 ; echo fail'; run foo; echo $?
bar
3
=> setenv foo 'echo bar ; exit 1 ; echo fail'; run foo; echo $?
bar
1
=> setenv foo 'echo bar ; exit 0 ; echo fail'; run foo; echo $?
bar
0
=> setenv foo 'echo bar ; exit -1 ; echo fail'; run foo; echo $?
bar
0
=> setenv foo 'echo bar ; exit -2 ; echo fail'; run foo; echo $?
bar
0
=> setenv foo 'echo bar ; exit ; echo fail'; run foo; echo $?
bar
0
"

Fixes: 8c4e3b79bd0 ("cmd: exit: Fix return value")
Reviewed-by: Hector Palacios <hector.palacios@digi.com>
Signed-off-by: Marek Vasut <marex@denx.de>
23 months agofastboot: Add OEM run command
Sean Anderson [Fri, 16 Dec 2022 18:20:16 +0000 (13:20 -0500)]
fastboot: Add OEM run command

This adds the UUU UCmd functionality as an OEM command. While the
fastboot tool allows sending arbitrary commands as long as they are
prefixed with "oem". This allows running generic U-Boot commands over
fastboot without UUU, which is especially useful when not using USB.
This is really the route we should have gone in the first place when
adding these commands.

While we're here, clean up the UUU Kconfig a bit.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
23 months agofastboot: remove #ifdef CONFIG when it is possible
Patrick Delaunay [Thu, 15 Dec 2022 09:15:50 +0000 (10:15 +0100)]
fastboot: remove #ifdef CONFIG when it is possible

Much of the fastboot code predates the introduction of Kconfig and
has quite a few #ifdefs in it which is unnecessary now that we can use
IS_ENABLED() et al.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Sean Anderson <sean.anderson@seco.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # on vim3l
23 months agooptee: bind the TA drivers on OP-TEE node
Patrick Delaunay [Thu, 15 Dec 2022 08:54:52 +0000 (09:54 +0100)]
optee: bind the TA drivers on OP-TEE node

In U-Boot driver model the devices can be referenced by
phandle in the U-Boot configuration nodes.

Without a valid node provided during the bind, the driver
associated to OP-TEE TA can't be referenced.

For example to force the sequence number with alias
(.flags = DM_UC_FLAG_SEQ_ALIAS)

  aliases {
rng0 = &optee;
  };

or other configuration:

board-sysinfo {
   compatible = "vendor,sysinfo-board";
   ramdom = <&optee>;
}

With this patch all drivers bound from OP-TEE service
discovery are now associated are associated to OP-TEE
node, allowing to identify by phandle the driver
provided by the TA for one UCLASS without modifying
device tree.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
23 months agoenv: add failing trace in env_erase
Patrick Delaunay [Wed, 14 Dec 2022 15:51:32 +0000 (16:51 +0100)]
env: add failing trace in env_erase

Add trace in env save to indicate any errors to end user and avoid
silent output when the command 'env erase' is not executed as it is
done in env_save with commit 8968288cb477 ("env: add failing trace in
env_save")

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
23 months agoenv: ubi: add support of command env erase
Patrick Delaunay [Wed, 14 Dec 2022 15:51:31 +0000 (16:51 +0100)]
env: ubi: add support of command env erase

Add support of opts erase for ubi env backend, this opts is used by
command 'env erase'.

This command only zero-fill the env UBI volume CONFIG_ENV_UBI_VOLUME
and CONFIG_ENV_UBI_VOLUME_REDUND, so the saved environment becomes
invalid.

This patch introduces a local define ENV_UBI_VOLUME_REDUND
only to avoid #if in the code, as CONFIG_ENV_UBI_VOLUME_REDUND
is only defined when CONFIG_SYS_REDUNDAND_ENVIRONMENT is defined.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
23 months agotest: env: add test for u-boot-initial-env creation
Max Krummenacher [Fri, 9 Dec 2022 12:09:56 +0000 (13:09 +0100)]
test: env: add test for u-boot-initial-env creation

Checks that `make u-boot-initial-env` creates the text file
u-boot-initial-env and checks that it at least contains
`board=<something>`.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
23 months agocmd: change the return value when argc error
Shenlin Liang [Fri, 9 Dec 2022 09:17:43 +0000 (17:17 +0800)]
cmd: change the return value when argc error

When the number of parameters is wrong, the return value should be processed in
the same way as other cmds, return CMD_RET_USAGE so that it can print the information.

Signed-off-by: Shenlin Liang <liangshenlin@eswincomputing.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
23 months agocmd: mtdparts: add SYS_MTDPARTS_RUNTIME dependency on CONFIG_MTDIDS/MTDPARTS_DEFAULT
Patrick Delaunay [Thu, 8 Dec 2022 08:10:13 +0000 (09:10 +0100)]
cmd: mtdparts: add SYS_MTDPARTS_RUNTIME dependency on CONFIG_MTDIDS/MTDPARTS_DEFAULT

The two configuration CONFIG_MTDIDS_DEFAULT and CONFIG_MTDPARTS_DEFAULT
are not needed with mtd configuration CONFIG_SYS_MTDPARTS_RUNTIME which
allows the MTDIDS and MTDPARTS to be configured at runtime.

This patch has no defconfig impacts because CONFIG_SYS_MTDPARTS_RUNTIME
is only used by two platforms (stm32mp and igep00x0) which don't define
CONFIG_MTDIDS_DEFAULT or CONFIG_MTDPARTS_DEFAULT.

This patch solves an UBI environment load issue for NAND boot for
stm32mp15 platform. In mtd_uboot.c, when GD_FLG_ENV_READY is not set,
env_get_f() return a EMPTY string, define in default_environment[]
because CONFIG_MTDIDS_DEFAULT="" and CONFIG_MTDPARTS_DEFAULT="",
but a NULL pointer is expected to allow call of board_mtdparts_default.
Without mtdparts, the env partition [CONFIG_ENV_UBI_PART="UBI"] is not
found in env/ubi.c [CONFIG_ENV_IS_IN_UBI].

It is not a problem when env becomes ready, as these empty variables are
removed form U-Boot environment in env_import() / himport_r().

Fixes: a331017c237c ("Complete migration of MTDPARTS_DEFAULT / MTDIDS_DEFAULT, include in environment")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
23 months agolib: rsa: cosmetic: fix building warning
Haijun Qin [Tue, 6 Dec 2022 07:41:37 +0000 (15:41 +0800)]
lib: rsa: cosmetic: fix building warning

add initialization of variable 'node',this can aviod the building
warning:

    'node' may be used uninitialized [-Wmaybe-uninitialized]

Signed-off-by: Haijun Qin <qinhaijun@eswincomputing.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
23 months agoreboot-mode: Add NVMEM reboot mode
Sean Anderson [Fri, 2 Dec 2022 16:03:53 +0000 (11:03 -0500)]
reboot-mode: Add NVMEM reboot mode

This adds an NVMEM reboot mode driver, similar to Linux's
implementation. This allows using the same device tree binding for Linux
and U-Boot in most cases.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
23 months agortc: abx8xx: Add support for reading RAM
Sean Anderson [Fri, 2 Dec 2022 15:35:19 +0000 (10:35 -0500)]
rtc: abx8xx: Add support for reading RAM

This adds support for reading the battery-backed memory present on these
RTCs. This modifies the read/write methods to access the RAM instead of
raw register offsets. No one was using these in-tree, so we should be
fine changing them.

We use the "standard" address space window to access the RAM. The
extension RAM address register has some reserved bits, but we write the
whole thing for simplicity (as these bits default to 0).

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
23 months agocommon:autoboot:modify function parameters
Shenlin Liang [Fri, 2 Dec 2022 04:53:48 +0000 (12:53 +0800)]
common:autoboot:modify function parameters

the blob parameter of the function process_fdt_options has not been
invoked in the function body and should be changed to void type

Signed-off-by: Shenlin Liang <liangshenlin@eswincomputing.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
23 months agoMerge branch '2023-01-10-platform-updates'
Tom Rini [Wed, 11 Jan 2023 02:13:57 +0000 (21:13 -0500)]
Merge branch '2023-01-10-platform-updates'

- Platform updates for TI, nuvoton pinctrl, starqltechn/sdm845 fixes,
  and assorted platform CONFIG_BUILD_TARGET corrections

23 months agoARM: omap3: evm: Name this directory omap3evm
Andrew Davis [Fri, 6 Jan 2023 19:05:14 +0000 (13:05 -0600)]
ARM: omap3: evm: Name this directory omap3evm

Before this was named just evm, which doesn't match the naming
of the other TI board file directory and makes it look like a
common directory for evms. Name this omap3evm.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Derald Woods <woods.technical@gmail.com>