]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
2 years agoMerge tag 'u-boot-rockchip-20221020' of https://source.denx.de/u-boot/custodians...
Tom Rini [Fri, 21 Oct 2022 02:32:38 +0000 (22:32 -0400)]
Merge tag 'u-boot-rockchip-20221020' of https://source.denx.de/u-boot/custodians/u-boot-rockchip

- dts update and sync for rk356x, rk3288, rk3399 from Linux;
- Add rk3399 EAIDK-610 board support;
- Update for puma-rk3399 board;
- some fix and typo fix in different drivers;

2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Thu, 20 Oct 2022 13:11:08 +0000 (09:11 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-riscv

2 years agoMerge tag 'clk-2023.01' of https://source.denx.de/u-boot/custodians/u-boot-clk
Tom Rini [Thu, 20 Oct 2022 12:58:25 +0000 (08:58 -0400)]
Merge tag 'clk-2023.01' of https://source.denx.de/u-boot/custodians/u-boot-clk

Clock patches for 2023.01

This contains various fixes (some long overdue) for the next release.

2 years agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxi
Tom Rini [Thu, 20 Oct 2022 12:58:05 +0000 (08:58 -0400)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxi

Beside some rather unexciting sync of the DTs from the kernel tree, and
some Kconfig cleanup, there are some improvements for the ARMv5 Allwinner
family, to support boards with the F1C200s (64MB DRAM) better. We will
get actual board support as soon as the DTs have passed the Linux review
process.
There is also support for the X96 Mate TV Box, featuring the H616 SoC and
a full 4GB of DRAM.
Also we found the secret to enable SPI booting on the H616 (pin PC5 must
be pulled to GND), so the SPI boot support patch is now good to go.

Passed the gitlab CI, plus briefly tested on Pine64-LTS, LicheePi Nano,
X96 Mate and OrangePi Zero.

2 years agoriscv: ae350: Check firmware_fdt_addr header
Rick Chen [Thu, 20 Oct 2022 05:56:17 +0000 (13:56 +0800)]
riscv: ae350: Check firmware_fdt_addr header

Check firmware_fdt_addr header to see if it
is a valid fdt blob.

Signed-off-by: Rick Chen <rick@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
2 years agoriscv: andes_plic.c: use modified IPI scheme
Yu Chien Peter Lin [Fri, 14 Oct 2022 07:00:18 +0000 (15:00 +0800)]
riscv: andes_plic.c: use modified IPI scheme

The IPI scheme in OpenSBI has been updated to support 8-core AE350
platform, the plicsw configuration needs to be modified accordingly.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
2 years agoriscv: qemu: spl: Fix booting Linux kernel with OpenSBI 1.0+
Bin Meng [Sun, 16 Oct 2022 16:42:06 +0000 (00:42 +0800)]
riscv: qemu: spl: Fix booting Linux kernel with OpenSBI 1.0+

Since OpenSBI commit bf3ef53bb7f5 ("firmware: Enable FW_PIC by default"),
OpenSBI runs directly at the load address without any code movement.
This causes the SPL version of QEMU 'virt' U-Boot does not boot Linux
kernel anymore. In that case, OpenSBI is loaded and runs at 0x81000000,
and it creates a 512KiB PMP window from that address. When booting
the Linux kernel, moving kernel to its linking address 0x80200000
overlaps the PMP window, and a PMP access failure is raised.

Update SPL_OPENSBI_LOAD_ADDR to load OpenSBI to a safe address.

Reported-by: Yangjie Zhang <pyjmstr@gmail.com>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Yangjie Zhang <pyjmstr@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
2 years agok210: fix k210_pll_calc_config()
Heinrich Schuchardt [Sun, 16 Oct 2022 16:12:32 +0000 (18:12 +0200)]
k210: fix k210_pll_calc_config()

The k210 driver is selected by sandbox_defconfig.
Building the sandbox on 32bit systems fails with:

test/dm/k210_pll.c: In function ‘dm_test_k210_pll_calc_config’:
include/linux/bitops.h:11:38: warning:
left shift count >= width of type [-Wshift-count-overflow]
   11 | #define BIT(nr)         (1UL << (nr))
      |                              ^~
test/dm/k210_pll.c:36:54: note: in expansion of macro ‘BIT’
   36 |                         error = abs((error - BIT(32))) >> 16;
      |                                              ^~~

Use the BIT_ULL() macro to create a u64 value.
Replace abs() by abs64() to get correct results on 32bit system
Apply the same for the unit test.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
2 years agoriscv: support building double-float modules
Heinrich Schuchardt [Wed, 12 Oct 2022 12:59:51 +0000 (14:59 +0200)]
riscv: support building double-float modules

The riscv32 toolchain for GCC-12 provided by kernel.org contains libgcc.a
compiled for double-float. To link to it we have to adjust how we build
U-Boot.

As U-Boot actually does not use floating point at all this should not
make a significant difference for the produced binaries.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
2 years agocmd/sbi: user friendly short texts
Heinrich Schuchardt [Tue, 4 Oct 2022 08:09:54 +0000 (10:09 +0200)]
cmd/sbi: user friendly short texts

In the sbi command use the same short texts for the legacy extensions
as the SBI specification 1.0.0.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Rick Chen <rick@andestech.com>
2 years agocmd/sbi: error message for failure to get spec version
Heinrich Schuchardt [Tue, 4 Oct 2022 08:09:53 +0000 (10:09 +0200)]
cmd/sbi: error message for failure to get spec version

If calling 'Get SBI specification version' fails, write an error message
and return CMD_RET_FAILURE.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Rick Chen <rick@andestech.com>
2 years agocmd/sbi: format RustSBI version number
Heinrich Schuchardt [Tue, 4 Oct 2022 08:09:52 +0000 (10:09 +0200)]
cmd/sbi: format RustSBI version number

The SBI command can print out the version number of the SBI implementation.
Choose the correct output format for RustSBI.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Rick Chen <rick@andestech.com>
2 years agoclk: update clk_clean_rate_cache to use private clk struct
Patrick Delaunay [Mon, 20 Jun 2022 13:37:25 +0000 (15:37 +0200)]
clk: update clk_clean_rate_cache to use private clk struct

In clk_clean_rate_cache, clk->rate should update the private clock
struct, in particular when CCF is activated, to save the cached
rate value.

When clk_get_parent_rate is called, the cached information
is read from pclk->rate, with pclk = clk_get_parent(clk).

As the cached is read from private clk data, the update should
be done also on it.

Fixes: 6b7fd3128f7 ("clk: fix set_rate to clean up cached rates for the hierarchy")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Link: https://lore.kernel.org/r/20220620153717.v2.1.Ifa06360115ffa3f3307372e6cdd98ec16759d6ba@changeid
Link: https://lore.kernel.org/r/20220712142352.RESEND.v2.1.Ifa06360115ffa3f3307372e6cdd98ec16759d6ba@changeid/
2 years agorockchip: clk: pll: Fix constant typo
Michal Suchanek [Wed, 28 Sep 2022 10:41:29 +0000 (12:41 +0200)]
rockchip: clk: pll: Fix constant typo

Fixes: bbda2ed584 ("rockchip: clk: pll: add common pll setting funcs")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Link: https://lore.kernel.org/r/20220928104129.13240-1-msuchanek@suse.de
2 years agoclk: change return type of clk_get_parent_rate from long long to ulong
Michal Suchanek [Wed, 28 Sep 2022 10:37:57 +0000 (12:37 +0200)]
clk: change return type of clk_get_parent_rate from long long to ulong

All functions getting and setting clock rate use ulong for rate, only
clk_get_parent_rate is an exception. Change the return value to match
other clock rate funcrions.

Most users directly assign the rate to unsigned long anyway, and the few
users that use u64 (not s64) multiply the rate so they may need the
extra bits for the result in their use case.

Fixes: 4aa78300a0 ("dm: clk: Define clk_get_parent_rate() for clk operations")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Link: https://lore.kernel.org/r/20220928103757.11870-1-msuchanek@suse.de
2 years agosuniv: add UART1 support
Andre Przywara [Wed, 5 Oct 2022 22:19:54 +0000 (23:19 +0100)]
suniv: add UART1 support

Some boards with the Allwinner F1C100s family SoCs use UART1 for its
debug UART, so define the pins for the SPL and the pinmux name and mux
value for U-Boot proper.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
2 years agosuniv: move SKIP_LOWLEVEL_INIT_ONLY into Kconfig
Andre Przywara [Wed, 5 Oct 2022 22:19:28 +0000 (23:19 +0100)]
suniv: move SKIP_LOWLEVEL_INIT_ONLY into Kconfig

So far we stated the lack of a lowlevel() init function for the
Allwinner F1C100s board by defining the respective SKIP_* symbol in the
board's defconfig. However we don't expect any *board* to employ such
low level code, so expect this to be never used for the ARMv5 Allwinner
SoCs.

Select the appropriate symbols in the Kconfig, so that we can remove
them from the defconfig, and avoid putting them in future defconfigs for
other boards.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
2 years agosunxi: fix 32MB load address layout
Andre Przywara [Thu, 6 Oct 2022 17:16:34 +0000 (18:16 +0100)]
sunxi: fix 32MB load address layout

The default load addresses for the various payloads (kernel, DT,
ramdisk) on systems with just 32MB of DRAM have some issues:
For a start the preceding comment doesn't match the actual values:
apparently they were copied from the 64MB S3 layout, then halved, but
since 0x5 is NOT the half of 0x10, they don't match up.
Also those projected maximum sizes are quite restrictive: it's not easy
to build a compressed kernel image with just 4MB. The only defconfig in
mainline Linux that supports the F1C100s (the only 32MB user so far)
creates a 6MB compressed / 15MB uncompressed kernel.
Rearrange the default load addresses to accommodate such a kernel: we
allow an 7MB/16MB kernel, and up to 5MB of ramdisk, stuffing the smaller
binaries like the DTB towards the end, just before the relocated U-Boot.
Shrink the size for DTB and scripts on the way, there is no need for
allowing up to 512K for them.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
2 years agosunxi: Kconfig: introduce SUNXI_MINIMUM_DRAM_MB
Andre Przywara [Sat, 2 Jul 2022 23:47:20 +0000 (00:47 +0100)]
sunxi: Kconfig: introduce SUNXI_MINIMUM_DRAM_MB

Traditionally we assumed that every Allwinner board would come with at
least 256 MB of DRAM, and set our DRAM layout accordingly. This affected
both the default load addresses, but also U-Boot's own address
expectations (like being loaded at 160 MB).

Some SoCs come with co-packaged DRAM, but only provide 32 or 64MB. So
far we special-cased those *chips*, as there was only one chip per DRAM
size. However new chips force us to take a more general approach.

Introduce a Kconfig symbol, which provides the minimum DRAM size of the
board. If nothing else is specified, we use 256 MB, and default to
smaller values for those co-packaged SoCs.
Then select the different DRAM maps according to this new symbol, so
that different SoCs with the same DRAM size can share those definitions.

Inspired by an idea from Icenowy.

This is just refactoring: compiled for all boards before and after this
patch: the binaries were identical.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
2 years agoconfigs: sunxi: licheepi_nano: enable D-Cache
Icenowy Zheng [Thu, 13 Oct 2022 13:26:45 +0000 (21:26 +0800)]
configs: sunxi: licheepi_nano: enable D-Cache

As the compile error when D-Cache is enabled is gone, we can have
D-Cache enabled now.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agosunxi: fix SUNIV build when enabling D-Cache
Icenowy Zheng [Thu, 13 Oct 2022 13:26:44 +0000 (21:26 +0800)]
sunxi: fix SUNIV build when enabling D-Cache

The enable_caches function in architecture-specific board code is only
necessary for V7A CPUs, code for both V8A and ARM926 have already
declared this function.

Only provide our implementation of enable_caches() for V7A CPUs.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agosunxi: defconfig: Add X96 Mate TV box
Andre Przywara [Sat, 10 Sep 2022 23:06:19 +0000 (00:06 +0100)]
sunxi: defconfig: Add X96 Mate TV box

The X96 Mate TV box is a TV box with the Allwinner H616 SoC. It is
available with up to 4GB of DRAM and 64GB eMMC.
The DRAM chips require a different configuration when compared to the
OrangePi Zero2, we must not use read/write training and write leveling.

Add a defconfig for the box, so that we can easily build U-Boot for it.
We synced the .dts file already from the kernel tree.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
2 years agoarm: dts: rockchip: rk356x: sync with Linux 6.0
FUKAUMI Naoki [Tue, 4 Oct 2022 01:30:30 +0000 (01:30 +0000)]
arm: dts: rockchip: rk356x: sync with Linux 6.0

prepare for rk3566 based board

Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: jerry: Enable RESET driver
Simon Glass [Wed, 28 Sep 2022 02:40:46 +0000 (20:40 -0600)]
rockchip: jerry: Enable RESET driver

At present the display does not work since it needs the reset driver to
operate. Fix this by enabling it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: cd529f7ad62 ("rockchip: video: edp: Add missing reset support")
Fixes: 9749d2ea29e ("rockchip: video: vop: Add reset support")
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: puma-rk3399: migrate to u-boot-rockchip-spi.bin
Quentin Schulz [Thu, 15 Sep 2022 09:14:32 +0000 (11:14 +0200)]
rockchip: puma-rk3399: migrate to u-boot-rockchip-spi.bin

Now that a single binary containing TPL/SPL correctly formatted for SPI
flashes and U-Boot proper, can be generated by binman, let's do it.

Also update the documentation to tell the user to use this newly
generated file instead of manually generating and flashing the binaries.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: puma-rk3399: migrate to u-boot-rockchip.bin
Quentin Schulz [Thu, 15 Sep 2022 09:14:30 +0000 (11:14 +0200)]
rockchip: puma-rk3399: migrate to u-boot-rockchip.bin

The offset of the SPL payload on Puma is different than for other
Rockchip devices in that it is stored at offset 256K instead of much
further away in the MMC.

Flashing one binary instead of two at different offsets is much more
user friendly so let's migrate to it by modifying the offset in the Puma
specific Device Tree.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: puma-rk3399: migrate to TPL
Quentin Schulz [Thu, 15 Sep 2022 09:14:29 +0000 (11:14 +0200)]
rockchip: puma-rk3399: migrate to TPL

Depending on the toolchain used to compile the SPL for Puma RK3399-Q7
module, the board does not boot because the resulting binary is too big
to fit in SRAM.

Let's add a TPL so that there's no need to fiddle with or hack the
defconfig to have a working bootloader.

This follows what's been done for the majority of other RK3399-based
boards.

See the original commit for the first migrations:
bdc00080111f "rockchip: rk3399: update defconfig for TPL"

Unfortunately, the offset in SPI-NOR for U-Boot proper needs to be
modified, since the move from SPL to TPL+SPL for idbloader.img (and the
"only the first 2KB per 4KB blocks are written" "hack" for rkspi format)
increased the size above 256KB. Let's move it to 512KB to, hopefully, be
safe.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: puma-rk3399: remove useless CONFIG_SYS_SPI_U_BOOT_OFFS
Quentin Schulz [Thu, 15 Sep 2022 09:14:28 +0000 (11:14 +0200)]
rockchip: puma-rk3399: remove useless CONFIG_SYS_SPI_U_BOOT_OFFS

The SPL payload offset when booting from SPI defaults to
CONFIG_SYS_SPI_U_BOOT_OFFS but can be overridden by
u-boot,spl-payload-offset. The Device Tree for Puma Haikou has this
property so there's no need to have this one option in the defconfig,
especially since they are not in sync and therefore confusing.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: puma-rk3399: load environment from same medium as one used to load U-Boot...
Quentin Schulz [Thu, 15 Sep 2022 09:14:27 +0000 (11:14 +0200)]
rockchip: puma-rk3399: load environment from same medium as one used to load U-Boot proper

Chances are when one boots U-Boot proper from a given storage medium,
they want the same medium to be used to load and store the environment.

This basically allows to have completely separate U-Boot (TPL/SPL/U-Boot
proper/environment) per storage medium which is convenient when working
with recovery from SD-Card as one would just need to insert a properly
configured SD-Card into the device to have access to their whole debug
setup.

No fallback mechanism is provided as to not dirty other storage medium
environment by mistake. However, since arch_env_get_location() is called
by env_init() which is part of the pre-relocation process, a valid,
non-ENVL_UNKNOWN, value shall be returned otherwise the relocation fails
with the following message:
initcall sequence 00000000002866c0 failed at call 0000000000256b34 (err=-19)

This valid, non-ENVL_UNKNOWN, value is ENVL_NOWHERE which requires to
always select CONFIG_ENV_IS_NOWHERE otherwise this work-around does not
work.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: puma-rk3399: allow loading environment from SPI-NOR flash
Quentin Schulz [Thu, 15 Sep 2022 09:14:26 +0000 (11:14 +0200)]
rockchip: puma-rk3399: allow loading environment from SPI-NOR flash

There's a SPI-NOR flash available from which SPL and U-Boot proper can
be booted, it makes sense to also allow this medium to store U-Boot
environment so let's enable it.

The Device Tree advertises a max frequency of 50MHz so let's set the
config option appropriately.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: puma-rk3399: load environment from same MMC as used for loading U-Boot...
Quentin Schulz [Thu, 15 Sep 2022 09:14:25 +0000 (11:14 +0200)]
rockchip: puma-rk3399: load environment from same MMC as used for loading U-Boot proper

Automatically detect which MMC device (SD-Card or eMMC) was used to load
U-Boot proper and load the environment from that MMC device instead of
a hardcoded one.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: puma-rk3399: remove unused default ENV_OFFSET for SPI flashes
Quentin Schulz [Thu, 15 Sep 2022 09:14:24 +0000 (11:14 +0200)]
rockchip: puma-rk3399: remove unused default ENV_OFFSET for SPI flashes

CONFIG_ENV_OFFSET is set in the defconfig to a different value already
so this isn't used. Let's remove it as to not confuse users.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: puma-rk3399: allow non-SD-Card-loaded SPL to load U-Boot proper from SD...
Quentin Schulz [Thu, 15 Sep 2022 09:14:23 +0000 (11:14 +0200)]
rockchip: puma-rk3399: allow non-SD-Card-loaded SPL to load U-Boot proper from SD-Card

Trying to load U-Boot proper from SPL when SPL was not loaded from
SD-Card is currently not working because the SDMMC pins aren't muxed
correctly. It is assumed the BootROM is doing this for us when booting
from SD-Card hence why it's not needed when booting TPL/SPL from
SD-Card.

The pinctrl properties are removed from the SPL DT property removal list
and the pinctrl configuration nodes made available in the SPL DT, in
addition to the pull-up configurations to allow loading U-Boot proper
from SD-Card as a fallback mechanism for SPI-NOR and eMMC.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: puma-rk3399: use gpio-hog instead of fixed-regulator for enabling eMMC...
Quentin Schulz [Thu, 15 Sep 2022 09:14:22 +0000 (11:14 +0200)]
rockchip: puma-rk3399: use gpio-hog instead of fixed-regulator for enabling eMMC/SPI-NOR

On Haikou devkit, it is possible to disable eMMC and SPI-NOR to force
booting from SD card or USB via rkdeveloptool by toggling a switch. This
switch needs to be overridden in software to be able to access eMMC and
SPI-NOR once the device has booted from SD Card. Puma SoM can override
this pin via gpio3_d5.

Until now, fixed regulator device was abused to model this, but since
there's now support for GPIO hogs, let's use it.

Since we want to be able to boot the SPL from SD Card but give it the
ability to load U-Boot proper from a fallback medium such as eMMC and
SPI-NOR, SPL support for GPIO hogs needs to be enabled too. Support for
other kinds of regulators are not needed anymore, so let's disable them.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: puma-rk3399: fix boot_targets swap depending on U-Boot proper load medium
Quentin Schulz [Thu, 15 Sep 2022 09:14:21 +0000 (11:14 +0200)]
rockchip: puma-rk3399: fix boot_targets swap depending on U-Boot proper load medium

distroboot should try first on the same MMC medium as the one the SPL
loaded U-Boot proper from. This was the case when the introducing commit
was merged because the default order was eMMC first and then SD card.
The check was therefore made only on whether we booted from SD card,
because otherwise the order was the expected one.
However, in commit b212ad24a604 ("rockchip: Fix MMC boot order"), the
order was swapped. Meaning our simple check is now useless.

Let's fix that by accounting for all scenarii: default boot_targets has
mmc0 first but booting from SD Card, mmc1 first but booting from eMMC.

Fixes: b212ad24a604 ("rockchip: Fix MMC boot order")
Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: rk3399: Add EAIDK-610 support
Andy Yan [Sun, 18 Sep 2022 11:30:02 +0000 (19:30 +0800)]
rockchip: rk3399: Add EAIDK-610 support

Specification
- Rockchip RK3399
- LPDDR3 4GB
- TF sd scard slot
- eMMC
- AP6255 for WiFi + BT
- Gigabit ethernet
- HDMI out
- 40 pin header
- USB 2.0 x 2
- USB 3.0 x 1
- USB 3.0 Type-C x 1 work in otg mode
- 12V DC Power supply

The dts file is sync from linux-next[0].

[0]:https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/arch/arm64/boot/dts/rockchip/rk3399-eaidk-610.dts

Signed-off-by: Andy Yan <andyshrk@163.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: puma-rk3399: remove dead code
Quentin Schulz [Thu, 15 Sep 2022 16:25:32 +0000 (18:25 +0200)]
rockchip: puma-rk3399: remove dead code

CONFIG_SERIAL_TAG is not selectable for ARM64 machines. While
get_board_serial is weakly defined if ENV_VARS_UBOOT_RUNTIME_CONFIG is
defined, it is only called when CONFIG_SUPPORT_PASSING_ATAGS is defined,
which also is not selectable for ARM64 machines. Therefore this is dead
code so let's remove it.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoram: rockchip: fix typo in KConfig option label
Quentin Schulz [Thu, 15 Sep 2022 10:17:10 +0000 (12:17 +0200)]
ram: rockchip: fix typo in KConfig option label

RAM_PX30_DDR4 is for DDR4 support and not DDR3 so let's fix the typo.

Fixes: 2db36c64bd5a ("ram: rockchip: px30: add a config-based ddr selection")
Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: px30: support debug uart on UART0
Quentin Schulz [Thu, 15 Sep 2022 10:12:47 +0000 (12:12 +0200)]
rockchip: px30: support debug uart on UART0

UART0 can obviously also be used for debug uart in U-Boot, so let's add
its support.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: rk3399: fix incorrect ifdef check on SPL_GPIO
Quentin Schulz [Fri, 22 Jul 2022 09:30:14 +0000 (11:30 +0200)]
rockchip: rk3399: fix incorrect ifdef check on SPL_GPIO

The check to perform is on CONFIG_SPL_GPIO and not SPL_GPIO.
Because this was never compiled in, it missed an include of cru.h that
was not detected before. Let's include it too.

Also switch to IS_ENABLED in-code check as it is the preferred
inclusion/exclusion mechanism.

Fixes: 07586ee4322a ("rockchip: rk3399: Support common spl_board_init")
Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: rk3399: fix incorrect ifdef check on SPL_DM_REGULATOR
Quentin Schulz [Fri, 22 Jul 2022 09:30:13 +0000 (11:30 +0200)]
rockchip: rk3399: fix incorrect ifdef check on SPL_DM_REGULATOR

The check to perform is on CONFIG_SPL_DM_REGULATOR and not
SPL_DM_REGULATOR. Also switch to in-code check instead of ifdefs.

Fixes: 07586ee4322a ("rockchip: rk3399: Support common spl_board_init")
Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Peter Robinson <pbrobinson@gmail.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com> # Rock960
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoarm: rockchip: rk3399: Program PLL clock for DDR at 50 MHz in documented range
Xavier Drudis Ferran [Sat, 16 Jul 2022 10:31:45 +0000 (12:31 +0200)]
arm: rockchip: rk3399: Program PLL clock for DDR at 50 MHz in documented range

The original code set up the DDR clock to 48 MHz, not 50MHz as
requested, and did it in a way that didn't satisfy the Application
Notes in RK3399 TRM [1]. 2.9.2.B says:

   PLL frequency range requirement
   [...]
   FOUTVCO: 800MHz to 3.2GHz

2.9.2.A :
   PLL output frequency configuration
   [...]
   FOUTVCO = FREF / REFDIV * FBDIV
   FOUTPOSTDIV = FOUTVCO / POSTDIV1 / POSTDIV2

FREF = 24 MHz

The original code gives FOUTVCO: 24MHz/1 * 12 = 288MHz < 800MHz
And the resulting FOUTPOSTDIV is 288MHz / 3 / 2 = 48MHz
but the requested frequency was 50MHz

Note:
2.7.2 Detail Register Description
PMUCRU_PPLL_CON0 says

   fbdiv
   Feedback Divide Value
   Valid divider settings are:
   [16, 3200] in integer mode

So .fbdiv = 12 wouldn't be right. But 2.9.2.C says:

   PLL setting consideration
   [...]
   The following settings are valid for FBDIV:
   DSMPD=1 (Integer Mode):
   12,13,14,16-4095 (practical value is limited to 3200, 2400, or 1600
   (FVCOMAX / FREFMIN))
   [...]

So .fbdiv = 12 would be right.

In any case FOUTVCO is still wrong. I thank YouMin Chen for
confirmation and explanation.

Despite documentation, I don't seem to be able to reproduce a
practical problem with the wrong FOUTVCO. When I initially found it I
thought some problems with detecting the RAM capacity in my Rock Pi 4B
could be related to it and my patch seemed to help. But since I'm no
longer able to reproduce the issue, it works with or without this
patch. And meanwhile a patch[2] by Lee Jones and YouMin Chen addresses
this issue. Btw, shouldn't that be commited?

So this patches solves no visible problem.  Yet, to prevent future
problems, I think it'd be best to stick to spec.

An alternative to this patch could be

    {.refdiv = 1, .fbdiv = 75, .postdiv1 = 6, .postdiv2 = 6};

This would theoretically consume more power and yield less jitter,
according to 2.9.2.C :

   PLL setting consideration
   [...]
   For lowest power operation, the minimum VCO and FREF frequencies
   should be used. For minimum jitter operation, the highest VCO and
   FREF frequencies should be used.
   [...]

But I haven't tried it because I don't think it matters much. 50MHz
for DDR is only shortly used by TPL at RAM init. Normal operation is
at 800MHz.  Maybe it's better to use less power until later when more
complex software can control batteries or charging or whatever ?

Cc: Simon Glass <sjg@chromium.org>
Cc: Philipp Tomsich <philipp.tomsich@vrull.eu>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Sean Anderson <seanga2@gmail.com>
Link: [1] https://opensource.rock-chips.com/images/e/ee/Rockchip_RK3399TRM_V1.4_Part1-20170408.pdf
Link: [2] https://patchwork.ozlabs.org/project/uboot/list/?series=305766

Signed-off-by: Xavier Drudis Ferran <xdrudis@tinet.cat>
Tested-by: Michal Suchánek <msuchanek@suse.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoarm: dts: rockchip: rk3288: partial sync from Linux
Johan Jonker [Wed, 28 Sep 2022 14:24:28 +0000 (16:24 +0200)]
arm: dts: rockchip: rk3288: partial sync from Linux

Partial sync of rk3288.dtsi from Linux version 5.18

Changed:
  only properties and functions that are not yet included
  swap some clocks positions
  fix some irq numbers
  style and sort nodes

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoarm: dts: rockchip: update cpu and gpu nodes
Johan Jonker [Wed, 28 Sep 2022 14:24:14 +0000 (16:24 +0200)]
arm: dts: rockchip: update cpu and gpu nodes

In order to better compare the Linux rk3288.dtsi version
with the u-boot version update the cpu and gpu nodes.

Changed:
  use operating-points-v2
  update thermal for all cpus
  add labels to all cpus
  change gpu compatible
  change gpu interrupt names

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoarm: dts: rockchip: rk3288: move thermal sub nodes to dtsi
Johan Jonker [Wed, 28 Sep 2022 14:24:06 +0000 (16:24 +0200)]
arm: dts: rockchip: rk3288: move thermal sub nodes to dtsi

In order to better compare the Linux rk3288.dtsi version
with the u-boot version move thermal sub nodes to the dtsi
file and remove rk3288-thermal.dtsi

Changed:
  replace underscore in nodename
  remove comments about sensor and ID
  use gpu phandle
  add #cooling-cells to gpu node
  lower critical temparature
  remove linux,hwmon property

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agophycore-rk3288: Avoid enabling partition support in SPL
Simon Glass [Fri, 11 Mar 2022 19:10:04 +0000 (12:10 -0700)]
phycore-rk3288: Avoid enabling partition support in SPL

This is not needed or used, and adds code size. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: phycore_rk3288: remove phycore_init() function
Johan Jonker [Tue, 18 Oct 2022 11:25:00 +0000 (13:25 +0200)]
rockchip: phycore_rk3288: remove phycore_init() function

The phycore_rk3288 board has a SPL size problem,
so remove phycore_init() function to stay within the limits.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Wadim Egorov <w.egorov@phytec.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoMerge branch '2022-10-18-TI-platform-updates'
Tom Rini [Tue, 18 Oct 2022 22:13:39 +0000 (18:13 -0400)]
Merge branch '2022-10-18-TI-platform-updates'

- Assorted fixes and improvements to some TI platforms

2 years agowatchdog: omap_wdt: Switch required include for watchdog defines
Tom Rini [Mon, 10 Oct 2022 20:29:17 +0000 (16:29 -0400)]
watchdog: omap_wdt: Switch required include for watchdog defines

All of the required values for using the omap_wdt.c driver are found in
<asm/ti-common/omap_wdt.h> and this is what is indirectly pulled in via
<asm/arch/hardware.h> when it exists.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoNokia RX-51: Fix compilation with non-zero CONFIG_SYS_TEXT_BASE
Pali Rohár [Sun, 9 Oct 2022 19:37:13 +0000 (21:37 +0200)]
Nokia RX-51: Fix compilation with non-zero CONFIG_SYS_TEXT_BASE

For some unknown reason GNU assembler version 2.31.1 (arm-linux-gnueabi-as
from Debian Buster) cannot compile following code from located in file
board/nokia/rx51/lowlevel_init.S:

  kernoffs:
    .word  KERNEL_OFFSET - (. - CONFIG_SYS_TEXT_BASE)

when CONFIG_SYS_TEXT_BASE is set to 0x80008000. It throws strange compile
error which is even without line number:

    AS      board/nokia/rx51/lowlevel_init.o
  {standard input}: Assembler messages:
  {standard input}: Error: attempt to get value of unresolved symbol `L0'
  make[2]: *** [scripts/Makefile.build:293: board/nokia/rx51/lowlevel_init.o] Error 1

I have no idea about this error and my experiments showed that ARM GNU
assembler is happy with negation of that number. So changing code to:

  kernoffs:
    .word  . - CONFIG_SYS_TEXT_BASE - KERNEL_OFFSET

and then replacing mathematical addition by substraction of "kernoffs"
value (so calculation of address does not change) compiles assembler file
without any error now.

There should be not any functional change.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agoarm: mach-k3: Move hardware handling to common files
Andrew Davis [Fri, 7 Oct 2022 19:22:05 +0000 (14:22 -0500)]
arm: mach-k3: Move hardware handling to common files

These hardware register definitions are common for all K3, remove
duplicate data them by moving them to hardware.h.

While here do some minor whitespace cleanup + grouping.

Signed-off-by: Andrew Davis <afd@ti.com>
2 years agoarm: mach-k3: security: Use dma-mapping for cache ops
Andrew Davis [Fri, 7 Oct 2022 17:12:29 +0000 (12:12 -0500)]
arm: mach-k3: security: Use dma-mapping for cache ops

This matches how this would be done in Linux and these functions
do the alignment for us which makes the code look cleaner.

Signed-off-by: Andrew Davis <afd@ti.com>
2 years agodma: Transfer dma_ops should use DMA address types
Andrew Davis [Fri, 7 Oct 2022 17:11:13 +0000 (12:11 -0500)]
dma: Transfer dma_ops should use DMA address types

DMA operations should function on DMA addresses, not virtual addresses.
Although these are usually the same in U-Boot, it is more correct
to be explicit with our types here.

Signed-off-by: Andrew Davis <afd@ti.com>
2 years agodma: ti-edma3: Add DMA map operations before and after transfers
Andrew Davis [Fri, 7 Oct 2022 17:11:12 +0000 (12:11 -0500)]
dma: ti-edma3: Add DMA map operations before and after transfers

We should clean the caches before any DMA operation and clean+invalidate
after. This matches what the DMA framework does for us already but adds
it to the two functions here in this driver that don't yet go through the
new DMA framework.

Signed-off-by: Andrew Davis <afd@ti.com>
2 years agodma: Use dma-mapping for cache ops and sync after write
Andrew Davis [Fri, 7 Oct 2022 17:11:11 +0000 (12:11 -0500)]
dma: Use dma-mapping for cache ops and sync after write

The DMA'd memory area needs cleaned and invalidated after the DMA
write so that any stale cache lines do not mask new data.

Signed-off-by: Andrew Davis <afd@ti.com>
2 years agoarm: mach-k3: common: Set boot_fit on non-GP devices
Andrew Davis [Fri, 7 Oct 2022 16:27:46 +0000 (11:27 -0500)]
arm: mach-k3: common: Set boot_fit on non-GP devices

This matches what we did for pre-K3 devices. This allows us to build
boot commands that can check for our device type at runtime.

Signed-off-by: Andrew Davis <afd@ti.com>
2 years agophy: ti: j721e-wiz: add j784s4-wiz-10g module support
Matt Ranostay [Wed, 5 Oct 2022 20:51:30 +0000 (13:51 -0700)]
phy: ti: j721e-wiz: add j784s4-wiz-10g module support

Add support for j784s4-wiz-10g device which has two core reference
clocks (e.g core_ref_clk, core_ref1_clk) which requires an additional
mux selection option.

Signed-off-by: Matt Ranostay <mranostay@ti.com>
2 years agoarm: dts: k3-am64-evm: EMIF tool update to v0.08.40 for 1600MT/s DDR4
Dave Gerlach [Thu, 29 Sep 2022 17:35:49 +0000 (12:35 -0500)]
arm: dts: k3-am64-evm: EMIF tool update to v0.08.40 for 1600MT/s DDR4

Move to latest DDR4 1600MT/s for k3-am64-evm based on EMIF tool
v0.08.40.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
2 years agoarm: dts: k3-am64-sk: EMIF tool update to v0.08.40 and move to 1600MT/s LPDDR4
Dave Gerlach [Thu, 29 Sep 2022 17:35:48 +0000 (12:35 -0500)]
arm: dts: k3-am64-sk: EMIF tool update to v0.08.40 and move to 1600MT/s LPDDR4

Move k3-am64-sk to use 1600MT/s LPDDR4 configuration and update to latest EMIF
tool v0.08.40.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
2 years agoMerge tag 'dm-pull-18oct22' of https://source.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Tue, 18 Oct 2022 11:36:52 +0000 (07:36 -0400)]
Merge tag 'dm-pull-18oct22' of https://source.denx.de/u-boot/custodians/u-boot-dm

Update uclass iterators to work better when devices fail to probe
Support VBE OS requests / fixups
Minor error-handling tweaks to bootm command

2 years agoMerge tag 'u-boot-stm32-20221018' of https://source.denx.de/u-boot/custodians/u-boot-stm
Tom Rini [Tue, 18 Oct 2022 11:36:39 +0000 (07:36 -0400)]
Merge tag 'u-boot-stm32-20221018' of https://source.denx.de/u-boot/custodians/u-boot-stm

- stm32mp: fix compilation issue with DEBUG_UART
- DT update :
  - Remove buck3 regulator-always-on on AV96
  - Enable btrfs support on DHSOM
  - Drop extra newline from AV96 U-Boot extras DT
  - Add DHCOR based Testbench board
  - Fix and expand PLL configuration comments
  - update SCMI dedicated file

2 years agosunxi: OrangePi Zero 2: Enable SPI booting
Andre Przywara [Sun, 4 Jul 2021 21:15:01 +0000 (22:15 +0100)]
sunxi: OrangePi Zero 2: Enable SPI booting

The OrangePi Zero 2 board comes with 2MB of SPI flash, from which the
BROM is able to boot from. Please note that the fuse setup requires
PC5 (BOOT_SEL3) to be pulled to GND for that to actually work.

Enable the SPL code responsible for finding and loading U-Boot proper and
friends, so that u-boot-sunxi-with-spl.bin can be written into the flash.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Tested-by: Ivan Shishkin <s45rus@gmail.com>
2 years agosunxi: SPL SPI: Add SPI boot support for the Allwinner H616 SoC
Andre Przywara [Sun, 13 Dec 2020 20:19:43 +0000 (20:19 +0000)]
sunxi: SPL SPI: Add SPI boot support for the Allwinner H616 SoC

The H616 SoC uses the same SPI IP as the H6, also shares the same clocks
and reset bits.
The only real difference is a slight change in the pin assignment: the
H6 uses PC5, the H616 PC4 instead. This makes for a small change in
our spi0_pinmux_setup() routine.

Apart from that, just extend the H6 #ifdef guards to also cover the H616,
using the shared CONFIG_SUN50I_GEN_H6 symbol.
Also use this symbol for the Kconfig dependency.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Tested-by: Ivan Shishkin <s45rus@gmail.com>
2 years agosunxi: defconfig: drop redundant definitions
Andre Przywara [Tue, 13 Sep 2022 00:26:36 +0000 (01:26 +0100)]
sunxi: defconfig: drop redundant definitions

When some configuration symbols were converted from header files to
Kconfig, their values were placed into *every* defconfig file.
Since we now have sensible per-SoC defaults defined in Kconfig, those
values are now redundant, and can just be removed.
This affects CONFIG_SPL_STACK, CONFIG_SYS_PBSIZE, CONFIG_SPL_MAX_SIZE,
and CONFIG_SYS_BOOTM_LEN.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agosunxi: Kconfig: use SoC-wide values for some symbols
Andre Przywara [Tue, 13 Sep 2022 00:23:58 +0000 (01:23 +0100)]
sunxi: Kconfig: use SoC-wide values for some symbols

Some configuration symbols formerly defined in header files were
recently converted to Kconfig symbols. This moved their value definition
into *every* defconfig file, even though those values are hardly board
choices.
Use the new Kconfig option to define per-SoC default values, in just one
place, which makes the definition in each defconfig file redundant.

We refrain from setting a sunxi specific value for CONFIG_SYS_BOOTM_LEN,
so this defaults to a much better 64MB for uncompressed arm64 kernels.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agosunxi: dts: arm: update devicetree files
Andre Przywara [Mon, 12 Sep 2022 23:52:52 +0000 (00:52 +0100)]
sunxi: dts: arm: update devicetree files

Update the devicetree files from the Linux kernel, version v6.0-rc4.
This is covering the 32-bit SoCs, from arch/arm/boot/dts/.

This avoids the not backwards-compatible r_intc binding change, to allow
older kernels to boot, but the other nodes are updated.

Not much change here, the vast majority is actually cosmetic: node names
and using symbolic names for the the RTC clocks.
The R40 boards gain DVFS support.
Some A23/A33 tablet DTs are unified into a single file.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
2 years agosunxi: dts: arm64: update devicetree files
Andre Przywara [Sat, 10 Sep 2022 23:04:41 +0000 (00:04 +0100)]
sunxi: dts: arm64: update devicetree files

Update the devicetree files from the Linux kernel, version v6.0-rc4.
This is covering the 64-bit SoCs, from arch/arm64/boot/dts/allwinner.

This avoids the not backwards-compatible r_intc binding change, to allow
older kernels to boot, but the other nodes are updated.

Not much change here, the vast majority is actually cosmetic: node names
and using symbolic names for the the RTC clocks.
Some A64 boards gain some audio nodes.
The H616 DTs are now switched to the version finally merged into the
kernel, which brings some changes, but none affecting U-Boot.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
2 years agostm32mp: fix compilation issue with DEBUG_UART
Patrick Delaunay [Tue, 11 Oct 2022 14:44:26 +0000 (16:44 +0200)]
stm32mp: fix compilation issue with DEBUG_UART

Fix the compilation issue when CONFIG_DEBUG_UART is activated

 drivers/serial/serial_stm32.o: in function `debug_uart_init':
 drivers/serial/serial_stm32.c:291: undefined reference to \
    `board_debug_uart_init'

The board_debug_uart_init is needed for SPL boot, called in
cpu.c::mach_cpu_init(); it is defined in board/st/stm32mp1/spl.c.

But with the removal #ifdefs patch, the function debug_uart_init() is
always compiled even if not present in the final U-Boot image.

This patch adds a file to provided this function when DEBUG_UART and SPL
are activated.

Fixes: c8b2eef52b6c ("stm32mp15: tidy up #ifdefs in cpu.c")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoARM: dts: stm32: update SCMI dedicated file
Patrick Delaunay [Mon, 10 Oct 2022 08:56:14 +0000 (10:56 +0200)]
ARM: dts: stm32: update SCMI dedicated file

The PWR regulators don't need be removed as they are already deactivated.
This patches is a alignment with the accepted patch in Linux device tree
in commit a34b42f8690c ("ARM: dts: stm32: fix pwr regulators references
to use scmi").

Fixes: 69ef98b209e7 ("ARM: dts: stm32mp15: alignment with v5.19")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoARM: dts: stm32: Fix and expand PLL configuration comments
Marek Vasut [Tue, 11 Oct 2022 20:42:44 +0000 (22:42 +0200)]
ARM: dts: stm32: Fix and expand PLL configuration comments

Fix the frequencies listed in PLL configuration comments to match
the actual frequencies programmed into hardware. Furthermore, add
a comment which explains how those frequencies are calculated, so
it won't be necessary to look it up all over the datasheet and
make more mistakes in the calculation in the future.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agoARM: dts: stm32: Add DHCOR based Testbench board
Marek Vasut [Mon, 26 Sep 2022 16:50:00 +0000 (18:50 +0200)]
ARM: dts: stm32: Add DHCOR based Testbench board

Add DT for DHCOR Testbench board, which is a testbench for testing of
DHCOR SoM during manufacturing. This is effectively a trimmed down
version of AV96 board with CSI-2 bridge, HDMI bridge, WiFi, Audio and
LEDs removed and used as GPIOs instead. Furthermore, the PMIC Buck3
is always configured from PMIC NVM to cater for both 1V8 and 3V3 SoM
variant.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoARM: dts: stm32: Drop extra newline from AV96 U-Boot extras DT
Marek Vasut [Mon, 26 Sep 2022 16:46:31 +0000 (18:46 +0200)]
ARM: dts: stm32: Drop extra newline from AV96 U-Boot extras DT

Remove duplicate newline, no functional change.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoARM: stm32: Enable btrfs support on DHSOM
Marek Vasut [Mon, 26 Sep 2022 16:44:58 +0000 (18:44 +0200)]
ARM: stm32: Enable btrfs support on DHSOM

The btrfs filesystem provides advanced functionality like copy-on-write
and snapshots, as well as metadata and data duplication and checksumming.
Enable btrfs in U-Boot to permit even the primary partition to be btrfs
and let system boot from it.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoARM: dts: stm32: Remove buck3 regulator-always-on on AV96
Marek Vasut [Fri, 23 Sep 2022 01:31:22 +0000 (03:31 +0200)]
ARM: dts: stm32: Remove buck3 regulator-always-on on AV96

In case the regulator-always-on is present in regulator DT node,
the regulator is always reconfigured to the voltage set in DT on
probe, even if regulator_set_value() has been called before. Drop
the property from AV96 U-Boot DT and enable the regulator manually
in code, as the board already reconfigures the Buck3 regulator in
code per PMIC NVM content instead.

Fixes: 0adf10a87b1 ("ARM: dts: stm32: Configure Buck3 voltage per PMIC NVM on Avenger96")
Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agovbe: Add a test for VBE device tree fixups
Simon Glass [Tue, 11 Oct 2022 15:47:20 +0000 (09:47 -0600)]
vbe: Add a test for VBE device tree fixups

When a FIT includes some OS requests, U-Boot should process these and add
the requested info to corresponding subnodes of the /chosen node. Add a
pytest for this, which sets up the FIT, runs bootm and then uses a C
unit test to check that everything looks OK.

The test needs to run on sandbox_flattree since we don't support
device tree fixups on sandbox (live tree) yet. So enable BOOTMETH_VBE and
disable bootflow_system(), since EFI is not supported on
sandbox_flattree.

Add a link to the initial documentation.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodm: core: Update docs about oftree_from_fdt()
Simon Glass [Tue, 11 Oct 2022 15:47:19 +0000 (09:47 -0600)]
dm: core: Update docs about oftree_from_fdt()

Update this function's comment and also the livetree documentation, so it
is clear when to use the function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agovbe: Add fixups for a basic set of OS requests
Simon Glass [Tue, 11 Oct 2022 15:47:18 +0000 (09:47 -0600)]
vbe: Add fixups for a basic set of OS requests

As a starting point, add support for providing random data, if requested
by the OS. Also add ASLR, as a placeholder for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
(fixed up to use uclass_first_device_err() instead)

2 years agotest: Move common FIT code into a separate fit_util file
Simon Glass [Tue, 11 Oct 2022 15:47:17 +0000 (09:47 -0600)]
test: Move common FIT code into a separate fit_util file

To avoid duplicating code, create a new fit_util module which provides
various utility functions for FIT. Move this code out from the existing
test_fit.py and refactor it with addition parameters.

Fix up pylint warnings in the conversion.

This involves no functional change.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoboot: Tidy up logging and naming in vbe_simple
Simon Glass [Tue, 11 Oct 2022 15:47:16 +0000 (09:47 -0600)]
boot: Tidy up logging and naming in vbe_simple

Make sure the log_msg_ret() values are unique so that the log trace is
unambiguous with LOG_ERROR_RETURN. Also avoid reusing the 'node' variable
for two different nodes in bootmeth_vbe_simple_ft_fixup(), since this is
confusing.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoboot: Pass the correct FDT to the EVT_FT_FIXUP event
Simon Glass [Tue, 11 Oct 2022 15:47:15 +0000 (09:47 -0600)]
boot: Pass the correct FDT to the EVT_FT_FIXUP event

Now that we support multiple device trees with the ofnode interface, we
can pass the correct FDT to this event. This allows the 'working' FDT to
be fixed up, as expected, so long as OFNODE_MULTI_TREE is enabled.

Also make sure we don't try to do this with livetree, which does not
support fixups yet.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agosandbox: Support FDT fixups
Simon Glass [Tue, 11 Oct 2022 15:47:14 +0000 (09:47 -0600)]
sandbox: Support FDT fixups

Add support for doing device tree fixups in sandbox. This allows us to
test that functionality in CI.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Move VBE setup into a shared function
Simon Glass [Tue, 11 Oct 2022 15:47:13 +0000 (09:47 -0600)]
bootstd: Move VBE setup into a shared function

This information needs to be set up by the bootstd tests as well. Move it
into a common function and ensure it is executed before any bootstd test
is run.

Make sure the 'images' parameter is set correctly for fixups.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agofdt: Show a message when the working FDT changes
Simon Glass [Tue, 11 Oct 2022 15:47:12 +0000 (09:47 -0600)]
fdt: Show a message when the working FDT changes

The working FDT is the one which comes from the OS and is fixed up by
U-Boot. When the bootm command runs, it sets up the working FDT to be the
one it is about to pass to the OS, so that fixups can happen.

This seems like an important step, so add a message indicating that the
working FDT has changed. This is shown during the running of the bootm
command.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agofs: Quieten down the filesystems more
Simon Glass [Tue, 11 Oct 2022 15:47:11 +0000 (09:47 -0600)]
fs: Quieten down the filesystems more

When looking for a filesystem on a partition we should do so quietly. At
present if the filesystem is very small (e.g. 512 bytes) we get a host of
messages.

Update these to only show when debugging.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoboot: Correct handling of addresses in boot_relocate_fdt()
Simon Glass [Tue, 11 Oct 2022 15:47:10 +0000 (09:47 -0600)]
boot: Correct handling of addresses in boot_relocate_fdt()

This code uses casts between addresses and pointers, so does not work with
sandbox. Update it so we can allow sandbox to do device tree fixups.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootm: Drop #ifdef from do_bootm()
Simon Glass [Tue, 11 Oct 2022 15:47:09 +0000 (09:47 -0600)]
bootm: Drop #ifdef from do_bootm()

Drop the #ifdefs from this command by using a variable to hold the states
that should be executed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootm: Avoid returning error codes from command
Simon Glass [Tue, 11 Oct 2022 15:47:08 +0000 (09:47 -0600)]
bootm: Avoid returning error codes from command

Functions which implement commands must return a CMD_RET_... error code.
At present bootm can return a negative errno value in some cases, thus
causing strange behaviour such as trying to exit the shell and printing
usage information.

Fix this by returning the correct value.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootm: Change incorrect 'unsupported' error
Simon Glass [Tue, 11 Oct 2022 15:47:07 +0000 (09:47 -0600)]
bootm: Change incorrect 'unsupported' error

At present when bootm fails, it says:

    subcommand not supported

and then prints help for the bootm command. This is not very useful, since
generally the error is related to something else, such as fixups failing.
It is quite confusing to see this in a test run.

Change the error and show the error code.

We could update the OS functions to return -ENOSYS when they do not
support the bootm subcommand. But this involves some thought since this is
arch-specific code and proper errno error codes are not always returned.
Also, with the code as is, all required subcommands are of course
supported - a problem would only come if someone added a new one or
removed support for one from an existing OS. Therefore it seems better to
leave that sort of effort for when our bootm tests are improved.

Note: v1 of this patch generated a discussion[1] about printing error
strings automatically using printf(). That is outside the scope of this
patch but will be dealt with separately.

[1] https://patchwork.ozlabs.org/project/uboot/patch/20220909151801.336551-3-sjg@chromium.org/

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodm: core: Switch uclass_*_device_err to use uclass_*_device_check
Michal Suchanek [Wed, 12 Oct 2022 19:58:06 +0000 (21:58 +0200)]
dm: core: Switch uclass_*_device_err to use uclass_*_device_check

The _err variant iterators use the simple iterators without suffix as
basis.

However, there is no user that uclass_next_device_err for iteration,
many users of uclass_first_device_err use it to get the first and
(assumed) only device of an uclass, and a couple that use
uclass_next_device_err to get the device following a known device in the
uclass list.

While there are some truly singleton device classes in which more than
one device cannot exist these are quite rare, and most classes can have
multiple devices even if it is not the case on the SoC's EVB.

In a later patch the simple iterators will be updated to not stop on
error and return next device instead. With this in many cases the code
that expects the first device or an error if it fails to probe may get
the next device instead. Use the _check iterators as the basis of _err
iterators to preserve the old behavior.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agodm: core: Switch uclass_foreach_dev_probe to use simple iterator
Michal Suchanek [Wed, 12 Oct 2022 19:58:05 +0000 (21:58 +0200)]
dm: core: Switch uclass_foreach_dev_probe to use simple iterator

The return value is not used for anythig, and in a later patch the
behavior of the _err iterator will change in an incompatible way.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Update pvblock_probe() to avoid using internal var:
Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agompc83xx: gazerbeam: Update sysinfo_get error handling
Michal Suchanek [Wed, 12 Oct 2022 19:58:04 +0000 (21:58 +0200)]
mpc83xx: gazerbeam: Update sysinfo_get error handling

In a later patch sysinfo_get will be changed to return the device in cae
of an error. Set sysinfo to NULL on error to preserve previous behavior.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agonet: eth-uclass: Do not set device on error
Michal Suchanek [Wed, 12 Oct 2022 19:58:02 +0000 (21:58 +0200)]
net: eth-uclass: Do not set device on error

eth_get_dev relies on the broken behavior that returns an error but not
the device on which the error happened which gives the caller no
reasonable way to report or handle the error.

In a later patch uclass_first_device_err will be changed to return the
device on error but eth_get_dev stores the returned device pointer
directly in a global state without checking the return value. Unset the
pointer again in the error case.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agodm: blk: Do not use uclass_next_device_err
Michal Suchanek [Wed, 12 Oct 2022 19:58:01 +0000 (21:58 +0200)]
dm: blk: Do not use uclass_next_device_err

blk_first_device_err/blk_next_device_err uses
uclass_first_device_err/uclass_next_device_err for device iteration.

Although the function names superficially match the return value from
uclass_first_device_err/uclass_next_device_err is never used
meaningfully, and uclass_first_device/uclass_next_device works equally
well for this purpose.

In the following patch the semantic of
uclass_first_device_err/uclass_next_device_err will be changed to be
based on uclass_first_device_check/uclass_next_device_check breaking
this sole user that uses uclass_next_device_err for iteration.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agodm: treewide: Use uclass_next_device_err when accessing second device
Michal Suchanek [Wed, 12 Oct 2022 19:58:00 +0000 (21:58 +0200)]
dm: treewide: Use uclass_next_device_err when accessing second device

There are a couple users of uclass_next_device return value that get the
first device by other means and use uclass_next_device assuming the
following device in the uclass is related to the first one.

Use uclass_next_device_err because the return value from
uclass_next_device will be removed in a later patch.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agodm: treewide: Use uclass_first_device_err when accessing one device
Michal Suchanek [Wed, 12 Oct 2022 19:57:59 +0000 (21:57 +0200)]
dm: treewide: Use uclass_first_device_err when accessing one device

There is a number of users that use uclass_first_device to access the
first and (assumed) only device in uclass.

Some check the return value of uclass_first_device and also that a
device was returned which is exactly what uclass_first_device_err does.

Some are not checking that a device was returned and can potentially
crash if no device exists in the uclass. Finally there is one that
returns NULL on error either way.

Convert all of these to use uclass_first_device_err instead, the return
value will be removed from uclass_first_device in a later patch.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agocmd: List all uclass devices regardless of probe error
Michal Suchanek [Wed, 12 Oct 2022 19:57:58 +0000 (21:57 +0200)]
cmd: List all uclass devices regardless of probe error

There are a few commands that iterate uclass with
uclass_first_device/uclass_next_device or the _err variant.

Use the _check class iterator variant to get devices that fail to probe
as well, and print the status.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agow1: Fix bus counting in w1_get_bus
Michal Suchanek [Wed, 12 Oct 2022 19:57:57 +0000 (21:57 +0200)]
w1: Fix bus counting in w1_get_bus

Use uclass_first_device_check/uclass_next_device_check to correctly
count buses that fail to probe.

Fixes: d3e19cf919 ("w1: Add 1-Wire uclass")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agovideo: ipuv3: Fix error handling when getting the display
Michal Suchanek [Wed, 12 Oct 2022 19:57:56 +0000 (21:57 +0200)]
video: ipuv3: Fix error handling when getting the display

The code checks that uclass_first_device returned a device but the
returned value that is assigned is never used. Use
uclass_first_device_err instead, and move the error return outside of
the if block.

Fixes: f4ec1ae08e ("mxc_ipuv3_fb.c: call display_enable")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agostdio: Fix class iteration in stdio_add_devices()
Michal Suchanek [Wed, 12 Oct 2022 19:57:55 +0000 (21:57 +0200)]
stdio: Fix class iteration in stdio_add_devices()

There is a complaint in the code that iterates keyboards that we don't
have the _check variant of class iterator but we in fact do, use it.

In the code that iterates video devices there is an attempt to print
errors but the simple iterator does not return a device when there is an
error. Use the _check variant of the iterator as well.

Also format error messages consistently.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agousb: ether: Fix error handling in usb_ether_init
Michal Suchanek [Wed, 12 Oct 2022 19:57:54 +0000 (21:57 +0200)]
usb: ether: Fix error handling in usb_ether_init

The code checks the return value from uclass_first_device as well as
that the device exists but it passes on the return value which may be
zero if there are no gadget devices. Just check that a device was
returned and return -ENODEV otherwise.

Also remove the dev variable which is not really used for anything.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>