]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
14 months agodt-bindings: clock: Add Amlogic A1 clock bindings
Igor Prusov [Mon, 25 Sep 2023 15:52:08 +0000 (18:52 +0300)]
dt-bindings: clock: Add Amlogic A1 clock bindings

Add clock bindings for Amlogic A1 from linux-next next-20230821.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Link: https://lore.kernel.org/r/20230925155209.130671-2-ivprusov@salutedevices.com
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
14 months agoMerge branch '2023-10-11-port-gen_compile_commands_py'
Tom Rini [Wed, 11 Oct 2023 17:25:01 +0000 (13:25 -0400)]
Merge branch '2023-10-11-port-gen_compile_commands_py'

To quote the author:
I'm submitting a patch series that ports the gen_compile_commands.py
script from the Linux kernel's sources to U-Boot. This script,
originally located in scripts/clang-tools/gen_compile_commands.py,
enables the generation of compile_commands.json file for improved code
navigation and analysis. The series consists of the initial script
import, the necessary modifications for U-Boot compatibility, and
finally some documentation.

14 months agoscripts/gen_compile_commands: fix usage message
Joao Marcos Costa [Sun, 1 Oct 2023 10:00:36 +0000 (12:00 +0200)]
scripts/gen_compile_commands: fix usage message

Replace mentions to 'kernel' by 'U-Boot' to avoid confusion.

Signed-off-by: Joao Marcos Costa <jmcosta944@gmail.com>
Tested-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
14 months agodoc: add ide_integration.rst to doc/develop
Joao Marcos Costa [Sun, 1 Oct 2023 10:00:35 +0000 (12:00 +0200)]
doc: add ide_integration.rst to doc/develop

Add 'Integration with IDEs' chapter.

For now, this chapter is mostly a reference to the documentation of
gen_compile_commands, in doc/build, but it can be futurely used as
a guide for other IDE-friendly features.

Signed-off-by: Joao Marcos Costa <jmcosta944@gmail.com>
Tested-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
14 months agodoc: add documentation for gen_compile_commands.py
Joao Marcos Costa [Sun, 1 Oct 2023 10:00:34 +0000 (12:00 +0200)]
doc: add documentation for gen_compile_commands.py

This documentation briefly explains what is a compilation database,
and how to use the script to generate one.

This is not a portage, as there was no original documentation in the
Linux sources.

Acknowledge the documentation in the script's header and in doc/build
index.

Signed-off-by: Joao Marcos Costa <jmcosta944@gmail.com>
Tested-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
14 months ago.gitignore: add compile_commands.json
Joao Marcos Costa [Sun, 1 Oct 2023 10:00:33 +0000 (12:00 +0200)]
.gitignore: add compile_commands.json

Add Clang's compilation database file (i.e. compile_commands.json) to
.gitignore, at the root of the repository.

Signed-off-by: Joao Marcos Costa <jmcosta944@gmail.com>
Tested-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
14 months agoscripts/gen_compile_commands.py: add acknowledgments
Joao Marcos Costa [Sun, 1 Oct 2023 10:00:32 +0000 (12:00 +0200)]
scripts/gen_compile_commands.py: add acknowledgments

Add acknowledgments for porting and modifying the script. Of course, the
license, author, and copyright notice remain the same as in the original
script.

Signed-off-by: Joao Marcos Costa <jmcosta944@gmail.com>
Tested-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
14 months agoscripts/gen_compile_commands.py: fix docstring
Joao Marcos Costa [Sun, 1 Oct 2023 10:00:31 +0000 (12:00 +0200)]
scripts/gen_compile_commands.py: fix docstring

The referred tool is now in U-Boot. Replace "the Linux kernel" by
"U-Boot" to make the docstring coherent.

Signed-off-by: Joao Marcos Costa <jmcosta944@gmail.com>
Tested-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
14 months agoscripts/gen_compile_commands.py: adapt _LINE_PATTERN
Joao Marcos Costa [Sun, 1 Oct 2023 10:00:30 +0000 (12:00 +0200)]
scripts/gen_compile_commands.py: adapt _LINE_PATTERN

For U-Boot's context, the regular expression defined by _LINE_PATTERN
should be adapted. Replace 'savedcmd' by 'cmd'.

Signed-off-by: Joao Marcos Costa <jmcosta944@gmail.com>
Tested-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
14 months agoscripts: Port Linux's gen_compile_commands.py to U-Boot
Joao Marcos Costa [Sun, 1 Oct 2023 10:00:29 +0000 (12:00 +0200)]
scripts: Port Linux's gen_compile_commands.py to U-Boot

This script generates a database of compiler flags, namely
compile_commands.json. It is quite useful for text editors that use
clangd LSP (e.g. Vim, Neovim).

It was ported from Linux's sources:
- tag: v6.4
- revision 6995e2de6891c724bfeb2db33d7b87775f913ad1

Modifications for U-Boot compatibility will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <jmcosta944@gmail.com>
Tested-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
14 months agoconfigs: Resync with savedefconfig
Tom Rini [Wed, 11 Oct 2023 16:01:17 +0000 (12:01 -0400)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
14 months agoMerge branch '2023-10-11-assorted-fixes-and-updates'
Tom Rini [Wed, 11 Oct 2023 15:53:58 +0000 (11:53 -0400)]
Merge branch '2023-10-11-assorted-fixes-and-updates'

- Assorted TI K3 updates, use ".dtso" for device tree overlays to match
  general usage, mkimage fixes/improvements, assorted platform
  updates/fixes, other assorted driver/platform fixes.

14 months agoconfigs: Make TI_SECURE_DEVICE default for K3
Andrew Davis [Thu, 3 Aug 2023 14:54:41 +0000 (09:54 -0500)]
configs: Make TI_SECURE_DEVICE default for K3

All K3 boards now are secure by default, instead of setting this in each
defconfig, make it implied by the ARCH config.

The only exception is IOT2050, which I do not believe will have any
problems with being a TI_SECURE_DEVICE, but for now turn it off to keep
its config the same.

Signed-off-by: Andrew Davis <afd@ti.com>
Tested-by: Tom Rini <trini@konsulko.com>
14 months agoconfigs: am65x: Merge the HS and non-HS defconfigs
Andrew Davis [Thu, 3 Aug 2023 14:54:40 +0000 (09:54 -0500)]
configs: am65x: Merge the HS and non-HS defconfigs

K3 devices have runtime type board detection. Make the default defconfig
include the secure configuration. Then remove the HS specific config.

Non-HS devices will continue to boot due to runtime device type detection.

Signed-off-by: Andrew Davis <afd@ti.com>
Tested-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Manorit Chawdhry <m-chawdhry@ti.com>
14 months agoARM: psci: move GIC address override to Kconfig
Andre Przywara [Sun, 1 Oct 2023 22:52:12 +0000 (23:52 +0100)]
ARM: psci: move GIC address override to Kconfig

As the code to switch an ARM core from secure to the non-secure state
needs to know the base address of the Generic Interrupt Controller
(GIC), we read an Arm Cortex defined system register that is supposed to
hold that base address. However there are SoCs out there that get this
wrong, and this CBAR register either reads as 0 or points to the wrong
address. To accommodate those systems, so far we use a macro defined in
some platform specific header files, for affected boards.

To simplify future extensions, replace that macro with a Kconfig variable
that holds this override address, and define a default value for SoCs
that need it.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Sam Edwards <CFSworks@gmail.com>
14 months agomisc: fs_loader: Fix alignment of fs_loader driver
Sean Anderson [Sat, 30 Sep 2023 20:45:46 +0000 (16:45 -0400)]
misc: fs_loader: Fix alignment of fs_loader driver

DM_DRIVER_GET will redeclare the fs_loader driver without the correct
alignment. This causes GCC to use the default section alignment of 32
bytes. This in turn creates a gap in the linker list due to the padding
required to achieve the correct alignment, corrupting all further entries.
Use DM_DRIVER_REF instead, which doesn't redeclare anything.

Fixes: 0998a20cfc6 ("misc: fs_loader: Add function to get the chosen loader")
Signed-off-by: Sean Anderson <seanga2@gmail.com>
14 months agomkimage: update man page and -h output
Rasmus Villemoes [Thu, 28 Sep 2023 08:02:57 +0000 (10:02 +0200)]
mkimage: update man page and -h output

The man page correctly said that -B was ignored without -E, while the
`mkimage -h` output suggested otherwise. Now that -B can actually be
used by itself, update the man page.

While at it, also amend the `mkimage -h` line to mention the
connection with -E.

The FDT header is a fixed 40 bytes, so its size cannot (and is not)
modified, while its alignment is a property of the address in RAM one
loads the FIT to, so not something mkimage can affect in any way. (In
the file itself, the header is of course at offset 0, which has all
possible alignments already.)

Reported-by: Sean Anderson <seanga2@gmail.com>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agodoc: use .dtso as extension for device tree overlay sources
Rasmus Villemoes [Mon, 25 Sep 2023 08:09:09 +0000 (10:09 +0200)]
doc: use .dtso as extension for device tree overlay sources

Moving towards using .dtso for overlay sources, update the
documentation examples to follow that pattern.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agosandbox: rename overlay sources to .dtso
Rasmus Villemoes [Mon, 25 Sep 2023 08:09:08 +0000 (10:09 +0200)]
sandbox: rename overlay sources to .dtso

Distinguish more clearly between source files meant for producing .dtb
from those meant for producing .dtbo. No functional change, as we
currently have rules for producing a foo.dtbo from either foo.dts or
foo.dtso.

Note that in the linux tree, all device tree overlay sources have been
renamed to .dtso, and the .dts->.dtbo rule is gone since v6.5 (commit
81d362732bac). So this is also a step towards staying closer to linux
with respect to both Kbuild and device tree sources.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agoarm64: zynqmp: rename overlay sources to .dtso
Rasmus Villemoes [Mon, 25 Sep 2023 08:09:07 +0000 (10:09 +0200)]
arm64: zynqmp: rename overlay sources to .dtso

Distinguish more clearly between source files meant for producing .dtb
from those meant for producing .dtbo. No functional change, as we
currently have rules for producing a foo.dtbo from either foo.dts or
foo.dtso.

Note that in the linux tree, all device tree overlay sources have been
renamed to .dtso, and the .dts->.dtbo rule is gone since v6.5 (commit
81d362732bac). So this is also a step towards staying closer to linux
with respect to both Kbuild and device tree sources.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
14 months agoiot2050: rename overlay sources to .dtso
Rasmus Villemoes [Mon, 25 Sep 2023 08:09:06 +0000 (10:09 +0200)]
iot2050: rename overlay sources to .dtso

Distinguish more clearly between source files meant for producing .dtb
from those meant for producing .dtbo. No functional change, as we
currently have rules for producing a foo.dtbo from either foo.dts or
foo.dtso.

Note that in the linux tree, all device tree overlay sources have been
renamed to .dtso, and the .dts->.dtbo rule is gone since v6.5 (commit
81d362732bac). So this is also a step towards staying closer to linux
with respect to both Kbuild and device tree sources.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>
14 months agoarm: dts: imx8mm-cl-iot-gate: rename overlay sources to .dtso
Rasmus Villemoes [Mon, 25 Sep 2023 08:09:05 +0000 (10:09 +0200)]
arm: dts: imx8mm-cl-iot-gate: rename overlay sources to .dtso

Distinguish more clearly between source files meant for producing .dtb
from those meant for producing .dtbo. No functional change, as we
currently have rules for producing a foo.dtbo from either foo.dts or
foo.dtso.

Note that in the linux tree, all device tree overlay sources have been
renamed to .dtso, and the .dts->.dtbo rule is gone since v6.5 (commit
81d362732bac). So this is also a step towards staying closer to linux
with respect to both Kbuild and device tree sources.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
14 months agoarm: apple: Add initial Apple M2 Ultra support
Janne Grunau [Wed, 6 Sep 2023 21:50:34 +0000 (23:50 +0200)]
arm: apple: Add initial Apple M2 Ultra support

Apple's M2 Ultra SoC are somewhat similar to the M1 Ultra but needs
a tweaked memory map as the M2 Pro/Max SoCs.  USB, NVMe, UART, WDT
and PCIe are working with the existing drivers.

Signed-off-by: Janne Grunau <j@jannau.net>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
14 months agoevent: Rename rest of EVENT_SPY to EVENT_SPY_FULL or EVENT_SPY*
Marek Vasut [Tue, 5 Sep 2023 13:48:08 +0000 (15:48 +0200)]
event: Rename rest of EVENT_SPY to EVENT_SPY_FULL or EVENT_SPY*

Fix up remaining occurances of EVENT_SPY with no suffix.

Fixes: 6c4cad7438 ("event: Rename EVENT_SPY to EVENT_SPY_FULL")
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agoenv: Improve ENV_OFFSET help message
Paul Barker [Fri, 1 Sep 2023 14:28:59 +0000 (15:28 +0100)]
env: Improve ENV_OFFSET help message

When reading Kconfig help messages to understand ENV_OFFSET and
ENV_OFFSET_REDUND, developers may not realise that they need to also
look at the chosen ENV_IS_IN_* options to see how the offsets will be
interpreted.

Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agodriver: rng: Add DM_RNG interface for ARMv8.5 RNDR registers
Andre Przywara [Wed, 30 Aug 2023 11:32:30 +0000 (12:32 +0100)]
driver: rng: Add DM_RNG interface for ARMv8.5 RNDR registers

The ARMv8.5 architecture extension defines architectural RNDR/RNDRRS
system registers, that provide 64 bits worth of randomness on every
read. Since it's an extension, and implementing it is optional, there is
a field in the ID_AA64ISAR0_EL1 ID register to query the availability
of those registers.

Add a UCLASS_RNG driver that returns entropy via repeated reads from
those system registers, if the extension is implemented.
The driver always binds, but checks the availability in the probe()
routine.

This helps systems which suffer from low boot entropy, since U-Boot can
provide entropy via the generic UEFI entropy gathering protocol to the OS,
at an early stage.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agotools: ensure zeroed padding in external FIT images
Roman Azarenko [Fri, 25 Aug 2023 08:10:14 +0000 (10:10 +0200)]
tools: ensure zeroed padding in external FIT images

Padding the header of an external FIT image is achieved by truncating
the existing temporary FIT file to match the required alignment before
appending image data. Reusing an existing file this way means that the
padding will likely contain a portion of the original data not
overwritten by the new header.

Zero out any data past the end of the new header, and stop at either
the end of the desired padding, or the end of the old FIT file,
whichever comes first.

Fixes: 7946a814a319 ("Revert "mkimage: fit: Do not tail-pad fitImage with external data"")
Signed-off-by: Roman Azarenko <roman.azarenko@iopsys.eu>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agobootstd: Drop some TODOs
Simon Glass [Fri, 25 Aug 2023 01:39:24 +0000 (19:39 -0600)]
bootstd: Drop some TODOs

The existing TODOs are done, so remove them. Add another that came up
today.

Signed-off-by: Simon Glass <sjg@chromium.org>
14 months agoarm: dts: k3-am625-verdin: fix boot
Marcel Ziswiler [Tue, 10 Oct 2023 11:13:04 +0000 (13:13 +0200)]
arm: dts: k3-am625-verdin: fix boot

A53 U-Boot proper got broken because nodes marked as 'bootph-pre-ram'
are no longer available in U-Boot proper before relocation.

Fix this by marking all nodes in u-boot.dtsi as 'bootph-all'.

Fixes: 9e644284ab812 ("dm: core: Report bootph-pre-ram/sram node as pre-reloc after relocation")
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
14 months agomalloc: Enable assertions if UNIT_TEST is enabled
Sean Anderson [Sun, 8 Oct 2023 02:01:56 +0000 (22:01 -0400)]
malloc: Enable assertions if UNIT_TEST is enabled

dlmalloc has some sanity checks it performs on free() which can help detect
memory corruption. However, they are only enabled if DEBUG is defined before
including common.h. Define DEBUG earlier if UNIT_TEST is enabled so that
assertions are enabled in sandbox.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agoarm: dts: k3-j721e-sk/common-proc-board: Fix boot
Nishanth Menon [Thu, 5 Oct 2023 18:15:14 +0000 (13:15 -0500)]
arm: dts: k3-j721e-sk/common-proc-board: Fix boot

Since commit 9e644284ab81 ("dm: core: Report bootph-pre-ram/sram node
as pre-reloc after relocation") A53 u-boot proper is broken. This is
because nodes marked as 'bootph-pre-ram' are not available at u-boot
proper before relocation.

To fix this we mark all nodes in u-boot.dtsi as 'bootph-all'.

Fixes: 69b19ca67bcb ("arm: dts: k3-j721e: Sync with v6.6-rc1")
Cc: Neha Francis <n-francis@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Tested-by: Tom Rini <trini@konsulko.com> # J721E-EVM GP
Tested-by: Neha Malcom Francis <n-francis@ti.com>
Reviewed-by: Roger Quadros <rogerq@kernel.org>
14 months agoarm: mach-k3: Remove secure device makefile
Andrew Davis [Thu, 5 Oct 2023 14:21:17 +0000 (09:21 -0500)]
arm: mach-k3: Remove secure device makefile

This is now done using binman but this file was leftover and is now
unused, remove it.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
14 months agoboard: siemens: iot2050: Fix logical bug in PG1/PG2 detection
Jan Kiszka [Thu, 5 Oct 2023 04:37:25 +0000 (06:37 +0200)]
board: siemens: iot2050: Fix logical bug in PG1/PG2 detection

This caused the wrong fdtfile to be set and was failing to apply M.2
settings.

Fixes: badaa1f6a7a9 ("boards: siemens: iot2050: Unify PG1 and PG2/M.2 configurations again")
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
14 months agoarm: dts: k3-am65-iot2050: Fix boot
Jan Kiszka [Thu, 5 Oct 2023 04:37:17 +0000 (06:37 +0200)]
arm: dts: k3-am65-iot2050: Fix boot

Since commit 9e644284ab812 ("dm: core: Report bootph-pre-ram/sram node
as pre-reloc after relocation") A53 u-boot proper is broken. This is
because nodes marked as 'bootph-pre-ram' are not available at u-boot
proper before relocation.

To fix this we mark all nodes in u-boot.dtsi as 'bootph-all'.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Roger Quadros <rogerq@kernel.org>
Reviewed-by: Nishanth Menon <nm@ti.com>
14 months agospi: mtk_spim: prevent global pll clock override
Nicolò Veronese [Tue, 3 Oct 2023 22:14:26 +0000 (00:14 +0200)]
spi: mtk_spim: prevent global pll clock override

With commit 793e62301180 ("spi: mtk_spim: get spi clk rate only once") a
new system to calculate the SPI clocks has been added.

Unfortunately, the do_div macro overrides the global priv->pll_clk_rate
field. This will cause to have a reduced clock rate on each subsequent
SPI call.

Signed-off-by: Valerio 'ftp21' Mancini <ftp21@ftp21.eu>
Signed-off-by: Nicolò Veronese <nicveronese@gmail.com>
14 months agoMakefile: make u-boot-initial-env target depend explicitly on scripts_basic
Rasmus Villemoes [Tue, 3 Oct 2023 10:02:17 +0000 (12:02 +0200)]
Makefile: make u-boot-initial-env target depend explicitly on scripts_basic

We're seeing sporadic errors like

  ENVC    include/generated/env.txt
  HOSTCC  scripts/basic/fixdep
  ENVP    include/generated/env.in
  ENVT    include/generated/environment.h
  HOSTCC  tools/printinitialenv
/bin/sh: 1: scripts/basic/fixdep: not found
make[1]: *** [scripts/Makefile.host:95: tools/printinitialenv] Error 127
make[1]: *** Deleting file 'tools/printinitialenv'
make: *** [Makefile:2446: u-boot-initial-env] Error 2
make: *** Waiting for unfinished jobs....

where sometimes the "fixdep: not found" is instead "fixdep: Permission
denied" and the Error 127 becomes 126.

This smells like a race condition, and indeed it is: Currently,
u-boot-initial-env is a prerequisite of the envtools target, which
also lists scripts_basic as a prerequisite:

envtools: u-boot-initial-env scripts_basic $(version_h) $(timestamp_h) tools/version.h
$(Q)$(MAKE) $(build)=tools/env

However, the u-boot-initial-env rule involves building the
printinitialenv helper, which in turn is built using an if_changed_dep
rule. That means we must ensure scripts/basic/fixdep is built and
ready before trying to build printinitialenv, i.e. the
u-boot-initial-env rule itself must depend on the phony scripts_basic
target.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agoboard: xen: introduce virtio-blk support
Andrii Chepurnyi [Tue, 3 Oct 2023 08:58:28 +0000 (08:58 +0000)]
board: xen: introduce virtio-blk support

Added new xenguest_arm64_virtio_defconfig which
enables support for virtio-blk using various types
of transport like virtio-pci, vrtio-mmio. Currently
supported: up to 2 PCI host bridges and 10 MMIO devices.
Note: DT parsing code was partly taken from pci-uclass.c
Limitation: All memory regions should be
below 4GB address space.

Signed-off-by: Andrii Chepurnyi <andrii_chepurnyi@epam.com>
14 months agoboard: synquacer: set actual gd->ram_top and gd->ram_size
Masahisa Kojima [Tue, 3 Oct 2023 02:29:57 +0000 (11:29 +0900)]
board: synquacer: set actual gd->ram_top and gd->ram_size

Current gd->ram_size and gd->ram_top reflect only the
first DRAM bank even if the SynQuacer Developerbox could
have up to three DRAM banks.
With the commit 06d514d77c37 ("lmb: consider EFI memory map"),
the first DRAM bank indicates <4GB address, so whole >4GB memory
is marked as EFI_BOOT_SERVICES_DATA and it results that
U-Boot can not access >4GB memory.

Since 64-bits DRAM address is fully available on the SynQuacer
Developerbox, let's set the installed DIMM information to
gd->ram_top and gd->ram_size.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
14 months agoinput: avoid NULL dereference
Heinrich Schuchardt [Tue, 3 Oct 2023 01:09:01 +0000 (03:09 +0200)]
input: avoid NULL dereference

Before using the result of env_get("stdin") we must check if it is NULL.

Avoid #if. This resolves the -Wunused-but-set-variable issue and we don't
need a dummy assignment in the else branch. Anyway this warning is
disabled in the Makefile.

For sake of readability use an early return after the configuration check.

Checking CONFIG_SPL_BUILD is incorrect as env_get() is only defined if
CONFIG_$(SPL_TPL)ENV_SUPPORT=y.

Fixes: 985ca3945fa3 ("spl: input: Allow input in SPL and TPL")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
14 months agomkimage: allow internalization of data-position
Lars Feyaerts [Mon, 2 Oct 2023 08:00:14 +0000 (10:00 +0200)]
mkimage: allow internalization of data-position

Make it possible for data that was externalized using a static external
position (-p) to be internalized. Enables the ability to convert
existing FIT images built with -p to be converted to a FIT image where the
data is internal, to be converted to a FIT image where the data is
external relative to the end of the FIT (-E) or change the initial
static external position to a different static external position (-p).

Removing the original external-data-related properties ensures that
they're not present after conversion. Without this, they would still be
present in the resulting FIT even if the FIT has been, for example,
internalized.

Signed-off-by: Lars Feyaerts <lars@bitbiz.be>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agocheckpatch: skip fdtdec_* check for tools
Lars Feyaerts [Mon, 2 Oct 2023 08:00:13 +0000 (10:00 +0200)]
checkpatch: skip fdtdec_* check for tools

Have checkpatch.pl skip warnings for use of fdtdec_* functions in
ooling; livetree isn't used there.

Signed-off-by: Lars Feyaerts <lars@bitbiz.be>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agoMerge tag 'fsl-qoirq-2023-10-10' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Wed, 11 Oct 2023 14:21:33 +0000 (10:21 -0400)]
Merge tag 'fsl-qoirq-2023-10-10' of https://source.denx.de/u-boot/custodians/u-boot-fsl-qoriq

Drop legacy PPA secure FW support
support for MC reserved memory
reset the FLSHxCR1 registers for nxp_fspi

14 months agoMerge branch '2023-10-10-blk-sandbox-support-binding-a-device-with-a-given-logical...
Tom Rini [Wed, 11 Oct 2023 01:47:50 +0000 (21:47 -0400)]
Merge branch '2023-10-10-blk-sandbox-support-binding-a-device-with-a-given-logical-block-size'

To quote the author:
At present on Sandbox when binding to a host backing file, the host
block device is created with a hard-coded 512 bytes block size.

Such assumption works for most cases, but for situation that with a raw
image file dump from a pre-formatted GPT partitioned disk image from a
4KiB block size device, when binding this file to a host device and mapping
this device to a blkmap, "blkmap" command like "blkmap part" won't work
correctly, due to block size mismatch during parsing the partition table.

This series updates Sandbox block driver, as well as the blkmap driver,
to get rid of the hard-coded 512 bytes block size assumption.

This series is available at u-boot-x86/blk for testing.

Test log (512 block size):

  => host bind 0 test.img
  => host info
  dev       blocks  blksz label           path
    0       262144    512 0               test.img
  => blkmap create 0
  Created "0"
  => blkmap map 0 0 40000 linear host 0 0
  Block 0x0+0x40000 mapped to block 0x0 of "host 0"
  => blkmap info
  Device 0: Vendor: U-Boot Rev: 1.0 Prod: blkmap
              Type: Hard Disk
              Capacity: 128.0 MB = 0.1 GB (262144 x 512)
  => blkmap part

  Partition Map for BLKMAP device 0  --   Partition Type: EFI

  Part    Start LBA       End LBA         Name
          Attributes
          Type GUID
          Partition GUID
    1     0x00000022      0x000000bd      "u-boot-spl"
          attrs:  0x0000000000000000
          type:   5b193300-fc78-40cd-8002-e86c45580b47
                  (5b193300-fc78-40cd-8002-e86c45580b47)
          guid:   0bb6bb6e-4aac-4c27-be03-016b01e7b941
    2     0x00000822      0x00000c84      "u-boot"
          attrs:  0x0000000000000000
          type:   2e54b353-1271-4842-806f-e436d6af6985
                  (2e54b353-1271-4842-806f-e436d6af6985)
          guid:   91d50814-8e31-4cc0-97dc-779e1dc59056
    3     0x00000c85      0x0000cc84      "rootfs"
          attrs:  0x0000000000000004
          type:   0fc63daf-8483-4772-8e79-3d69d8477de4
                  (linux)
          guid:   42799722-6e55-46e6-afa9-529e7af3f03b

Test log (4096 block size):

  => host bind 0 test.img 4096
  => host info
  dev       blocks  blksz label           path
    0        32768   4096 0               test.img
  => blkmap create 0
  Created "0"
  => blkmap map 0 0 8000 linear host 0 0
  Block 0x0+0x8000 mapped to block 0x0 of "host 0"
  => blkmap info
  Device 0: Vendor: U-Boot Rev: 1.0 Prod: blkmap
              Type: Hard Disk
              Capacity: 128.0 MB = 0.1 GB (32768 x 4096)
  => blkmap part

  Partition Map for BLKMAP device 0  --   Partition Type: EFI

  Part    Start LBA       End LBA         Name
          Attributes
          Type GUID
          Partition GUID
    1     0x00000100      0x00001fff      "primary"
          attrs:  0x0000000000000000
          type:   0fc63daf-8483-4772-8e79-3d69d8477de4
                  (linux)
          guid:   eba904d7-72c1-4dbd-bb4e-36be49cba5e3
    2     0x00002000      0x00007ffa      "primary"
          attrs:  0x0000000000000000
          type:   0fc63daf-8483-4772-8e79-3d69d8477de4
                  (linux)
          guid:   c48c360e-db47-46da-ab87-26416fad3cd3

14 months agodisk: part: Handle blkmap device in print_part_header()
Bin Meng [Tue, 26 Sep 2023 08:43:45 +0000 (16:43 +0800)]
disk: part: Handle blkmap device in print_part_header()

Print out the blkmap device type when showing partition header for
a blkmap device.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agodisk: part: Print out the unknown device uclass id
Bin Meng [Tue, 26 Sep 2023 08:43:44 +0000 (16:43 +0800)]
disk: part: Print out the unknown device uclass id

It's helpful to output the device uclass id for unknown devices
during the debugging process.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agodm: blk: Drop blk_{read,write}_devnum()
Bin Meng [Tue, 26 Sep 2023 08:43:43 +0000 (16:43 +0800)]
dm: blk: Drop blk_{read,write}_devnum()

blk_{read,write}_devnum() are no longer used by anywhere in the
source tree. Drop them.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agocmd: blk_common: Stop using hard-coded block size for Sandbox operations
Bin Meng [Tue, 26 Sep 2023 08:43:42 +0000 (16:43 +0800)]
cmd: blk_common: Stop using hard-coded block size for Sandbox operations

commit 3d2fc7971454 ("cmd: blk: Allow generic read/write operations to work in sandbox")
used the hard-coded block size (512) for accessing the sandbox host
device. Now that we have added support for non-512 block size for both
Sandbox host device and blkmap driver, let's stop using the hard-coded
block size.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agodm: blk: Rename get_desc() and make it externally visible
Bin Meng [Tue, 26 Sep 2023 08:43:41 +0000 (16:43 +0800)]
dm: blk: Rename get_desc() and make it externally visible

get_desc() can be useful outside blk-uclass.c. Let's change it to
an API and make it externally visible.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agocmd: blk_common: Use macros for the return values
Bin Meng [Tue, 26 Sep 2023 08:43:40 +0000 (16:43 +0800)]
cmd: blk_common: Use macros for the return values

Avoid using magic number 0/1 for the command result.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
14 months agoblk: blkmap: Support mapping to device of any block size
Bin Meng [Tue, 26 Sep 2023 08:43:39 +0000 (16:43 +0800)]
blk: blkmap: Support mapping to device of any block size

At present if a device to map has a block size other than 512,
the blkmap map process just fails. There is no reason why we
can't just use the block size of the mapped device.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agocmd: blkmap: Make map_handlers[] and its .fn static
Bin Meng [Tue, 26 Sep 2023 08:43:38 +0000 (16:43 +0800)]
cmd: blkmap: Make map_handlers[] and its .fn static

These are only used in cmd/blkmap.c.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agoblk: blkmap: Make bind/unbind routines static
Bin Meng [Tue, 26 Sep 2023 08:43:37 +0000 (16:43 +0800)]
blk: blkmap: Make bind/unbind routines static

These 2 are only used in drivers/block/blkmap.c.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agocmd: host: Print out the block size of the host device
Bin Meng [Tue, 26 Sep 2023 08:43:36 +0000 (16:43 +0800)]
cmd: host: Print out the block size of the host device

It's useful if we can print out the block size of the host device
in the "host info" command.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agoblk: host_dev: Sanity check on the size of host backing file
Bin Meng [Tue, 26 Sep 2023 08:43:35 +0000 (16:43 +0800)]
blk: host_dev: Sanity check on the size of host backing file

Since we are emulating a block device, its size should be multiple
of the configured block size.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agoblk: host_dev: Make host_sb_detach_file() and host_sb_ops static
Bin Meng [Tue, 26 Sep 2023 08:43:34 +0000 (16:43 +0800)]
blk: host_dev: Make host_sb_detach_file() and host_sb_ops static

They are only used in drivers/block/host_dev.c.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agoblk: sandbox: Support binding a device with a given logical block size
Bin Meng [Tue, 26 Sep 2023 08:43:33 +0000 (16:43 +0800)]
blk: sandbox: Support binding a device with a given logical block size

Allow optionally set the logical block size of the host device to
bind in the "host bind" command. If not given, defaults to 512.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
14 months agocmd: host: Mandate the filename parameter in the 'bind' command
Bin Meng [Tue, 26 Sep 2023 08:43:32 +0000 (16:43 +0800)]
cmd: host: Mandate the filename parameter in the 'bind' command

At present the host bind command does not require filename to be
provided. When it is not given NULL is passed to the host device
driver, which ends up failure afterwards.

Change to mandate the filename so that it is useful.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agoblk: Use a macro for the typical block size
Bin Meng [Tue, 26 Sep 2023 08:43:31 +0000 (16:43 +0800)]
blk: Use a macro for the typical block size

Avoid using the magic number 512 directly.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agoMerge branch '2023-10-09-assorted-fixes'
Tom Rini [Tue, 10 Oct 2023 12:54:17 +0000 (08:54 -0400)]
Merge branch '2023-10-09-assorted-fixes'

- Cleanup how we pick what to launch in SPL, a few test changes, some TI
  K3 platform updates, top-level Makefile fixes and related cleanup,
  correct a problem with LMB overlap, other assorted fixes.

14 months agospi: nxp_fspi: reset the FLSHxCR1 registers
Han Xu [Wed, 13 Sep 2023 21:15:35 +0000 (16:15 -0500)]
spi: nxp_fspi: reset the FLSHxCR1 registers

Reset the FLSHxCR1 registers to default value. ROM may set the register
value and it affects the SPI NAND normal functions.

Signed-off-by: Han Xu <han.xu@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
14 months agoboard: freescale: ls1088a: declare MC reserved regions
Laurentiu Tudor [Wed, 27 Sep 2023 15:30:49 +0000 (18:30 +0300)]
board: freescale: ls1088a: declare MC reserved regions

Populate the device tree with the MC reserved memory regions.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
14 months agoboard: freescale: ls2080a: declare MC reserved regions
Laurentiu Tudor [Wed, 27 Sep 2023 15:30:48 +0000 (18:30 +0300)]
board: freescale: ls2080a: declare MC reserved regions

Populate the device tree with the MC reserved memory regions.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
14 months agodrivers: net: fsl-mc: add support for MC reserved memory
Laurentiu Tudor [Wed, 27 Sep 2023 15:30:47 +0000 (18:30 +0300)]
drivers: net: fsl-mc: add support for MC reserved memory

Add support for declaring in device tree the reserved memory ranges
required for MC. Since the MC firmware acts as any DMA master present
in the SoC, the reserved memory ranges need also be identity mapped
in the SMMU, so create the required 'iommu-addresses' property in
the reserved memory nodes.
For now this support is used only on LX2160A SoCs.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
14 months agoarmv8: fsl-layerscape: make some functions static
Laurentiu Tudor [Wed, 27 Sep 2023 15:30:46 +0000 (18:30 +0300)]
armv8: fsl-layerscape: make some functions static

Some functions are not used outside this file, so make them static.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
14 months agofsl-layerscape: drop obsolete PPA secure firmware support
Laurentiu Tudor [Wed, 23 Aug 2023 13:25:46 +0000 (16:25 +0300)]
fsl-layerscape: drop obsolete PPA secure firmware support

PPA was a secure firmware developed in-house which is no longer
supported and replaced by TF-A quite some years ago. Drop support
for it.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
14 months agoconfigs: layerscape: delete defconfigs using legacy PPA secure FW
Laurentiu Tudor [Tue, 10 Oct 2023 02:08:36 +0000 (10:08 +0800)]
configs: layerscape: delete defconfigs using legacy PPA secure FW

PPA was a secure firmware developed in-house which is no longer
supported and replaced by TF-A quite some years ago. This makes
the defconfigs that make use of PPA obsolete, so remove them.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
 [Merged part 1 and part 2]
Signed-off-by: Peng Fan <peng.fan@nxp.com>
14 months agotest: Fix SPL tests not being run
Sean Anderson [Fri, 29 Sep 2023 16:06:54 +0000 (12:06 -0400)]
test: Fix SPL tests not being run

SPL doesn't have OF_LIVE enabled, so we can only run tests with a flat
tree. Don't skip them even if they don't use the devicetree.

Fixes: 6ec5178c0ef ("test: Skip flat-tree tests if devicetree is not used")
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agoboard/km/cent2: Fix buffer overflow when fixing MAC address
Francois Berder [Fri, 29 Sep 2023 14:11:00 +0000 (16:11 +0200)]
board/km/cent2: Fix buffer overflow when fixing MAC address

String "/soc/fman/ethernet@e8000" is 25 bytes long
and not 24 due to extra byte for null character at
the end.

Signed-off-by: Francois Berder <fberder@outlook.fr>
14 months agostdio: fix stdio_deregister_dev()
Heinrich Schuchardt [Fri, 29 Sep 2023 00:47:17 +0000 (02:47 +0200)]
stdio: fix stdio_deregister_dev()

When copying the name of a stdio device we must ensure that it is NUL
terminated before passing it to strcmp() to avoid a buffer overrun.

Truncating the name field leads to failure to deregister a stdio device.
When copying we must ensure that the name field sizes match.

Addresses-Coverity-ID: 350462 String not null terminated
Fixes: 5294e97832a6 ("stdio: extend "name" to 32 symbols")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agodm: serial: fix serial_post_probe()
Heinrich Schuchardt [Fri, 29 Sep 2023 00:47:16 +0000 (02:47 +0200)]
dm: serial: fix serial_post_probe()

The size of the name of a udevice is not limited.

When setting the fixed sized name field of a stdio device we must ensure
that the target string is NUL terminated to avoid buffer overflows.

Fixes: 57d92753d4ca ("dm: Add a uclass for serial devices")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agospl: Jump to image at end of board_init_r
Jonas Karlman [Wed, 27 Sep 2023 21:44:13 +0000 (21:44 +0000)]
spl: Jump to image at end of board_init_r

spl_board_prepare_for_boot() is not called before jumping/invoking atf,
optee, opensbi or linux images.

Jump to image at the end of board_init_r() to fix this.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agospl: add __noreturn attribute to spl_invoke_atf function
Chanho Park [Fri, 8 Sep 2023 08:08:56 +0000 (17:08 +0900)]
spl: add __noreturn attribute to spl_invoke_atf function

spl_invoke_atf function will not be returned to SPL. Thus, we need to
set __noreturn function attribute to the function.

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
14 months agotools: iot2050-sign-fw.sh: Make localization of tools dir more robust
Jan Kiszka [Wed, 27 Sep 2023 15:41:09 +0000 (17:41 +0200)]
tools: iot2050-sign-fw.sh: Make localization of tools dir more robust

When building in-tree, there is no source link.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
14 months agoarm: mach-k3: common: fix compile warnings with PHYS_64BIT on 32bit
Matthias Schiffer [Wed, 27 Sep 2023 13:43:14 +0000 (15:43 +0200)]
arm: mach-k3: common: fix compile warnings with PHYS_64BIT on 32bit

Use uintptr_t instead of phys_addr_t where appropriate, so passing the
addresses to writel() doesn't result in compile warnings when PHYS_64BIT
is set for 32bit builds (which is actually a useful configuration, as
the K3 SoC family boots from an R5 SPL, which may pass bank information
based on gd->bd->bi_dram to fdt_fixup_memory_banks() etc., so PHYS_64BIT
is needed for fixing up the upper bank).

Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
14 months agotest/py: sleep: Add a test for the time command
Love Kumar [Wed, 27 Sep 2023 05:03:55 +0000 (10:33 +0530)]
test/py: sleep: Add a test for the time command

Execute "time <sleep cmd>", and validate that it gives the approximately
the correct amount of command execution time.

Signed-off-by: Love Kumar <love.kumar@amd.com>
14 months agomailbox: k3-sec-proxy: fix error handling for missing scfg in FDT
Matthias Schiffer [Tue, 26 Sep 2023 12:42:54 +0000 (14:42 +0200)]
mailbox: k3-sec-proxy: fix error handling for missing scfg in FDT

The wrong field was checked.

Fixes: f9aa41023bd9 ("mailbox: Introduce K3 Secure Proxy Driver")
Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
14 months agotest: lmb: Add test for coalescing and overlap range
Udit Kumar [Tue, 26 Sep 2023 11:24:43 +0000 (16:54 +0530)]
test: lmb: Add test for coalescing and overlap range

Add test case for an address range which is coalescing with one of
range and overlapping with next range

Cc: Simon Glass <sjg@google.com>
Signed-off-by: Udit Kumar <u-kumar1@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agolmb: remove overlapping region with next range
Udit Kumar [Tue, 26 Sep 2023 11:24:42 +0000 (16:54 +0530)]
lmb: remove overlapping region with next range

In case of new memory range to be added is coalesced
with any already added non last lmb region.

And there is possibility that, then region in which new memory
range added is not adjacent to next region. But have some
sections are overlapping.

So along with adjacency check with next lmb region,
check for overlap should be done.

In case overlap  is found, adjust and merge these two lmb
region into one.

Reported-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Udit Kumar <u-kumar1@ti.com>
14 months agoexynos: Cleanup exynos_init
Tom Rini [Thu, 21 Sep 2023 23:32:48 +0000 (19:32 -0400)]
exynos: Cleanup exynos_init

- None of the callers perform error checking and based on the non-empty
  versions of this function, there's no checking to be done, so make
  this a void.
- Add a default weak version of the function.
- Remove the empty versions of exynos_init now that we have a weak
  version.

Signed-off-by: Tom Rini <trini@konsulko.com>
14 months agoboard: Remove essentially empty board files and Makefiles
Tom Rini [Thu, 21 Sep 2023 23:32:47 +0000 (19:32 -0400)]
board: Remove essentially empty board files and Makefiles

As part of reviewing a new platform, Daniel Schwierzeck noted that we
can have an empty Makefile in the board directory and don't need an
empty board.c file as well.  Further with further cleanup in the
Makefile we can now omit the Makefile entirely. Remove a number of now
unnecessary board.c and Makefiles.

Signed-off-by: Tom Rini <trini@konsulko.com>
14 months agoMakefile: Allow for board directories to not have a Makefile
Tom Rini [Thu, 21 Sep 2023 23:32:46 +0000 (19:32 -0400)]
Makefile: Allow for board directories to not have a Makefile

It is entirely possible at this point to have platforms in U-Boot that
do not have board-specific C code (just Kconfig or environment) and so
make it optional to have to descend in to and then build in the board
directory.

Signed-off-by: Tom Rini <trini@konsulko.com>
14 months agoARM: vexpress_ca9x4: Add missing flash width config option
Patryk Biel [Wed, 20 Sep 2023 07:41:20 +0000 (09:41 +0200)]
ARM: vexpress_ca9x4: Add missing flash width config option

Allow for a proper configuration of CFI flash banks avaialble on the vexpress_ca9x4
board. Without this option, the CFI flash incorrectly detects that the board has two
banks of 32MB flash devices, while in reality, the board provides
two flash banks, each with 64MB size. As a result, it becomes impossible to e.g. to
save u-boot env in flash. According to device tree for this board and
its implementation in QEMU, the CFI width should be set to 32 bits.

After applying this fix, CFI flash will correctly detect both flash
banks each with a size of 64MB. As as result the functionality of e.g. saving u-boot
env will work correctly.

Tested on QEMU 6.2.0.

Cc: Kristian Amlie <kristian.amlie@northern.tech>
Signed-off-by: Patryk Biel <pbiel7@gmail.com>
Reviewed-by: Kristian Amlie <kristian.amlie@northern.tech>
14 months agobootstd: use ARCH_DMA_MINALIGN in memalign() when allocating memory
Tony Dinh [Tue, 19 Sep 2023 21:27:21 +0000 (14:27 -0700)]
bootstd: use ARCH_DMA_MINALIGN in memalign() when allocating memory

Use ARCH_DMA_MINALIGN in memalign() when allocating memory to read the script from the media.

Ref: https://lore.kernel.org/u-boot/CAJaLiFy05F3Cr4X4G2mVkppXnBEFZrHQ+5CngYN8eJPg8ENWkg@mail.gmail.com/T/#m26daadc2463fe653b814a94e6309e5e6bb6be1d1

Note: this patch depends on the previous patch
https://patchwork.ozlabs.org/project/uboot/patch/20230917230649.30357-1-mibodhi@gmail.com/

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agoMakefile: Force regeneration of env.txt
Andrew Davis [Fri, 15 Sep 2023 14:43:23 +0000 (09:43 -0500)]
Makefile: Force regeneration of env.txt

If the source .env file changes to one that is also older than the
generated env.txt file then the .env file is not regenerated. This
means when switching board configs we do not regenerate the env.

This can be tested with:

$ make j721e_evm_a72_defconfig
$ make # this may fail to complete but that is okay for this test
$ make am64x_evm_a53_defconfig
$ make
$ vim include/generated/env.txt

Note this is still the J721e env not the AM64 config as expected.

As ENV_FILE is set based on configuration, regenerate anytime
autoconf.h changes.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 months agoMerge tag 'u-boot-rockchip-20231007' of https://source.denx.de/u-boot/custodians...
Tom Rini [Sun, 8 Oct 2023 13:58:55 +0000 (09:58 -0400)]
Merge tag 'u-boot-rockchip-20231007' of https://source.denx.de/u-boot/custodians/u-boot-rockchip

- Add Board: rk3568 Bananapi R2Pro;
- Update pcie bifurcation support;
- dwc_eth_qos controller support for rk3568 and rk3588;
- Compressed binary support for U-Boot on rockchip platform;
- dts and config updates for different board and soc;

[ trini: Fix conflict on include/spl.h ]
Signed-off-by: Tom Rini <trini@konsulko.com>
14 months agorockchip: rk356x-u-boot: Add bootph-all to i2c0_xfer pinctrl node
Jonas Karlman [Thu, 3 Aug 2023 21:11:54 +0000 (21:11 +0000)]
rockchip: rk356x-u-boot: Add bootph-all to i2c0_xfer pinctrl node

A RK8XX PMIC is typically using i2c0 on RK356x devices. Add bootph-all
to required pinctrl nodes to simplify use of the prevent booting on
power plug-in option in SPL.

With the following Kconfig options and nodes in u-boot.dtsi the prevent
booting on power plug-in option can work in SPL.

  CONFIG_ROCKCHIP_RK8XX_DISABLE_BOOT_ON_POWERON=y
  CONFIG_SPL_I2C=y
  CONFIG_SPL_POWER=y
  CONFIG_SPL_PINCTRL=y
  CONFIG_SPL_PMIC_RK8XX=y

  &i2c0 {
   bootph-pre-ram;
  };

  &rk817 {
   bootph-pre-ram;

   regulators {
   bootph-pre-ram;
   };
  };

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
14 months agopower: pmic: rk8xx: Fix power-on source check in SPL
Jonas Karlman [Thu, 3 Aug 2023 21:02:42 +0000 (21:02 +0000)]
power: pmic: rk8xx: Fix power-on source check in SPL

The commit 30975fb73d51 ("rockchip: Add option to prevent booting on
power plug-in") introduce an option to prevent booting a device when the
device was powered on due to power plug-in instead of pressing a power
button.

This feature works by checking the power-on source during PMIC probe
and powers off the device if power-on source was power plug-in.
This check currently runs very late at PMIC probe in U-Boot proper.

Fix so that the power-on source check can work at probe time in SPL.
Also enable probe after bind and remove the PMIC banner in SPL.

With this we can use ROCKCHIP_RK8XX_DISABLE_BOOT_ON_POWERON and
SPL_PMIC_RK8XX to power off the device very quickly after TPL instead
of after TF-A and U-Boot proper has been loaded and run.

  DDR V1.18 f366f69a7d typ 23/07/17-15:48:58
  ln
  LP4/4x derate en, other dram:1x trefi
  ddrconfig:7
  LPDDR4X, 324MHz
  BW=32 Col=10 Bk=8 CS0 Row=17 CS1 Row=17 CS=2 Die BW=16 Size=8192MB

  change to: 324MHz
  clk skew:0x64

  change to: 528MHz
  clk skew:0x58

  change to: 780MHz
  clk skew:0x58

  change to: 1056MHz(final freq)
  clk skew:0x40
  out
  Power Off due to plug-in event

Fixes: 30975fb73d51 ("rockchip: Add option to prevent booting on power plug-in")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
14 months agorockchip: rk356x: Enable poweroff command
Jonas Karlman [Thu, 17 Aug 2023 05:45:04 +0000 (05:45 +0000)]
rockchip: rk356x: Enable poweroff command

With PMIC_RK8XX, SYSRESET and CMD_POWEROFF options enabled it is
possible to power down a board using the poweroff command and turn the
board back on using a power button.

Enable the poweroff command on RK356x boards that have a button wired
to PMIC pwron.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
14 months agopower: pmic: rk8xx: Use sysreset implementation of the poweroff command
Jonas Karlman [Thu, 17 Aug 2023 05:45:02 +0000 (05:45 +0000)]
power: pmic: rk8xx: Use sysreset implementation of the poweroff command

Select SYSRESET_CMD_POWEROFF to use the sysreset implementation of the
poweroff command when PMIC_RK8XX is enabled.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
14 months agoconfigs: rockchip: rk3308: enable CONFIG_OF_LIBFDT_OVERLAY
FUKAUMI Naoki [Mon, 11 Sep 2023 10:01:21 +0000 (19:01 +0900)]
configs: rockchip: rk3308: enable CONFIG_OF_LIBFDT_OVERLAY

enable CONFIG_OF_LIBFDT_OVERLAY and use it on Radxa ROCK Pi S.

Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
14 months agoconfigs: rockchip: rk3308: use CONFIG_DEFAULT_FDT_FILE
FUKAUMI Naoki [Mon, 11 Sep 2023 10:01:20 +0000 (19:01 +0900)]
configs: rockchip: rk3308: use CONFIG_DEFAULT_FDT_FILE

all rk3308 boards should use their own dtb file.

also, change fdt_addr_r to avoid following error:
 "ERROR: Did not find a cmdline Flattened Device Tree"
it happens on Radxa ROCK Pi S (256MB/512MB) with kernel built from
Radxa BSP.

Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
14 months agoarm: dts: rockchip: rock-5b: add support for PCIe3 and NVMe
FUKAUMI Naoki [Tue, 5 Sep 2023 11:47:36 +0000 (20:47 +0900)]
arm: dts: rockchip: rock-5b: add support for PCIe3 and NVMe

this patch adds support for PCIe3 (M.2 M key) and enables NVMe.

 => pci
 BusDevFun  VendorId   DeviceId   Device Class       Sub-Class
 _____________________________________________________________
 00.00.00   0x1d87     0x3588     Bridge device           0x04
 01.00.00   0x10ec     0x8125     Network controller      0x00
 02.00.00   0x1d87     0x3588     Bridge device           0x04
 03.00.00   0x1179     0x011a     Mass storage controller 0x08
 => nvme scan
 => nvme info
 Device 0: Vendor: 0x1179 Rev: AGHA4101 Prod: 79CA20WPKRYN
             Type: Hard Disk
             Capacity: 488386.3 MB = 476.9 GB (1000215216 x 512)

Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
14 months agoarm: dts: rockchip: sync DT for RK3588 series with Linux
FUKAUMI Naoki [Tue, 5 Sep 2023 11:47:35 +0000 (20:47 +0900)]
arm: dts: rockchip: sync DT for RK3588 series with Linux

Sync the device tree for RK3588 series with Linux 6.6-rc1.

Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
14 months agoconfigs: rockchip: rock-pi-s: use default bootdelay (2s)
FUKAUMI Naoki [Mon, 11 Sep 2023 10:05:08 +0000 (19:05 +0900)]
configs: rockchip: rock-pi-s: use default bootdelay (2s)

align with other boards.

Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
14 months agoconfigs: rockchip: add DOS_PARTITION to RK3308 boards defconfig
Massimo Pegorer [Sun, 1 Oct 2023 14:15:29 +0000 (16:15 +0200)]
configs: rockchip: add DOS_PARTITION to RK3308 boards defconfig

Without DOS_PARTITION support U-Boot is not able to boot an OS stored
into an SD card with MBR partitions table. This is still a quite common
case so add DOS_PARTITION (only for U-Boot proper build) to Rockchip
RK3308 EVB, Radxa ROCK Pi S and Firefly roc-rk3308-cc boards: they are
the only RK boards missing of DOS_PARTITION.

Reported-by: Jayantajit Gogoi <jayanta.gogoi525@gmail.com>
Signed-off-by: Massimo Pegorer <massimo.pegorer+oss@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
14 months agoboard: rockchip: Add Bananapi R2Pro Board
Frank Wunderlich [Wed, 4 Oct 2023 19:04:34 +0000 (21:04 +0200)]
board: rockchip: Add Bananapi R2Pro Board

Add Bananapi R2 Pro board.

tested:
- sdcard
- both front usb-ports
- sata
- wan-port

lan-ports are connected to mt7531 switch where driver needs to be
separated from mtk ethernet-driver.

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Jonas Karlman <jonas@kwiboo.se>
14 months agoconfigs: rockchip: Enable ethernet driver on RK3588 boards
Jonas Karlman [Sun, 1 Oct 2023 19:17:22 +0000 (19:17 +0000)]
configs: rockchip: Enable ethernet driver on RK3588 boards

Enable DWC_ETH_QOS_ROCKCHIP and related PHY driver on RK3588 boards that
have an enabled gmac node and drop ETH_DESIGNWARE and GMAC_ROCKCHIP for
remaining RK3588 boards.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
14 months agoconfigs: rockchip: Enable ethernet driver on RK356x boards
Jonas Karlman [Sun, 1 Oct 2023 19:17:21 +0000 (19:17 +0000)]
configs: rockchip: Enable ethernet driver on RK356x boards

Enable DWC_ETH_QOS_ROCKCHIP and related PHY driver on RK356x boards that
have an enabled gmac node.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
14 months agonet: dwc_eth_qos_rockchip: Add support for RK3588
Jonas Karlman [Sun, 1 Oct 2023 19:17:20 +0000 (19:17 +0000)]
net: dwc_eth_qos_rockchip: Add support for RK3588

Add rk_gmac_ops and other special handling that is needed for GMAC to
work on RK3588.

rk_gmac_ops was ported from linux commits:
2f2b60a0ec28 ("net: ethernet: stmmac: dwmac-rk: Add gmac support for rk3588")
88619e77b33d ("net: stmmac: rk3588: Allow multiple gmac controller")

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
14 months agonet: dwc_eth_qos: Add glue driver for GMAC on Rockchip RK3568
Jonas Karlman [Sun, 1 Oct 2023 19:17:19 +0000 (19:17 +0000)]
net: dwc_eth_qos: Add glue driver for GMAC on Rockchip RK3568

Add a new glue driver for Rockchip SoCs, i.e RK3568, with a GMAC based
on Synopsys DWC Ethernet QoS IP.

rk_gmac_ops was ported from linux commit:
3bb3d6b1c195 ("net: stmmac: Add RK3566/RK3568 SoC support")

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>