]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
23 months agopower: pmic: axp: Bind regulators from the DT
Samuel Holland [Sat, 21 Jan 2023 23:13:06 +0000 (17:13 -0600)]
power: pmic: axp: Bind regulators from the DT

Now that a regulator driver exists for this PMIC, hook it up to the
device tree "regulators" subnodes.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
23 months agopower: regulator: Add a driver for AXP PMIC regulators
Samuel Holland [Sat, 21 Jan 2023 23:13:05 +0000 (17:13 -0600)]
power: regulator: Add a driver for AXP PMIC regulators

This driver handles most voltage regulators found in X-Powers AXP PMICs.
It is based on, and intended to replace, the regulator driver in TF-A.

AXP PMIC regulators can be divided into 6 categories:
 - Switches without voltage control => fully supported.
 - Single linear range => fully supported.
 - Two linear ranges, "step" and "2 * step" => fully supported.
 - Two linear ranges, "step" and "5 * step" => only the first range is
   supported. No boards are known to use the second range.
 - Non-linear voltage values => fully supported.
 - LDOs shared with GPIO pins => not supported.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
23 months agopower: pmic: axp: Provide a variant ID in the driver data
Samuel Holland [Sat, 21 Jan 2023 23:13:04 +0000 (17:13 -0600)]
power: pmic: axp: Provide a variant ID in the driver data

Subordinate regulator drivers can use this enumerated ID instead of
matching the compatible string again.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
23 months agosunxi: eMMC: support TOC0 on boot partitions
Andre Przywara [Fri, 25 Nov 2022 01:38:06 +0000 (01:38 +0000)]
sunxi: eMMC: support TOC0 on boot partitions

To determine whether we have been booted from an eMMC boot partition, we
replay some of the checks that the BROM must have done to successfully
load the SPL. This involves a checksum check, which currently relies on
the SPL being wrapped in an "eGON" header.

If a board has secure boot enabled, the BROM will only accept the "TOC0"
format, which is internally very different, but uses the same
checksumming algorithm. Actually the only difference for calculating the
checksum is that the size of the SPL is stored at a different offset.

Do a header check to determine whether we deal with an eGON or TOC0
format, then set the SPL size accordingly. The rest of the code is
unchanged.

This fixes booting from an eMMC boot partition on devices with secure
boot enabled, like the Remix Mini PC.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
23 months agosunxi: remove CONFIG_MMC?_CD_PIN
Andre Przywara [Wed, 13 Jul 2022 16:21:45 +0000 (17:21 +0100)]
sunxi: remove CONFIG_MMC?_CD_PIN

For legacy reasons we were defining the card detect GPIO for all sunxi
boards in each board's defconfig.
There is actually no need for a card-detect check in the SPL code (which
consequently has been removed already), and also in U-Boot proper we
have DM code to query the CD GPIO name from the device tree.

That means we don't have any user of that information left, so can
remove the definitions from the defconfigs.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Tested-by: Samuel Holland <samuel@sholland.org>
23 months agosunxi: mmc: group non-DM specific functions
Andre Przywara [Wed, 13 Jul 2022 16:21:44 +0000 (17:21 +0100)]
sunxi: mmc: group non-DM specific functions

As the SPL code for sunxi boards does not use the driver model, we have
two mmc_ops structures, one for DM, one for non-DM. The actual hardware
access code is shared, with the respective callback functions using that
common code.

To make this more obvious and easier to read, reorder the functions to
group them: we first have the common code, then the non-DM bits, and
the proper DM implementation at the end.
Also document this structure in the comment at the beginning of the file.

No functional change intended.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Tested-by: Samuel Holland <samuel@sholland.org>
23 months agosunxi: mmc: ignore card detect in SPL
Andre Przywara [Wed, 13 Jul 2022 16:21:43 +0000 (17:21 +0100)]
sunxi: mmc: ignore card detect in SPL

The sunxi MMC code does not use the DM in the SPL, as we don't have a
device tree available that early, also no space for it.
This also means we cannot access the card-detect GPIO information from
there, so we have Kconfig symbols called CONFIG_MMCx_CD_PIN, which each
board has to define. This is a burden, also requires extra GPIO code in
the SPL.
As the SPL is the natural successor of the BootROM (from which we are
loaded), we can actually ignore the CD pin completely, as this is what
the BootROM does as well: CD GPIOs are board specific, but the BootROM
is not, so accesses the MMC devices anyway.
Also, as we must have been loaded from an MMC device when reaching this
code, there must have been a card in the slot.

Remove the card detect code from the non-DM implementation of the sunxi
MMC driver, to get rid of this unneeded code.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Tested-by: Samuel Holland <samuel@sholland.org>
23 months agosunxi: fel: drop redundant "control register" save/restore
Andre Przywara [Wed, 13 Jul 2022 15:27:58 +0000 (16:27 +0100)]
sunxi: fel: drop redundant "control register" save/restore

For some reasons shrouded in mystery, the code saving the FEL state was
saving the SCTLR register twice, with the second copy trying to justify
itself by using its ancient "control register" alias name.

Drop the redundant second copy, both from the fel_stash data structure,
and also the code saving and restoring it.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Tested-by: Samuel Holland <samuel@sholland.org>
23 months agosunxi: h616: lower SPL stack address to avoid BROM data
Andre Przywara [Wed, 13 Jul 2022 15:27:57 +0000 (16:27 +0100)]
sunxi: h616: lower SPL stack address to avoid BROM data

When using the USB OTG FEL mode on the Allwinner H616, the BootROM
stores some data at the end of SRAM C. This is also the location where
we place the initial SPL stack, so it will overwrite this data.
We still need the BROM code after running the SPL, so should leave that
area alone.
Interestingly this does not seem to have an adverse effect, I guess on
the "way out" (when we return to FEL after the SPL has run), this data
is not needed by the BROM, for just the trailing end of the USB operation.
However this is still wrong, and we should not clobber BROM data.

Lower the SPL stack address to be situated right below the swap buffers
we use in sunxi-fel: that should be out of the way of everyone else.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Tested-by: Samuel Holland <samuel@sholland.org>
23 months agosunxi: armv8: fel: load only 32-bit values
Andre Przywara [Wed, 13 Jul 2022 15:27:56 +0000 (16:27 +0100)]
sunxi: armv8: fel: load only 32-bit values

Both the values and the MMIO addresses that we need during the 64-bit FEL
restore are smaller than 2^32, so we don't need to do any 64-bit loads.

Change the loads to only load 32 bits worth of data, that saves us some
bytes for storing the values.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Tested-by: Samuel Holland <samuel@sholland.org>
23 months agosunxi: f1c100s: Drop no-MMC hack
Andre Przywara [Fri, 16 Dec 2022 23:55:17 +0000 (23:55 +0000)]
sunxi: f1c100s: Drop no-MMC hack

When support for the Allwinner F1C100s SoC was originally introduced,
its DT lacked any MMC nodes, which upset our sunxi-u-boot.dtsi overlay,
when it tried to add an alias to the SD card.  To quickly fix this back
then, we guarded that alias with a preprocessor macro.

Now the F1C100s family has gained MMC nodes, so we don't need the
special treatment anymore. Just remove this guard.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
23 months agosunxi: f1c100s: re-enable SYSRESET
Andre Przywara [Fri, 16 Dec 2022 23:34:47 +0000 (23:34 +0000)]
sunxi: f1c100s: re-enable SYSRESET

The SoC .dtsi originally submitted for the Allwinner F1C100s had the
wrong compatible string for the watchdog, which broke U-Boot's reset
functionality. To quickly fix this, we disable CONFIG_SYSRESET in
cfcf1952c11e6ffcbbf88 ("sunxi: f1c100s: Drop SYSRESET to enable reset
functionality"), so that U-Boot's hardcoded reset driver could take over.

After this was properly fixed in the devicetree, we reverted that patch
in 92373de041ea ("Revert "sunxi: f1c100s: Drop SYSRESET to enable reset
functionality"), however this line sneaked back in with d0ee7f295d74
("Convert CONFIG_SYS_PBSIZE to Kconfig"), so during a Kconfig update.

Remove this line (again), to use the proper reset driver.

Fixes: d0ee7f295d74 ("Convert CONFIG_SYS_PBSIZE to Kconfig")
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
23 months agoMerge tag 'efi-2023-04-rc1-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Fri, 20 Jan 2023 19:23:20 +0000 (14:23 -0500)]
Merge tag 'efi-2023-04-rc1-2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2023-04-rc1-2

Documentation

* man-pages for source, blkcache, bdinfo
* fix references to distro documentation

UEFI:

* allow clear screen by scrolling
* ensure that file ubootefi.var is created
* fix CapsuleMax variable reporting

Others:

* reduce verbosity of fat_read_file()

23 months agoMerge branch '2023-01-20-finish-CONFIG-migration-work'
Tom Rini [Fri, 20 Jan 2023 19:21:38 +0000 (14:21 -0500)]
Merge branch '2023-01-20-finish-CONFIG-migration-work'

- Merge in the final batch of CONFIG to Kconfig/CFG migration work. This
  includes a fix for a number of ns16550 or similar UARTs due to a
  migration bug. We also pull in a revert for enabling CONFIG_VIDEO on
  tools-only_defconfig.

23 months agoRevert "config: tools only: add VIDEO to build bmp_logo"
Fabio Estevam [Thu, 19 Jan 2023 01:23:21 +0000 (22:23 -0300)]
Revert "config: tools only: add VIDEO to build bmp_logo"

This reverts commit 1cfba53ca46cade2dbf4e067afc8c19e72909a4b.

Since commit 1cfba53ca46c ("config: tools only: add VIDEO to build
bmp_logo") the build of tools-only_defconfig fails:

| /bin/sh: line 1: tools/bmp_logo: No such file or directory

This has been noticed in OpenEmbedded and Debian [1].

Revert it for now.

[1] https://lists.denx.de/pipermail/u-boot/2023-January/504758.html

Signed-off-by: Fabio Estevam <festevam@denx.de>
23 months agoCI: Make check for new defined CONFIG symbols even more robust
Tom Rini [Tue, 10 Jan 2023 16:19:46 +0000 (11:19 -0500)]
CI: Make check for new defined CONFIG symbols even more robust

Now that all remaining in-tree cases where we define or undef a CONFIG
symbol have been migrated to Kconfig or renamed to CFG we can make the
CI check more robust. We will exclude the doc, tools and arch/arm/dts
directories from this check as they are special cases. Further, we can
exclude the scripts/kconfig/lkc.h and include/linux/kconfig.h files as
the CONFIG values they define are special tooling cases and not real
symbols.

In the case of docs, the only places that currently fail this test are
old documentation that should be rewritten so that we can remove this
special case.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
23 months agoglobal: Finish CONFIG -> CFG migration
Tom Rini [Tue, 10 Jan 2023 16:19:45 +0000 (11:19 -0500)]
global: Finish CONFIG -> CFG migration

At this point, the remaining places where we have a symbol that is
defined as CONFIG_... are in fairly odd locations. While as much dead
code has been removed as possible, some of these locations are simply
less obvious at first. In other cases, this code is used, but was
defined in such a way as to have been missed by earlier checks.  Perform
a rename of all such remaining symbols to be CFG_... rather than
CONFIG_...

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
23 months agowatchdog: Clean up defaults for imx_watchdog / ulp_wdog
Tom Rini [Tue, 10 Jan 2023 16:19:44 +0000 (11:19 -0500)]
watchdog: Clean up defaults for imx_watchdog / ulp_wdog

In imx_watchdog, clean up the comment to just note the range now, as we
do not need to set the default here as Kconfig does this for us. For
ulp_wdog, set the default value via Kconfig instead.

Cc: Stefan Roese <sr@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Stefan Roese <sr@denx.de>
23 months agousbtty: Remove default CONFIG_USBD_* values
Tom Rini [Tue, 10 Jan 2023 16:19:43 +0000 (11:19 -0500)]
usbtty: Remove default CONFIG_USBD_* values

For this legacy driver, the only user sets these values in Kconfig, so
we can remove them from the header.

Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agonxp: Finish migration of SYS_FSL_SRDS_[12] to Kconfig
Tom Rini [Tue, 10 Jan 2023 16:19:42 +0000 (11:19 -0500)]
nxp: Finish migration of SYS_FSL_SRDS_[12] to Kconfig

As this is used on both ARM and PowerPC platforms, this needs to be
listed in arch/Kconfig.nxp and match how they're currently used by
select'ing them under the required PowerPC ARCH_xxx options.

Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agonxp: Finish migration of SYS_FSL_IFC_BANK_COUNT to Kconfig
Tom Rini [Tue, 10 Jan 2023 16:19:41 +0000 (11:19 -0500)]
nxp: Finish migration of SYS_FSL_IFC_BANK_COUNT to Kconfig

As this is used on both ARM and PowerPC platforms, this needs to be
asked in arch/Kconfig.nxp.  Set the PowerPC defaults based on
arch/powerpc/include/asm/config_mpc85xx.h and remove the default set in
drivers/mtd/nand/raw/fsl_ifc_nand.c

Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agonet: phy: mv88e61xx: Finish migration of MV88E61XX_FIXED_PORTS
Tom Rini [Tue, 10 Jan 2023 16:19:40 +0000 (11:19 -0500)]
net: phy: mv88e61xx: Finish migration of MV88E61XX_FIXED_PORTS

Set the default for MV88E61XX_FIXED_PORTS to 0x0 in Kconfig, and move
the comment from code to the help to explain what this does.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
23 months agofsl-layerscape: Rework usage of CONFIG_CLUSTER_CLK_FREQ
Tom Rini [Tue, 10 Jan 2023 16:19:39 +0000 (11:19 -0500)]
fsl-layerscape: Rework usage of CONFIG_CLUSTER_CLK_FREQ

In the case where CONFIG_CLUSTER_CLK_FREQ is not defined, simply set
cluster_clk to get_board_sys_clk().

Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agousb: musb: Rename CONFIG_USB_MUSB_TIMEOUT to MUSB_TIMEOUT
Tom Rini [Tue, 10 Jan 2023 16:19:38 +0000 (11:19 -0500)]
usb: musb: Rename CONFIG_USB_MUSB_TIMEOUT to MUSB_TIMEOUT

This variable has never been configured to another value at present, and
was not converted to Kconfig. Opt instead to rename this to
MUSB_TIMEOUT.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Marek Vasut <marex@denx.de>
23 months agofpga: Migrate CONFIG_MAX_FPGA_DEVICES to Kconfig
Tom Rini [Tue, 10 Jan 2023 16:19:37 +0000 (11:19 -0500)]
fpga: Migrate CONFIG_MAX_FPGA_DEVICES to Kconfig

This is always defined to 5, so use that as the default.

Cc: Michal Simek <michal.simek@amd.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Michal Simek <michal.simek@amd.com>
23 months agocommon/update: Finish Kconfig migration
Tom Rini [Tue, 10 Jan 2023 16:19:36 +0000 (11:19 -0500)]
common/update: Finish Kconfig migration

We can enforce the dependencies of this module via Kconfig now, so do so
rather than with #error statements. Further, we can ensure that all
required values are set to their defaults in Kconfig, and in fact
already do so, so remove the tests here. The exception is
CONFIG_UPDATE_LOAD_ADDR which needed to be migrated to Kconfig in the
first place.

Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agospl: sata: Rework the loading case it not use IS_ENABLED(...)
Tom Rini [Tue, 10 Jan 2023 16:19:35 +0000 (11:19 -0500)]
spl: sata: Rework the loading case it not use IS_ENABLED(...)

In this case, using IS_ENABLED(...) to attempt to load the image results
in harder to read and less useful code, along with having to define a
CONFIG value that would be unused. To maintain the current albeit
slightly odd behavior, maintain that if we have both SPL_FS_FAT and
SPL_SATA_RAW_U_BOOT_USE_SECTOR enabled, we use SPL_FS_FAT for the load.

Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agoautoboot: Rework CONFIG_AUTOBOOT_STOP_STR_* usage
Tom Rini [Tue, 10 Jan 2023 16:19:34 +0000 (11:19 -0500)]
autoboot: Rework CONFIG_AUTOBOOT_STOP_STR_* usage

In order to not define a CONFIG value when the
CONFIG_AUTOBOOT_STOP_STR_* functionality is not enabled, rework the
assignment of empty and unused (as the code will be discarded under if
0, in the end) values to be AUTOBOOT_STOP_STR_* instead of
CONFIG_AUTOBOOT_STOP_STR_*.

Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agoarm: lib1funcs.S: Update compatibility with Linux comment slightly
Tom Rini [Tue, 10 Jan 2023 16:19:33 +0000 (11:19 -0500)]
arm: lib1funcs.S: Update compatibility with Linux comment slightly

At this point, the Linux code for "lib1funcs" has changed rather
dramatically. While a resync would be beneficial, it's outside the scope
of what we need here.  Simply remove the define for CONFIG_AEABI and
tests for it.

Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agodm: ns16550: Restore how we define UART_REG
Tom Rini [Tue, 17 Jan 2023 22:10:50 +0000 (17:10 -0500)]
dm: ns16550: Restore how we define UART_REG

Prior to commit 9591b63531fa ("Convert CONFIG_SYS_NS16550_MEM32 et al to
Kconfig") we had defined CONFIG_SYS_NS16550_REG_SIZE to -1 with
DM_SERIAL such that we would then have a size 0 character array. This
resulted in functionally no padding. The confusion on my part came from
dealing with the constraints around platforms that do not use DM_SERIAL
in SPL/TPL. After Andre Przywara reported that sunxi was broken, I've
re-read the code and comments again and thought on this harder. What we
want I believe is what this patch does now.

If DM_SERIAL is defined for this stage, regardless of
CONFIG_SYS_NS16550_REG_SIZE then we will dynamically handle reg shifts
and 'struct ns16550' needs no padding (which is functionally what
unsigned char foo[0] provides). This is the same case as NS16550_DYNAMIC
and DEBUG_UART. Expand the existing comment here slightly.

Otherwise, we will have CONFIG_SYS_NS16550_REG_SIZE set to a non-zero
value, and handle padding within the struct.

Cc: Simon Glass <sjg@chromium.org>
Cc: Sergei Antonov <saproj@gmail.com>
Cc: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Cc: Andre Przywara <andre.przywara@arm.com>
Fixes: 9591b63531fa ("Convert CONFIG_SYS_NS16550_MEM32 et al to Kconfig")
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
23 months agoarm: Rework usage of CONFIG_ARMV[78]_SECURE_BASE in linker scripts
Tom Rini [Tue, 10 Jan 2023 16:19:31 +0000 (11:19 -0500)]
arm: Rework usage of CONFIG_ARMV[78]_SECURE_BASE in linker scripts

In order to avoid defining CONFIG_ARMV[78_]SECURE_BASE as empty in the
linker scripts, if not already defined, add and use
__ARMV[78_]SECURE_BASE for when the base is not defined and we want the
linker scripts to continue.

Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agoi2c: fsl_i2c: Rework usage of CONFIG_SYS_IMMR
Tom Rini [Tue, 10 Jan 2023 16:19:30 +0000 (11:19 -0500)]
i2c: fsl_i2c: Rework usage of CONFIG_SYS_IMMR

This driver is used on both m68k, where CONFIG_SYS_IMMR is not used, and
PowerPC an ARM where it is. Abstract this to a new value rather than
re-defining a CONFIG symbol on m68k.

Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agoarc: Migrate ARC_MMU_VER to Kconfig
Tom Rini [Tue, 10 Jan 2023 16:19:29 +0000 (11:19 -0500)]
arc: Migrate ARC_MMU_VER to Kconfig

Move this value to Kconfig.

Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agoglobal: Remove unused CONFIG defines
Tom Rini [Tue, 10 Jan 2023 16:19:28 +0000 (11:19 -0500)]
global: Remove unused CONFIG defines

Remove some CONFIG symbols and related comments, etc, that are unused
within the code itself at this point.

Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agoefi_loader: fix CapsuleMax variable reporting
Ilias Apalodimas [Fri, 20 Jan 2023 11:58:48 +0000 (13:58 +0200)]
efi_loader: fix CapsuleMax variable reporting

Currently the code that adds the CapsuleMax variable is under a
Kconfig named 'EFI_HAVE_CAPSULE_UPDATE.  Git history only shows a
single occurrence of that.  The IS_ENABLED should be checking for
EFI_HAVE_CAPSULE_SUPPORT

Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
23 months agoefi_loader: update the error message of TCG protocol installation
Ilias Apalodimas [Thu, 19 Jan 2023 14:29:15 +0000 (16:29 +0200)]
efi_loader: update the error message of TCG protocol installation

"Unable to find TPMv2 device" doesn't explain much with regards to the
error origin. Update it to match what we have in the RNG protocol
installation.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
23 months agoefi_loader: ensure that file ubootefi.var is created
Heinrich Schuchardt [Thu, 19 Jan 2023 13:49:33 +0000 (14:49 +0100)]
efi_loader: ensure that file ubootefi.var is created

Currently file ubootefi.var is only created if the user sets a non-volatile
EFI variable. If the file is missing, a warning is written.

With the change PlatformLang is always persisted. So the file will exist on
second boot.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
23 months agoefi_loader: Avoid overwriting previous outputs on console screen clearing
Jan Kiszka [Wed, 18 Jan 2023 21:24:59 +0000 (22:24 +0100)]
efi_loader: Avoid overwriting previous outputs on console screen clearing

Before clearing the screen, ensure that no previous output of firmware
or UEFI programs will be overwritten on serial devices or other
streaming consoles. This helps generating complete boot logs.

Tested regarding multi-output against qemu-x86_defconfig. Still, there
were remaining concerns about side effects, so this is provided as an
opt-in feature.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
23 months agoefi_loader: Set default console colors on efi_cout_clear_screen if needed
Jan Kiszka [Wed, 18 Jan 2023 21:25:00 +0000 (22:25 +0100)]
efi_loader: Set default console colors on efi_cout_clear_screen if needed

Ensures a consistent background color of the whole screen for succeeding
outputs as both demanded by the spec and implemented in EDK2 as well.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
23 months agodoc: fix references to distro documentation
Dario Binacchi [Mon, 9 Jan 2023 11:52:40 +0000 (12:52 +0100)]
doc: fix references to distro documentation

Commit 37c5195dfcd157 ("doc: Move distro boot doc to rST") renamed
doc/README.distro to doc/develop/distro.rst.

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Soeren Moch <smoch@web.de>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
23 months agodoc: man-page for bdinfo
Heinrich Schuchardt [Sun, 15 Jan 2023 11:45:44 +0000 (12:45 +0100)]
doc: man-page for bdinfo

Provide a man-page for the bdinfo command

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
23 months agodoc: man-page for blkcache
Heinrich Schuchardt [Sun, 15 Jan 2023 10:35:55 +0000 (11:35 +0100)]
doc: man-page for blkcache

Provide a man-page for the blkcache command.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
23 months agodoc: man-page for source command
Heinrich Schuchardt [Sat, 14 Jan 2023 19:15:15 +0000 (20:15 +0100)]
doc: man-page for source command

Provide a man-page for the source command.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
23 months agofs/fat: avoid noisy message fat_read_file()
Heinrich Schuchardt [Thu, 19 Jan 2023 14:37:40 +0000 (15:37 +0100)]
fs/fat: avoid noisy message fat_read_file()

UEFI applications call file system functions to determine if a file exists.
The return codes are evaluated to show appropriate messages.
U-Boot's file system layer should not interfere with the output.

Rename file_fat_read_at() to fat_read_file() adjusting the parameter
sequence and names and eliminate the old wrapper function.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
23 months agoMerge tag 'tpm-20012023' of https://source.denx.de/u-boot/custodians/u-boot-tpm
Tom Rini [Fri, 20 Jan 2023 15:36:00 +0000 (10:36 -0500)]
Merge tag 'tpm-20012023' of https://source.denx.de/u-boot/custodians/u-boot-tpm

TPM fixes and state reporting

23 months agotee: optee: fix uuid comparisons on service discovery
Ilias Apalodimas [Thu, 19 Jan 2023 09:21:37 +0000 (11:21 +0200)]
tee: optee: fix uuid comparisons on service discovery

When comparing UUIDs for discovered services we only compare up to the
ptr size instead of the entire UUID

Fixes: 94ccfb78a4d61 ("drivers: tee: optee: discover OP-TEE services")
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
23 months agotpm2: ftpm: add the device in the OP-TEE services list
Ilias Apalodimas [Thu, 19 Jan 2023 14:36:12 +0000 (16:36 +0200)]
tpm2: ftpm: add the device in the OP-TEE services list

commit fe8a4ed0111073 ("tee: optee: discover services dependent on tee-supplicant")
is trying to automatically scan and add TAs that are presented on pseudo
bus from the secure world.
In order to be able to list and compare the scanned devices the available drivers
have to register themselves on the op-tee service list.

Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
23 months agoMAINTAINERS: add a new entry on TEE MAINTAINERS
Ilias Apalodimas [Thu, 19 Jan 2023 15:10:57 +0000 (17:10 +0200)]
MAINTAINERS: add a new entry on TEE MAINTAINERS

Since I do have a look on TEE patches regardless and Jens doesn't have
his own tree, add myself as a co-maintainer.  I'll be carrying over the
TEE related patches from now on.  While at it add the maintenance tree
for TPM

Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
23 months agotee: optee: fix a print error on rng probing
Ilias Apalodimas [Wed, 18 Jan 2023 15:38:21 +0000 (17:38 +0200)]
tee: optee: fix a print error on rng probing

If we fail to probe the optee-rng device, we print a wrong message
referring to the firmware tpm.

Fixes: 476a3d58dfeb ("tee: optee: don't fail probe because of optee-rng")
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
23 months agoMerge tag 'dm-pull-18jan23' of https://source.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Thu, 19 Jan 2023 14:46:57 +0000 (09:46 -0500)]
Merge tag 'dm-pull-18jan23' of https://source.denx.de/u-boot/custodians/u-boot-dm

convert rockchip to use binman
patman fix for checkpatch
binman optional entries, improved support for ELF symbols
trace improvements
minor fdt refactoring

23 months agoMerge branch '2022-01-18-assorted-updates'
Tom Rini [Thu, 19 Jan 2023 14:41:54 +0000 (09:41 -0500)]
Merge branch '2022-01-18-assorted-updates'

- A few TI platform fixes, compression test cleanup and zstd update,
  npcm7xx update, add "part type" subcommand, VBE bugfix on some
  platforms, cleanup EVENT related Kconfig option logic (and fix some
  platforms), other minor cleanups.

23 months agoodroid: limit boot memory to lowmem
Joost van Zwieten [Sat, 14 Jan 2023 23:57:30 +0000 (00:57 +0100)]
odroid: limit boot memory to lowmem

In commit 4963f63fe61f ("image: Use gd->ram_base/_size in
env_get_bootm_size()") the size of the available memory for U-Boot to
use when relocating images, and not otherwise constrained, was changed
to include all known memory banks. In the case of this platform however,
all of the memory known to U-Boot is not also part of the Linux kernel
"lowmem" and so we must use CFG_SYS_BOOTMAPSZ to limit where we relocate
images to. We set a conservative limit of 256MB here to mirror the
previous behavior.

Signed-off-by: Joost van Zwieten <joost@diskos.nl>
[trini: Reword the commit messsage]
Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agoconfigs: enable poweroff command on QEMU ARM platforms
Heinrich Schuchardt [Fri, 13 Jan 2023 19:02:28 +0000 (20:02 +0100)]
configs: enable poweroff command on QEMU ARM platforms

Enable the sysreset based poweroff command. It invokes PSCI.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
23 months agovbe: Allow probing the VBE bootmeth to fail in OS fixup
Simon Glass [Thu, 12 Jan 2023 23:48:54 +0000 (16:48 -0700)]
vbe: Allow probing the VBE bootmeth to fail in OS fixup

This device is created when there are no bootmeths defined in the device
tree. But it cannot be probed without a device tree node.

For now, ignore a probe failure.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Karsten Merker <merker@debian.org>
Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Fixes: a56f663f0707 ("vbe: Add info about the VBE device to the fwupd node")
Tested-by: Vagrant Cascadian <vagrant@debian.org>
Tested-by: Karsten Merker <merker@debian.org>
23 months agotest: compression: add zstd uncompression test
Brandon Maier [Thu, 12 Jan 2023 16:27:46 +0000 (10:27 -0600)]
test: compression: add zstd uncompression test

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
23 months agolib: zstd: update to latest Linux zstd 1.5.2
Brandon Maier [Thu, 12 Jan 2023 16:27:45 +0000 (10:27 -0600)]
lib: zstd: update to latest Linux zstd 1.5.2

Update the zstd implementation to match Linux zstd 1.5.2 from commit
2aa14b1ab2.

This was motivated by running into decompression corruption issues when
trying to uncompress files compressed with newer versions of zstd. zstd
users also claim significantly improved decompression times with newer
zstd versions which is a side benefit.

Original zstd code was copied from Linux commit 2aa14b1ab2 which is a
custom-built implementation based on zstd 1.3.1. Linux switched to an
implementation that is a copy of the upstream zstd code in Linux commit
e0c1b49f5b, this results in a large code diff. However this should make
future updates easier along with other benefits[1].

This commit is a straight mirror of the Linux zstd code, except to:
- update a few #include that do not translate cleanly
  - linux/swab.h -> asm/byteorder.h
  - linux/limits.h -> linux/kernel.h
  - linux/module.h -> linux/compat.h
- remove assert() from debug.h so it doesn't conflict with u-boot's
  assert()
- strip out the compressor code as was done in the previous u-boot zstd
- update existing zstd users to the new Linux zstd API
- change the #define for MEM_STATIC to use INLINE_KEYWORD for codesize
- add a new KConfig option that sets zstd build options to minify code
  based on zstd's ZSTD_LIB_MINIFY[2].

These changes were tested by booting a zstd 1.5.2 compressed kernel inside a
FIT. And the squashfs changes by loading a file from zstd compressed squashfs
with sqfsload. buildman was used to compile test other boards and check for
binary bloat, as follows:

> $ buildman -b zstd2 --boards dh_imx6,m53menlo,mvebu_espressobin-88f3720,sandbox,sandbox64,stm32mp15_dhcom_basic,stm32mp15_dhcor_basic,turris_mox,turris_omnia -sS
> Summary of 6 commits for 9 boards (8 threads, 1 job per thread)
> 01: Merge branch '2023-01-10-platform-updates'
>        arm:  w+   m53menlo dh_imx6
> 02: lib: zstd: update to latest Linux zstd 1.5.2
>    aarch64: (for 2/2 boards) all -3186.0 rodata +920.0 text -4106.0
>        arm: (for 5/5 boards) all +1254.4 rodata +940.0 text +314.4
>    sandbox: (for 2/2 boards) all -4452.0 data -16.0 rodata +640.0 text -5076.0

[1] https://github.com/torvalds/linux/commit/e0c1b49f5b674cca7b10549c53b3791d0bbc90a8
[2] https://github.com/facebook/zstd/blob/f302ad8811643c428c4e3498e28f53a0578020d3/lib/libzstd.mk#L31

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
[trini: Set ret to -EINVAL for the error of "failed to detect
compressed" to fix warning, drop ZSTD_SRCSIZEHINT_MAX for non-Linux host
tool builds]
Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agopatman: symlink top level .checkpatch.conf
Maxim Cournoyer [Fri, 13 Jan 2023 13:50:50 +0000 (08:50 -0500)]
patman: symlink top level .checkpatch.conf

This makes it possible to run the patman test suite simply by invoking
'pytest' from the patman sub-directory:

  $ cd tools/patman
  $ pytest

Otherwise, the top level .checkpatch.conf would be ignored and
multiple test_checkpatch.py tests would fail.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
23 months agoRevert "patman: invoke the checkpatch.pl script with '--u-boot' and '--strict'"
Maxim Cournoyer [Fri, 13 Jan 2023 13:50:49 +0000 (08:50 -0500)]
Revert "patman: invoke the checkpatch.pl script with '--u-boot' and '--strict'"

This reverts commit 648d8186dd7f9c444fb07f355090d275dcdd4de4, because
it broke usage of patman on Linux, whose check script doesn't know
about '--strict' or '--u-boot'.

Reported-by: Sjoerd Simons <sjoerd@collabora.com>
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Sjoerd Simons <sjoerd@collabora.com>
23 months agobinman: Support positioning an entry by and ELF symbol
Simon Glass [Wed, 11 Jan 2023 23:10:19 +0000 (16:10 -0700)]
binman: Support positioning an entry by and ELF symbol

In some cases it is useful to position an entry over the top of a symbol
in an ELF file. For example, if the symbol holds a version string then it
allows the string to be accessed from the fdtmap.

Add support for this.

Suggested-by: Pali Rohár <pali@kernel.org>
Suggested-by: Keith Short <keithshort@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agodtoc: Add a way to read a phandle with params
Simon Glass [Wed, 11 Jan 2023 23:10:18 +0000 (16:10 -0700)]
dtoc: Add a way to read a phandle with params

Add a function to read a phandle and associated name and offset. This is
useful for binman.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobinman: Provide general support for updating ELF symbols
Simon Glass [Wed, 11 Jan 2023 23:10:17 +0000 (16:10 -0700)]
binman: Provide general support for updating ELF symbols

The current support for updating variables in a binary is hard-coded to
work with U-Boot:

- It assumes the image starts at __image_copy_start
- It uses the existing U-Boot-specific entry types

It is useful for other projects to use these feature.

Add properties to enable writing symbols for any blob, a way of specifying
the base symbol and a way of providing the ELF filename to allow symbol
lookup to take place.

With this it is possible to update a Zephyr image, such as zephyr.bin
after it has been built.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobinman: Support overlapping entries
Simon Glass [Wed, 11 Jan 2023 23:10:16 +0000 (16:10 -0700)]
binman: Support overlapping entries

In some cases it is useful to have an entry overlap with another in a
section, either to update the contents within a blob, or to add an entry
to the fdtmap that covers only part of the blob.

Add support for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobinman: Add a function to check for special section nodes
Simon Glass [Wed, 11 Jan 2023 23:10:15 +0000 (16:10 -0700)]
binman: Add a function to check for special section nodes

This appears in two places in the code. Use a shared function instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobinman: Add a null entry
Simon Glass [Wed, 11 Jan 2023 23:10:14 +0000 (16:10 -0700)]
binman: Add a null entry

It is sometimes useful to define an entry which does not have its own
contents but does appear in the image. The contents are set by the section
which contains it, even though it appears as an entry in the fdtmap.

Add support for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobinman: Clarify use of False when obtaining data
Simon Glass [Wed, 11 Jan 2023 23:10:13 +0000 (16:10 -0700)]
binman: Clarify use of False when obtaining data

This means that the data is not yet available. Update some comments to
make this clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobinman: Add a test for an inner section with a size
Simon Glass [Wed, 11 Jan 2023 23:10:12 +0000 (16:10 -0700)]
binman: Add a test for an inner section with a size

This is a slightly different scenario from the existing testSections
tests. Add a new test for it.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agorockchip: Drop the FIT generator script
Simon Glass [Sat, 7 Jan 2023 21:07:20 +0000 (14:07 -0700)]
rockchip: Drop the FIT generator script

This is not used anymore. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agorockchip: Convert all boards to use binman
Simon Glass [Sat, 7 Jan 2023 21:07:19 +0000 (14:07 -0700)]
rockchip: Convert all boards to use binman

Instead of the bash script, use binman to generate the FIT for arm64.

For 32-bit boards, use binman for all images, dropping the intermediate
files.

With this change, only Zynq is now using SPL_FIT_GENERATOR so update the
Kconfig rule accordingly.

Clean up the Makefile to the extent possible. Unfortunately, two boards
do not use SPL_FRAMEWORK so don't enable the u-boot.img rule:

   evb-rk3036
   kylin-rk3036

So a small remnant remains.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agorockchip: Support building the all output files in binman
Simon Glass [Sat, 7 Jan 2023 21:07:18 +0000 (14:07 -0700)]
rockchip: Support building the all output files in binman

Add the required binman images to replace the Makefile rules which are
currently used. This includes subsuming:

   - tpl/u-boot-tpl-rockchip.bin if TPL is enabled
   - idbloader.img if either or both of SPL and TPL are enabled
   - u-boot.itb if SPL_FIT is enabled
   - u-boot-rockchip.bin if SPL is used, either using u-boot.itb when
     SPL_FIT is enabled or u-boot.img when it isn't

Note that the intermediate files are dropped with binman, since it
producing everything in one pass. This means that
tpl/u-boot-tpl-rockchip.bin is not created, for example.

Note that for some 32-bit rk3288 boards, rockchip-optee.dtsi is included.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agorockchip: Use multiple-images for rk3399
Simon Glass [Sat, 7 Jan 2023 21:07:17 +0000 (14:07 -0700)]
rockchip: Use multiple-images for rk3399

Enable multiple-images so we can generate more than one image. Also
add a comment for the end of the #if block.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agorockchip: evb-rk3288: Drop raw-image support
Simon Glass [Sat, 7 Jan 2023 21:07:16 +0000 (14:07 -0700)]
rockchip: evb-rk3288: Drop raw-image support

This boards uses SPL_FIT so does not need to support loading a raw image.
Drop it to avoid binman trying to insert a symbol which has no value.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobinman: Support optional external blobs
Simon Glass [Sat, 7 Jan 2023 21:07:15 +0000 (14:07 -0700)]
binman: Support optional external blobs

Some blobs are actually not necessary for the board to work correctly. Add
a property to allow this to be indicated. Missing optional blobs do not
cause a build failure.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobinman: Support new op-tee binary format
Simon Glass [Sat, 7 Jan 2023 21:07:14 +0000 (14:07 -0700)]
binman: Support new op-tee binary format

OP-TEE has a format with a binary header that can be used instead of the
ELF file. With newer versions of OP-TEE this may be required on some
platforms.

Add support for this in binman. First, add a method to obtain the ELF
sections from an entry, then use that in the FIT support. We then end up
with the ability to support both types of OP-TEE files, depending on which
one is passed in with the entry argument (TEE=xxx in the U-Boot build).

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobinman: Add a way to check for a valid ELF file
Simon Glass [Sat, 7 Jan 2023 21:07:13 +0000 (14:07 -0700)]
binman: Add a way to check for a valid ELF file

Add a function which checks whether data is in ELF format or not. This
will be used by binman to check this for entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobinman: Support optional entries
Simon Glass [Sat, 7 Jan 2023 21:07:12 +0000 (14:07 -0700)]
binman: Support optional entries

Support entries which can be optional depending on their contents. This
allows special entry types which appear in the image only when needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobinman: Use a reference for binman symbols docs
Simon Glass [Sat, 7 Jan 2023 21:07:11 +0000 (14:07 -0700)]
binman: Use a reference for binman symbols docs

Several etypes have this reference in their documentation. Now that we are
using rST, link to the section directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
23 months agobinman: Update entry docs
Simon Glass [Sat, 7 Jan 2023 21:07:10 +0000 (14:07 -0700)]
binman: Update entry docs

These have got out of data recently. Regenerate them.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobinman: Tidy up comment in fit _gen_node
Simon Glass [Sat, 7 Jan 2023 21:07:09 +0000 (14:07 -0700)]
binman: Tidy up comment in fit _gen_node

Expand this comment to cover both cases that are supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agobinman: Allow writing section contents to a file
Simon Glass [Sat, 7 Jan 2023 21:07:08 +0000 (14:07 -0700)]
binman: Allow writing section contents to a file

At present only the image (which is a section) has a filename. Move this
implementation to the entry_Section class so that any section can have a
filename. With this, the section data is written to a file.

This allows parts of an image to be written, along with the entire image.

Make a note that this can be used to include the contents of a section in
one image in another (later) image.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agodm: pinctrl: Revert "pinctrl: probe pinctrl drivers during post-bind"
Simon Glass [Wed, 21 Dec 2022 14:27:39 +0000 (07:27 -0700)]
dm: pinctrl: Revert "pinctrl: probe pinctrl drivers during post-bind"

This breaks chromebook_coral and it is also not how things should work. If
a board needs to bind GPIOs as part of a pinctrl driver this can be done
during the bind step, if needed.

We cannot probe pinctrl devices when binding as a rule, since it cannot be
supported on some platforms.

The bind and probe steps are separate in U-Boot and they should remain
separate.

This reverts commit f9ec791b5e24378b71590877499f8683d5f54dac.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agoRevert "fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ"
Simon Glass [Wed, 21 Dec 2022 23:08:28 +0000 (16:08 -0700)]
Revert "fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ"

The fdt_path_offset() function is slow since it must scan the tree.
This substantial overhead now applies to all boards.

The original code may not be ideal but it is fit for purpose and is only
needed on a few boards.

Reverting this reduces time to set up driver model by about 30ms.

Before revert:

Accumulated time:
                47,170  dm_r
                53,237  dm_spl
               572,986  dm_f

Accumulated time:
                44,598  dm_r
                50,347  dm_spl
               549,133  dm_f

This reverts commit 26f981f295d00351b6f0c69b5317b254b2361cc0.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agorockchip: Enable bootstage on rockpro64
Simon Glass [Sat, 7 Jan 2023 21:57:30 +0000 (14:57 -0700)]
rockchip: Enable bootstage on rockpro64

This board is useful for benchmarking overall U-Boot performance. Enable
the bootstage feature so we get a report.

Since this returns to the boot rom before finishing executing
board_init_r() in SPL, add a few bootstage calls so that we can collect
timing from TPL.

For the stash region, use a portion of SRAM, 64KB below the stack top.
This allows the TPL image to be up to nearly 120KB (it is typically about
64KB). SPL normally runs from SDRAM at 0, so can use the same stash
region.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agotrace: Don't require TIMER_EARLY
Simon Glass [Wed, 21 Dec 2022 23:08:26 +0000 (16:08 -0700)]
trace: Don't require TIMER_EARLY

Some platforms cannot honour this and don't need trace before relocation.
Use 'imply' instead, so boards can disable this.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agotrace: Update trace-format generator for newer version
Simon Glass [Wed, 21 Dec 2022 23:08:25 +0000 (16:08 -0700)]
trace: Update trace-format generator for newer version

This now includes flags and the layout has changed slightly in recent
versions of Linux. Update the generator accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agotrace: Adjust flags in proftool
Simon Glass [Wed, 21 Dec 2022 23:08:24 +0000 (16:08 -0700)]
trace: Adjust flags in proftool

The flags in this tool don't match the comments or help. Also the variable
names are quite confusing. Update them for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agomkimage: Add a few more messages for FIT failures
Simon Glass [Wed, 21 Dec 2022 23:08:23 +0000 (16:08 -0700)]
mkimage: Add a few more messages for FIT failures

Add messages to make it clearer which part of the FIT creation is failing.
This can happen when an invalid 'algo' property is provided in the .its
file.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agotrace: Move trace pointer to data section
Simon Glass [Wed, 21 Dec 2022 23:08:22 +0000 (16:08 -0700)]
trace: Move trace pointer to data section

This can be written before relocation. Move it to the data section, since
accessing BSS before relocation is not permitted.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agofdt: Check for overlapping data and FDT
Simon Glass [Wed, 21 Dec 2022 23:08:21 +0000 (16:08 -0700)]
fdt: Check for overlapping data and FDT

If the FDT overlaps with the data region of the image, or with the stack,
it can become corrupted before relocation. Add a check for this, behind a
debug flag, as it can be very confusing and time-consuming to debug.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agofdt: Pass the device tree to fdtdec_prepare_fdt()
Simon Glass [Wed, 21 Dec 2022 23:08:20 +0000 (16:08 -0700)]
fdt: Pass the device tree to fdtdec_prepare_fdt()

This function uses gd->fdt_blob a lot and cannot be used to check any
other device tree. Use a parameter instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agofdt: Drop ifdefs in fdtdec_prepare_fdt()
Simon Glass [Wed, 21 Dec 2022 23:08:19 +0000 (16:08 -0700)]
fdt: Drop ifdefs in fdtdec_prepare_fdt()

This function is a bit messy with several #ifdefs. Convert them to use C
for the conditions.

Rewrite the function comment since most of it is stale.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agofdt: Avoid exporting fdtdec_prepare_fdt()
Simon Glass [Wed, 21 Dec 2022 23:08:18 +0000 (16:08 -0700)]
fdt: Avoid exporting fdtdec_prepare_fdt()

This function is not used outside this file. Make it static.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agotpm: Add a proper Kconfig option for crc8 in SPL
Simon Glass [Sat, 7 Jan 2023 21:57:20 +0000 (14:57 -0700)]
tpm: Add a proper Kconfig option for crc8 in SPL

The current approach is a bit of a hack and only works for the tpm
subsystem. Add a Kconfig so that crc8 can be enabled in SPL for other
purposes.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agoarm: Support trace on armv8
Simon Glass [Wed, 21 Dec 2022 23:08:16 +0000 (16:08 -0700)]
arm: Support trace on armv8

Use the notrace attribute so that timer functions can be used when
tracing. This is required to avoid infinite loops when recording a trace.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agotrace: Use notrace for short
Simon Glass [Wed, 21 Dec 2022 23:08:15 +0000 (16:08 -0700)]
trace: Use notrace for short

The attribute syntax is quite verbose. Use the macro provided for this
purpose.

Signed-off-by: Simon Glass <sjg@chromium.org>
23 months agoconfigs: Increase malloc size after relocation
Neha Malcom Francis [Wed, 11 Jan 2023 12:41:23 +0000 (18:11 +0530)]
configs: Increase malloc size after relocation

Current default size of 0x100000 is not capable of getting the FIT
buffer during boot when transitioning to using binman generated boot
images for certain K3 devices, so increase it to 0x400000. Since A72 SPL
is coming after relocation to DDR this should not be an issue for any K3
device, so make it default for all.

Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
Acked-by: Andrew Davis <afd@ti.com>
23 months agoconfigs: remove SDL2 dependency in tools-only_defconfig
Heinrich Schuchardt [Wed, 11 Jan 2023 06:43:30 +0000 (07:43 +0100)]
configs: remove SDL2 dependency in tools-only_defconfig

When building tools only there is no point in requiring the SDL2 library.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
23 months agofirmware: ti_sci: fix typo in boot authentication message name
Jorge Ramirez-Ortiz [Tue, 10 Jan 2023 17:29:48 +0000 (18:29 +0100)]
firmware: ti_sci: fix typo in boot authentication message name

Fix AUTH_BOOT message identifier (s/IMIAGE/IMAGE)

Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Acked-by: Andrew Davis <afd@ti.com>
23 months agotest/py: gpt: add test for the gpt partition type GUID identifier
Enric Balletbo i Serra [Tue, 10 Jan 2023 16:19:35 +0000 (17:19 +0100)]
test/py: gpt: add test for the gpt partition type GUID identifier

Add sandbox test for the gpt partition type command, the test uses the
persistent data test_gpt_disk_image.bin to check that the first
partition type GUID that identifies the type of the partition has the
"Linux filesystem data" type ( 0FC63DAF-8483-4772-8E79-3D69D8477DE4 ).

Signed-off-by: Enric Balletbo i Serra <eballetbo@redhat.com>
23 months agocmd: part: Add partition-related type command
Enric Balletbo i Serra [Tue, 10 Jan 2023 16:19:34 +0000 (17:19 +0100)]
cmd: part: Add partition-related type command

This implements the following command:

    part type mmc 0:1
      -> print partition type UUID
    part type mmc 0:1 uuid
      -> set environment variable to partition type UUID

"part type" can be useful when writing a bootcmd which searches for a
specific partition type to enable automatic discovery of partitions and
their intended usage or mount point.

Signed-off-by: Enric Balletbo i Serra <eballetbo@redhat.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
[trini: Fix when CONFIG_PARTITION_TYPE_GUID is disabled and have the
command check for "types" before "type"]
Signed-off-by: Tom Rini <trini@konsulko.com>
23 months agodoc/README.gpt: Fix typo 'a optionnal'
Enric Balletbo i Serra [Tue, 10 Jan 2023 16:19:33 +0000 (17:19 +0100)]
doc/README.gpt: Fix typo 'a optionnal'

Change the string 'a optionnal' to 'an optional'.

Signed-off-by: Enric Balletbo i Serra <eballetbo@redhat.com>
Reviewed-by: Simon Glass <sjg@chromium.org>