]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
2 years agoMerge tag 'fsl-qoriq-2022-9-6' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Tue, 6 Sep 2022 12:59:51 +0000 (08:59 -0400)]
Merge tag 'fsl-qoriq-2022-9-6' of https://source.denx.de/u-boot/custodians/u-boot-fsl-qoriq

Reset fixes for p1_p2_rdb_pc
Fix use after free issue fix in fsl_enetc.c
Fix for fsl ddr: make bank_addr_bits reflect actual bits
sl28 board update

2 years agoboard: freescale: p1_p2_rdb_pc: Turn off watchdog before reset
Pali Rohár [Mon, 1 Aug 2022 13:31:46 +0000 (15:31 +0200)]
board: freescale: p1_p2_rdb_pc: Turn off watchdog before reset

P1/P2 RDB boards have external max6370 watchdog connected to CPLD and this
watchdog is not deactivated on board reset. So if it is active during board
reset, it can trigger another reset when CPU is booting U-Boot. To prevent
possible infinite reset loop caused by external watchdog, turn it off
before reset.

Do it via a new board_reset_prepare() callback which is called from
do_reset() function before any reset sequence.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoboard: freescale: p1_p2_rdb_pc: Avoid usage of CPLD's system reset register
Pali Rohár [Mon, 1 Aug 2022 13:31:45 +0000 (15:31 +0200)]
board: freescale: p1_p2_rdb_pc: Avoid usage of CPLD's system reset register

CPLD's system reset register is buggy and requires workaround in U-Boot.
So use this kind of board reset only when there is no other reset option.

Introduce a new board_reset_last() callback which is last-stage
board-specific reset and implement CPLD's system reset in this new
board_reset_last() callback instead of board_reset() callback.

Fixes: 20fb58fc5a1c ("board: freescale: p1_p2_rdb_pc: Implement board_reset()")
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoboard: freescale: p1_p2_rdb_pc: Add workaround for non-working watchdog
Pali Rohár [Mon, 1 Aug 2022 13:31:44 +0000 (15:31 +0200)]
board: freescale: p1_p2_rdb_pc: Add workaround for non-working watchdog

If watchdog timer was already set to non-disabled value then it means that
watchdog timer was already activated, has already expired and caused CPU
reset. If this happened then due to CPLD firmware bug, writing to wd_cfg
register has no effect and therefore it is not possible to reactivate
watchdog timer again. Watchdog starts working again after CPU reset via
non-watchdog method.

Implement this workaround (reset CPU when it was reset by watchdog) to make
watchdog usable again. Watchdog timer logic on these P1/P2 RDB boards is
connected to CPLD, not to SoC itself.

Note that reset does not occur immediately after calling do_reset(), but
after few ms later as real reset is done by CPLD. So it is normal that
function do_reset() returns. Therefore hangs after calling do_reset() to
prevent CPU execution of the rest U-Boot code.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoboard: freescale: p1_p2_rdb_pc: Add workaround for board reset reboot loop
Pali Rohár [Mon, 1 Aug 2022 13:31:43 +0000 (15:31 +0200)]
board: freescale: p1_p2_rdb_pc: Add workaround for board reset reboot loop

CPLD's system reset register on P1/P2 RDB boards is not autocleared after
flipping it. If this register is set to one in 100ms after reset starts
then CPLD triggers another CPU reset.

This means that trying to reset board via CPLD system reset register cause
reboot loop. To prevent this reboot loop, the only workaround is to try to
clear CPLD's system reset register as early as possible. U-Boot is already
doing it in its board_early_init_f() function, which seems to be enough as
register is cleared prior CPLD triggers another reset.

But board_early_init_f() is not called from SPL and therefore usage of SPL
can cause reboot loop.

To prevent reboot loop when using SPL, call board_early_init_f() function
in SPL too. For accessing CPLD memory space it is needed to have CPLD entry
in TLB.

With this change it is possible to trigger board reset via CPLD's system
reset register on P2020 RDB board.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agonet: enetc: Fix use after free issue in fsl_enetc.c
Siarhei Yasinski [Wed, 31 Aug 2022 10:57:37 +0000 (10:57 +0000)]
net: enetc: Fix use after free issue in fsl_enetc.c

If ethernet connected to SFP, like this:

&enetc_port0 {
            phy-connection-type = "sgmii";
            sfp = <&sfp0>;
            managed = "in-band-status";
            status = "okay";
};

Then enetc_config_phy returns -ENODEV and the memory containing the mdio interface is freed.
It's better to unregister and free mdio resources.

Signed-off-by: Siarhei Yasinski <siarhei.yasinski@sintecs.eu>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoddr: fsl: Make bank_addr_bits reflect actual bits
Sean Anderson [Tue, 30 Aug 2022 21:01:07 +0000 (17:01 -0400)]
ddr: fsl: Make bank_addr_bits reflect actual bits

In both the Freescale DDR controller and the SPD spec, bank address bits
are stored as the number of bank address bits minus 2. For example, if a
chip had 8 banks (3 total bank address bits), the value of
bank_addr_bits would be 1. This is rather surprising for users
configuring their memory manually, since they can't set bank_addr_bits
to the actual number of bank address bits. Rectify this.

There is at least one example of this kind of mistake already, in
board/freescale/t102xrdb/ddr.c. The documented MT40A512M8HX has two bank
address bits, but bank_addr_bits was set to 2, implying 4 bank address
bits. Such a value is reserved in BA_BITS_CS, but I suspect the
controller simply ignores the top bit, making this kind of mistake
harmless, if misleading.

Fixes: e8a7f1c32b5 ("powerpc/t1023rdb: Add T1023 RDB board support")
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoddr: fsl: Reduce the size of interactive options
Sean Anderson [Tue, 30 Aug 2022 20:54:39 +0000 (16:54 -0400)]
ddr: fsl: Reduce the size of interactive options

The interactive mode uses large several tables of options which can be
configured. However, much of the contents of these tables are
repetetive. For example, no struct is larger than half a kilobyte, so
the offset only takes up 9 bits. Similarly, the size is only ever 4 or
8, and printhex is a boolean. Reduce the size of these fields. This
reduces the size of the options tables by around 10 KiB. However, the
largest contributor to the size of the options tables is the use of a
pointer for the strings. A better approach would be to use a separate
array of strings, and store an integer index in the options tables.
However, this would require a large re-architecting of this file.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoboard: sl28: remove COUNTER_FREQUENCY_REAL
Michael Walle [Tue, 23 Aug 2022 09:30:18 +0000 (11:30 +0200)]
board: sl28: remove COUNTER_FREQUENCY_REAL

The frequency of the system counter is static which is given by the
COUNTER_FREQUENCY option. Remove COUNTER_FREQUENCY_REAL.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoboard: sl28: support dynamic prompts
Michael Walle [Tue, 23 Aug 2022 09:30:17 +0000 (11:30 +0200)]
board: sl28: support dynamic prompts

Depending on the boot source, set different CLI prompts. This will help
the user to figure out in which mode the bootloader was started. There
are two special modes: failsafe and SDHC boot.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoboard: sl28: add user friendly names for the boot sources
Michael Walle [Tue, 23 Aug 2022 09:30:16 +0000 (11:30 +0200)]
board: sl28: add user friendly names for the boot sources

During startup the SPL will print where the u-boot proper is read from.
Instead of using the default names, provide more user friendly names.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoboard: sl28: implement additional bootsources
Michael Walle [Tue, 23 Aug 2022 09:30:15 +0000 (11:30 +0200)]
board: sl28: implement additional bootsources

The board is able to boot from the following source:
 - user-updateble SPI flash
 - write-protected part of the same SPI flash
 - eMMC
 - SD card

Implement the needed function hooks to support all of these boot
sources.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoarmv8: layerscape: spl: mark OCRAM as non-secure
Michael Walle [Tue, 23 Aug 2022 09:30:14 +0000 (11:30 +0200)]
armv8: layerscape: spl: mark OCRAM as non-secure

By default the OCRAM is marked as secure. While the SPL runs in EL3 and
thus can access it, DMA devices cannot. Mark the whole OCRAM as
non-secure.
This will fix MMC and SD card boot on LS1028A when using SPL instead of
TF-A.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoPrepare v2022.10-rc4
Tom Rini [Tue, 6 Sep 2022 00:32:56 +0000 (20:32 -0400)]
Prepare v2022.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoconfigs: Resync with savedefconfig
Tom Rini [Tue, 6 Sep 2022 00:32:14 +0000 (20:32 -0400)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoMerge tag 'u-boot-rockchip-20220905' of https://source.denx.de/u-boot/custodians...
Tom Rini [Mon, 5 Sep 2022 02:35:40 +0000 (22:35 -0400)]
Merge tag 'u-boot-rockchip-20220905' of https://source.denx.de/u-boot/custodians/u-boot-rockchip

- migrate to use binman for U-Boot image generate on rockchip platform;
- Some fixes for rk3399 and rk3308;

2 years agoclk: rockchip: rk3399: Fix Unknown clock 77 on mmc@fe310000
Michal Suchanek [Sun, 21 Aug 2022 07:17:24 +0000 (09:17 +0200)]
clk: rockchip: rk3399: Fix Unknown clock 77 on mmc@fe310000

Adding some debug prints I can see:

MMC:   mmc@fe320000: Got clock clock-controller@ff760000 76
mmc@fe310000: Got clock clock-controller@ff760000 77
Unknown clock 77
rockchip_dwmmc_get_mmc_clk: err=-2
mmc@fe310000: 3, mmc@fe320000: 1, mmc@fe330000: 0

According to kernel code the SDIO clock is identical to SDMMC clock
except for the con 16->15 change.

Add support for the clock to avoid the error.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: add u-boot-rockchip-spi.bin image for booting from SPI-NOR flash
Quentin Schulz [Fri, 2 Sep 2022 13:10:55 +0000 (15:10 +0200)]
rockchip: add u-boot-rockchip-spi.bin image for booting from SPI-NOR flash

This new image is similar to u-boot-rockchip.bin except that it's
destined to be flashed on SPI-NOR flashes.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agorockchip: allow to build SPI images even without HAS_ROM option
Quentin Schulz [Fri, 2 Sep 2022 13:10:54 +0000 (15:10 +0200)]
rockchip: allow to build SPI images even without HAS_ROM option

This prepares for the creation of a u-boot-rockchip-spi.bin image
similar to u-boot-rockchip.bin to the exception it's destined for
SPI-NOR flashes instead of MMC storage medium.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: simplify binman image dependencies addition to INPUTS
Quentin Schulz [Fri, 2 Sep 2022 13:10:53 +0000 (15:10 +0200)]
rockchip: simplify binman image dependencies addition to INPUTS

By factoring SPL check in the first condition, this makes the checks a
bit less convoluted and more readable.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agorockchip: generate u-boot-rockchip.bin with binman for ARM64 boards
Quentin Schulz [Fri, 2 Sep 2022 13:10:52 +0000 (15:10 +0200)]
rockchip: generate u-boot-rockchip.bin with binman for ARM64 boards

This allows to build u-boot-rockchip.bin binary with binman for Rockchip
ARM64 boards instead of the legacy Makefile way.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agorockchip: generate idbloader.img content for u-boot-rockchip.bin with binman for ARM
Quentin Schulz [Fri, 2 Sep 2022 13:10:51 +0000 (15:10 +0200)]
rockchip: generate idbloader.img content for u-boot-rockchip.bin with binman for ARM

idbloader.img content - currently created by way of Makefile - can be
created by binman directly.

So let's do that for Rockchip ARM platforms.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: remove binman temporary files when cleaning
Quentin Schulz [Fri, 2 Sep 2022 13:10:50 +0000 (15:10 +0200)]
rockchip: remove binman temporary files when cleaning

Binman mkimage entry generates temporary files so let's remove them
when calling `make clean`.

Fixes: 9b312e26fc77 ("rockchip: Enable building a SPI ROM image on jerry")
Cc: Quentin Schulz <foss+uboot@0leil.net>
Reported-by: Johan Jonker <jbx6244@gmail.com>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agobinman: allow user-defined filenames for mkimage entry
Quentin Schulz [Fri, 2 Sep 2022 13:10:49 +0000 (15:10 +0200)]
binman: allow user-defined filenames for mkimage entry

mkimage entry currently creates a file whose name is derived from the
section name containing said entry.

Let's allow the user to define a filename for the mkimage-generated
binary by using the 'filename' DT property.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: add support for skipping file concatenation for mkimage
Quentin Schulz [Fri, 2 Sep 2022 13:10:48 +0000 (15:10 +0200)]
binman: add support for skipping file concatenation for mkimage

Some image types handled by mkimage require the datafiles to be passed
independently (-d data1:data2) for specific handling of each. A
concatenation of datafiles prior to passing them to mkimage wouldn't
work.

That is the case for rkspi for example which requires page alignment
and only writing 2KB every 4KB.

This adds the ability to tell binman to pass the datafiles without
prior concatenation to mkimage, by adding the multiple-data-files
boolean property to the mkimage node.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agorockchip: rk3399: sync spl_boot_devices_tbl and boot_devices node paths
Quentin Schulz [Fri, 15 Jul 2022 15:15:52 +0000 (17:15 +0200)]
rockchip: rk3399: sync spl_boot_devices_tbl and boot_devices node paths

While technically not a bug, let's have some consistency in paths
returned by u-boot,spl-boot-order look-up and the one saved in
u-boot,spl-boot-device by syncing spl_boot_devices_tbl and boot_devices
node paths.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Tested-by: Xavier Drudis Ferran <xdrudis@tinet.cat>
Reviewed-by: Xavier Drudis Ferran <xdrudis@tinet.cat>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: rk3399: fix incorrect boot-device in u-boot, spl-boot-device
Quentin Schulz [Fri, 15 Jul 2022 15:15:51 +0000 (17:15 +0200)]
rockchip: rk3399: fix incorrect boot-device in u-boot, spl-boot-device

On RK3399, mmc0 is eMMC and mmc1 is SD card, c.f. console:
MMC:   mmc@fe320000: 1, mmc@fe330000: 0

In arch/arm/mach-rockchip/spl-boot-order.c:board_boot_order, the
boot_device (BOOT_DEVICE_*) value is gotten from spl_node_to_boot_device
function. Said function returns BOOT_DEVICE_MMC1 for mmc0 (eMMC) and
BOOT_DEVICE_MMC2 for mmc1 (SD card).

Since the SD card controller is at mmc@fe320000, it should be associated
with BOOT_DEVICE_MMC2 and not BOOT_DEVICE_MMC1. Same applies to eMMC.

Let's fix that by swapping the two BOOT_DEVICEs.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Tested-by: Xavier Drudis Ferran <xdrudis@tinet.cat>
2 years agorockchip: rk3308: fix same-as-spl boot order
John Keeping [Thu, 14 Jul 2022 14:18:37 +0000 (15:18 +0100)]
rockchip: rk3308: fix same-as-spl boot order

Rockchip SoCs need the boot_devices array defined in order to map the
bootloader's value to a U-Boot device.  Implement this for rk3308.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: rk3308: fix rockchip_dnl_key_pressed() on roc-cc
John Keeping [Thu, 14 Jul 2022 14:09:12 +0000 (15:09 +0100)]
rockchip: rk3308: fix rockchip_dnl_key_pressed() on roc-cc

Commit 6aa4fe3912 ("dm: core: Rename and fix uclass_get_by_name_len()")
changed uclass_get_device_by_name() to an exact match when previously it
behaved as a prefix match.

The roc-cc code relied on this prefix match by only specifying part of
the device name.  Fix this by using the full name including the address.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: rk3399: boot_devices: fix eMMC node name
Quentin Schulz [Mon, 11 Jul 2022 14:15:33 +0000 (16:15 +0200)]
rockchip: rk3399: boot_devices: fix eMMC node name

When idbloader.img is flashed on the eMMC, the SPL still tries to load
from SPI-NOR first.

This is due to an incorrect look-up in the Device Tree. Since commit
822556a93459 ("arm: dts: sync the Rockhip 3399 SoCs from Linux"), the
node name (but not label) changed from sdhci@fe330000 to mmc@fe330000
meaning U-Boot SPL is not looking for the correct node name anymore and
fails to find the "same-as-spl" node when eMMC is the medium from which
the SPL booted.

Fixes: 822556a93459 ("arm: dts: sync the Rockhip 3399 SoCs from Linux")
Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Xavier Drudis Ferran <xdrudis@tinet.cat>
Reviewed-by: Artem Lapkin <email2tema@gmail.com>
Tested-by: Artem Lapkin <email2tema@gmail.com>
Tested-by: Lapkin Artem <email2tema@gmail.com>
Tested-by: Lapkin Artem <email2tema@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoram: rk3399: Conduct memory training at 400MHz
Lee Jones [Thu, 11 Aug 2022 07:58:48 +0000 (08:58 +0100)]
ram: rk3399: Conduct memory training at 400MHz

Currently the default initialisation frequency is 50MHz.  Although
this does appear to be suitable for some LPDDR4 RAM chips, training at
this low frequency has been seen to cause Column errors, leading to
Capacity check errors on others.

Here we force RAM initialisation to happen at 400MHz before ramping up
to the final value running value of 800MHz after everything has been
successfully configured.

Link: https://lore.kernel.org/u-boot/Yo4v3jUeHXTovjOH@google.com/
Suggested-by: YouMin Chen <cym@rock-chips.com>
Signed-off-by: Lee Jones <lee@kernel.org>
Tested-by: Xavier Drudis Ferran <xdrudis@tinet.cat>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Michal Suchánek <msuchanek@suse.de>
2 years agoram: rk3399: Fix faulty frequency change reports
Lee Jones [Thu, 11 Aug 2022 07:58:47 +0000 (08:58 +0100)]
ram: rk3399: Fix faulty frequency change reports

Frequency changes to 400MHz are presently reported as:

  lpddr4_set_rate_0: change freq to 400000000 mhz 0, 1

This is obviously wrong by 6 orders of magnitude.

Ensure frequency changes are reported accurately.

Signed-off-by: Lee Jones <lee@kernel.org>
Tested-by: Xavier Drudis Ferran <xdrudis@tinet.cat>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoram: rk3399: Fix .set_rate_index() error handling
Lee Jones [Thu, 11 Aug 2022 07:58:46 +0000 (08:58 +0100)]
ram: rk3399: Fix .set_rate_index() error handling

Functions pointed to by this op pointer can return non-zero values
indicating an error.  Ensure any error value is propagated back up the
call-chain.

Signed-off-by: Lee Jones <lee@kernel.org>
Tested-by: Xavier Drudis Ferran <xdrudis@tinet.cat>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agodrivers: ram: rockchip: Fix dram channels calculation for rk3399
Han Pengfei [Sun, 15 May 2022 06:11:59 +0000 (14:11 +0800)]
drivers: ram: rockchip: Fix dram channels calculation for rk3399

Only add the dram channel when we finally setup it successfully at the
last step.

Signed-off-by: Han Pengfei <pengphei@foxmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoarm: dts: rockchip: rk3288: rename mmc nodenames
Johan Jonker [Mon, 2 May 2022 09:42:22 +0000 (11:42 +0200)]
arm: dts: rockchip: rk3288: rename mmc nodenames

The boot_devices constants for rk3288 were changed to match the
binding, but the dtsi file was not synced.
Fix by renaming the rk3288 mmc node names.
Also correct the clock name for "ciu-drive".

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoMerge tag 'tpm-03092022' of https://source.denx.de/u-boot/custodians/u-boot-tpm
Tom Rini [Sat, 3 Sep 2022 18:55:37 +0000 (14:55 -0400)]
Merge tag 'tpm-03092022' of https://source.denx.de/u-boot/custodians/u-boot-tpm

TPM fixes and state reporting

2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-sh
Tom Rini [Sat, 3 Sep 2022 18:55:24 +0000 (14:55 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-sh

2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Sat, 3 Sep 2022 18:55:13 +0000 (14:55 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-usb

2 years agotpm: Allow committing non-volatile data
Simon Glass [Wed, 31 Aug 2022 03:05:38 +0000 (21:05 -0600)]
tpm: Allow committing non-volatile data

Add an option to tell the TPM to commit non-volatile data immediately it
is changed, rather than waiting until later. This is needed in some
situations, since if the device reboots it may not write the data.

Add definitions for the rest of the Cr50 commands while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agotpm: Implement state command for Cr50
Simon Glass [Wed, 31 Aug 2022 03:05:37 +0000 (21:05 -0600)]
tpm: Implement state command for Cr50

Add a vendor-specific TPM2 command for this and implement it for Cr50.
Note: This is not part of the TPM spec, but is a Cr50 extension.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agotpm: Allow reporting the internal state
Simon Glass [Wed, 31 Aug 2022 03:05:36 +0000 (21:05 -0600)]
tpm: Allow reporting the internal state

It is useful to read information about the current TPM state, where
supported, e.g. for debugging purposes when verified boot fails.

Add support for this to the TPM interface as well as Cr50. Add a simple
sandbox test.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agotpm: sandbox: Allow init of TPM in a different phase
Simon Glass [Wed, 31 Aug 2022 03:05:35 +0000 (21:05 -0600)]
tpm: sandbox: Allow init of TPM in a different phase

At present the emulator assumes that the TPM is inited in the same phase
where it is used. But in fact SPL may init the TPM, so we don't want to
complain when U-Boot proper later uses it. Remove this check.

It might be best to save this information into the device state for the
TPM, so that we can make sure the TPM was inited at some point. For now,
this seems good enough.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agotpm: Correct the define-space command in TPMv2
Simon Glass [Wed, 31 Aug 2022 03:05:34 +0000 (21:05 -0600)]
tpm: Correct the define-space command in TPMv2

The message format is incorrect. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agotpm: Correct the permissions command in TPMv1
Simon Glass [Wed, 31 Aug 2022 03:05:33 +0000 (21:05 -0600)]
tpm: Correct the permissions command in TPMv1

The offset here is incorrect. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agotpm: Require a digest source when extending the PCR
Simon Glass [Wed, 31 Aug 2022 03:05:32 +0000 (21:05 -0600)]
tpm: Require a digest source when extending the PCR

This feature is used for measured boot, so we can add a log entry to the
TCPA with some information about where the digest comes from. It is not
currently supported in the TPM drivers, but add it to the API so that
code which expects it can signal its request.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agoMerge tag 'efi-2022-10-rc4-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sat, 3 Sep 2022 11:44:22 +0000 (07:44 -0400)]
Merge tag 'efi-2022-10-rc4-2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request of efi-2022-10-rc4-2

UEFI:
* provide EFI Conformance Profile Table
* fix display of NVMe EUI-64
* fixes for Simple Text Input Ex Protocol
* fix exception unit-test on non-x86 sandbox

2 years agoefi_loader: fix display of NVMe EUI-64
Heinrich Schuchardt [Wed, 23 Feb 2022 08:06:24 +0000 (09:06 +0100)]
efi_loader: fix display of NVMe EUI-64

UEFI specification 2.9A requires to display the EUI-64 "in hexadecimal
format with byte 7 first (i.e., on the left) and byte 0 last".

This is in contrast to what the NVMe specification wants.
But it is what EDK II has been implementing.

Here is an example with the patch applied:

    qemu-system-aarch64 -machine virt -cpu cortex-a72 -nographic \
    -bios denx/u-boot.bin \
    -device nvme,id=nvme1,serial=9ff81223 \
    -device nvme-ns,bus=nvme1,drive=nvme1n0,eui64=0x123456789ABCDEF0 \
    -drive file=arm64.img,if=none,format=raw,id=nvme1n0

    => nvme scan
    => efidebug devices
    Device Path
    ====================
    /VenHw(…)/NVMe(0x1,f0-de-bc-9a-78-56-34-12)

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi: ECPT add EBBRv2.0 conformance profile
Jose Marinho [Fri, 17 Dec 2021 12:55:05 +0000 (12:55 +0000)]
efi: ECPT add EBBRv2.0 conformance profile

Display the EBBRv2.0 conformance in the ECPT table.

The EBBRv2.0 conformance profile is set in the ECPT if
CONFIG_EFI_EBBR_2_0_CONFORMANCE=y.

Signed-off-by: Jose Marinho <jose.marinho@arm.com>
Add dependencies for CONFIG_EFI_EBBR_2_0_CONFORMANCE.
Enable the setting by default.
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi: Create ECPT table
Jose Marinho [Thu, 23 Dec 2021 14:51:07 +0000 (14:51 +0000)]
efi: Create ECPT table

The ECPT table will be included in the UEFI specification 2.9+.
The ECPT table was introduced in UEFI following the code-first path. The
acceptance ticket can be viewed at:
https://bugzilla.tianocore.org/show_bug.cgi?id=3591

The Conformance Profiles table is a UEFI configuration table that contains
GUID of the UEFI profiles that the UEFI implementation conforms with.

The ECPT table is created when CONFIG_EFI_ECPT=y.
The config is set by default.

Signed-off-by: Jose Marinho <jose.marinho@arm.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi_selftest: on sandbox use host specific assembly
Heinrich Schuchardt [Fri, 2 Sep 2022 00:46:37 +0000 (02:46 +0200)]
efi_selftest: on sandbox use host specific assembly

The selftest checking the handling of exceptions in UEFI binaries is using
assembly to provide an undefined instruction. On the sandbox the correct
form of the instruction depends on the host architecture.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agoefi_loader: support CTRL+\ - CTRL+_
Heinrich Schuchardt [Thu, 1 Sep 2022 22:49:12 +0000 (00:49 +0200)]
efi_loader: support CTRL+\ - CTRL+_

In the extended text input protocol support input of control letters
0x1c - 0x1f.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agoefi_loader: compliance Simple Text Input Ex Protocol
Heinrich Schuchardt [Thu, 1 Sep 2022 21:30:09 +0000 (23:30 +0200)]
efi_loader: compliance Simple Text Input Ex Protocol

We cannot expect the buffers passed to the input protocols to be zero
filled. If only modifier keys are pressed, we have to return EFI_NOT_READY
but we still have to fill the key structure.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agoefi_loader: printing UEFI revision in helloworld.efi
Heinrich Schuchardt [Thu, 1 Sep 2022 20:23:47 +0000 (22:23 +0200)]
efi_loader: printing UEFI revision in helloworld.efi

We need to support multiple digits in the parts of the UEFI verision
number. E.g.

    EFI_SPECIFICATION_VERSION = (123 << 16) | 456

must be printed as

    123.45.6

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoMerge tag 'efi-2022-10-rc4' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Fri, 2 Sep 2022 13:09:47 +0000 (09:09 -0400)]
Merge tag 'efi-2022-10-rc4' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2022-10-rc4

Documentation:

* add a page on sending patches
* bindings for FWU Metadata mtd storage
* fpio status output fields description

UEFI:

* ensure all block devices are probed

2 years agodrivers: usb: fastboot: Fix full-speed usb descriptor
qianfan Zhao [Mon, 22 Aug 2022 01:18:31 +0000 (09:18 +0800)]
drivers: usb: fastboot: Fix full-speed usb descriptor

The host will report such error message if the fastboot device work in
full-speed mode: "Duplicate descriptor for config 1 interface 0
altsetting 0, skipping"

Fastboot device ack both full and high speed interface descriptors when
work in full-speed mode, that's will cause this issue.

Fix it.

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
Reviewed-by: John Keeping <john@metanate.com>
2 years agorenesas: Fix RPC-IF compatible values
Geert Uytterhoeven [Tue, 29 Mar 2022 12:19:09 +0000 (14:19 +0200)]
renesas: Fix RPC-IF compatible values

The compatible values used for device nodes representing Renesas Reduced
Pin Count Interfaces were based on preliminary versions of the Device
Tree Bindings.

Correct them in both DTSi files and drivers, to match the final DT
Bindings.

Note that there are no DT bindings for RPC-IF on RZ/A1 yet, hence the
most logical SoC-specific value is used, without specifying a
family-specific value.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
2 years agoARM: renesas: Propagate RPC-IF enablement to subsequent software
Geert Uytterhoeven [Tue, 29 Mar 2022 12:19:08 +0000 (14:19 +0200)]
ARM: renesas: Propagate RPC-IF enablement to subsequent software

As the Renesas Reduced Pin Count Interface may be locked by TF-A, it is
disabled by default[1].  When unlocked, TF-A passes a DT fragment to
enable it, which is applied to the U-Boot DT[2].

Unlike the memory layout, the RPC-IF enablement is not propagated to
subsequent software.  Hence e.g. Linux cannot know if the RPC-IF is
locked or not, and will lock-up when trying to access the RPC-IF when
locked.

Fix this by checking if the RPC-IF is enabled in the TF-A DT fragment, and
setting the status of the RPC-IF device node in the target DT, if
present, to "okay".  Do this only when a "flash" subnode is found, to
avoid errors in subsequent software when the RPC-IF is not intended to
be used.

Note that this requires the status of the RPC-IF node to be set to
"disabled" in the target DT, just like in the U-Boot DT.

[1] commit 3d5f45c95c9db73d ("ARM: dts: rmobile: Disable RPC HF by
    default")
[2] commit 361377dbdbc9f0f5 ("ARM: rmobile: Merge prior-stage firmware
    DT fragment into U-Boot DT on Gen3")

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
2 years agoARM: dts: rmobile: Fix RPC-IF device node names
Geert Uytterhoeven [Tue, 29 Mar 2022 12:19:07 +0000 (14:19 +0200)]
ARM: dts: rmobile: Fix RPC-IF device node names

According to the Generic Names Recommendation in the Devicetree
Specification Release v0.3, and the DT Bindings for the Renesas Reduced
Pin Count Interface, the node name for a Renesas RPC-IF device should be
"spi".  Especially on R-Car Gen3 and RZ/G2, the node name matters, as
the node is enabled by passing a DT fragment from TF-A to U-Boot, and
from U-Boot to subsequent software.

Fix this by renaming the device nodes from "rpc" to "spi".

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
2 years agodt/bindings: Add bindings for FWU Metadata mtd storage
Sughosh Ganu [Fri, 22 Jul 2022 17:43:15 +0000 (12:43 -0500)]
dt/bindings: Add bindings for FWU Metadata mtd storage

Add bindings needed for accessing the FWU metadata regions.
These include the compatible string which point to the access
method, the actual device which stores the FWU metadata and
the offsets for both metadata regions.

The current patch adds basic bindings needed for accessing the
metadata structure on non-GPT mtd regions.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2 years agogithub: Update PR template for new "Patches" content
Tom Rini [Mon, 29 Aug 2022 16:59:35 +0000 (12:59 -0400)]
github: Update PR template for new "Patches" content

The old "Patches" wiki page is not available anymore. Now that the
content has been integrated with the submitting_patches document,
reference that instead.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agodoc: process, sending_patches: Update and correct the old "Patches" content
Tom Rini [Mon, 29 Aug 2022 16:59:34 +0000 (12:59 -0400)]
doc: process, sending_patches: Update and correct the old "Patches" content

- Use gender-neutral language to refer to the user, consistently.
- Reference the checkpatch document.
- Move the section on commit message tags to the process document and
  reference this in sending_patches.rst.
  - Reword the custodian workflow process section to refer to this new
    section, integrate some of the wording from there in this new section.
- Update the comment about GPLv2 applying to August 2022, to be clear
  this still is correct.
- Reword the section about MAKEALL to talk about local build testing and
  link to the CI document.
- Reference the system_configuration document for the note about
  modifying existing code.
- Reword the patchwork flow section.

Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agodoc: sending_patches.rst: Incorporate the old "Patches" wiki content
Tom Rini [Mon, 29 Aug 2022 16:59:33 +0000 (12:59 -0400)]
doc: sending_patches.rst: Incorporate the old "Patches" wiki content

Import as-is much of the old "Patches" wiki page to the current
sending_patches.rst file. This means we need to move patman to being
included in the higher level ToC and add a reference for "Custodians" in
the process document. A very minimal amount of content changing and
rewording is done here as part of the import, in order to make the
conversion easier.

Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agodoc: Add gpio status output fields description
Patrice Chotard [Tue, 30 Aug 2022 14:56:28 +0000 (16:56 +0200)]
doc: Add gpio status output fields description

Add gpio status output fields description and one output example.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tweak the formatting.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi_loader: ensure all block devices are probed
Heinrich Schuchardt [Wed, 31 Aug 2022 14:37:35 +0000 (16:37 +0200)]
efi_loader: ensure all block devices are probed

Only probed block devices are available in the UEFI sub-system. Multiple
block devices may be involved in the boot process. So we have to make sure
that all block devices are probed. Another reason is that we store UEFI
variables on the ESP which may be on any block device.

On the sandbox before the patch:

=> efidebug devices
No EFI system partition
Device           Device Path
================ ====================
000000001b027c70 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)
000055d078bc1ae0 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/Uart(0,0,D,D)
000000001b22e0b0 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/MAC(020011223344,1)

After the patch:

=> efidebug devices
No EFI system partition
Device           Device Path
================ ====================
000000001b027c70 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)
000055bdac8ddae0 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/Uart(0,0,D,D)
000000001b230920 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(2)/SD(0)
000000001b233ac0 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(1)/SD(1)
000000001b233b80 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(1)/SD(1)/HD(1,GPT,d0a914ee-a71c-fc1e-73f0-7e302b0e6c20,0x30,0x1)
000000001b234110 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(1)/SD(1)/HD(2,GPT,9330a0ea-8aff-f67a-294c-fa05d60896c3,0x31,0x1)
000000001b22f0e0 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(2)
000000001b238df0 /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/MAC(020011223344,1)

Fixes: a9bf024b2933 ("efi_loader: disk: a helper function to create efi_disk objects from udevice")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoMerge branch '2022-08-31-assorted-fixes'
Tom Rini [Wed, 31 Aug 2022 23:32:31 +0000 (19:32 -0400)]
Merge branch '2022-08-31-assorted-fixes'

- Assorted bugfixes including re-working the i2c command CVE and fixing
  some TI reference platforms with different EEPROMs.

2 years agoarm: smh: Fix uninitialized parameters with newer GCCs
Sean Anderson [Tue, 30 Aug 2022 20:32:27 +0000 (16:32 -0400)]
arm: smh: Fix uninitialized parameters with newer GCCs

Newer versions of GCC won't initialize parts of structures which don't
appear to be used. This results in uninitialized semihosting parameters
passed via R1. Fix this by marking the inline assembly as clobbering
memory.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
2 years agotools: mkimage: fix build with recent LibreSSL
Mark Kettenis [Mon, 29 Aug 2022 11:34:01 +0000 (13:34 +0200)]
tools: mkimage: fix build with recent LibreSSL

LibreSSL 3.5.0 and later (also shipped as part of OpenBSD 7.1 and
and later) have an opaque RSA object and do provide the
RSA_get0_* functions that OpenSSL provides.

Fixes: 2ecc354b8e46 ("tools: mkimage: fix build with LibreSSL")
Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Jonathan Gray <jsg@jsg.id.au>
2 years agobootm: Fix upper bound of FDT overlap checks
Pali Rohár [Sat, 27 Aug 2022 12:48:10 +0000 (14:48 +0200)]
bootm: Fix upper bound of FDT overlap checks

FTD blob can be put immediately after the OS image.
So use strict inequality for start address check.

Fixes: fbde7589ce30 ("common: bootm: add checks to verify if ramdisk / fdtimage overlaps OS image")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoimage-fit: don't set compression if it can't be read
Daniel Golle [Sat, 27 Aug 2022 03:17:28 +0000 (04:17 +0100)]
image-fit: don't set compression if it can't be read

fit_image_get_comp() should not set value -1 in case it can't read
the compression node. Instead, leave the value untouched in that case
as it can be absent and a default value previously defined by the
caller of fit_image_get_comp() should be used.

As a result the warning message
WARNING: 'compression' nodes for ramdisks are deprecated, please fix your .its file!
no longer shows if the compression node is actually absent.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobootm: fix typo imape_comp -> image_comp
Daniel Golle [Sat, 27 Aug 2022 03:14:42 +0000 (04:14 +0100)]
bootm: fix typo imape_comp -> image_comp

Change variable name 'imape_comp' to the supposedly intended name
'image_comp'.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agocorenet_ds.h: Remove
Tom Rini [Fri, 26 Aug 2022 14:53:36 +0000 (10:53 -0400)]
corenet_ds.h: Remove

This was missed when removing the platform.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoi2c: fix stack buffer overflow vulnerability in i2c md command
Marek Vasut [Fri, 26 Aug 2022 21:15:56 +0000 (23:15 +0200)]
i2c: fix stack buffer overflow vulnerability in i2c md command

This reinstates fix from commit 8f8c04bf1ebb ("i2c: fix stack buffer
overflow vulnerability in i2c md command") without the changes unrelated
to the actual fix. Avoid the underflow by setting only nbytes and
linebytes as unsigned integers.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Cc: Nicolas Iooss <nicolas.iooss+uboot@ledger.fr>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tim Harvey <tharvey@gateworks.com>
Acked-by: Tim Harvey <tharvey@gateworks.com>
2 years agoRevert "i2c: fix stack buffer overflow vulnerability in i2c md command"
Marek Vasut [Fri, 26 Aug 2022 21:15:55 +0000 (23:15 +0200)]
Revert "i2c: fix stack buffer overflow vulnerability in i2c md command"

This reverts commit 8f8c04bf1ebbd2f72f1643e7ad9617dafa6e5409.

The commit is largely wrong and breaks most of i2c command functionality.
The problem described in the aforementioned commit commit message is valid,
however the commit itself does many more changes unrelated to fixing that
one problem it describes. Those extra changes, namely the handling of i2c
device address length as unsigned instead of signed integer, breaks the
expectation that address length may be negative value. The negative value
is used by DM to indicate that address length of device does not change.

The actual bug documented in commit 8f8c04bf1ebbd2f72f1643e7ad9617dafa6e5409
can be fixed by extra sanitization in separate patch.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Cc: Nicolas Iooss <nicolas.iooss+uboot@ledger.fr>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agospl: ahci: Fix dependency for SPL_AHCI_PCI
Oleksandr Suvorov [Thu, 25 Aug 2022 17:03:51 +0000 (20:03 +0300)]
spl: ahci: Fix dependency for SPL_AHCI_PCI

The option SPL_SATA_SUPPORT is renamed to SPL_SATA. Fix the option
name.

Fixes: 73059529b20 ("ata: ahci-pci: Add new option CONFIG_SPL_AHCI_PCI")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Acked-by: Pali Rohár <pali@kernel.org>
2 years agofs: fix comment typo
Roger Knecht [Thu, 25 Aug 2022 12:12:01 +0000 (12:12 +0000)]
fs: fix comment typo

Fix typo in include/fs.h

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Roger Knecht <rknecht@pm.me>
2 years agokbuild: add KBUILD_HOSTLDFLAGS to cmd_host-csingle
Heiko Thiery [Wed, 24 Aug 2022 08:37:23 +0000 (10:37 +0200)]
kbuild: add KBUILD_HOSTLDFLAGS to cmd_host-csingle

When compiling executables from a single.c file, the linker is also
invoked. Pass the flags like the other linker commands.

cherry-pick kbuild change from Linux:

63185b46cdb3 (kbuild: use HOSTLDFLAGS for single .c executables)

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoboard: ti: common: board_detect: Fix EEPROM read quirk
Matwey V. Kornilov [Tue, 23 Aug 2022 16:05:34 +0000 (19:05 +0300)]
board: ti: common: board_detect: Fix EEPROM read quirk

There are three different kinds of EEPROM possibly present on boards.
  1. 1byte address. For those we should avoid 2byte address in order
     not to rewrite the data. Second byte of the address can potentially
     be interpreted as the data to write.
  2. 2byte address with defined behaviour. When we try to use 1byte
     address they just return "FF FF FF FF ... FF"
  3. 2byte address with undefined behaviour (for instance, 24LC32AI).
     When we try to use 1byte address, then their internal read
     pointer is changed to some value. Subsequential reads may be
     broken.

To gracefully handle both case #1 and case #3 we read all required
data from EEPROM at once (about 80 bytes). So either all the data is
valid or we fallback to 2byte address.

Cc: Nishanth Menon <nm@ti.com>
Fixes: a58147c2dbbf ("board: ti: common: board_detect: Do 1byte address checks first.")
Reference: https://lore.kernel.org/all/CAJs94Ebdd4foOjhGFu9Bop0v=B1US9neDLxfhgcY23ukgLzFOQ@mail.gmail.com/
Signed-off-by: Matwey V. Kornilov <matwey.kornilov@gmail.com>
Acked-by: Nishanth Menon <nm@ti.com>
2 years agogitlab-ci: Update comment about the Dockerfile
Joel Stanley [Tue, 23 Aug 2022 06:18:26 +0000 (16:18 +1000)]
gitlab-ci: Update comment about the Dockerfile

It's found in the u-boot tree now.

Signed-off-by: Joel Stanley <joel@jms.id.au>
2 years agocommon/console.c: prevent pre-console buffer contents from being added to itself
Rasmus Villemoes [Tue, 3 May 2022 13:13:27 +0000 (15:13 +0200)]
common/console.c: prevent pre-console buffer contents from being added to itself

I do not have any non-serial output devices, so a
print_pre_console_buffer(PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL)
does nothing for me.

However, I was manually inspected the pre-console buffer using md.b,
and I noticed that the early part of it was repeated. The reason is
that the first call of print_pre_console_buffer(), from
console_init_f(), ends up invoking puts() with the contents of the
buffer at that point, and puts() at that point ends up in the else
branch of

if (gd->flags & GD_FLG_DEVINIT) {
/* Send to the standard output */
fputs(stdout, s);
} else {
/* Send directly to the handler */
pre_console_puts(s);
serial_puts(s);
}

so indeed the contents is added again.

That can be somewhat confusing (both when reading the buffer manually,
but also if it did actually come out on some device). So disable all
use of the pre-console buffer while print_pre_console_buffer() is
emitting it.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoMerge tag 'dm-pull-26aug22' of https://source.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Sat, 27 Aug 2022 12:07:09 +0000 (08:07 -0400)]
Merge tag 'dm-pull-26aug22' of https://source.denx.de/u-boot/custodians/u-boot-dm

binman/patman documentation improvements
other minor fixes

2 years agoMerge branch '2022-08-26-assorted-fixes'
Tom Rini [Sat, 27 Aug 2022 12:05:15 +0000 (08:05 -0400)]
Merge branch '2022-08-26-assorted-fixes'

- PCIe, NVMe and 2 UBIFS related fixes

2 years agodistroboot: ubifs: Add support for specifying UBI header offset
Pali Rohár [Sun, 7 Aug 2022 19:04:22 +0000 (21:04 +0200)]
distroboot: ubifs: Add support for specifying UBI header offset

Some UBI partitions may use non-standard UBI header offset. For attaching
these UBI partitions it is required to pass second argument with offset to
"ubi part" command.

Therefore extend distroboot to allow specifying additional optional 6th
argument with UBI header offset. This offset is set in new distroboot
variable ${bootubioff} which may be used by distroboot script to e.g.
properly pass this value to linux kernel command line for proper mounting
of rootfs by kernel. This variable is set to empty string (cleared) when
UBI header offset is not specified into distroboot BOOT_TARGET_DEVICES
macro.

Usage of helper macro BOOTENV_DEV_UBIFS_BOOTUBIOFF in this change is there
as a type check. It ensures that in BOOT_TARGET_DEVICES macro was specified
UBIFS func with either 5 or 6 arguments. If not then cpp throws compile
error.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agoRename disto_[pxe_]getfile to distro_[pxe_]getfile
Dario Binacchi [Fri, 26 Aug 2022 13:15:41 +0000 (15:15 +0200)]
Rename disto_[pxe_]getfile to distro_[pxe_]getfile

Replace 'disto' with 'distro' since they are all functions about distro
booting.

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
2 years agovbe: Enable command only with BOOTSTD_FULL
Simon Glass [Tue, 23 Aug 2022 17:14:05 +0000 (10:14 -0700)]
vbe: Enable command only with BOOTSTD_FULL

Avoid enabling this command by default. This saves about 1KB of code
space.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agobinman: Sort tests and rework test-file numbers
Stefan Herbrechtsmeier [Tue, 23 Aug 2022 10:46:09 +0000 (12:46 +0200)]
binman: Sort tests and rework test-file numbers

Tests should be in order of the test-file numbers. Sort the tests
according to the test-file numbers and rework the test-file numbers to
eliminate duplicate numbers.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Document how to handle dependent images
Simon Glass [Thu, 18 Aug 2022 08:16:46 +0000 (02:16 -0600)]
binman: Document how to handle dependent images

Binman does not support this properly at present. Add documentation about
it including a work-around.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Mention split-elf in the main docs
Simon Glass [Thu, 18 Aug 2022 08:16:45 +0000 (02:16 -0600)]
binman: Mention split-elf in the main docs

Since we are talking about ATF, add mention of this new feature too.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agopatman: Tidy up unnecessary blank lines and numbers
Simon Glass [Wed, 17 Aug 2022 18:47:07 +0000 (12:47 -0600)]
patman: Tidy up unnecessary blank lines and numbers

Quite a few blank lines are not needed here. Drop these and use the #
mechanism to number paragraphs.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agopatman: Fix version table
Simon Glass [Wed, 17 Aug 2022 18:47:06 +0000 (12:47 -0600)]
patman: Fix version table

One of the changes to the version table was made by mistake. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoboot: simplify bootmeth_vbe_simple_ft_fixup()
Heinrich Schuchardt [Tue, 23 Aug 2022 08:31:56 +0000 (10:31 +0200)]
boot: simplify bootmeth_vbe_simple_ft_fixup()

Don't assign a value to a variable if it is not used afterwards.
Move variables to the code fragment where they are used.

Addresses-Coverity: CID 356243 ("Code maintainability issues (UNUSED_VALUE)")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoboot: fix vbe_find_first_device()
Heinrich Schuchardt [Tue, 23 Aug 2022 08:25:25 +0000 (10:25 +0200)]
boot: fix vbe_find_first_device()

uclass_find_first_device() may return NULL if no device for the uclass
exists. Handle this case gracefully.

Addresses-Coverity: CID 356244 ("Null pointer dereferences (FORWARD_NULL)")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agodm: core: fix a typo in help text
Sergei Antonov [Sun, 21 Aug 2022 13:45:08 +0000 (16:45 +0300)]
dm: core: fix a typo in help text

Signed-off-by: Sergei Antonov <saproj@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agodoc: Build documentation in parallel
Simon Glass [Sat, 13 Aug 2022 17:40:40 +0000 (11:40 -0600)]
doc: Build documentation in parallel

With the addition of the revision stats this now takes over a minute. Use
a parallel build to reduce it a bit (24 seconds for me).

Series-changes; 2
- Use '-j auto' instead

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodisk: part: remove dependency to ubifs for spl
Stefan Herbrechtsmeier [Mon, 8 Aug 2022 14:45:17 +0000 (16:45 +0200)]
disk: part: remove dependency to ubifs for spl

The spl doesn't support ubifs and thereby doesn't provide the
ubifs_is_mounted function. Remove the dependency to ubifs for the spl.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
2 years agonvme: Do a clean NVMe shutdown
Hector Martin [Sun, 31 Jul 2022 06:31:31 +0000 (15:31 +0900)]
nvme: Do a clean NVMe shutdown

The brute-force controller disable method can end up racing controller
initialization and causing a crash when we shut down Apple ANS2 NVMe
controllers. Do a proper controlled shutdown, which does block until
things are quiesced properly. This is nicer in general for all
controllers.

Signed-off-by: Hector Martin <marcan@marcan.st>
Tested-by: Mark Kettenis <kettenis@openbsd.org> (firefly-rk3399)
2 years agopci: Add checks to prevent config space overflow
Pali Rohár [Sun, 3 Jul 2022 10:48:06 +0000 (12:48 +0200)]
pci: Add checks to prevent config space overflow

PCIe config space has address range 0-4095. So do not allow reading from
addresses outside of this range. Lot of U-Boot drivers do not expect that
passed value is not in this range. PCI DM read function is extended to
fill read value to all ones or zeros when it fails as U-Boot callers
ignores return value.

Calling U-Boot command 'pci display.b 0.0.0 0 0x2000' now stops printing
config space at the end (before 0x1000 address).

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Tue, 23 Aug 2022 19:44:54 +0000 (15:44 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- kirkwood: pogo_v4 & nsa310s: Add distro boot (Tony)
- kirkwood: add DM timer support and use it on lsxl boards (Michael)
- kirkwood: convert the Buffalo Linkstation LS-CHLv2 and XHL boards
  to DM (Michael)
- mvebu: turris_mox/omnia: misc improments (Pali)
- mvebu: mbus: Fix mbus driver to work also after U-Boot relocation (Pali)

2 years agoconfigs: Resync with savedefconfig
Tom Rini [Tue, 23 Aug 2022 19:24:14 +0000 (15:24 -0400)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoboard: lsxl: update the README
Michael Walle [Wed, 17 Aug 2022 19:38:09 +0000 (21:38 +0200)]
board: lsxl: update the README

Update the board's README to reflect all the recent changes.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoboard: lsxl: disable eth0
Michael Walle [Wed, 17 Aug 2022 19:38:08 +0000 (21:38 +0200)]
board: lsxl: disable eth0

The board has only one network interface. The linux kernel will
gracefully skip a the ethernet interface if no connected PHY could be
probed. u-boot on the other hand will throw an error message. The kernel
device tree is about to be fixed. For now, just disable the ethernet
interface in our -u-boot.dtsi.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Stefan Roese <sr@denx.de>