]> git.ipfire.org Git - thirdparty/u-boot.git/log
thirdparty/u-boot.git
6 months agoMerge tag 'i2cfixes-for-v2024-01-rc2' of https://source.denx.de/u-boot/custodians...
Tom Rini [Thu, 2 Nov 2023 14:12:33 +0000 (10:12 -0400)] 
Merge tag 'i2cfixes-for-v2024-01-rc2' of https://source.denx.de/u-boot/custodians/u-boot-i2c

i2c updates for v2024.01-rc2

- nuvoton: support standard/fast/fast plus mode
- bootcount: remove legacy i2c driver and implement
  DM based version

Bugfixes:
- designware_i2c: adjust timing calculation
  SPL probing failed on the StarFive VisionFive 2 board
  Heinrich fixed this, by syncing timing calculation with
  linux implementation.

6 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Thu, 2 Nov 2023 13:30:34 +0000 (09:30 -0400)] 
Merge https://source.denx.de/u-boot/custodians/u-boot-riscv

+ CI: Use OpenSBI 1.3.1 release for testing
+ riscv: Support resume after exception
+ rng: Support RNG provided by RISC-V Zkr ISA extension
+ board: starfive VF2: Support jtag
+ board: starfive VF2: Support TRNG driver
+ board: sifive unmatched: Move kernel load address

6 months agoconfigs: visionfive2: Enable JH7110 RNG driver
Chanho Park [Wed, 1 Nov 2023 12:16:52 +0000 (21:16 +0900)] 
configs: visionfive2: Enable JH7110 RNG driver

Enables JH7110 RNG driver to visionfive2 board.

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
6 months agoriscv: dts: jh7110: Add rng device tree node
Chanho Park [Wed, 1 Nov 2023 12:16:51 +0000 (21:16 +0900)] 
riscv: dts: jh7110: Add rng device tree node

Adds jh7110 trng device tree node.

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
6 months agorng: Add StarFive JH7110 RNG driver
Chanho Park [Wed, 1 Nov 2023 12:16:50 +0000 (21:16 +0900)] 
rng: Add StarFive JH7110 RNG driver

Adds to support JH7110 TRNG driver which is based on linux kernel's
jh7110-trng.c. This can support to generate 256-bit random numbers and
128-bit but this makes 256-bit default for convenience.

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
6 months agoclk: starfive: jh7110: Add security clocks
Chanho Park [Wed, 1 Nov 2023 12:16:49 +0000 (21:16 +0900)] 
clk: starfive: jh7110: Add security clocks

Add STGCLK_SEC_HCLK and STGCLK_SEC_MISCAHB clocks for JH7110 TRNG
device.

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
6 months agoriscv: import read/write_relaxed functions
Chanho Park [Wed, 1 Nov 2023 12:16:48 +0000 (21:16 +0900)] 
riscv: import read/write_relaxed functions

This imports mmio functions from Linux's arch/riscv/include/asm/mmio.h
to use read/write[b|w|l|q]_relaxed functions.

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
6 months agorng: Provide a RNG based on the RISC-V Zkr ISA extension
Heinrich Schuchardt [Tue, 31 Oct 2023 12:55:52 +0000 (14:55 +0200)] 
rng: Provide a RNG based on the RISC-V Zkr ISA extension

The Zkr ISA extension (ratified Nov 2021) introduced the seed CSR. It
provides an interface to a physical entropy source.

A RNG driver based on the seed CSR is provided. It depends on
mseccfg.sseed being set in the SBI firmware.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
6 months agoriscv: allow resume after exception
Heinrich Schuchardt [Tue, 31 Oct 2023 12:55:51 +0000 (14:55 +0200)] 
riscv: allow resume after exception

If CSRs like seed are readable by S-mode, may not be determinable by
S-mode. For safe driver probing allow to resume via a longjmp after an
exception.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
6 months agoboard: starfive: spl: Support jtag for VisionFive2 board
Chanho Park [Tue, 31 Oct 2023 08:56:00 +0000 (17:56 +0900)] 
board: starfive: spl: Support jtag for VisionFive2 board

JTAG pins are mapped as below. To access the JTAG pins, we need to
control the GPIO pins from SPL which seems to be the earliest stage for
JTAG.

- JTAG nTRST: GPIO36 / Input
- JTAG TDI: GPIO61 / Input
- JTAG TMS: GPIO63 / Input
- JTAG TCK: GPIO60 / Input
- JTAG TDO: GPIO44 / Output

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
6 months agoriscv: cpu: jh7110: Add gpio helper macros
Chanho Park [Tue, 31 Oct 2023 08:55:59 +0000 (17:55 +0900)] 
riscv: cpu: jh7110: Add gpio helper macros

Add gpio.h header file that includes JH7110 helper macros. The file is
imported from StarFive github[1] with small changes such as alignment.

[1]: https://github.com/starfive-tech/u-boot

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
6 months agoriscv: Weakly define invalidate_icache_range()
Samuel Holland [Tue, 31 Oct 2023 05:37:20 +0000 (00:37 -0500)] 
riscv: Weakly define invalidate_icache_range()

Some RISC-V CPUs, such as the T-HEAD XuanTie series, have a
vendor-specific way to invalidate a portion of the instruction cache.
Allow them to override invalidate_icache_range().

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
6 months agoriscv: Align the trap handler to 64 bytes
Samuel Holland [Tue, 31 Oct 2023 05:35:41 +0000 (00:35 -0500)] 
riscv: Align the trap handler to 64 bytes

This is required on CPUs which always operate in CLIC mode, such as the
T-HEAD E906 and E907. Per the CLIC specification: "In this mode, the
trap vector base address held in mtvec is constrained to be aligned on a
64-byte or larger power-of-two boundary."

Reported-by: Madushan Nishantha <jlmadushan@gmail.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
6 months agoriscv: Sort target configs alphabetically
Samuel Holland [Tue, 31 Oct 2023 05:32:12 +0000 (00:32 -0500)] 
riscv: Sort target configs alphabetically

Clean things up for the next time somebody adds a target.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
6 months agoboard: sifive: unmatched: move kernel load address to 0x80200000
Yong-Xuan Wang [Thu, 26 Oct 2023 03:22:52 +0000 (03:22 +0000)] 
board: sifive: unmatched: move kernel load address to 0x80200000

U-boot initially loads the kernel image to the kernel_addr_r, and
subsequently relocates it to memory address 0x80200000. Setting
kernel_addr_r to 0x80200000 can eliminate one copy operation.

Signed-off-by: Yong-Xuan Wang <yongxuan.wang@sifive.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 months agoCI: use OpenSBI 1.3.1 for testing
Heinrich Schuchardt [Tue, 24 Oct 2023 22:15:43 +0000 (00:15 +0200)] 
CI: use OpenSBI 1.3.1 for testing

Use the most recent upstream release of OpenSBI for CI testing.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
6 months agoMerge tag 'clk-2024.01-rc2' of https://source.denx.de/u-boot/custodians/u-boot-clk
Tom Rini [Wed, 1 Nov 2023 21:49:58 +0000 (17:49 -0400)] 
Merge tag 'clk-2024.01-rc2' of https://source.denx.de/u-boot/custodians/u-boot-clk

Clock changes for 2024.01-rc2

This contains several fixes for the clock core.

6 months agoclk: also handle ENOENT in *_optional functions
Yang Xiwen [Thu, 17 Aug 2023 17:04:02 +0000 (01:04 +0800)] 
clk: also handle ENOENT in *_optional functions

If the device does not specify any clocks in device tree, these
functions will return PTR_ERR(-ENOENT). This is not the intended
behavior and does not comply with linux kernel CCF. Fix that by
returning NULL under such circumstances instead.

Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Link: https://lore.kernel.org/r/20230818-clk-fix-v1-3-49ec18f820bf@outlook.com
6 months agoclk: use private clk struct in CLK_CCF's enable/disable functions
Maksim Kiselev [Tue, 5 Sep 2023 22:16:49 +0000 (01:16 +0300)] 
clk: use private clk struct in CLK_CCF's enable/disable functions

In clk_enable()/clk_disable() functions, when CCF is activated,
we must pass a private clk struct to enable()/disable() ops functions.
Otherwise, the use of a container_of() construction within these ops
should be banned. Because passing a non-private clk struct to
container_of() results in an out of range error.

At the moment, clk-mux, clk-fixed-factor, clk-gate and possibly other
clocks use container_of() in their enable()/disable() functions.
Therefore, for these functions to work correclty, private clk struct
must be passed.

Signed-off-by: Maksim Kiselev <bigunclemax@gmail.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Link: https://lore.kernel.org/r/20230905221649.3577929-1-bigunclemax@gmail.com
6 months agoclk: fix count parameter type for clk_release_all
Eugen Hristev [Mon, 19 Jun 2023 10:47:52 +0000 (13:47 +0300)] 
clk: fix count parameter type for clk_release_all

The second parameter for clk_release_all is used as an unsigned
(which makes sense) but the function prototype declares it as an int.
This causes warnings/error like such below:

include/clk.h:422:48: error: conversion to ‘int’ from ‘unsigned int’ may change the sign of the result [-Werror=sign-conversion]
  422 |         return clk_release_all(bulk->clks, bulk->count);

To fix this, changed the type of the count to `unsigned int`

Fixes: 82a8a669b4f7 ("clk: add clk_release_all()")
Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
Reviewed-by: Xavier Drudis Ferran <xdrudis@tinet.cat>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Link: https://lore.kernel.org/r/20230619104752.278500-1-eugen.hristev@collabora.com
6 months agodrivers: clk: Adjust temp var data type to properly match that of struct clk_ops
Nathan Barrett-Morrison [Mon, 15 May 2023 19:49:58 +0000 (15:49 -0400)] 
drivers: clk: Adjust temp var data type to properly match that of struct clk_ops

In commit 5c5992cb90cf ("clk: Add debugging for return values"), a
temporary storage variable was added around the ops->get_rate() call
inside clk_get_rate(), so that the result could be passed through
log_ret.

This temporary variable was declared as an int, yet when we look in
struct clk_ops, we can see this needs to be a ulong:
ulong (*get_rate)(struct clk *clk);

This was resulting in a signed to unsigned casting error on our
builds, where a clock value of 0xABCDABCD was being incorrectly cast
to 0xFFFFFFFFABCDABCD.

Signed-off-by: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Link: https://lore.kernel.org/r/20230515195005.1961495-1-nathan.morrison@timesys.com
6 months agoMerge branch '2023-11-01-bootstd-fixes'
Tom Rini [Wed, 1 Nov 2023 16:52:32 +0000 (12:52 -0400)] 
Merge branch '2023-11-01-bootstd-fixes'

- Four patches to address issues with bootstd flows in some cases

6 months agobootstd: cros: Correct condition for read method
Simon Glass [Tue, 24 Oct 2023 18:17:37 +0000 (07:17 +1300)] 
bootstd: cros: Correct condition for read method

This has a typo which makes the method inoperable. Correct it so that
'bootflow read' works correctly for ChromeOS.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 months agobootstd: Handle a few special cases in cmdline_set_arg()
Simon Glass [Tue, 24 Oct 2023 18:17:36 +0000 (07:17 +1300)] 
bootstd: Handle a few special cases in cmdline_set_arg()

Two bugs have appeared:

- arguments can have an equals sign embedded in them, which must be
  considered part of the value
- arguments must fully match the name; partial matches should be
  ignored

Fix these and add a test to cover both.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 months agobootstd: Make efi_mgr bootmeth work for non-sandbox setups
Mark Kettenis [Sun, 3 Sep 2023 20:40:00 +0000 (22:40 +0200)] 
bootstd: Make efi_mgr bootmeth work for non-sandbox setups

Enable the bootflow based on this bootmeth if the BootOrder EFI
variable is set.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 months agobootstd: BOOTDEV_SPI_FLASH requires BOOTSTD
Heinrich Schuchardt [Mon, 28 Aug 2023 18:49:59 +0000 (20:49 +0200)] 
bootstd: BOOTDEV_SPI_FLASH requires BOOTSTD

Compiling sandbox_defconfig with CONFIG_BOOTSTD=n fails:

    /usr/bin/ld: drivers/mtd/spi/sf_bootdev.o:
    in function `sf_get_bootflow':
    /drivers/mtd/spi/sf_bootdev.c:43:(.text+0x96):
    undefined reference to `bootmeth_set_bootflow'

Add the missing Kconfig dependency.

Fixes: Fixes: 0c1f4a9fb13a ("bootstd: Add a SPI flash bootdev")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-mmc
Tom Rini [Wed, 1 Nov 2023 13:44:33 +0000 (09:44 -0400)] 
Merge https://source.denx.de/u-boot/custodians/u-boot-mmc

7 months agocmd: mmc: Add mmc reg read command for reading card registers
Marek Vasut [Tue, 31 Oct 2023 12:20:17 +0000 (13:20 +0100)] 
cmd: mmc: Add mmc reg read command for reading card registers

Add extension to the 'mmc' command to read out the card registers.
Currently, only the eMMC OCR/CID/CSD/EXTCSD/RCA/DSR register are
supported. A register value can either be displayed or read into
an environment variable.

Tested-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
7 months agommc: sdhci: Rework SDHCI_QUIRK_BROKEN_R1B
Sean Anderson [Fri, 27 Oct 2023 20:57:03 +0000 (16:57 -0400)] 
mmc: sdhci: Rework SDHCI_QUIRK_BROKEN_R1B

As noted in commit 3a6383207be ("mmc: sdhci: add the quirk for broken
r1b response"), some MMC controllers don't always set the transfer
complete bit with R1b responses.

According to the SD Host Controller Simplified Specification v4.20,

> In the case of a command pairing with response-with-busy[, Transfer
> Complete] is set when busy is de-asserted. Refer to DAT Line Active
> and Command Inhibit (DAT) in the Present State register.

By polling the DAT Line Active bit in the present state register, we can
detect when we are no longer busy, without waiting for a long timeout.
This results in much faster reads/writes on buggy controllers.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Tested-by: Henrik Grimler <henrik@grimler.se>
7 months agommc: pci: Drop the superfluous cast
Bin Meng [Wed, 11 Oct 2023 11:00:52 +0000 (19:00 +0800)] 
mmc: pci: Drop the superfluous cast

dm_pci_map_bar() return a value of (void *) already, hence no need
to cast it again before assigning to host->ioaddr.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
7 months agommc: spl: select SPL_BLK for SPL_DM_MMC
Oleksandr Suvorov [Wed, 23 Aug 2023 15:45:45 +0000 (18:45 +0300)] 
mmc: spl: select SPL_BLK for SPL_DM_MMC

mmc_bind() in mmc-uclass.c calls blk_create_devicef() which is
defined in blk-uclass.c, so SPL_BLK is required by SPL_DM_MMC.
Implicitly select SPL_BLK for SPL_DM_MMC.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
7 months agoMerge branch '2023-10-31-platform-updates'
Tom Rini [Tue, 31 Oct 2023 15:17:24 +0000 (11:17 -0400)] 
Merge branch '2023-10-31-platform-updates'

- Updates for npcm8xx, developerbox, corstone1000 and one clock fix for
  TI K3 platforms.

7 months agocorstone1000: enable PSCI reset
Emekcan Aras [Thu, 26 Oct 2023 12:50:51 +0000 (13:50 +0100)] 
corstone1000: enable PSCI reset

enable PSCI reset used for the system reset

Even though Corstone-1000 does not implement the entire PSCI APIs,
it relies on PSCI reset interface for the system reset.

Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
7 months agocorstone1000: enable distro booting command
Abdellatif El Khlifi [Thu, 26 Oct 2023 12:50:50 +0000 (13:50 +0100)] 
corstone1000: enable distro booting command

enable distro_bootcmd

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
7 months agocorstone1000: add compressed kernel support
Abdellatif El Khlifi [Thu, 26 Oct 2023 12:50:49 +0000 (13:50 +0100)] 
corstone1000: add compressed kernel support

unzip the kernel before executing it

The Corstone-1000 kernel has become too large to fit in the available
storage.  Switching to a compressed kernel avoids the problem, but
requires uncompressing it.

Changes made are generated using savedefconfig.

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
7 months agoboard: developerbox: update flash rawwrite binary size
Masahisa Kojima [Wed, 25 Oct 2023 06:51:03 +0000 (15:51 +0900)] 
board: developerbox: update flash rawwrite binary size

Current documentation limits the firmware size to 1.5MB.
When the fTPM and StandaloneMM-based RPMB secure storage is
enabled, firmware size is bigger than that size.
Let's specify the A/B update bank size(4MB) for flash
rawwrite parameter.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
7 months agoboard: developerbox: update old NOR flash layout build instruction
Masahisa Kojima [Wed, 25 Oct 2023 06:51:02 +0000 (15:51 +0900)] 
board: developerbox: update old NOR flash layout build instruction

v2023.07 is the last version supporting old NOR flash layout
by default. The later versions of U-Boot, Developerbox is
configured to enable A/B update and new NOR Flash layout
by default.
This commit updates the documentation to pin the U-Boot
version for the old NOR flash layout. It is still useful
for the user wants to replace the factory default EDK II
firmware to U-Boot.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
7 months agoboard: developerbox: remove obsolete NOR flash layout definition
Masahisa Kojima [Wed, 25 Oct 2023 06:51:01 +0000 (15:51 +0900)] 
board: developerbox: remove obsolete NOR flash layout definition

There are two kinds of NOR flash layout for the Developerbox.
Capsule update for the old layout is no longer available since
it has small capacity for secure world images and can not
house the TA such as fTPM.
This commit removes the definition related to the obsolete
NOR flash layout for the UEFI capsule update.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
7 months agoclk: ti: k3-pll: Add calibration support for non fractional mode
Vishal Mahaveer [Mon, 23 Oct 2023 13:35:46 +0000 (08:35 -0500)] 
clk: ti: k3-pll: Add calibration support for non fractional mode

PLL calibration needs to be enabled when operating in non fractional
mode. Add the sequence to do a fast calibration when using PLL
in this mode.

Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
7 months agoconfigs: nuvoton: npcm8xx: Disable CONFIG_SPI_FLASH_USE_4K_SECTORS
Jim Liu [Mon, 23 Oct 2023 07:02:25 +0000 (15:02 +0800)] 
configs: nuvoton: npcm8xx: Disable CONFIG_SPI_FLASH_USE_4K_SECTORS

disable this config to improve flash program time

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
7 months agoboard: nuvuton: arbel: Fix incorrect ram size
Jim Liu [Mon, 23 Oct 2023 07:02:24 +0000 (15:02 +0800)] 
board: nuvuton: arbel: Fix incorrect ram size

1. Fix incorrect ram size of 4GB dram with ECC enabled
2. Fix wrong place to set dram bank size
   - The dram bank size should be set in dram_init_banksize
   - Dram_init should not access gd->bd because the board info
     struct is not reserved yet.

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
[trini: Rework slightly]
Signed-off-by: Tom Rini <trini@konsulko.com>
7 months agoconfigs: npcm: Support more uart baud rate
Jim Liu [Mon, 23 Oct 2023 07:02:23 +0000 (15:02 +0800)] 
configs: npcm: Support more uart baud rate

Add uart baud rate table to arbel(npcm8xx) and poleg(npcm7xx)

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
[trini: Rework slightly]
Signed-off-by: Tom Rini <trini@konsulko.com>
7 months agopinctrl: npcm8xx: Add name for gpio function
Jim Liu [Mon, 23 Oct 2023 07:02:22 +0000 (15:02 +0800)] 
pinctrl: npcm8xx: Add name for gpio function

GPIO function name is needed in the debug log

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
7 months agobootcount: Add driver model I2C driver
Philip Richard Oberfichtner [Tue, 31 Oct 2023 07:38:48 +0000 (08:38 +0100)] 
bootcount: Add driver model I2C driver

This adds a generic I2C bootcounter adhering to driver model to replace
the previously removed legacy implementation.

There is no change in functionality, it can be used on any I2C device.
The device tree configuration may look like this for example:

bootcount {
compatible = "u-boot,bootcount-i2c";
i2cbcdev = <&i2c_rtc>;
offset = <0x11>;
};

Signed-off-by: Philip Richard Oberfichtner <pro@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
7 months agoi2c: Implement i2c_get_chip_by_phandle()
Philip Richard Oberfichtner [Tue, 31 Oct 2023 07:38:46 +0000 (08:38 +0100)] 
i2c: Implement i2c_get_chip_by_phandle()

This new function enhances the i2c_get_chip*() toolbox by implementing a
variant that does not require a chip_addr. Instead, the desired device
is pointed to by a phandle.

Signed-off-by: Philip Richard Oberfichtner <pro@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
7 months agobootcount: Remove legacy I2C driver
Philip Richard Oberfichtner [Tue, 31 Oct 2023 07:38:44 +0000 (08:38 +0100)] 
bootcount: Remove legacy I2C driver

The legacy I2C bootcounter will hereby be removed and eventually
be replaced by a driver model implementation in the follow-up commit.

The legacy driver has the following drawbacks:
- It's not adhering to the driver model
- Settings are grabbed from Kconfig rather than device tree
- i2c_{read,write} are being used instead of dm_i2c_{read,write}

Signed-off-by: Philip Richard Oberfichtner <pro@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
7 months agoMerge branch '2023-10-30-assorted-general-updates'
Tom Rini [Mon, 30 Oct 2023 20:01:54 +0000 (16:01 -0400)] 
Merge branch '2023-10-30-assorted-general-updates'

- Two Kconfig content fixes, fix some issues reported by Coverity,
  resync get_maintainer.pl (two small fixees), update i2c_eeprom, and
  fix an off by one in addrmap_set_entry

7 months agomisc: i2c_eeprom: consider pagesize when writing to eeprom
Michel Alex [Thu, 26 Oct 2023 05:47:41 +0000 (05:47 +0000)] 
misc: i2c_eeprom: consider pagesize when writing to eeprom

Calculate the maximum length of the buffer when writing
across the page boundary. If the buffer length (len)
exceeds the page boundary (pagesize), split it. Use this
length instead of comparing the length with the pagesize,
because if the write start address (offset) is not at the
beginning of a page and the page_offset + len is greater
than the page boundary (pagesize), the write operation
would overflow the current page and the behaviour can be
undefined (e.g. at24).

Signed-off-by: Alex Michel <alex.michel@wiedemann-group.com>
7 months agoget_maintainer.pl: update from Linux kernel v6.5
Tom Rini [Sat, 28 Oct 2023 16:58:27 +0000 (12:58 -0400)] 
get_maintainer.pl: update from Linux kernel v6.5

Update U-Boot's version of scripts/get_maintainer.pl to sync it up with
the latest changes to the Linux kernel's version of the same script.

The last sync was with Linux kernel version v5.13-rc6. The commits to
the kernel's get_maintainer.pl since then (starting with the most
recent) are:
        11fb48961e52 get_maintainer: Honor mailmap for in file emails
        26d98e9f78da get_maintainer: don't remind about no git repo when --nogit is used

Signed-off-by: Tom Rini <trini@konsulko.com>
7 months agoKconfig: Remove all default n/no options
Michal Simek [Wed, 25 Oct 2023 07:25:37 +0000 (09:25 +0200)] 
Kconfig: Remove all default n/no options

Similar change was done by commit b4c2c151b14b ("Kconfig: Remove all
default n/no options") and again sync is required.

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Angelo Dureghello <angelo@kernel-space.org>
7 months agotools: mkimage: fix sfspl_image_extract_subimage()
Heinrich Schuchardt [Tue, 24 Oct 2023 07:26:38 +0000 (09:26 +0200)] 
tools: mkimage: fix sfspl_image_extract_subimage()

Do not leak file descriptor if writing fails.
Correct the error text if opening a file fails.

Addresses-Coverity-ID: 467054 Resource leaks
Fixes: 64fd30d367a1 ("tools: mkimage: Add StarFive SPL image support")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 months agoarm_ffa: fix: remove deadcode in ffa_print_error_log()
Abdellatif El Khlifi [Fri, 20 Oct 2023 13:15:33 +0000 (14:15 +0100)] 
arm_ffa: fix: remove deadcode in ffa_print_error_log()

address the CID 464361 Control flow issues [1]

[1]: https://lore.kernel.org/all/20230821210927.GL3953269@bill-the-cat/

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Cc: Tom Rini <trini@konsulko.com>
7 months agocommon: Reword CONSOLE_RECORD_.*SIZE help texts
Tom Rini [Thu, 19 Oct 2023 15:04:35 +0000 (11:04 -0400)] 
common: Reword CONSOLE_RECORD_.*SIZE help texts

Make it clear that in the options for setting the console record buffer
sizes that we are talking about buffers for that feature specifically
and not the general console buffers.

Signed-off-by: Tom Rini <trini@konsulko.com>
7 months agoaddrmap: Fix off by one in addrmap_set_entry()
Dan Carpenter [Tue, 25 Jul 2023 06:50:40 +0000 (09:50 +0300)] 
addrmap: Fix off by one in addrmap_set_entry()

The > comparison needs to be changed to >= to prevent an out of bounds
write on th next line.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 months agoi2c: designware_i2c: adjust timing calculation
Heinrich Schuchardt [Fri, 13 Oct 2023 13:09:39 +0000 (15:09 +0200)] 
i2c: designware_i2c: adjust timing calculation

In SPL probing of the designware_i2c device on the StarFive VisionFive 2
board fails with

    dw_i2c: mode 0, ic_clk 1000000, speed 100000,
    period 10 rise 1 fall 1 tlow 5 thigh 4 spk 0
    dw_i2c: bad counts. hcnt = -4 lcnt = 4
    device_probe: i2c@12050000 failed to probe -22

When changing the offset for the high phase from 7 to 3 the device is
probed correctly. This now matches the value from the Linux driver.

Without this fix the memory size of the StarFive VisionFive 2 board cannot
be read from EEPROM.

Fixes: e71b6f6622d6 ("i2c: designware_i2c: Rewrite timing calculation")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
7 months agoi2c: nuvoton: remove standard mode only
Jim Liu [Wed, 4 Oct 2023 01:35:58 +0000 (09:35 +0800)] 
i2c: nuvoton: remove standard mode only

first version is only support standard mode.
remove this judgment to support standard/fast/fast plus  mode.

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
Changes for v2:
   - add commit message
Reviewed-by: Heiko Schocher <hs@denx.de>
7 months agoMerge branch 'master_tmio_fixes' of https://source.denx.de/u-boot/custodians/u-boot-sh
Tom Rini [Sat, 28 Oct 2023 16:51:28 +0000 (12:51 -0400)] 
Merge branch 'master_tmio_fixes' of https://source.denx.de/u-boot/custodians/u-boot-sh

- MMC fixes for Renesas platforms

7 months agoMerge branch '2023-10-28-assorted-platform-updates'
Tom Rini [Sat, 28 Oct 2023 13:23:27 +0000 (09:23 -0400)] 
Merge branch '2023-10-28-assorted-platform-updates'

- Fix some mpc85xx platforms, fixes for a few TI K3 platforms, enable
  usb device and fastboot on verdin-imx8mp, make all QEMU platforms use
  the default console buffer sizes, vexpress platform fixes, and update
  synquacer flash layout

7 months agoiot2050: Allow for more than 1 USB storage device
Jan Kiszka [Sun, 22 Oct 2023 18:07:26 +0000 (20:07 +0200)] 
iot2050: Allow for more than 1 USB storage device

This was lost in refactoring while some users of the IOT2050 expect it
to work: Make sure that up to 3 USB storage devices are probed.

Fixes: 53873974a4b0 ("include: armv7: Enable distroboot across all configs")
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
7 months agompc85xx: relocate code in non-SPL build
Martin Fäcknitz [Thu, 19 Oct 2023 23:06:55 +0000 (01:06 +0200)] 
mpc85xx: relocate code in non-SPL build

When building a non-SPL image, relocation is needed. This patch restores
the old behaviour before commit b35316fb67cb ("Convert
CONFIG_SPL_INIT_MINIMAL et al to Kconfig") was only defined if
CONFIG_SPL_BUILD was defined.

Fixes: b35316fb67cb ("Convert CONFIG_SPL_INIT_MINIMAL et al to Kconfig")
Signed-off-by: Martin Fäcknitz <faecknitz@hotsplots.de>
7 months agoboard: synquacer: Update the flash image layout
Ilias Apalodimas [Thu, 19 Oct 2023 13:54:19 +0000 (16:54 +0300)] 
board: synquacer: Update the flash image layout

The SynQuacer Developerbox, in EFI mode, supports A/B capsule
updates and single image ones. The flash layout in the latter case is
outdated, update it with the new offsets and images

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Tested-By: Masahisa Kojima <masahisa.kojima@linaro.org>
7 months agodriver: misc: k3_avs: Add support for thermal shutdown
Udit Kumar [Thu, 19 Oct 2023 07:27:53 +0000 (12:57 +0530)] 
driver: misc: k3_avs: Add support for thermal shutdown

To avoid thermal burn out, program thermal shutdown
value in VTM (Voltage and Thermal Manager) IP.

Part of Linux kernel driver (drivers/thermal/k3_j72xx_bandgap.c)
is ported from kernel 6.6-rc1, which sets thermal shutdown values.

Signed-off-by: Udit Kumar <u-kumar1@ti.com>
Signed-off-by: Neha Francis <n-francis@ti.com>
7 months agovexpress64: Add MMC card to the BOOT_TARGET_DEVICES of FVP
Wei Chen [Wed, 18 Oct 2023 06:27:45 +0000 (14:27 +0800)] 
vexpress64: Add MMC card to the BOOT_TARGET_DEVICES of FVP

Add MMC disk to FVP's BOOT_TARGET_DEVICES. This allows the user to boot
from MMC devices.

Signed-off-by: Wei Chen <wei.chen@arm.com>
Signed-off-by: Qi Feng <qi.feng@arm.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
7 months agomisc: vexpress_config: Use member .priv_auto to set the private data
Wei Chen [Wed, 18 Oct 2023 06:27:44 +0000 (14:27 +0800)] 
misc: vexpress_config: Use member .priv_auto to set the private data

In current vexpress_config_probe code, it sets the uclass private data
directly. This will cause one compilation error:
drivers/misc/vexpress_config.c:114:27: error: lvalue required as left operand of assignment
  114 |  dev_get_uclass_priv(dev) = priv;
      |                           ^

In this patch we set the uclass private data through struct member
.priv_auto, and this compilation error disappears.

Signed-off-by: Wei Chen <wei.chen@arm.com>
Signed-off-by: Qi Feng <qi.feng@arm.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
7 months agoconfig: qemu: relax print and console buffer size
Heinrich Schuchardt [Mon, 16 Oct 2023 21:54:45 +0000 (23:54 +0200)] 
config: qemu: relax print and console buffer size

QEMU print and console buffer sizes have been restricted on QEMU below
their default values.

One of the side effects of the print buffer size restriction is output
truncation of the 'efidebug dh' command.

As QEMU does not have special memory size restrictions remove the settings
from the defconfig files and go with the generic defaults.

Fixes: d0ee7f295d74 ("Convert CONFIG_SYS_PBSIZE to Kconfig")
Fixes: d31466b382dd ("Convert CONFIG_SYS_CBSIZE to Kconfig")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 months agoboard: siemens: iot2050: Fix M.2 detection
Jan Kiszka [Tue, 17 Oct 2023 05:20:14 +0000 (07:20 +0200)] 
board: siemens: iot2050: Fix M.2 detection

The "simpler" the logic, the higher the probability to not test and get
things wrong, again: The absence of a "-PG2" suffix is not sufficient to
derive that we are on PG1. There is also "IOT2050-ADVANCED-M2".

Finally fix that by exactly matching against the two PG1 device names.

While changing this, we can also drop the not really needed check for
!board_is_sr1 in board_is_m2 and call the boards by their names
("board_is_pg1").

Reported-and-tested-by: Bao Cheng Su <baocheng.su@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 months agoboard: toradex: verdin-imx8mp: enable usb device and fastboot support
Marcel Ziswiler [Mon, 28 Aug 2023 21:38:02 +0000 (23:38 +0200)] 
board: toradex: verdin-imx8mp: enable usb device and fastboot support

Enable USB device and fastboot support which may be used to load the
Toradex Easy Installer FIT image.

While at it also enable USB mass storage aka UMS support.

Note that the i.MX 8M Plus recovery mode support is based on the USB
boot stage of the BOOTROM and does NOT require USB SDP SPL aka serial
downloader support.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
7 months agoMerge tag 'tpm-next-27102023' of https://source.denx.de/u-boot/custodians/u-boot-tpm
Tom Rini [Fri, 27 Oct 2023 23:27:29 +0000 (19:27 -0400)] 
Merge tag 'tpm-next-27102023' of https://source.denx.de/u-boot/custodians/u-boot-tpm

bootX measurements and measurement API moved to u-boot core:

Up to now, U-Boot could perform measurements and EventLog creation as
described by the TCG spec when booting via EFI.

The EFI code was residing in lib/efi_loader/efi_tcg2.c and contained
both EFI specific code + the API needed to access the TPM, extend PCRs
and create an EventLog. The non-EFI part proved modular enough and
moving it around to the TPM subsystem was straightforward.

With that in place we can have a common API for measuring binaries
regardless of the boot command, EFI or boot(m|i|z), and contructing an
EventLog.

I've tested all of the EFI cases -- booting with an empty EventLog and
booting with a previous stage loader providing one and found no
regressions.  Eddie tested the bootX part.

Eddie also fixed the sandbox TPM which couldn't be used for the EFI code
and it now supports all the required capabilities. This had a slight
sideeffect in our testing since the EFI subsystem initializes the TPM
early and 'tpm2 init' failed during some python tests. That code only
opens the device though, so we can replace it with 'tpm2 autostart'
which doesn't error out and still allows you to perfom the rest of the
tests but doesn't report an error if the device is already opened.

There's a few minor issues with this PR as well but since testing and
verifying the changes takes a considerable amount of time, I prefer
merging it now.

Heinrich has already sent a PR for -master containing "efi_loader: fix
EFI_ENTRY point on get_active_pcr_banks" and I am not sure if that will
cause any conflicts, but in any case they should be trivial to resolve.

Both the EFI and non-EFI code have a Kconfig for measuring the loaded
Device Tree.  The reason this is optional is that we can't reason
when/if devices add random info like kaslr-seed, mac addresses etc in
the DT. In that case measurements are random, board specific and
eventually useless.  The reason it was difficult to fix it prior to this
patchset is because the EFI subsystem and thus measurements was brought
up late and DT fixups might have already been applied. With this
patchset we can measure the DT really early in the future.

Heinrich also pointed out that the two Kconfigs for the DTB measurements
can be squashed in a single one and that the documentation only explains
the non-EFI case.  I agree on both but as I said this is a sane working
version, so let's pull this first it's aleady big enough and painful to
test.

7 months agoMerge tag 'efi-2024-01-rc2-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Fri, 27 Oct 2023 19:23:21 +0000 (15:23 -0400)] 
Merge tag 'efi-2024-01-rc2-2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request efi-2024-01-rc2-2

Documentation:

* Bump urllib3 version
* Replace references to dm_dump_all() with dm_dump_tree()
* Update description of build dependencies for Alpine Linux
* Fix typo in gpt example
* Fix ordering of shell commands

UEFI:

* Move misplace EFI_ENTRY macro

7 months agoefi_loader: fix EFI_ENTRY point on get_active_pcr_banks
Ilias Apalodimas [Thu, 19 Oct 2023 16:21:55 +0000 (11:21 -0500)] 
efi_loader: fix EFI_ENTRY point on get_active_pcr_banks

efi_tcg2_get_active_pcr_banks doesn't immediately call the
EFI_ENTRY() wrapper once it enters the function. Move the call a
few lines above to cover the error cases properly as well.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
7 months agodoc: usage: fix ordering of shell commands
Tom Fitzhenry [Tue, 24 Oct 2023 12:03:00 +0000 (23:03 +1100)] 
doc: usage: fix ordering of shell commands

I initially didn't find the bootz docs when I went looking for them. :)

Signed-off-by: Tom Fitzhenry <tom@tom-fitzhenry.me.uk>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
7 months agodoc: gpt: fix example of echoing variable
Tom Fitzhenry [Tue, 24 Oct 2023 11:59:06 +0000 (22:59 +1100)] 
doc: gpt: fix example of echoing variable

Fixes: 44c5d7764bf4 ("doc: Add gpt command documentation")
Signed-off-by: Tom Fitzhenry <tom@tom-fitzhenry.me.uk>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
7 months agodoc: Replace dm_dump_all() with dm_dump_tree()
Dylan Corrales [Thu, 19 Oct 2023 14:02:30 +0000 (10:02 -0400)] 
doc: Replace dm_dump_all() with dm_dump_tree()

Replace dm_dump_all() with dm_dump_tree() in driver model documentation,
to reflect changes introduced in commit 145287040480 ("dm: core: Rename
dm_dump_all()").

Fixes: 145287040480 ("dm: core: Rename dm_dump_all()")
Signed-off-by: Dylan Corrales <deathcamel58@gmail.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reivewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
7 months agosphinx: Bump urllib3 version
Tom Rini [Wed, 18 Oct 2023 12:33:48 +0000 (08:33 -0400)] 
sphinx: Bump urllib3 version

While unlikely to be a direct issue for us, urllib3 before 2.0.7 is
vulnerable to CVE-2023-45803, so bump our version up.

Reported-by: GitHub dependabot
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
7 months agoMerge tag 'u-boot-amlogic-20231027' of https://source.denx.de/u-boot/custodians/u...
Tom Rini [Fri, 27 Oct 2023 14:19:17 +0000 (10:19 -0400)] 
Merge tag 'u-boot-amlogic-20231027' of https://source.denx.de/u-boot/custodians/u-boot-amlogic

- Fix environment saving for new Android boot features on vim3*_android
- Add SPIFC support for Amlogic A1
- Add DFU RAM boot step when booting over USB

7 months agoARM: amlogic: ad401: enable SPIFC
Igor Prusov [Tue, 24 Oct 2023 22:51:40 +0000 (01:51 +0300)] 
ARM: amlogic: ad401: enable SPIFC

Enable Amlogic A1 SPI FLash Controller support.

Signed-off-by: Igor Prusov <ivprusov@sberdevices.ru>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20231024225140.366571-3-ivprusov@sberdevices.ru
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
7 months agospi: add support for Amlogic A1 SPI Flash Controller
Igor Prusov [Tue, 24 Oct 2023 22:51:39 +0000 (01:51 +0300)] 
spi: add support for Amlogic A1 SPI Flash Controller

Add A1 SPIFC driver from Linux. Slightly modified to use u-boot driver
framework and accommodate to lack of ioread32_rep/iowrite32_rep.

Based on Linux version 6.6-rc4

Signed-off-by: Igor Prusov <IVPrusov@sberdevices.ru>
Signed-off-by: Martin Kurbanov <mmkurbanov@sberdevices.ru>
Reviewed-by: Simon Glass <sjg@chromium.org>
Link: https://lore.kernel.org/r/20231024225140.366571-2-ivprusov@sberdevices.ru
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
[trini: Drop <common.h> as it's not needed]

7 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Fri, 27 Oct 2023 13:38:58 +0000 (09:38 -0400)] 
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- kirkwood: Enable bootstd on some boards (Tony)
- mvebu: turris_mox: Extend to support RIPE Atlas Probe (Marek)
- mvebu/bubt: Support eMMC data partition booting (Josua)

7 months agotest/py: always use autostart on tpm2 selftests
Ilias Apalodimas [Wed, 25 Oct 2023 07:25:25 +0000 (10:25 +0300)] 
test/py: always use autostart on tpm2 selftests

commit 789ed2784256 ("test/py: replace 'tpm2 init, startup, selftest' sequences")
changed some of the tpm2 init sequences to 'tpm2 autostart' instead of
calling 'tpm init', 'tpm startup TPM2_SU_CLEAR', 'tpm2 self_test full'.

The autostart command calls the afforementioned sequence and on top of
that deals with the 'tpm2 init' return codes if the tpm is already
started. Since we initialize the tpm from various subsystems now,
replace the last remaining instances of 'tpm2 init' with 'tpm2
autostart'.  Since the latter calls 'tpm2 init' anyway we will still be
implicitly testing the validity of that command

It's worth noting that since 'tpm2 autostart' performs the startup and
self tests sequences of the tpm we could drop
'test_tpm2_sandbox_self_test_full' and 'test_tpm2_startup, but let's
keep the since they test tpm commands and options

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
7 months agotest: use a non system PCR for testing PCR extend
Ilias Apalodimas [Tue, 24 Oct 2023 15:43:54 +0000 (10:43 -0500)] 
test: use a non system PCR for testing PCR extend

We currently use PCR 0 for testing the PCR read/extend functionality in
our selftests.  How ever those PCRs are defined by the TCG spec for
platform use.  For example if the tests run *after* the efi subsystem
initialization, which extends PCRs 0 & 7 it will give a false positive.

So let's switch over to a PCR which is more suitable and is defined for
OS use.  It's worth noting that we are using PCR10 here, since PCR9 is
used internally by U-Boot if we choose to measure the loaded DTB

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
7 months agoefi_loader: fix EFI_ENTRY point on get_active_pcr_banks
Ilias Apalodimas [Tue, 24 Oct 2023 15:43:53 +0000 (10:43 -0500)] 
efi_loader: fix EFI_ENTRY point on get_active_pcr_banks

efi_tcg2_get_active_pcr_banks doesn't immediately call the
EFI_ENTRY() wrapper once it enters the function. Move the call a
few lines above to cover the error cases properly as well.

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
7 months agodoc: Add measured boot documentation
Eddie James [Tue, 24 Oct 2023 15:43:52 +0000 (10:43 -0500)] 
doc: Add measured boot documentation

Briefly describe the feature and specify the requirements.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
7 months agotest: Add sandbox TPM boot measurement
Eddie James [Tue, 24 Oct 2023 15:43:51 +0000 (10:43 -0500)] 
test: Add sandbox TPM boot measurement

Use the sandbox TPM driver to measure some boot images in a unit
test case.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
7 months agobootm: Support boot measurement
Eddie James [Tue, 24 Oct 2023 15:43:50 +0000 (10:43 -0500)] 
bootm: Support boot measurement

Add a configuration option to measure the boot through the bootm
function. Add the measurement state to the booti and bootz paths
as well.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Ilias: Added some info on Kconfig explaining this is when booting !EFI
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
7 months agotpm: Support boot measurements
Eddie James [Tue, 24 Oct 2023 15:43:49 +0000 (10:43 -0500)] 
tpm: Support boot measurements

Add TPM2 functions to support boot measurement. This includes
starting up the TPM, initializing/appending the event log, and
measuring the U-Boot version. Much of the code was used in the
EFI subsystem, so remove it there and use the common functions.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
For the API moving around from EFI -> u-boot core
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
For EFI testing
Tested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
7 months agotpm: sandbox: Update for needed TPM2 capabilities
Eddie James [Tue, 24 Oct 2023 15:43:48 +0000 (10:43 -0500)] 
tpm: sandbox: Update for needed TPM2 capabilities

The driver needs to support getting the PCRs in the capabilities
command. Fix various other things and support the max number
of PCRs for TPM2.
Remove the !SANDBOX dependency for EFI TCG2 as well.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
7 months agotpm: Fix spelling for tpmu_ha union
Eddie James [Tue, 24 Oct 2023 15:43:47 +0000 (10:43 -0500)] 
tpm: Fix spelling for tpmu_ha union

tmpu -> tpmu

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
7 months agommc: tmio: Disable 1/1024 clock divider on Renesas R-Car platforms
Marek Vasut [Sun, 22 Oct 2023 21:40:43 +0000 (23:40 +0200)] 
mmc: tmio: Disable 1/1024 clock divider on Renesas R-Car platforms

The R-Car Gen3 SD_CLK_CTRL register does not use BIT(16) to implement
divider 1/1024, instead BIT(16) is reserved bit and divider 1/1024 is
not supported. The divider 1/1024 is specific to Socionext variant of
the IP, as is indicated by Linux commit:

0196c8db8363 ("mmc: tmio: move tmio_mmc_set_clock() to platform hook")
"
Socionext (and Panasonic) uses bit 10 (CLKSEL) for 1/1.  Also, newer
versions of UniPhier SoC variants use bit 16 for 1/1024.
"

Do not set the TMIO_SD_CAP_DIV1024 on Renesas R-Car platforms even if
the IP VERSION register does exist, and indicates IP version is newer
or equal to version 1.0 . The IP version 1.0 or newer does not imply
presence of the 1/1024 divider.

Since the TMIO driver is used exactly by two supported platforms, that
is Renesas R-Car and Socionext UniPhier, it is OK to check whether the
TMIO_SD_CAP_RCAR capability is not set to identify the UniPhier platform
and add the capability only on that platform.

Fixes: 58c35b17aa8f ("mmc: matsushita-common: Always check controller version")
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Acked-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Tested-by: Thuan Nguyen Hong <thuan.nguyen-hong@banvien.com.vn>
7 months agommc: tmio: Always check for errors after receiving an IRQ
Marek Vasut [Sat, 14 Oct 2023 21:56:03 +0000 (23:56 +0200)] 
mmc: tmio: Always check for errors after receiving an IRQ

Unconditionally check for errors even after successful reception
of IRQ flag, since the hardware may set both an IRQ completion
flag and an error flag at the same time.

This mode of failure happens in case of an error during transfer,
in which case the hardware may set the expected IRQ completion
flag as well as error flags. The later is currently not checked
by the driver and such an error is not detected. Improve the
error detection.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Tested-by: Thuan Nguyen Hong <thuan.nguyen-hong@banvien.com.vn>
7 months agommc: sh_sdhi: Drop unused driver
Marek Vasut [Sat, 14 Oct 2023 21:27:24 +0000 (23:27 +0200)] 
mmc: sh_sdhi: Drop unused driver

This driver is long superseded by renesas-sdhi.c and unused.
Drop the driver.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Acked-by: Paul Barker <paul.barker.ct@bp.renesas.com>
7 months agommc: renesas-sdhi: Fix error handling in rzg2l_sdhi_setup
Paul Barker [Thu, 19 Oct 2023 14:50:38 +0000 (15:50 +0100)] 
mmc: renesas-sdhi: Fix error handling in rzg2l_sdhi_setup

We should ensure that reset_free() is called in the error path.

Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Fixes: 93c811b7331b ("mmc: renesas-sdhi: Initialize module on RZ/G2L")
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
7 months agoARM: meson: enable USB DFU + RAM on Amlogic boards with USB Gadget
Neil Armstrong [Mon, 23 Oct 2023 12:41:37 +0000 (14:41 +0200)] 
ARM: meson: enable USB DFU + RAM on Amlogic boards with USB Gadget

Enable DFU as an alternate USB boot method when script wasn't
uploaded, this fixes USB full boot on G12/SM1 boards.

Link: https://lore.kernel.org/r/20231023-usb-dfu-boot-v1-4-df9d121c67c1@linaro.org
[narmstrong: remove dfu from ad401]
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
7 months agoconfigs: meson64: add alternate USB DFU boot target
Neil Armstrong [Mon, 23 Oct 2023 12:41:36 +0000 (14:41 +0200)] 
configs: meson64: add alternate USB DFU boot target

Add boot over DFU RAM as an alternate to running script at
a fixed address like done today.

The main culprit is that it's not possible to do that
on G12A/Sm1 platforms due to changes in the USB boot protocol.

With this, U-Boot will present a DFU device with a ram slot where
the Host could write a fitImage or legacy U-Boot image, then with the
detach command boot will continue trying to boot the uploaded image.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://lore.kernel.org/r/20231023-usb-dfu-boot-v1-3-df9d121c67c1@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
7 months agoconfigs: meson64: declare addr out of EXTRA_ENV_SETTINGS
Neil Armstrong [Mon, 23 Oct 2023 12:41:35 +0000 (14:41 +0200)] 
configs: meson64: declare addr out of EXTRA_ENV_SETTINGS

In order to reuse addresses for DFU RAM, define them separately,
it's cleaner and will be easier to override.

Link: https://lore.kernel.org/r/20231023-usb-dfu-boot-v1-2-df9d121c67c1@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
7 months agoARM: meson: enable FIT with LEGACY_IMAGE_FORMAT on all configs
Neil Armstrong [Mon, 23 Oct 2023 12:41:34 +0000 (14:41 +0200)] 
ARM: meson: enable FIT with LEGACY_IMAGE_FORMAT on all configs

Allow all boards to boot with a fitImage, but keep support for
Legacy image format for now.

Link: https://lore.kernel.org/r/20231023-usb-dfu-boot-v1-1-df9d121c67c1@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
7 months agoconfigs: khadas-vim3*_android: fix environment saving
Mattijs Korpershoek [Thu, 26 Oct 2023 13:41:31 +0000 (15:41 +0200)] 
configs: khadas-vim3*_android: fix environment saving

The environment is used to configure some additional boot features such as:
* extra boot arguments
* enable AVB (Android Verified Boot) verification

Right now, we cannot store it in eMMC:

  Loading Environment from nowhere... OK

Fix it by enabling the appropriate options in the defconfig

Fixes: b749d5ecdc06 ("configs: meson64_android: define raw parts for bootloader")
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20231026-fix-saveenv-v1-1-6aa59be65481@baylibre.com
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
7 months agoarm: kirkwood: Enable bootstd for Zyxel NSA310S board
Tony Dinh [Wed, 25 Oct 2023 22:38:37 +0000 (15:38 -0700)] 
arm: kirkwood: Enable bootstd for Zyxel NSA310S board

Enable bootstd for Zyxel NSA310S board, and remove distroboot.

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
7 months agocmd: mvebu/bubt: move eMMC data-partition uboot from LBA-0 to 4096
Josua Mayer [Wed, 25 Oct 2023 08:22:54 +0000 (10:22 +0200)] 
cmd: mvebu/bubt: move eMMC data-partition uboot from LBA-0 to 4096

A38x bootrom only searches 2 sectors when booting from eMMC,
irregardless of data or boot partition: 0 & 4096.

For eMMC boot partitions sector 0 is fine, but on data partition it
conflicts with MBR.

Change bubt command default to 4096 for eMMC data partition only, to
allow using an MBR partition table on the eMMC data partition while also
booting from it.

Signed-off-by: Josua Mayer <josua@solid-run.com>
Reviewed-by: Stefan Roese <sr@denx.de>
7 months agoarm: mvebu: allow additional 4096 offset for bootable mmc image
Josua Mayer [Wed, 25 Oct 2023 08:22:53 +0000 (10:22 +0200)] 
arm: mvebu: allow additional 4096 offset for bootable mmc image

Disarm the error message forcing u-boot/spl image to be located at
sector 0 on eMMC data-partition and microSD.
Offset 0 makes sense on eMMC boot partitions only, data partition must
use 4096 to avoid conflicting with MBR.

Valid offsets when booting from microSD, reported by boot-rom v1.73:

BootROM: Bad header at offset 00000200
BootROM: Bad header at offset 00004400
BootROM: Bad header at offset 00200000
BootROM: Bad header at offset 00400000
BootROM: Bad header at offset 00600000
BootROM: Bad header at offset 00800000
BootROM: Bad header at offset 00A00000
BootROM: Bad header at offset 00C00000
BootROM: Bad header at offset 00E00000
BootROM: Bad header at offset 01000000
BootROM: Bad header at offset 01200000
BootROM: Bad header at offset 01400000
BootROM: Bad header at offset 01600000
BootROM: Bad header at offset 01800000
BootROM: Bad header at offset 01A00000
BootROM: Bad header at offset 01C00000
BootROM: Bad header at offset 01E00000
BootROM: Bad header at offset 02000000
BootROM: Bad header at offset 02200000
BootROM: Bad header at offset 02400000
BootROM: Bad header at offset 02600000
BootROM: Bad header at offset 02800000
BootROM: Bad header at offset 02A00000
BootROM: Bad header at offset 02C00000
BootROM: Bad header at offset 02E00000

Valid offsets when booting from eMMC:

BootROM: Bad header at offset 00000000
BootROM: Bad header at offset 00200000
Switching BootPartitions.
BootROM: Bad header at offset 00000000
BootROM: Bad header at offset 00200000

Fixes: 2226ca17348 ("arm: mvebu: Load U-Boot proper binary in SPL code based on kwbimage header")
Signed-off-by: Josua Mayer <josua@solid-run.com>
Reviewed-by: Stefan Roese <sr@denx.de>
7 months agoarm: kirkwood: Enable bootstd for Pogo V4 board
Tony Dinh [Tue, 24 Oct 2023 23:17:08 +0000 (16:17 -0700)] 
arm: kirkwood: Enable bootstd for Pogo V4 board

Enable bootstd for Pogo V4 board, and remove distroboot.

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>