platform/kernel/u-boot.git
19 months agoMerge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-marvell into...
Tom Rini [Thu, 30 Mar 2023 14:04:21 +0000 (10:04 -0400)]
Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-marvell into next

- mvebu: Fix boot mode detection (Pali)
- mvebu: clearfog: defconfig and eMMC updates (Martin)

19 months agoarm: mvebu: Define all options for AXP BOOT_FROM_* macros
Pali Rohár [Wed, 29 Mar 2023 19:03:35 +0000 (21:03 +0200)]
arm: mvebu: Define all options for AXP BOOT_FROM_* macros

Definitions are according to the MV78460 Hardware Specifications.

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Tested-by: Martin Rowe <martin.p.rowe@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
19 months agoarm: mvebu: Define all BOOTROM_ERR_MODE_* macros
Pali Rohár [Wed, 29 Mar 2023 19:03:34 +0000 (21:03 +0200)]
arm: mvebu: Define all BOOTROM_ERR_MODE_* macros

A385 BootROM fills into bits [31:28] of register 0x182d0 tracing value,
which represents in which state BootROM currently is. BootROM fills one
of the possible values: 0x2 (CPU initialization), 0x3 (UART detection),
0x6 (UART booting), 0x8 (PCI Express booting), 0x9 (parallel or SPI NOR
booting), 0xA (parallel or SPI NAND booting), 0xB (SATA booting) and 0xE
(SD / eMMC booting).

Meaning of these values matches TRACE_* macros from Marvell soc_spec.h file:
https://github.com/MarvellEmbeddedProcessors/u-boot-marvell/blob/u-boot-2013.01-armada-18.06/tools/marvell/doimage_mv/soc_spec.h

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Tested-by: Martin Rowe <martin.p.rowe@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
19 months agoarm: mvebu: Define all options for A38x BOOT_FROM_* macros
Pali Rohár [Wed, 29 Mar 2023 19:03:33 +0000 (21:03 +0200)]
arm: mvebu: Define all options for A38x BOOT_FROM_* macros

Disassembling A385 BootROM binary reveal how BootROM interprets strapping
pins for Boot Device Mode. All possible options are:

0x00..0x07 -> Parallel NOR
0x08..0x15 -> Parallel NAND
0x16..0x17 -> Parallel NOR
0x18..0x25 -> Parallel NAND
0x26..0x27 -> SPI NAND
0x28..0x29 -> UART xmodem
0x2a..0x2b -> SATA
0x2c..0x2d -> PCI Express
0x2e..0x2f -> Parallel NOR
0x30..0x31 -> SD / eMMC
0x32..0x39 -> SPI NOR
0x3a..0x3c -> Parallel NOR
0x3d..0x3e -> UART debug console
0x3f       -> Invalid

Note that Boot Device Mode Options in A38x Hardware Specifications is
incomplete.

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Tested-by: Martin Rowe <martin.p.rowe@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
19 months agoarm: mvebu: Convert BOOT_FROM_* constants to function macros
Pali Rohár [Wed, 29 Mar 2023 19:03:32 +0000 (21:03 +0200)]
arm: mvebu: Convert BOOT_FROM_* constants to function macros

This allows to merge BOOT_FROM_MMC and BOOT_FROM_MMC_ALT constants to one
macro. And also allows to extend other BOOT_FROM_* macros for other
variants.

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Tested-by: Martin Rowe <martin.p.rowe@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
19 months agoarm: mvebu: Remove A38x BOOT_FROM_SATA 0x22 constant
Pali Rohár [Wed, 29 Mar 2023 19:03:31 +0000 (21:03 +0200)]
arm: mvebu: Remove A38x BOOT_FROM_SATA 0x22 constant

A385 BootROM treats strapping configuration 0x22 as SPI-NAND. So remove
incorrect definition 0x22 as SATA. SATA on A385 has configuration 0x2A.

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Tested-by: Martin Rowe <martin.p.rowe@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
19 months agoarm: mvebu: Remove A38x BOOT_FROM_UART_ALT 0x3f constant
Pali Rohár [Wed, 29 Mar 2023 19:03:30 +0000 (21:03 +0200)]
arm: mvebu: Remove A38x BOOT_FROM_UART_ALT 0x3f constant

A385 BootROM treats strapping configuration 0x3f as invalid. When booting
fails (e.g. because of invalid configuration) then BootROM fallbacks to
UART booting.

Detecting BootROM fallback to UART booting is implemented in U-Boot since
commit 2fd4284051e3 ("ARM: mach-mvebu: handle fall-back to UART boot").

So there is no need to define BOOT_FROM_UART_ALT constant and special
handling for it anymore, remove it.

This change effectively revers commit f3a88e2ca17a ("arm: mvebu: fix boot
from UART on ClearFog Base").

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Tested-by: Martin Rowe <martin.p.rowe@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
19 months agoarm: mvebu: Cleanup get_boot_device() code
Pali Rohár [Mon, 27 Mar 2023 21:11:50 +0000 (23:11 +0200)]
arm: mvebu: Cleanup get_boot_device() code

Show correct information in debug() output and use correct names for variables.

No functional change.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
19 months agoarm: mvebu: clearfog: Detect MMC vs SDHC and fixup fdt
Martin Rowe [Mon, 27 Mar 2023 11:24:09 +0000 (21:24 +1000)]
arm: mvebu: clearfog: Detect MMC vs SDHC and fixup fdt

[upstream of vendor commit 19a96f7c40a8fc1d0a6546ac2418d966e5840a99]

The Clearfog devices have only one SDHC device. This is either eMMC if
it is populated on the SOM or SDHC if not. The Linux device tree assumes
the SDHC case. Detect if the device is an eMMC and fixup the device-tree
so it will be detected by Linux.

Ported from vendor repo at https://github.com/SolidRun/u-boot

Signed-off-by: Martin Rowe <martin.p.rowe@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
19 months agoarm: mvebu: clearfog: Add defconfig for SPI booting
Martin Rowe [Sat, 25 Mar 2023 00:02:44 +0000 (10:02 +1000)]
arm: mvebu: clearfog: Add defconfig for SPI booting

This new clearfog_spi_defconfig file is a copy of existing
clearfog_defconfig file modified to instruct build system to generate
final kwbimage for SPI booting and to store the environment in SPI.

Signed-off-by: Martin Rowe <martin.p.rowe@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
19 months agoarm: mvebu: clearfog: Fix MMC detection
Martin Rowe [Sat, 25 Mar 2023 00:02:43 +0000 (10:02 +1000)]
arm: mvebu: clearfog: Fix MMC detection

A388 Clearfog MMC is either SD Card or eMMC with different behaviour for
both. Setting the device to non-removable in the u-boot.dtsi allows both
to correctly detect the device.

Signed-off-by: Martin Rowe <martin.p.rowe@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
19 months agoMerge branch '2023-03-29-assorted-platform-updates' into next
Tom Rini [Thu, 30 Mar 2023 01:52:28 +0000 (21:52 -0400)]
Merge branch '2023-03-29-assorted-platform-updates' into next

- Assorted TI, Apple M1, and mpc83xx improvements / cleanups.

19 months agoinclude: configs: am65x_evm: Change to using .env
Nikhil M Jain [Tue, 21 Mar 2023 12:53:30 +0000 (18:23 +0530)]
include: configs: am65x_evm: Change to using .env

Move to using .env file for setting up environment variables for am65x.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
19 months agoboard: ti: am62x: am62x: Include K3 common .env files
Nikhil M Jain [Mon, 20 Mar 2023 17:23:56 +0000 (22:53 +0530)]
board: ti: am62x: am62x: Include K3 common .env files

Include ti_armv7_common.env and ti/mmc.env, which includes' K3  common
environment variables used across different K3 boards.

This patch depends on
https://lore.kernel.org/all/20230315052745.110502-1-n-francis@ti.com/

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
19 months agoinclude: configs: am62ax: Change to using .env
Nikhil M Jain [Mon, 20 Mar 2023 17:02:08 +0000 (22:32 +0530)]
include: configs: am62ax: Change to using .env

Move to using .env file for setting up environment variables for am62ax.

This patch depends on
https://lore.kernel.org/all/20230315052745.110502-1-n-francis@ti.com/

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
19 months agoconfigs: am62ax: enable secure device configs by default
Bryan Brattlof [Fri, 17 Mar 2023 23:37:11 +0000 (18:37 -0500)]
configs: am62ax: enable secure device configs by default

TI's security enforcing SoCs will authenticate each binary it loads by
comparing it's signature with keys etched into the SoC during the boot
up process. The am62ax family of SoCs by default will have some level of
security enforcement checking. To keep things as simple as possible,
enable the CONFIG_TI_SECURE_DEVICE options by default so all levels of
secure SoCs will work out of the box

Enable the CONFIG_TI_SECURE_DEVICE by default

Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Kamlesh Gurudasani <kamlesh@ti.com>
19 months agoinclude: configs: j721e_evm: Change to using .env
Neha Malcom Francis [Wed, 15 Mar 2023 05:27:45 +0000 (10:57 +0530)]
include: configs: j721e_evm: Change to using .env

Move to using .env file for setting up environment variables for J721E
and J7200.

Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
19 months agoinclude: configs: j721s2_evm: Change to using .env
Neha Malcom Francis [Wed, 15 Mar 2023 05:27:44 +0000 (10:57 +0530)]
include: configs: j721s2_evm: Change to using .env

Move to using .env file for setting up environment variables for J721S2.

Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
19 months agoinclude: environment: ti: Use .env for environment variables
Neha Malcom Francis [Wed, 15 Mar 2023 05:27:43 +0000 (10:57 +0530)]
include: environment: ti: Use .env for environment variables

Add K3 common environment variables to .env. We retain the old-style C
environment .h files to maintain compatibility with other K3 boards that
have not moved to using .env yet.

Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
19 months agompc83xx: Remove CONFIG_SYS_GPIO{1/2}_PRELIM and related
Christophe Leroy [Tue, 14 Mar 2023 22:24:45 +0000 (23:24 +0100)]
mpc83xx: Remove CONFIG_SYS_GPIO{1/2}_PRELIM and related

Last use of CONFIG_SYS_GPIO1_PRELIM was removed by
commit fae2ea5951 ("ppc: Remove MPC8349EMDS board and ARCH_MPC8349
support").

Last use of CONFIG_SYS_GPIO2_PRELIM was removed even before by
commit 6843862342 ("ppc: Remove caddy2 / vme8349 boards")

Those two items were removed from whitelist by
commit 8cca60a2cb ("Kconfig: Remove some symbols from the whitelist")

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Fixes: fae2ea5951 ("ppc: Remove MPC8349EMDS board and ARCH_MPC8349 support")

19 months agompc83xx: Remove stale CONFIG_SYS_LBLAWBAR{4/5/6/7}_PRELIM
Christophe Leroy [Tue, 14 Mar 2023 22:24:44 +0000 (23:24 +0100)]
mpc83xx: Remove stale CONFIG_SYS_LBLAWBAR{4/5/6/7}_PRELIM

Last (incorrect) use of those CONFIG items was removed by
commit 9fd9abedcc ("TQM834x: remove defines causing gcc4.4 warnings")

Those items are invalid and should have been removed at the
same time because lblaw[] has only 4 elements.

And they were removed from the whitelist by
commit 9c5df7a2a9 ("mpc83xx: Migrate LBLAW_* to Kconfig")

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Fixes: 9fd9abedcc ("TQM834x: remove defines causing gcc4.4 warnings")

19 months agoapple_m1_defconfig: Bump CONFIG_LMB_MAX_REGIONS to 64
Janne Grunau [Mon, 13 Mar 2023 13:54:32 +0000 (14:54 +0100)]
apple_m1_defconfig: Bump CONFIG_LMB_MAX_REGIONS to 64

Apple silicon SoCs have numerous embedded co-processors with pre-loaded
firmware. The co-processors text and data sections need to be mapped via
DART iommus controlled by the main processor. Those sections are
exported as reserved-memory. Bump CONFIG_LMB_MAX_REGIONS from 8 to 64 to
deal with the large amount of reserved-memory regions.

Signed-off-by: Janne Grunau <j@jannau.net>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
19 months agopci: apple: Initialize only enabled ports
Janne Grunau [Mon, 13 Mar 2023 13:46:11 +0000 (14:46 +0100)]
pci: apple: Initialize only enabled ports

The Linux devicetrees for Apple silicon devices are after review
feedback switching from deleting unused PCIe ports to disabling them.

Link: https://lore.kernel.org/asahi/1ea2107a-bb86-8c22-0bbc-82c453ab08ce@linaro.org/
Signed-off-by: Janne Grunau <j@jannau.net>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
19 months agophy: ti: j721e-wiz: Add support to enable LN23 Type-C swap
Sinthu Raja [Mon, 13 Mar 2023 12:42:24 +0000 (18:12 +0530)]
phy: ti: j721e-wiz: Add support to enable LN23 Type-C swap

The WIZ acts as a wrapper for SerDes and has Lanes 0 and 2 reserved
for USB for type-C lane swap if Lane 1 and Lane 3 are linked to the
USB PHY that is integrated into the SerDes IP. The WIZ control register
has to be configured to support this lane swap feature.

The support for swapping lanes 2 and 3 is missing and therefore
add support to configure the control register to swap between
lanes 2 and 3 if PHY type is USB.

Signed-off-by: Sinthu Raja <sinthu.raja@ti.com>
19 months agophy: ti: j721e-wiz: Manage TypeC lane swap if typec-dir-gpios not specified
Sinthu Raja [Mon, 13 Mar 2023 12:42:23 +0000 (18:12 +0530)]
phy: ti: j721e-wiz: Manage TypeC lane swap if typec-dir-gpios not specified

It's possible that the Type-C plug orientation on the DIR line will be
implemented through hardware design. In that situation, there won't be
an external GPIO line available, but the driver still needs to address
this since the DT won't use the typec-dir-gpios property.

Add code to handle LN10 Type-C swap if typec-dir-gpios property is not
specified in DT.

Signed-off-by: Sinthu Raja <sinthu.raja@ti.com>
19 months agoarm: mach-k3: introduce generic board detction kconfig option
Christian Gmeiner [Fri, 3 Mar 2023 19:16:28 +0000 (20:16 +0100)]
arm: mach-k3: introduce generic board detction kconfig option

For non TI boards it is not possible to enable the do_board_detect()
call as TI_I2C_BOARD_DETECT is defined in board/ti/common/Kconfig.

I want to use do_board_detect() to dectect boards and properties based
on some SPI communication with a FPGA.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
19 months agoboard: ti: Kconfig: Correct invalid Kconfig syntax
Neha Malcom Francis [Fri, 3 Mar 2023 08:21:24 +0000 (13:51 +0530)]
board: ti: Kconfig: Correct invalid Kconfig syntax

Kconfig does not support using 'select' to select a 'choice'. A choice
can be configured by either setting the choice symbol to 'y' in a
configuration file or by setting a 'default' of the choice.

In board/ti/*/Kconfig the SOC_K3_* choice is already set to 'y' in their
corresponding configs/*_defconfig file. So remove selecting it.

Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
19 months agoiot2050: Add support for configuring M.2 connector
Jan Kiszka [Tue, 28 Feb 2023 18:19:23 +0000 (19:19 +0100)]
iot2050: Add support for configuring M.2 connector

The M.2 slots of the related IOT2050 variant need to be configured
according to the plugged cards. This tries to detect the card using the
M.2 configuration pins of the B-key slot. If that fails, a U-Boot
environment variable can be set to configure manually. This variable is
write-permitted also in secure boot mode as it is not able to undermine
the integrity of the booted system.

The configuration is then applied to mux the serdes and to fix up the
device tree passed to or loaded by the bootloader. The fix-ups are
coming from device tree overlays that are embedded into the firmware
image and there also integrity protected. The OS remains free to load
a device tree to which they do not apply: U-Boot will not fail to boot
in that case.

Based on original patch by Chao Zeng.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
19 months agoarm: dts: iot2050: Add support for M.2 variant
chao zeng [Tue, 28 Feb 2023 18:19:22 +0000 (19:19 +0100)]
arm: dts: iot2050: Add support for M.2 variant

Add support for the M.2 board based on the iot2050 advanced board.
The board has two m.2 connectors, one is B-keyed, the other E-keyed.
The B-key slot can connect 5G/SSD devices, and E-key can be used for
WIFI/BT devices.

This variant is covered by PG2 firmware image.

Signed-off-by: chao zeng <chao.zeng@siemens.com>
[Jan: align DT to kernel, polish wording]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
19 months agoiot2050: Refresh defconfigs and activate CONFIG_EFI_SCROLL_ON_CLEAR_SCREEN
Jan Kiszka [Tue, 28 Feb 2023 18:19:21 +0000 (19:19 +0100)]
iot2050: Refresh defconfigs and activate CONFIG_EFI_SCROLL_ON_CLEAR_SCREEN

This feature is desired on the platform.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agoboard: siemens: iot2050: use the named gpio to control the user-button
chao zeng [Tue, 28 Feb 2023 18:19:20 +0000 (19:19 +0100)]
board: siemens: iot2050: use the named gpio to control the user-button

User-button is controlled by the mcu domain gpio number 25.
But main0 main1 mcu domain all have gpio number 25.

To identify where the gpio is from, Using gpio controll base as the prefix
to indicate the gpio resource.

Signed-off-by: chao zeng <chao.zeng@siemens.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agodoc: iot2050: Add a note about the watchdog firmware
Jan Kiszka [Tue, 28 Feb 2023 18:19:19 +0000 (19:19 +0100)]
doc: iot2050: Add a note about the watchdog firmware

This is enabled by default, thus should be described as well.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
19 months agoarm: dts: iot2050: Optionally embed OTP programming data into image
Jan Kiszka [Tue, 28 Feb 2023 18:19:18 +0000 (19:19 +0100)]
arm: dts: iot2050: Optionally embed OTP programming data into image

Use external blob otpcmd.bin to replace the 0xff filled OTP programming
command block to create a firmware image that provisions the OTP on
first boot. This otpcmd.bin is generated from the customer keys using
steps described in the meta-iot2050 integration layer for the device.

Based on original patch by Baocheng Su.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
19 months agoiot2050: Add script for signing artifacts
Jan Kiszka [Tue, 28 Feb 2023 18:19:17 +0000 (19:19 +0100)]
iot2050: Add script for signing artifacts

There are many ways to get a signed firmware for the IOT2050 devices,
namely for the parts under user-control. This script documents one way
of doing it, given a signing key. Augment the board documentation with
the required procedure around it.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
19 months agotools: Add script for converting public key into device tree include
Jan Kiszka [Tue, 28 Feb 2023 18:19:16 +0000 (19:19 +0100)]
tools: Add script for converting public key into device tree include

Allows to create a public key device tree dtsi for inclusion into U-Boot
SPL and proper during first build already. This can be achieved via
CONFIG_DEVICE_TREE_INCLUDES.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
19 months agoarm: dts: iot2050: Allow verifying U-Boot proper by SPL
Jan Kiszka [Tue, 28 Feb 2023 18:19:15 +0000 (19:19 +0100)]
arm: dts: iot2050: Allow verifying U-Boot proper by SPL

Add hashes and configuration signature stubs to prepare verified boot
of main U-Boot by SPL.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agoiot2050: Add CFG_ENV_FLAGS_LIST_STATIC
Jan Kiszka [Tue, 28 Feb 2023 18:19:14 +0000 (19:19 +0100)]
iot2050: Add CFG_ENV_FLAGS_LIST_STATIC

Will be needed when CONFIG_ENV_WRITEABLE_LIST is enabled. The listed
variables shall remain writable, for informational purposes - they have
to be considered untrusted because the persistent U-Boot env is not
protected.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
19 months agoiot2050: Add watchdog start to bootcmd
Jan Kiszka [Tue, 28 Feb 2023 18:19:13 +0000 (19:19 +0100)]
iot2050: Add watchdog start to bootcmd

Allows run-time control over watchdog auto-start and the timeout via
setting the environment variable watchdog_timeout_ms. A value of zero
means "do not start". Use CONFIG_WATCHDOG_TIMEOUT_MSECS as initial value
and this to zero by default. Users can then enable the watchdog once the
use and OS which picks it up during boot.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
19 months agoiot2050: Migrate settings into board env file
Jan Kiszka [Tue, 28 Feb 2023 18:19:12 +0000 (19:19 +0100)]
iot2050: Migrate settings into board env file

Anything that is not boot-env related is better kept there by now.

At this chance, also drop a stale comment from iot2050.h

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
19 months agoiot2050: Update firmware layout
Jan Kiszka [Tue, 28 Feb 2023 18:19:11 +0000 (19:19 +0100)]
iot2050: Update firmware layout

The latest version of the binary-only firmware parts come in a combined
form of FSBL and sysfw containers. This implies some layout changes to
the generated firmware image but also makes handling of artifacts much
simpler (4 files less). The env locations will not change, just the
space reserved for U-Boot will shrink from 4 to 3 MB - still plenty of
space left in practice.

Adjust configuration and documentation accordingly.

Along this change, add a new reservation for update commands of the
user-controlled OTP part. A specific userspace tool will fill it, and
the FSBL will evaluate it during boot. This reservation will use 64K of
the former sysfw section.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
19 months agoarm: dts: iot2050: Use the auto generator nodes for fdt
Su Baocheng [Tue, 28 Feb 2023 18:19:10 +0000 (19:19 +0100)]
arm: dts: iot2050: Use the auto generator nodes for fdt

Refactor according to the entry `fit: Entry containing a FIT` of
document tools/binman/README.entries.

As the generator uses the device tree name for the config description,
board_fit_config_name_match requires a small adjustment as well.

Signed-off-by: Su Baocheng <baocheng.su@siemens.com>
[Jan: re-add now required CONFIG_OF_LIST, update config matching]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agoboard: siemens: iot2050: Split the build for PG1 and PG2
Su Baocheng [Tue, 28 Feb 2023 18:19:09 +0000 (19:19 +0100)]
board: siemens: iot2050: Split the build for PG1 and PG2

Due to different signature keys, the PG1 and the PG2 boards can no
longer use the same FSBL (tiboot3). This makes it impossible anyway to
maintaine a single flash.bin for both variants, so we can also split the
build.

A new target is added to indicates the build is for PG1 vs. PG2 boards.
Hence now the variants have separated defconfig files.

The runtime board_is_sr1() check does make no sense anymore, so remove
it and replace with build time check.

Documentation is updated accordingly. New binary artifacts are already
available via meta-iot2050.

Signed-off-by: Su Baocheng <baocheng.su@siemens.com>
[Jan: refactor config option into targets, tweak some wordings]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
19 months agoMerge tag 'u-boot-at91-2023.07-a' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Tue, 28 Mar 2023 15:21:29 +0000 (11:21 -0400)]
Merge tag 'u-boot-at91-2023.07-a' of https://source.denx.de/u-boot/custodians/u-boot-at91 into next

First set of u-boot-at91 features for the 2023.07 cycle:

This feature set includes the clock changes required for sam9x60 SoC to
support USB host.

19 months agoRevert "rockchip: Fix early use of bootph props"
Tom Rini [Mon, 27 Mar 2023 19:20:19 +0000 (15:20 -0400)]
Revert "rockchip: Fix early use of bootph props"

While this change is correct for v2023.04 it is not correct for next
(where this is right now) nor post-v2023.04.

This reverts commit 8653e5d3b745925fced5fa6897c92f4a46ec2757.

Signed-off-by: Tom Rini <trini@konsulko.com>
19 months agoMerge branch 'master' into next
Tom Rini [Mon, 27 Mar 2023 19:19:57 +0000 (15:19 -0400)]
Merge branch 'master' into next

19 months agoPrepare v2023.04-rc5
Tom Rini [Mon, 27 Mar 2023 18:23:26 +0000 (14:23 -0400)]
Prepare v2023.04-rc5

Signed-off-by: Tom Rini <trini@konsulko.com>
19 months agoconfigs: Resync with savedefconfig
Tom Rini [Mon, 27 Mar 2023 17:39:17 +0000 (13:39 -0400)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
19 months agoMerge branch '2023-03-27-rockchip-rk3399-fixes'
Tom Rini [Mon, 27 Mar 2023 15:16:51 +0000 (11:16 -0400)]
Merge branch '2023-03-27-rockchip-rk3399-fixes'

- A series of minor cleanups to DISTRO_DEFAULTS and BOOTSTD so that the
  rk3399 bootstd migration can be complete and functional now, and make
  future migrations easier.

19 months agorockchip: rk3399: Drop altbootcmd
Tom Rini [Fri, 24 Mar 2023 20:58:16 +0000 (16:58 -0400)]
rockchip: rk3399: Drop altbootcmd

The defined altbootcmd was specific to distro_bootcmd which is not
longer in use on these platforms, so drop it.

Tested-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>
19 months agorockchip: Use BOOTSTD_DEFAULTS if not DISTRO_DEFAULTS
Tom Rini [Fri, 24 Mar 2023 20:58:15 +0000 (16:58 -0400)]
rockchip: Use BOOTSTD_DEFAULTS if not DISTRO_DEFAULTS

When we do not enable DISTRO_DEFAULTS (generally, to get distro_bootcmd)
we instea do want to imply BOOTSTD_DEFAULTS so that when using bootstd
the general distro boot functionality will still work.

Signed-off-by: Tom Rini <trini@konsulko.com>
19 months agorockchip: Disable DISTRO_DEFAULTS for rk3399 boards
Simon Glass [Fri, 24 Mar 2023 20:58:14 +0000 (16:58 -0400)]
rockchip: Disable DISTRO_DEFAULTS for rk3399 boards

These board have moved to standard boot but the old 'distro_bootcmd'
command is still active. Disable DISTRO_DEFAULTS to fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Vagrant Cascadian <vagrant@debian.org>
19 months agoboot: Create a common BOOT_DEFAULTS for distro and bootstd
Simon Glass [Fri, 24 Mar 2023 20:58:13 +0000 (16:58 -0400)]
boot: Create a common BOOT_DEFAULTS for distro and bootstd

These two features use a lot of common options. Move them into a common
CONFIG to reduce duplication.

Use 'select' for most options since these are things that boards aren't
supposed to override. For now it is not possible to disable
BOOT_DEFAULTS but we may take another look later.

Note that five options use 'imply' to match existing behaviour.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Rework a bit so we don't grow so many platforms unintentionally]
Signed-off-by: Tom Rini <trini@konsulko.com>
19 months agolmb: Enable LMB if SYS_BOOT_RAMDISK_HIGH
Simon Glass [Fri, 24 Mar 2023 20:58:12 +0000 (16:58 -0400)]
lmb: Enable LMB if SYS_BOOT_RAMDISK_HIGH

Ramdisk relocation requires LMB, so enable it automatically to avoid
build errors.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agoMove DISTRO_DEFAULTS into boot/
Simon Glass [Fri, 24 Mar 2023 20:58:11 +0000 (16:58 -0400)]
Move DISTRO_DEFAULTS into boot/

This relates to booting so move it in to that Kconfig file, before
changing it.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agorockchip: Drop bootstage stash in TPL and SPL for rockpro64
Simon Glass [Fri, 24 Mar 2023 20:58:10 +0000 (16:58 -0400)]
rockchip: Drop bootstage stash in TPL and SPL for rockpro64

Unfortunately the IRAM used to stash the bootstage records in TPL
becomes inaccessible after SPL runs. Presumably this is because of ATF
taking it over.

We could move the stash to another address in SPL, before passing it to
U-Boot proper. But it seems easier to wait until we have support for
standard passage[1] which should not be too far away.

For now, disable it in TPL and SPL.

[1] https://patchwork.ozlabs.org/project/uboot/cover/
    20220117150428.1580273-1-sjg@chromium.org/

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Vagrant Cascadian <vagrant@debian.org>
19 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-x86
Tom Rini [Mon, 27 Mar 2023 15:05:40 +0000 (11:05 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-x86

- x86: Bug fixes of previous BayTrail platform CONFIG_TEXT_BASE changes

19 months agoconfigs: at91: sam9x60: Add required configs for the USB clock
Sergiu Moga [Wed, 8 Mar 2023 14:39:54 +0000 (16:39 +0200)]
configs: at91: sam9x60: Add required configs for the USB clock

Add the configs required to use the SAM9X60's USB clock.

Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
[claudiu.beznea: added CONFIG_AT91_SAM9X60_USB to
 sam9x60_curiosity_mmc1_defconfig]
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
19 months agoclk: at91: sam9x60: Add initial setup of UPLL and USBCK rates
Sergiu Moga [Wed, 8 Mar 2023 14:39:53 +0000 (16:39 +0200)]
clk: at91: sam9x60: Add initial setup of UPLL and USBCK rates

In order for some of the functionalities, such as the USB clocks,
to work properly we need some clocks to be properly initialised
at the very beginning of booting.

Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
19 months agoclk: at91: pmc: export clock setup to pmc
Claudiu Beznea [Wed, 8 Mar 2023 14:39:52 +0000 (16:39 +0200)]
clk: at91: pmc: export clock setup to pmc

Clock setup was intended for setting clocks at boot time on SAMA7G5,
e.g. for root clocks like PLLs, that were used to feed IPs needed alive
in u-boot (e.g. Ethernet clock feed by a PLL). Export this functionality
to all at91 clocks as it may be necessary on other SoCs.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
19 months agoclk: at91: sam9x60: Register the required clocks for USB
Sergiu Moga [Wed, 8 Mar 2023 14:39:51 +0000 (16:39 +0200)]
clk: at91: sam9x60: Register the required clocks for USB

Register into DM the clocks required to properly enable USB functionality
within the bootloader.

Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
19 months agoclk: at91: Add support for sam9x60 USB clock
Sergiu Moga [Wed, 8 Mar 2023 14:39:50 +0000 (16:39 +0200)]
clk: at91: Add support for sam9x60 USB clock

Implement sam9x60 USB clock driver. This clock has
three parents: PLLA, UPLL and MAINXTAL. The driver is
aware of the three possible parents with the help of the
two mux tables provied to the driver during the registration
of the clock.

Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
19 months agox86: som-db5800-som-6867: Fix up adjustment of CONFIG_TEXT_BASE
Simon Glass [Tue, 14 Mar 2023 23:59:55 +0000 (17:59 -0600)]
x86: som-db5800-som-6867: Fix up adjustment of CONFIG_TEXT_BASE

With recent CONFIG_TEXT_BASE changes, there are inconsistencies between
several settings.

Adjust CONFIG_SYS_MONITOR_LEN to allow more code space. Move the MRC
cache out of the way too.

Fixes: e23cae30801f ("x86: som-db5800-som-6867: Adjust CONFIG_TEXT_BASE")
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
19 months agox86: dfi-bt700: Fix up adjustment of CONFIG_TEXT_BASE
Simon Glass [Tue, 14 Mar 2023 23:59:54 +0000 (17:59 -0600)]
x86: dfi-bt700: Fix up adjustment of CONFIG_TEXT_BASE

With recent CONFIG_TEXT_BASE changes, there are inconsistencies between
several settings.

Adjust CONFIG_SYS_MONITOR_LEN to allow more code space. Move the MRC
cache out of the way too.

Fixes: 5d1c8342aeaa ("x86: dfi-bt700: Adjust CONFIG_TEXT_BASE")
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
19 months agox86: conga-qeval20-qa3-e3845: Fix up adjustment of CONFIG_TEXT_BASE
Simon Glass [Tue, 14 Mar 2023 23:59:53 +0000 (17:59 -0600)]
x86: conga-qeval20-qa3-e3845: Fix up adjustment of CONFIG_TEXT_BASE

With recent CONFIG_TEXT_BASE changes, there are inconsistencies between
several settings.

Adjust CONFIG_SYS_MONITOR_LEN to allow more code space. Move the MRC
cache out of the way too.

Fixes: 388f93f96354 ("x86: conga-qeval20-qa3-e3845: Adjust CONFIG_TEXT_BASE")
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
19 months agox86: bayleybay: Fix up adjustment of CONFIG_TEXT_BASE
Simon Glass [Tue, 14 Mar 2023 23:59:52 +0000 (17:59 -0600)]
x86: bayleybay: Fix up adjustment of CONFIG_TEXT_BASE

With recent CONFIG_TEXT_BASE changes, there are inconsistencies between
several settings.

Adjust CONFIG_SYS_MONITOR_LEN to allow more code space. Move the MRC
cache out of the way too.

Fixes: f38be3086837 ("x86: bayleybay: Adjust CONFIG_TEXT_BASE")
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
19 months agox86: minnowmax: Fix up adjustment of CONFIG_TEXT_BASE
Simon Glass [Tue, 14 Mar 2023 23:59:51 +0000 (17:59 -0600)]
x86: minnowmax: Fix up adjustment of CONFIG_TEXT_BASE

With recent CONFIG_TEXT_BASE changes, there are inconsistencies between
several settings.

Adjust CONFIG_SYS_MONITOR_LEN to allow more code space. Move the MRC
cache out of the way too.

Add documentation on how to make this change safely.

Fixes: 66e2c665f3b6 ("x86: minnowmax: Adjust CONFIG_TEXT_BASE")
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
19 months agoMerge tag 'efi-next-20230325' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Sat, 25 Mar 2023 21:34:34 +0000 (17:34 -0400)]
Merge tag 'efi-next-20230325' of https://source.denx.de/u-boot/custodians/u-boot-efi into next

Pull request for efi-next-20230325

Documenation:

* add man-page for efi command

UEFI:

* Let EFI app call ExitBootServices() before legacy booting kernel
* Support zboot and bootm in the EFI app
* Let efi command show configuration tables
* Support booting a 64-bit kernel from 64-bit EFI app
* Allocate device-tree copy from high memory
* simplify efi_str_to_u16()

19 months agoMerge tag 'efi-2023.04-rc5' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sat, 25 Mar 2023 13:40:19 +0000 (09:40 -0400)]
Merge tag 'efi-2023.04-rc5' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2023.04-rc5

UEFI:

* Create unique device paths for USB devices with the same vendor
  and product id.

19 months agocmd: bootefi: allocate device-tree copy from high memory
Heinrich Schuchardt [Thu, 23 Feb 2023 19:27:38 +0000 (20:27 +0100)]
cmd: bootefi: allocate device-tree copy from high memory

The bootefi command creates a copy of the device-tree within the first
127 MiB of memory. This may lead to overwriting previously loaded binaries
(e.g. kernel, initrd).

Linux EFI stub itself copies U-Boot's copy of the device-tree. This means
there is not restriction for U-Boot to place the device-tree copy to any
address. (Restrictions existed for 32bit ARM before Linux commit
7a1be318f579 ("ARM: 9012/1: move device tree mapping out of linear region")
for legacy booting.

Reported-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Tested-by: Alexandre Ghiti <alexghiti@rivosinc.com>
19 months agoefI: Allow packaging a kernel in the debugging script
Simon Glass [Sun, 19 Mar 2023 19:30:16 +0000 (08:30 +1300)]
efI: Allow packaging a kernel in the debugging script

Add an option to package a kernel into the debugging script used for
EFI.

The name of the kernel must be added to the script. By default it is
assumed that the kernel is built in the /tmp/kernel directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agoefi: Support showing tables
Simon Glass [Sun, 19 Mar 2023 19:30:15 +0000 (08:30 +1300)]
efi: Support showing tables

Add a command (for the app and payload) to display the tables provided
by EFI. Note that for the payload the tables should always be present, so
an error message is unnecessary and would bloat the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agoefi: Split out table-listing code into a new file
Simon Glass [Sun, 19 Mar 2023 19:30:14 +0000 (08:30 +1300)]
efi: Split out table-listing code into a new file

This code is used with EFI_LOADER but is also useful (with some
modifications) for the EFI app and payload. Move it into a shared
file.

Show the address of the table so it can be examined if needed. Also show
the table name as unknown if necessary. Our list of GUIDs is fairly
small.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agodoc: Add help for the efi command
Simon Glass [Sun, 19 Mar 2023 19:30:13 +0000 (08:30 +1300)]
doc: Add help for the efi command

This command currently has no help. Add some.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agoefi: Include GUID names with EFI app and payload
Simon Glass [Sun, 19 Mar 2023 19:30:12 +0000 (08:30 +1300)]
efi: Include GUID names with EFI app and payload

These are currently only available when running with EFI_LOADER.
Expand this to include the app and payload, since it is useful to be
able to decode things there.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agoefi: Add another tranch of GUIDs
Simon Glass [Sun, 19 Mar 2023 19:30:11 +0000 (08:30 +1300)]
efi: Add another tranch of GUIDs

Provide information about the GUIDs supplied by QEMU, so far as it is
known.

These values are used in the 'efi table' command as well as the printf
format string %sU

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agox86: Support zboot and bootm in the EFI app
Simon Glass [Sun, 19 Mar 2023 19:30:10 +0000 (08:30 +1300)]
x86: Support zboot and bootm in the EFI app

These have been disabled due to the rudimentary support available. It is
a little better now, so enable these options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
19 months agox86: Exit EFI boot services before starting kernel
Simon Glass [Sun, 19 Mar 2023 19:30:09 +0000 (08:30 +1300)]
x86: Exit EFI boot services before starting kernel

When running the EFI app, we need to exit boot services before jumping
to Linux.

At some point it may be possible to jump to Linux and pass on the system
table, and:

  * install the device-tree as configuration table
  * use LoadImage() to load the kernel image (e.g. from memory)
  * start the image with StartImage()

This should allow the Linux efistub to be used. For now, this is not
implemented.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agox86: Support booting a 64-bit kernel from 64-bit U-Boot
Simon Glass [Sun, 19 Mar 2023 19:30:08 +0000 (08:30 +1300)]
x86: Support booting a 64-bit kernel from 64-bit U-Boot

Add the missing code to handle this. For a 64-bit kernel the entry
address is 0x200 bytes after the normal entry.

Rename the parameter to boot_linux_kernel() accordingly. Update the
comments to indicate that these are addresses, not pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agox86: Add return-value comment to cpu_jump_to_64bit()
Simon Glass [Sun, 19 Mar 2023 19:30:07 +0000 (08:30 +1300)]
x86: Add return-value comment to cpu_jump_to_64bit()

This does not mention what it returns. Add the missing documentation.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agox86: Adjust bootparam.h to be more like linux
Simon Glass [Sun, 19 Mar 2023 19:30:06 +0000 (08:30 +1300)]
x86: Adjust bootparam.h to be more like linux

This likely came from Linux originally, so update it to match v6.2 more.
This has no functional change.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agoefi: Set RUN_64BIT correctly for the EFI app
Simon Glass [Sun, 19 Mar 2023 19:30:05 +0000 (08:30 +1300)]
efi: Set RUN_64BIT correctly for the EFI app

The U-Boot EFI app can run as a 64-bit program, so set the Kconfig
correctly in that case. Make sure it doesn't build SPL, since there is
no need to switch from 32 to 64 bit when running.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agoefi_loader: simplify efi_str_to_u16()
Heinrich Schuchardt [Sun, 19 Mar 2023 08:20:23 +0000 (09:20 +0100)]
efi_loader: simplify efi_str_to_u16()

Use efi_alloc() to allocate memory.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agoefi_loader: move dp_alloc() to efi_alloc()
Heinrich Schuchardt [Sun, 19 Mar 2023 08:20:22 +0000 (09:20 +0100)]
efi_loader: move dp_alloc() to efi_alloc()

The incumbent function efi_alloc() is unused.

Replace dp_alloc() by a new function efi_alloc() that we can use more
widely.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
19 months agoefi_loader: move struct efi_device_path to efi.h
Heinrich Schuchardt [Sun, 19 Mar 2023 07:59:33 +0000 (08:59 +0100)]
efi_loader: move struct efi_device_path to efi.h

Avoid forward declaration of struct efi_device_path.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
19 months agoefi_loader: fix device-path for USB devices
Heinrich Schuchardt [Sun, 19 Mar 2023 15:18:09 +0000 (16:18 +0100)]
efi_loader: fix device-path for USB devices

EFI device paths for block devices must be unique. If a non-unique device
path is discovered, probing of the block device fails.

Currently we use UsbClass() device path nodes. As multiple devices may
have the same vendor and product id these are non-unique. Instead we
should use Usb() device path nodes. They include the USB port on the
parent hub. Hence they are unique.

A USB storage device may contain multiple logical units. These can be
modeled as Ctrl() nodes.

Reported-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agoefi_loader: support for Ctrl() device path node
Heinrich Schuchardt [Sun, 19 Mar 2023 15:18:08 +0000 (16:18 +0100)]
efi_loader: support for Ctrl() device path node

* Add the definitions for Ctrl() device path nodes.
* Implement Ctrl() nodes in the device path to text protocol.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
19 months agoefi_loader: fix device-path for USB devices
Heinrich Schuchardt [Sun, 19 Mar 2023 15:18:09 +0000 (16:18 +0100)]
efi_loader: fix device-path for USB devices

EFI device paths for block devices must be unique. If a non-unique device
path is discovered, probing of the block device fails.

Currently we use UsbClass() device path nodes. As multiple devices may
have the same vendor and product id these are non-unique. Instead we
should use Usb() device path nodes. They include the USB port on the
parent hub. Hence they are unique.

A USB storage device may contain multiple logical units. These can be
modeled as Ctrl() nodes.

Reported-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agoefi_loader: support for Ctrl() device path node
Heinrich Schuchardt [Sun, 19 Mar 2023 15:18:08 +0000 (16:18 +0100)]
efi_loader: support for Ctrl() device path node

* Add the definitions for Ctrl() device path nodes.
* Implement Ctrl() nodes in the device path to text protocol.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
19 months agoMerge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-marvell into...
Tom Rini [Sat, 25 Mar 2023 02:25:28 +0000 (22:25 -0400)]
Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-marvell into next

- mvebu: kwboot: Fix UART booting (Pali)
- mvebu: doc: Misc updates / fixes (Pali)
- kirkwood: Early init enhancements, e.g. for DEBUG UART (Pali & Tony)
- mvebu: Enable NAND flash for Thecus N2350 board (Tony)
- mvebu: Set common SPI flash default speed and mode (Tony)

19 months agoMerge branch 'rpi-2023.04' of https://source.denx.de/u-boot/custodians/u-boot-raspberrypi
Tom Rini [Fri, 24 Mar 2023 21:00:41 +0000 (17:00 -0400)]
Merge branch 'rpi-2023.04' of https://source.denx.de/u-boot/custodians/u-boot-raspberrypi

- Fixes for booting newer revs of the SoC in the Raspberry Pi 4
- Propagate some firmware DT properties to the loaded DT
- Update the Zero2W upstream DT name

19 months agommc: bcm2835-host: let firmware manage the clock divisor
Vincent Fazio [Tue, 14 Sep 2021 18:19:19 +0000 (13:19 -0500)]
mmc: bcm2835-host: let firmware manage the clock divisor

Newer firmware can manage the SDCDIV clock divisor register, allowing
the divisor to scale with the core as necessary.

Leverage this ability if the firmware supports it.

Adapted from the following raspberrypi Linux kernel commit:

  bcm2835-sdhost: Firmware manages the clock divisor
  https://github.com/raspberrypi/linux/commit/08532d242d7702ae0add95096aa49c5e96e066e2

Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
19 months agoarm: rpi: fallback to max clock rate for MMC clock
Vincent Fazio [Tue, 14 Sep 2021 18:19:18 +0000 (13:19 -0500)]
arm: rpi: fallback to max clock rate for MMC clock

In rpi-firmware 25e2b597ebfb2495eab4816a276758dcc6ea21f1,
the GET_CLOCK_RATE mailbox property was changed to return the last
value set by SET_CLOCK_RATE.

https://github.com/raspberrypi/firmware/issues/1619#issuecomment-917025502

Due to this change in firmware behavior, bcm2835_get_mmc_clock now
returns a clock rate of zero since we do not issue SET_CLOCK_RATE.
This results in degraded MMC performance.

SET_CLOCK_RATE fixes the clock to a specific value and disables scaling
so is not an ideal solution.

Instead, fallback to GET_MAX_CLOCK_RATE in bcm2835_get_mmc_clock if
GET_CLOCK_RATE returns zero.

Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
19 months agotools: kwboot: Document information about NOR XIP
Pali Rohár [Thu, 23 Mar 2023 20:00:07 +0000 (21:00 +0100)]
tools: kwboot: Document information about NOR XIP

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
19 months agotools: kwboot: Workaround A38x BootROM bug for images with a gap
Pali Rohár [Thu, 23 Mar 2023 19:57:55 +0000 (20:57 +0100)]
tools: kwboot: Workaround A38x BootROM bug for images with a gap

A38x BootROM has a bug which cause that BootROM loads data part of UART
image into RAM target address increased by one byte when source address
and header size stored in the image header are not same.

Workaround this bug by completely removing a gap between header and data
part of the UART image. Without gap, this BootROM bug is not triggered.

This gap can be present in SDIO or SATA image types which have aligned
start of the data part to the media sector size. With this workaround
kwboot should be able to convert and send SDIO or SATA images for UART
booting.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
19 months agotools: kwboot: Fix sending very small images
Pali Rohár [Thu, 23 Mar 2023 19:57:54 +0000 (20:57 +0100)]
tools: kwboot: Fix sending very small images

Sending of very small images (smaller than 128 bytes = xmodem block size)
cause out-of-bound memory read access. Fix this issue by ensuring that
hdrsz when sending image is not larger than total size of the image.
Issue was introduced in commit f8017c37799c ("tools: kwboot: Fix sending
Kirkwood v0 images"). Special case when total image is smaller than header
size aligned to multiply of xmodem size is already handled since that
commit.

Fixes: f8017c37799c ("tools: kwboot: Fix sending Kirkwood v0 images")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
19 months agotools: kwboot: Fix inserting UART data checksum without -B option
Pali Rohár [Thu, 23 Mar 2023 19:57:53 +0000 (20:57 +0100)]
tools: kwboot: Fix inserting UART data checksum without -B option

Commit 7665ed2fa04e ("tools: kwboot: Fix parsing UART image without data
checksum") added fixup code to insert place for data checksum if UART image
does not have it. Together with option -B (change baudrate), kwboot
calculates this checksum. Without option -B, it inserts only place for
checksum but does not calculate it.

This commit fix above logic and calculate data checksum also when kwboot is
used without -B option.

Fixes: 7665ed2fa04e ("tools: kwboot: Fix parsing UART image without data checksum")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
19 months agotools: kwboot: Fix invalid UART kwbimage v1 headersz
Pali Rohár [Thu, 23 Mar 2023 19:57:52 +0000 (20:57 +0100)]
tools: kwboot: Fix invalid UART kwbimage v1 headersz

Ensure that UART aligned header size is always stored into kwbimage v1
header. It is needed for proper UART booting. Calculation of headersz field
was broken in commit d656f5a0ee22 ("tools: kwboot: Calculate real used
space in kwbimage header when calling kwboot_img_grow_hdr()") which
introduced optimization of kwboot_img_grow_hdr() function.

Fixes: d656f5a0ee22 ("tools: kwboot: Calculate real used space in kwbimage header when calling kwboot_img_grow_hdr()")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
19 months agotools: kwbimage: Fix invalid UART kwbimage v1 headersz
Pali Rohár [Thu, 23 Mar 2023 19:57:51 +0000 (20:57 +0100)]
tools: kwbimage: Fix invalid UART kwbimage v1 headersz

Armada 385 BootROM ignores low 7 bits of headersz when parsing kwbimage
header of UART type, which effectively means that headersz is rounded down
to multiply of 128 bytes. For all other image types BootROM reads and use
all bits of headersz. Therefore fill into UART type of kwbimage v1 headersz
aligned to 128 bytes.

Fixes: 2b0980c24027 ("tools: kwbimage: Fill the real header size into the main header")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
19 months agoddr: marvell: a38x: Remove unused file seq_exec.h
Pali Rohár [Sat, 4 Mar 2023 12:26:46 +0000 (13:26 +0100)]
ddr: marvell: a38x: Remove unused file seq_exec.h

DDR code does not use seq_exec.h, so remove it.

Signed-off-by: Pali Rohár <pali@kernel.org>
19 months agoarm: kirkwood: Enable Debug UART for Zyxel NSA310S
Tony Dinh [Mon, 13 Mar 2023 03:35:51 +0000 (20:35 -0700)]
arm: kirkwood: Enable Debug UART for Zyxel NSA310S

It's useful to enable Debug UART for future DM Serial regression tests
for Kirkwood boards.

Also, see background discussion in this thread:
https://lists.denx.de/pipermail/u-boot/2023-March/512010.html

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>