]> git.baikalelectronics.ru Git - uboot.git/log
uboot.git
22 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

22 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

22 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>
22 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: 51691b197559f9 ("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>
22 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>
22 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>
22 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>
22 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
76251f11ca ("mtd: spi-nor: Mask out fast read if not requested in DT")

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
22 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
734946ddca ("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>
22 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
734946ddca ("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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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

22 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()

22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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: 3229d53df90b ("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>
22 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: 3586b627221d ("efi_loader: fix building aarch64 EFI binaries")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
22 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>
22 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>
22 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: 4a3a77c0dd3a ("lib: add function u16_strcasecmp()")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
22 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.

22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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.

22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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>
22 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: 015522f7ea2 ("cmd: exit: Fix return value")
Reviewed-by: Hector Palacios <hector.palacios@digi.com>
Signed-off-by: Marek Vasut <marex@denx.de>
22 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>
22 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
22 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>
22 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 fa9387012b1e ("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>
22 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>
22 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>
22 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>
22 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: 690ecd9413c9 ("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>
22 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>
22 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>
22 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>
22 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>
22 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

22 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>
22 months agopowerpc/mpc85xx: Unset CONFIG_SPL_TARGET="u-boot-with-spl.bin"
Pali Rohár [Thu, 29 Dec 2022 01:39:21 +0000 (02:39 +0100)]
powerpc/mpc85xx: Unset CONFIG_SPL_TARGET="u-boot-with-spl.bin"

CONFIG_SPL_TARGET should specify additional SPL make target. But
u-boot-with-spl.bin is final U-Boot binary, not SPL binary in some custom
format. Moreover u-boot-with-spl.bin is already set in CONFIG_BUILD_TARGET,
so make will build it by default.

Signed-off-by: Pali Rohár <pali@kernel.org>
22 months agopowerpc/mpc85xx: Set default CONFIG_BUILD_TARGET
Pali Rohár [Thu, 29 Dec 2022 01:39:20 +0000 (02:39 +0100)]
powerpc/mpc85xx: Set default CONFIG_BUILD_TARGET

Final U-Boot binary for mpc85xx boards which use SPL and are not PBL-based
based is u-boot-with-spl.bin. PBL is not used only on boards with e500v1
and e500v2 cores. Apparently CONFIG_E500 is set not only for e500 cores,
but also for all other mpc85xx cores e500mc, e5500 and e5600. So do not use
CONFIG_E500 and instead filter new cores with PBL based bootrom.

Signed-off-by: Pali Rohár <pali@kernel.org>
22 months agoarm: mvebu: Fix default CONFIG_BUILD_TARGET
Pali Rohár [Thu, 29 Dec 2022 01:39:19 +0000 (02:39 +0100)]
arm: mvebu: Fix default CONFIG_BUILD_TARGET

u-boot-with-spl.kwb is built only for SPL enabled 32-bit armada boards.
u-boot.kwb is built for 32-bit armada and kirkwood boards but only for
non-SPL targets.

So replace CONFIG_ARCH_MVEBU by CONFIG_ARMADA_32BIT (it implies
CONFIG_ARCH_MVEBU) for u-boot-with-spl.kwb.

And add additional CONFIG_ARMADA_32BIT && !CONFIG_SPL for u-boot.kwb.

Signed-off-by: Pali Rohár <pali@kernel.org>
22 months agoSoC: sdm845: find and save KASLR to env variables
Dzmitry Sankouski [Tue, 27 Dec 2022 19:47:09 +0000 (22:47 +0300)]
SoC: sdm845: find and save KASLR to env variables

KASLR address is needed to boot fully functional Android.
KASLR is set by primary bootloader, and since u-boot is used
as a secondary bootloader(replacing kernel) on sdm845 platform,
KASLR may be found by comparing memory chunks at relocaddr over
supposed KASLR range.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
22 months agoboard: starqltechn: enable serial console
Dzmitry Sankouski [Tue, 27 Dec 2022 19:47:08 +0000 (22:47 +0300)]
board: starqltechn: enable serial console

It was temporary disabled due to problem with boot.
Issue was fixed in
commit 33ac18e05d9f ("uart: sdm845: Fix debug UART pinmux")

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
22 months agoconfigs: am62a: use kernel fitImage when using secure bootflow
Bryan Brattlof [Sat, 24 Dec 2022 01:15:25 +0000 (19:15 -0600)]
configs: am62a: use kernel fitImage when using secure bootflow

In order to maintain the chain of trust, each stage of the boot process
will first authenticate each binary it loads before continuing. To
extend this to the kernal and its dtbs we can package the kernal and
its dtbs into another fitImage for Uboot to authenticate and extend the
chain of trust all the way to the kernel.

When 'boot_fit' is set, indicating we're using the secure bootflow, look
for and authenticate the kernel's fitImage.

Signed-off-by: Judith Mendez <jm@ti.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
22 months agoconfigs: am62a: convert bootcmd to distro_bootcmd
Bryan Brattlof [Sat, 24 Dec 2022 01:15:24 +0000 (19:15 -0600)]
configs: am62a: convert bootcmd to distro_bootcmd

We're currently using CONFIG_BOOTCOMMAND to run custom boot scripts to
jump into linux. While this works, let's begin the transition to more
distribution friendly jumps to linux by enabling distro_bootcmd.

Convert the custom bootcmd to a distro_bootcmd

Signed-off-by: Judith Mendez <jm@ti.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
22 months agoarm: mach-k3: copy bootindex to OCRAM for main domain SPL
Bryan Brattlof [Sat, 24 Dec 2022 01:15:23 +0000 (19:15 -0600)]
arm: mach-k3: copy bootindex to OCRAM for main domain SPL

Texas Instruments has begun enabling security settings on the SoCs it
produces to instruct ROM and TIFS to begin protecting the Security
Management Subsystem (SMS) from other binaries we load into the chip by
default.

One way ROM and TIFS do this is by enabling firewalls to protect the
OCSRAM and HSM RAM regions they're using during bootup.

The HSM RAM the wakeup SPL is in is firewalled by TIFS to protect
itself from the main domain applications. This means the 'bootindex'
value in HSM RAM, left by ROM to indicate if we're using the primary
or secondary boot-method, must be moved to OCSRAM (that TIFS has open
for us) before we make the jump to the main domain so the main domain's
bootloaders can keep access to this information.

Signed-off-by: Bryan Brattlof <bb@ti.com>
22 months agoconfigs: am62a: move stack and heap to HSM RAM
Bryan Brattlof [Sat, 24 Dec 2022 01:15:22 +0000 (19:15 -0600)]
configs: am62a: move stack and heap to HSM RAM

Texas Instruments has begun enabling security setting on the SoCs they
produce to instruct ROM and TIFS to begin protecting the Security
Management Subsystem (SMS) from other binaries we load into the chip by
default.

One way ROM does this is by enabling firewalls to protect the OCSRAM
region it's using during bootup. Only after TIFS has started (and had
time to disable the OCSRAM firewall region) will we have write access to
the region.

This means we will need to move the stack & heap from OCSRAM to HSM RAM
and reduce the size of BSS and the SPL to allow it to fit properly.

Signed-off-by: Bryan Brattlof <bb@ti.com>
22 months agoconfigs: restrict am62ax wakup SPL size
Bryan Brattlof [Sat, 24 Dec 2022 01:15:21 +0000 (19:15 -0600)]
configs: restrict am62ax wakup SPL size

In its current form, the am62a's wakeup SPL is fairly small, however
this will not remain as more boot modes are eventually added. To protect
us from overflowing our ~256k of HSM SRAM, add limits and check during
the wakeup SPL build.

Signed-off-by: Bryan Brattlof <bb@ti.com>
22 months agoconfigs: Enable distroboot on am625
Martyn Welch [Tue, 20 Dec 2022 18:38:19 +0000 (18:38 +0000)]
configs: Enable distroboot on am625

TI boards use a custom (though faily common to TI boards) mechanism for
booting Linux. We would like to use the "distroboot" approach.

Enable distroboot as a further option to use for booting on am625 should
the existing options fail.

Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
22 months agoarm64:mach-k3 am625_init: Correct boot mode detection
Martyn Welch [Tue, 20 Dec 2022 18:38:18 +0000 (18:38 +0000)]
arm64:mach-k3 am625_init: Correct boot mode detection

The boot mode detection assumes that BOOT_DEVICE_MMC2 should always
result in MMCSD_MODE_FS, but MMCSD_MODE_RAW is also a valid option for
this port.

The current logic also avoids looking at the bootmode pin strapping,
which should be the primary means of determining whether a device is
being booted in MMCSD_MODE_EMMCBOOT mode.

Switch around the logic to check the boot mode to determine whether the
eMMC boot mode is expected or MMC/SD boot mode. From there we can look
at the boot mode config if in MMC/SD boot mode to determine whether to
attempt RAW or FS based booting.

This change allows U-Boot to also be successfully booted from RAW
offsets in addition to from a filesystem.

Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
22 months agoconfigs: am62x_evm_a53: Enable ethernet
Sjoerd Simons [Tue, 20 Dec 2022 15:21:46 +0000 (16:21 +0100)]
configs: am62x_evm_a53: Enable ethernet

Enable ethernet support for u-boot on am62x evm

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
22 months agoarm: dts: k3-am625-sk: Enable first ethernet port
Sjoerd Simons [Tue, 20 Dec 2022 15:21:45 +0000 (16:21 +0100)]
arm: dts: k3-am625-sk: Enable first ethernet port

The K3 am625 sk EVM has two ethernet ports; Enable the first one for
usage in u-boot.

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
22 months agoconfigs: am62x_evm_*: Run savedefconfig
Sjoerd Simons [Tue, 20 Dec 2022 15:21:44 +0000 (16:21 +0100)]
configs: am62x_evm_*: Run savedefconfig

Clean configuration for am62x_evm using savedefconfig

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
Tested-by: Dhruva Gole <d-gole@ti.com>