platform/kernel/u-boot.git
19 months agox86: dfi-bt700: Fix up adjustment of CONFIG_TEXT_BASE
Simon Glass [Tue, 14 Mar 2023 23:59:54 +0000 (17:59 -0600)]
x86: dfi-bt700: Fix up adjustment of CONFIG_TEXT_BASE

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

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

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

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

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

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

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

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

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

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

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

Add documentation on how to make this change safely.

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

Pull request for efi-2023.04-rc5

UEFI:

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

19 months agoefi_loader: fix device-path for USB devices
Heinrich Schuchardt [Sun, 19 Mar 2023 15:18:09 +0000 (16:18 +0100)]
efi_loader: fix device-path for USB devices

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

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

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

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

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

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
19 months agoMerge branch 'rpi-2023.04' of https://source.denx.de/u-boot/custodians/u-boot-raspberrypi
Tom Rini [Fri, 24 Mar 2023 21:00:41 +0000 (17:00 -0400)]
Merge branch 'rpi-2023.04' of https://source.denx.de/u-boot/custodians/u-boot-raspberrypi

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

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

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

Leverage this ability if the firmware supports it.

Adapted from the following raspberrypi Linux kernel commit:

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

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

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

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

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

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

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

Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
19 months agoMerge branch '2023-03-22-assorted-fixes'
Tom Rini [Wed, 22 Mar 2023 18:01:01 +0000 (14:01 -0400)]
Merge branch '2023-03-22-assorted-fixes'

- Assorted TI platform fixes, correct location of NXP boot format git
  repository, don't try and mount partitions that are too small to be
  ext4 as ext4, handle .bin files in .gitattributes, flush out panic
  messages for sure, and correct console location on Arm total_compute.

19 months agodma: ti: k3-udma: Fix channel hang on teardown
Vignesh Raghavendra [Wed, 8 Mar 2023 04:12:57 +0000 (09:42 +0530)]
dma: ti: k3-udma: Fix channel hang on teardown

Setting RX flow error handling will stall the channel until descriptors
are available to move RX data. Setting this bit causes issues when
tearing down ethernet DMA channel at the end of TFTP transfer as
unrelated network packets can cause teardown to stall indefinitely waiting
for driver to queue add more desc leading to channel hang with error
logs:
udma_stop_dev2mem TIMEOUT !
udma_stop_dev2mem: peer not stopped TIMEOUT !
udma_stop_dev2mem TIMEOUT !

Fix this by clearing rx_error_handling similar to how its done for UDMA
as part of udma_alloc_rchan_sci_req()

This fixes occasional TFTP Failures seen when downloading multiple files
one after the other on AM64/AM62 SoCs.

Fixes: 9a92851c33e8 ("dma: ti: k3-udma: Add BCDMA and PKTDMA support")
Reported-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
19 months agofs: ext4: check the minimal partition size to mount
Patrick Delaunay [Wed, 8 Mar 2023 08:49:54 +0000 (09:49 +0100)]
fs: ext4: check the minimal partition size to mount

No need to mount a too small partition to handle a EXT4 file system.

This patch add a test on partition size before to read the
SUPERBLOCK_SIZE buffer and avoid error latter in fs_devread() function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
19 months agogitattributes: Treat .bin files as binary.
Sebastian Andrzej Siewior [Fri, 10 Mar 2023 13:52:30 +0000 (14:52 +0100)]
gitattributes: Treat .bin files as binary.

Binary files, which are committed to a private fork of this repository,
will be subject to line feed substitution unless marked as binary.

Mark .bin files as binary.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
19 months agoconfigs: am62x_evm_a53_defconfig: Fix SF_DEFAULT_MODE
Nikhil M Jain [Sat, 11 Mar 2023 15:54:23 +0000 (21:24 +0530)]
configs: am62x_evm_a53_defconfig: Fix SF_DEFAULT_MODE

Setting sf default mode to 0x3 breaks sf update when we do SF read
through u-boot console.

This issue arises when we do a splash image through OSPI flash media,
to fix this set the default mode to 0x0.

Fixes: 04150400c967 ("configs: enable OSPI related configs in AM62x")
Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
19 months agoarm: total_compute: Remap console logs
annsai01 [Mon, 13 Mar 2023 08:57:15 +0000 (14:27 +0530)]
arm: total_compute: Remap console logs

Remapping console logs from soc uart2 (s1 terminal)
to css non-secure (uart_ap terminal)

Signed-off-by: Annam Sai Manisha <annam.saimanisha@arm.com>
19 months agoconfigs: am62: move stack and heap to HSM RAM
Kamlesh Gurudasani [Thu, 2 Mar 2023 14:10:47 +0000 (19:40 +0530)]
configs: am62: move stack and heap to HSM RAM

On high security devices, ROM enables firewalls to protect the OCSRAM
region access during bootup. Only after TIFS has started (and had
time to disable the OCSRAM firewall region) will we have write access to
the region.

This means we will need to move the stack & heap from OCSRAM to HSM RAM
and reduce the size of BSS and the SPL to allow it to fit properly.

To protect us from overflowing our ~256k of HSM SRAM, add limits and
check during the wakeup SPL build.

Signed-off-by: Kamlesh Gurudasani <kamlesh@ti.com>
19 months agoarm: mach-k3: am62: move scratch board area to HSM RAM
Kamlesh Gurudasani [Thu, 2 Mar 2023 14:10:46 +0000 (19:40 +0530)]
arm: mach-k3: am62: move scratch board area to HSM RAM

On high security devices, ROM enables firewalls to protect the OCSRAM
region access during bootup. Only after TIFS has started (and had
time to disable the OCSRAM firewall region) will we have write access to
the region.

So, move scratch board area to HSM RAM.

Signed-off-by: Kamlesh Gurudasani <kamlesh@ti.com>
19 months agoconsole: Use flush() before panic and reset
Tony Dinh [Wed, 15 Mar 2023 00:24:26 +0000 (17:24 -0700)]
console: Use flush() before panic and reset

To make sure the panic and the reset messages will go out, console flush() should be used.
Sleep periods do not work in early u-boot phase when timer driver is not initialized yet.

Reference: https://lists.denx.de/pipermail/u-boot/2023-March/512233.html

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
19 months agoREADME.mpc85xx-sd-spi-boot: Suggest the NXP boot format github repo
Fabio Estevam [Fri, 13 Jan 2023 01:04:46 +0000 (22:04 -0300)]
README.mpc85xx-sd-spi-boot: Suggest the NXP boot format github repo

As explained in the text at the bottom of the page
https://source.codeaurora.org/external/qoriq/qoriq-yocto-sdk/boot-format:

"QUIC repositories on this site will not receive any updates after
March 31, 2022, and will be deleted on March 31, 2023."

Point to the NXP boot format github repo instead.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
19 months agoMerge tag 'u-boot-amlogic-20230322' of https://source.denx.de/u-boot/custodians/u...
Tom Rini [Wed, 22 Mar 2023 13:21:41 +0000 (09:21 -0400)]
Merge tag 'u-boot-amlogic-20230322' of https://source.denx.de/u-boot/custodians/u-boot-amlogic

- odroid-go-ultra: setup PMIC regulators at board init

19 months agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sh
Tom Rini [Tue, 21 Mar 2023 15:52:55 +0000 (11:52 -0400)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sh

A single reset controller driver (part of the clock driver) fix
for v2023.04 release.

19 months agoMerge tag 'u-boot-rockchip-20230319' of https://source.denx.de/u-boot/custodians...
Tom Rini [Mon, 20 Mar 2023 21:52:42 +0000 (17:52 -0400)]
Merge tag 'u-boot-rockchip-20230319' of https://source.denx.de/u-boot/custodians/u-boot-rockchip

- Fix for rockchip timer driver;
- Fix for rk3568 and rk3588 boot device and clock driver;
- Fix for rk3568 reset handler;
- Fix for rk3568 sdhci DLL at 52MHz;

19 months agoclk: renesas: Pack reset identifier before look up
Marek Vasut [Sat, 18 Mar 2023 11:30:53 +0000 (12:30 +0100)]
clk: renesas: Pack reset identifier before look up

The reset identifier must be processed via MOD_CLK_PACK() before it is
used to look up register and bit within reset_regs or reset_clear_regs
arrays, otherwise completely bogus register and bit is picked from the
arrays, one which may even be out of range.

Fixes: 326e05c5e21 ("clk: renesas: Add and enable CPG reset driver")
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
19 months agoarm: dts: rockchip: rk3188-radxarock-u-boot: remove timer compatible replacement
Johan Jonker [Tue, 7 Mar 2023 15:32:00 +0000 (16:32 +0100)]
arm: dts: rockchip: rk3188-radxarock-u-boot: remove timer compatible replacement

The Rockchip timer driver has been renamed after the fall back compatible.
There's no need to replace the timer compatible in rk3188-radxarock-u-boot.dtsi
anymore, so remove.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
19 months agorockchip: timer: rockchip_timer: fix compatible and driver name
Johan Jonker [Tue, 7 Mar 2023 15:30:58 +0000 (16:30 +0100)]
rockchip: timer: rockchip_timer: fix compatible and driver name

In the binding for the Rockchip timer the compatible string
consists of a SoC orientated string and a fall back string
"rockchip,rk3288-timer", so remove all unneeded ones and
fix driver name.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
19 months agorockchip: sdhci: rk3568: bypass DLL when clk <= 52 MHz
Vasily Khoruzhick [Thu, 9 Mar 2023 01:28:30 +0000 (17:28 -0800)]
rockchip: sdhci: rk3568: bypass DLL when clk <= 52 MHz

For Rockchip platform, DLL bypass bit and start bit need to be set if
DLL is not locked.

With this change applied eMMC in my NanoPi R5S can run at 52 MHz.

Based on linux commit b75a52b0dda3 ("mmc: sdhci-of-dwcmshc: Update DLL
and pre-change delay for rockchip platform")

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
19 months agoRevert "arm64: dts: rk356x-u-boot: Drop combphy1 assigned-clocks/rates"
Vasily Khoruzhick [Tue, 7 Mar 2023 22:08:27 +0000 (14:08 -0800)]
Revert "arm64: dts: rk356x-u-boot: Drop combphy1 assigned-clocks/rates"

This reverts commit 5bec4b0de7851a254fb4447b3599a60f95550141.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
19 months agoclk: rockchip: rk3568: add stubs for CLK_PCIEPHY_REF clocks
Vasily Khoruzhick [Wed, 8 Mar 2023 05:16:10 +0000 (21:16 -0800)]
clk: rockchip: rk3568: add stubs for CLK_PCIEPHY_REF clocks

Device tree contains assigned-clock-rates property for these,
but default value will work just fine

Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
19 months agorockchip: include: configs: Remove unused SDRAM_BANK_SIZE
Jonas Karlman [Tue, 14 Mar 2023 00:38:37 +0000 (00:38 +0000)]
rockchip: include: configs: Remove unused SDRAM_BANK_SIZE

Remove unused SDRAM_BANK_SIZE define.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
19 months agorockchip: include: configs: Remove dangling comments
Jonas Karlman [Tue, 14 Mar 2023 00:38:34 +0000 (00:38 +0000)]
rockchip: include: configs: Remove dangling comments

This removes dangling comments that no longer serve a purpose and has
been left after conversion of defines to Kconfig option.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
19 months agommc: rockchip_dw_mmc: Fix get_mmc_clk return value
Jonas Karlman [Tue, 14 Mar 2023 00:38:32 +0000 (00:38 +0000)]
mmc: rockchip_dw_mmc: Fix get_mmc_clk return value

The get_mmc_clk ops is expected to set a clock rate and return the
configured rate as an unsigned value. However, if clk_set_rate fails,
e.g. using a fixed rate clock, a negative error value is returned.

The mmc core will treat this as a valid unsigned rate and tries to
configure a divider based on this bogus clock rate.

Use 0 as the return value when setting clock rate fails, the mmc core
will configure to use bypass mode instead of using a bogus divider.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
19 months agorockchip: tinker-rk3288: Use common BOOT_TARGET_DEVICES
Jonas Karlman [Tue, 14 Mar 2023 00:38:31 +0000 (00:38 +0000)]
rockchip: tinker-rk3288: Use common BOOT_TARGET_DEVICES

Building U-Boot for Tinker Board with USB or NET Kconfig option disabled
result in the following build error:

  In file included from include/configs/rk3288_common.h:29,
                   from include/configs/tinker_rk3288.h:14,
                   from include/config.h:3,
                   from include/common.h:16,
                   from env/common.c:10:
  include/config_distro_bootcmd.h:302:9: error: expected '}' before 'BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB'
    302 |         BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB
        |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  include/config_distro_bootcmd.h:302:9: note: in definition of macro 'BOOTENV_DEV_NAME_USB'
    302 |         BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB
        |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  include/configs/tinker_rk3288.h:21:9: note: in expansion of macro 'BOOTENV_DEV_NAME'
     21 |         func(USB, usb, 0) \
        |         ^~~~
  include/config_distro_bootcmd.h:454:25: note: in expansion of macro 'BOOT_TARGET_DEVICES'
    454 |         "boot_targets=" BOOT_TARGET_DEVICES(BOOTENV_DEV_NAME) "\0"
        |                         ^~~~~~~~~~~~~~~~~~~
  include/config_distro_bootcmd.h:474:9: note: in expansion of macro 'BOOTENV_BOOT_TARGETS'
    474 |         BOOTENV_BOOT_TARGETS \
        |         ^~~~~~~~~~~~~~~~~~~~
  include/configs/rk3288_common.h:40:9: note: in expansion of macro 'BOOTENV'
     40 |         BOOTENV
        |         ^~~~~~~
  include/env_default.h:122:9: note: in expansion of macro 'CFG_EXTRA_ENV_SETTINGS'
    122 |         CFG_EXTRA_ENV_SETTINGS
        |         ^~~~~~~~~~~~~~~~~~~~~~
  In file included from env/common.c:32:
  include/env_default.h:29:36: note: to match this '{'
     29 | const char default_environment[] = {
        |                                    ^
  make[2]: *** [scripts/Makefile.build:256: env/common.o] Error 1

The BOOT_TARGET_DEVICES defined in rockchip-common.h include the same
devices as defined in tinker_rk3288.h, remove the board specific one to
fix building with USB or NET option disabled.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
19 months agorockchip: rk3588: Add boot device detection
Jonas Karlman [Tue, 14 Mar 2023 00:38:30 +0000 (00:38 +0000)]
rockchip: rk3588: Add boot device detection

Enable SPL on RK3588 to detect which device it was booted from.
Fixes use of same-as-spl in u-boot,spl-boot-order prop.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
19 months agoclk: rockchip: rk3588: Fix clk_aux16m in clock driver
Jonas Karlman [Tue, 14 Mar 2023 00:38:27 +0000 (00:38 +0000)]
clk: rockchip: rk3588: Fix clk_aux16m in clock driver

The rate and error value is not returned for aux16m clocks, fix this.

Fixes: 7a474df74023 ("clk: rockchip: Add rk3588 clk support")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
19 months agoclk: rockchip: rk3568: Fix reset handler
Peter Geis [Tue, 14 Mar 2023 00:38:26 +0000 (00:38 +0000)]
clk: rockchip: rk3568: Fix reset handler

The reset handler for rk3568 is missing its private data. This leads to
an abort when a reset is triggered.

  => reset
  resetting ...
  "Synchronous Abort" handler, esr 0x96000045
  elr: 0000000000a2bc04 lr : 0000000000a2bbd4 (reloc)
  elr: 00000000eff9bc04 lr : 00000000eff9bbd4
  x0 : 00000000fdd20000 x1 : 0000000014000001
  x2 : 000000000000fdb9 x3 : 00000000edf77e88
  x4 : 00000000edf50e78 x5 : 00000000edf77530
  x6 : 000000000000001d x7 : 00000000edf8a1d0
  x8 : 00000000ffffffd8 x9 : 0000000000000008
  x10: 000000000000000d x11: 0000000000000006
  x12: 000000000001869f x13: 0000000086c290c5
  x14: 000000009118e878 x15: 0000000000000000
  x16: 00000000eff9bbb8 x17: 0000000012f8c119
  x18: 00000000edf50dc0 x19: 0000000000000000
  x20: 0000000000000001 x21: 0000000000000000
  x22: 00000000edf85900 x23: 0000000000000001
  x24: 00000000effe8bbc x25: 0000000000000000
  x26: 00000000edf85940 x27: 0000000000000000
  x28: 0000000000000000 x29: 00000000edf3c8e0

  Code: d65f03c0 d5033fbf b9400661 529d9502 (b8216802)
  Resetting CPU ...

Add the missing dev_set_priv to the rk3568 clk driver to fix this.

Fixes: 4a262feba3a5 ("rockchip: rk3568: add clock driver")
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Tested-by: Jagan Teki <jagan@amarulasolutions.com> # radxa-cm3
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
19 months agorockchip: rk3568-rock-3a: Sync device tree from linux
Jonas Karlman [Tue, 14 Mar 2023 00:38:24 +0000 (00:38 +0000)]
rockchip: rk3568-rock-3a: Sync device tree from linux

Running U-Boot from eMMC on a ROCK 3 Model A result in the following:

  U-Boot SPL 2023.04-rc3 (Mar 11 2023 - 17:24:48 +0000)
  Trying to boot from MMC1
  Card did not respond to voltage select! : -110
  spl: mmc init failed with error: -95
  SPL: failed to boot from all boot devices
  ### ERROR ### Please RESET the board ###

The sdhci node is missing in board device tree, sync device tree from
linux v6.3-rc1 to fix booting from eMMC. Also disable sdmmc2 and uart1
nodes related to using a WiFi and BT module in the M2 slot.

Fixes: b44c54f600ab ("arm64: dts: rockchip: rk3568: Add Radxa ROCK 3 Model A board support")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
19 months agorockchip: rk3568: Fix boot device detection
Jonas Karlman [Tue, 14 Mar 2023 00:38:23 +0000 (00:38 +0000)]
rockchip: rk3568: Fix boot device detection

The boot source node path for emmc is using the old sdhci name.
Replace with correct mmc name and also add same-as-spl to boot order.

Fixes: 0d61f8e5f1c0 ("rockchip: rk3568: add boot device detection")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
19 months agorockchip: Fix early use of bootph props
Jonas Karlman [Tue, 14 Mar 2023 00:38:21 +0000 (00:38 +0000)]
rockchip: Fix early use of bootph props

Running U-Boot on a ROCK 3 Model A result in the following:

  No serial driver found
  resetting ...
  no sysreset
  ### ERROR ### Please RESET the board ###

Replace bootph- props with u-boot,dm- props to fix this.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
19 months agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-coldfire
Tom Rini [Wed, 15 Mar 2023 16:03:17 +0000 (12:03 -0400)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-coldfire

19 months agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxi
Tom Rini [Wed, 15 Mar 2023 16:01:55 +0000 (12:01 -0400)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxi

Per Andre:

[T]hese two patches containing just devicetree updates for
Allwinner boards.
I was still hoping for a review, since we cannot import the files from
the Linux tree verbatim, but managed to write some filter script that
convinced me that the changes are fine.
The files are from Linux v6.2-rc2, but are identical to the v6.2
release.

19 months agoboard: m5253demo: remove floating point flash size calculation
Angelo Dureghello [Tue, 14 Mar 2023 23:43:07 +0000 (00:43 +0100)]
board: m5253demo: remove floating point flash size calculation

This board is using floating point arithmetic to display
the SST39VF6401B flash size.

This actually generates errors with toolchains without
appropriate sw fp math functions available.

SST39VF6401B is the only flash for wich the size is displayed,
it's size is 8192KB and floating point calculation seems not
needed. Removing it.

Signed-off-by: Angelo Dureghello <angelo@kernel-space.org>
19 months agom68k: add private libgcc ashrdi3
Angelo Dureghello [Tue, 14 Mar 2023 09:06:58 +0000 (10:06 +0100)]
m68k: add private libgcc ashrdi3

Add ashrdi3.c to private libgcc.

Signed-off-by: Angelo Dureghello <angelo@kernel-space.org>
19 months agoboard: amcore: fix config options namespace
Angelo Dureghello [Sat, 25 Feb 2023 23:16:39 +0000 (00:16 +0100)]
board: amcore: fix config options namespace

Remove CONFIG_ namespace options from .h, moving them to
defconfig, while changing non-defconfig options to CFG_ namespace.

Signed-off-by: Angelo Durgehello <angelo@kernel-space.org>
19 months agom68k: rename CONFIG_MCFTMR to CFG_MCFTMR
Angelo Dureghello [Sat, 25 Feb 2023 22:25:26 +0000 (23:25 +0100)]
m68k: rename CONFIG_MCFTMR to CFG_MCFTMR

This is not a Kconfig option so changing to _CFG.

Signed-off-by: Angelo Durgehello <angelo@kernel-space.org>
19 months agom68k: dts: stmark2: set correct compatible field for spi nor
Angelo Dureghello [Wed, 15 Feb 2023 22:54:18 +0000 (23:54 +0100)]
m68k: dts: stmark2: set correct compatible field for spi nor

Fix error:

Invalid chip select 0:1 (err=-19)

update spi nor "compatible" property with "jedec,spi-nor"
to have spi nor properly bound as a child device.

Signed-off-by: Angelo Durgehello <angelo@kernel-space.org>
19 months agoarch: enable private libgcc for m68k
Angelo Dureghello [Tue, 7 Feb 2023 22:45:03 +0000 (23:45 +0100)]
arch: enable private libgcc for m68k

This patch fixes u-boot hanging on the first printf("%x", val).

Some toolchains built without multilib enabled may produce
u-boot freezing on first u64 shift operation, as in
lib/vsprintf.c number() function.
Using our private libgcc solves the issue.

Setting private libgcc enabled at architecture level to avoid
similar issues, it should not harm.

Signed-off-by: Angelo Durgehello <angelo@kernel-space.org>
19 months agoboard: stmark2: fix clock value
Angelo Dureghello [Mon, 6 Feb 2023 21:54:37 +0000 (22:54 +0100)]
board: stmark2: fix clock value

Fix totally blank console at boot, clock value must be decimal,
as for the 30Mhz external crystal.

Fixes: 26e5944ec90c ("stmark2: Migrate CONFIG_SYS_EXTRA_OPTIONS to Kconfig")
Signed-off-by: Angelo Dureghello <angelo@kernel-space.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
19 months agom68k: add global variable sdhc_per_clk for m68k
Angelo Dureghello [Tue, 7 Feb 2023 20:28:00 +0000 (21:28 +0100)]
m68k: add global variable sdhc_per_clk for m68k

The FSL eSDHC controller supports two reference clocks. They are
platform clock and periperhal clock. The global variable sdhc_clk
has already been used for platform clock.
ColdFire also uses eSHDC controller, as in arm and powerpc,
so adding sdhc_per_clk to arch_global_data.

Signed-off-by: Angelo Durgehello <angelo@kernel-space.org>
19 months agom68k: use longword-based jumps
Angelo Dureghello [Fri, 24 Feb 2023 00:43:19 +0000 (01:43 +0100)]
m68k: use longword-based jumps

Increasing of binary size requires longword-based jumps.

Signed-off-by: Angelo Durgehello <angelo.dureghello@timesys.com>
19 months agoboard: amcore: fix u-boot mtd partition
Angelo Dureghello [Fri, 24 Feb 2023 00:42:39 +0000 (01:42 +0100)]
board: amcore: fix u-boot mtd partition

Signed-off-by: Angelo Dureghello <angelo@kernel-space.org>
19 months agorpi: Update the RPi Zero 2W DT filename
Peter Robinson [Tue, 28 Feb 2023 10:17:26 +0000 (10:17 +0000)]
rpi: Update the RPi Zero 2W DT filename

Update the Raspberry Pi Zero 2W device tree file
name to match what landed upstream.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
19 months agorpi: Copy eth PHY address from fw DT to loaded DT
Antoine Mazeas [Fri, 19 Aug 2022 08:56:46 +0000 (10:56 +0200)]
rpi: Copy eth PHY address from fw DT to loaded DT

Some Raspberry Pi 400 boards, specifically rev 1.1, have a different
address for the ethernet PHY device than what is provided by the kernel
DTB. The correct address is provided by the firmware, so we should carry
it over into the loaded device tree so that ethernet works on such boards.

Signed-off-by: Antoine Mazeas <antoine@karthanis.net>
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
19 months agorpi: Copy properties from firmware dtb to the loaded dtb
Antoine Mazeas [Fri, 19 Aug 2022 08:56:45 +0000 (10:56 +0200)]
rpi: Copy properties from firmware dtb to the loaded dtb

The RPI firmware adjusts several property values in the dtb it passes
to u-boot depending on the board/SoC revision. Inherit some of these
when u-boot loads a dtb itself. Specificaly copy:

* /model: The firmware provides a more specific string
* /memreserve: The firmware defines a reserved range, better keep it
* emmc2bus and pcie0 dma-ranges: The C0T revision of the bcm2711 Soc (as
  present on rpi 400 and some rpi 4B boards) has different values for
  these then the B0T revision. So these need to be adjusted to boot on
  these boards
* blconfig: The firmware defines the memory area where the blconfig
  stored. Copy those over so it can be enabled.
* /chosen/kaslr-seed: The firmware generates a kaslr seed, take advantage
  of that.

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
Signed-off-by: Antoine Mazeas <antoine@karthanis.net>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
19 months agoARM: meson: odroid-go-ultra: setup PMIC regulators are board init
Neil Armstrong [Fri, 10 Feb 2023 10:25:07 +0000 (11:25 +0100)]
ARM: meson: odroid-go-ultra: setup PMIC regulators are board init

The Odroid Go Ultra has 2 chained PMICs RK818 and RK818, and needs
an adjustment on the BUCK and LDO values.

Add the initial regulators values in -u-boot.dtsi & run the initial
regulator setup in a new odroid-go-ultra board.

Proper OTG and BOOST regulators are still missing to have USB-A
host properly working.

Link: https://lore.kernel.org/r/20230210-u-boot-odroid-go-ultra-pmics-setup-v1-1-1f16d62b76af@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
19 months agoPrepare v2023.04-rc4
Tom Rini [Tue, 14 Mar 2023 00:52:48 +0000 (20:52 -0400)]
Prepare v2023.04-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>
19 months agoMerge tag 'efi-2023-04-rc4' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Mon, 13 Mar 2023 15:39:21 +0000 (11:39 -0400)]
Merge tag 'efi-2023-04-rc4' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2023-04-rc4

Documentation:

* man-page for panic command

UEFI:

* Correct parameter check for SetVariable()

Other:

 * Provide unit test for crc8

19 months agoefi_loader: describe term_get_char()
Heinrich Schuchardt [Fri, 3 Mar 2023 21:04:26 +0000 (22:04 +0100)]
efi_loader: describe term_get_char()

Add a function description.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
19 months agoefi_loader: update SetVariable attribute check
Masahisa Kojima [Tue, 21 Feb 2023 02:33:17 +0000 (11:33 +0900)]
efi_loader: update SetVariable attribute check

UEFI specification v2.10 says that
EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is deprecated and
EFI_UNSUPPORTED should be returned in SetVariable variable service.
Current implementation returns EFI_INVALID_PARAMETER,
let's fix the return value.

Together with above change, this commit also updates the SetVariable
attribute check to be aligned with the EDK2 reference implementation.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
19 months agodoc: man-page for panic command
Heinrich Schuchardt [Fri, 3 Mar 2023 21:48:27 +0000 (22:48 +0100)]
doc: man-page for panic command

Provide a man-page for the panic command.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agodoc: uefi: fix links
Vincent Stehlé [Mon, 20 Feb 2023 14:37:29 +0000 (15:37 +0100)]
doc: uefi: fix links

Fix a couple of links so that they are rendered correctly with sphinx.

Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
19 months agotest: unit test for crc8
Heinrich Schuchardt [Wed, 22 Feb 2023 01:10:20 +0000 (02:10 +0100)]
test: unit test for crc8

Add a unit test for the crc8() function.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Sat, 11 Mar 2023 00:10:14 +0000 (19:10 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-usb

Two minimal Kconfig/Makefile fixes for USB.

20 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-sh
Tom Rini [Sat, 11 Mar 2023 00:09:59 +0000 (19:09 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-sh

Assorted Renesas fixes below, namely MMC clocking breakage fix, clock
Kconfig fix, pin control unused symbols removal, and sysinfo fix and
enablement on now fixed platforms.

20 months agoMerge tag 'dm-pull-10mar23' of https://source.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Fri, 10 Mar 2023 21:01:52 +0000 (16:01 -0500)]
Merge tag 'dm-pull-10mar23' of https://source.denx.de/u-boot/custodians/u-boot-dm

fixes and tests for the fdt command

20 months agoARM: dts: renesas: Enable sysinfo on R-Car D3 Draak
Tam Nguyen [Mon, 27 Feb 2023 22:58:48 +0000 (23:58 +0100)]
ARM: dts: renesas: Enable sysinfo on R-Car D3 Draak

Enable support for sysinfo on R-Car D3 Draak board. The sysinfo is used
e.g. to access and decode board-specific information and then in turn
used by board-info to print those information.

Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Tam Nguyen <tam.nguyen.xa@renesas.com>
Signed-off-by: Hai Pham <hai.pham.ud@renesas.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
[Marek: Drop compatible from I2C node, this is in r8a77995.dtsi already.
        Drop status = "okay" from EEPROM node.
Add dts: tag.
Fix Kconfig EEPROM address to be 0x50 and match the DT, sync config.]

20 months agoARM: dts: renesas: Enable sysinfo on R-Car V3H Condor/Condor-I
Tam Nguyen [Mon, 27 Feb 2023 22:58:47 +0000 (23:58 +0100)]
ARM: dts: renesas: Enable sysinfo on R-Car V3H Condor/Condor-I

Add new sysinfo IDs for R-Car V3H Condor/Condor-I .

Enable support for sysinfo on R-Car V3H Condor/Condor-I. The sysinfo is
used e.g. to access and decode board-specific information and then in
turn used by board-info to print those information.

Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Tam Nguyen <tam.nguyen.xa@renesas.com>
Signed-off-by: Hai Pham <hai.pham.ud@renesas.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
[Marek: Drop compatible from I2C node, this is in r8a77980.dtsi already.
        Drop status = "okay" from EEPROM node.
Add dts: tag.
Update the commit message, note the new sysinfo IDs.
Fix Kconfig EEPROM address to be 0x50 and match the DT, sync config.]

20 months agosysinfo: rcar3: Fix Draak and Eagle board code
Tam Nguyen [Mon, 27 Feb 2023 22:58:46 +0000 (23:58 +0100)]
sysinfo: rcar3: Fix Draak and Eagle board code

Correct the board code ID based on the hardware documentation

Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Tam Nguyen <tam.nguyen.xa@renesas.com>
Signed-off-by: Hai Pham <hai.pham.ud@renesas.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
20 months agopinctrl: renesas: Drop non-existent PFC info table entries
Marek Vasut [Tue, 28 Feb 2023 06:25:53 +0000 (07:25 +0100)]
pinctrl: renesas: Drop non-existent PFC info table entries

Remove PFC info table entries which are never instantiated,
since there are no drivers for those. No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
20 months agoclk: renesas: Always select DM_RESET to prevent inobvious failure of rst_gen3 subdriver
Marek Vasut [Tue, 28 Feb 2023 21:16:02 +0000 (22:16 +0100)]
clk: renesas: Always select DM_RESET to prevent inobvious failure of rst_gen3 subdriver

The CLK_RCAR_GEN3 registers two subdrivers, clk_gen3 and rst_gen3.
The former depends on the clock framework, which is always enabled
in this context of clock framework driver, while the later depends
on reset framework which may not always be enabled.

Ensure the reset framework is also always enabled to prevent inobvious
early boot time bind failure of the CPG driver, which leads to system
showing no activity and is difficult to debug.

Note that one possible approach to debug this is to use CONFIG_DEBUG_UART
and add debug printascii()s into the drivers/clk/renesas/clk-rcar-gen3.c .

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
20 months agommc: renesas-sdhi: Add proper probe error fail path
Marek Vasut [Mon, 27 Feb 2023 22:49:28 +0000 (23:49 +0100)]
mmc: renesas-sdhi: Add proper probe error fail path

In case one of the calls in probe fail, trigger a fail path and
undo all the steps done in probe until the point of failure.
The current implementation failed to stop controller clock and
free claimed clock, so fix that. Furthermore, print return code
in error prints for easier debugging.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
20 months agommc: renesas-sdhi: Always configure default SDnH clock rate to 800 MHz
Marek Vasut [Mon, 27 Feb 2023 22:49:27 +0000 (23:49 +0100)]
mmc: renesas-sdhi: Always configure default SDnH clock rate to 800 MHz

The prior stage bootloader might have left the SDnCKCR register in completely
arbitrary state before passing control to U-Boot, which includes the register
being populated with incorrect values. Currently the SDHI driver will attempt
to use clock framework to configure SDn clock, which may fail in case SDnCKCR
contains invalid values for the SDnH clock, because the clock framework would
not be able to determine SDnH clock rate and would get -EINVAL instead, which
in turn would not allow the clock framework to determine the correct SDn clock
divider ratio.

This failure occurs specifically in case SDnCKCR reads back 0x209 .

Correct the problem by first setting default SDnH clock rate to 800 MHz, thus
assuring the SDnCKCR SDnH bits are correct, and only afterward set up the SDn
clock rate to default 200 MHz.

Note that the SDHI driver may reconfigure SDnH clock later based on IOS
settings obtained from the attached card, the 800 MHz set up here is only
the default value.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
20 months agousb: move CONFIG_USB_HUB_DEBOUNCE_TIMEOUT to USB
Heinrich Schuchardt [Wed, 25 Jan 2023 18:40:16 +0000 (19:40 +0100)]
usb: move CONFIG_USB_HUB_DEBOUNCE_TIMEOUT to USB

This configuration setting is only relevant if the board supports USB.
It should not be in the main menu but in the USB menu.

The setting is only relevant in USB host mode.

Fixes: 5454dea3137d ("usb: hub: allow to increase HUB_DEBOUNCE_TIMEOUT")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
20 months agousb: USB hubs require host mode
Heinrich Schuchardt [Wed, 25 Jan 2023 18:40:15 +0000 (19:40 +0100)]
usb: USB hubs require host mode

USB hubs run in host mode not in gadget mode. Hence, compiling usb_hub.c
should not be selected by CONFIG_USB_GADGET.

Suggested-by: Marek Vasut <marex@denx.de>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Marek Vasut <marex@denx.de>
20 months agotest: cmd: fdt: Test fdt bootcpu
Marek Vasut [Thu, 2 Mar 2023 03:08:40 +0000 (04:08 +0100)]
test: cmd: fdt: Test fdt bootcpu

Add 'fdt bootcpu' test which works as follows:
- Create basic FDT, map it to sysmem
- Print the FDT bootcpu
- Set the FDT bootcpu and read the value back using 'fdt header get'
- Perform the previous step twice to validate bootcpu overwrite

The test case can be triggered using:
"
./u-boot -Dc 'ut fdt'
"
To dump the full output from commands used during test, add '-v' flag.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agotest: cmd: fdt: Test fdt rm
Marek Vasut [Thu, 2 Mar 2023 03:08:38 +0000 (04:08 +0100)]
test: cmd: fdt: Test fdt rm

Add 'fdt rm' test which works as follows:
- Create fuller FDT, map it to sysmem
- Selectively delete nodes or properties by both path and aliases
- Verify created nodes or properties using fdt print command

The test case can be triggered using:
"
./u-boot -Dc 'ut fdt'
"
To dump the full output from commands used during test, add '-v' flag.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agotest: cmd: fdt: Test fdt mknode
Marek Vasut [Thu, 2 Mar 2023 03:08:37 +0000 (04:08 +0100)]
test: cmd: fdt: Test fdt mknode

Add 'fdt mknode' test which works as follows:
- Create fuller FDT, map it to sysmem
- Create node either in / or subnode
- Attempt to create node over existing node, which fails
- Attempt to create subnodes in non-existing nodes or aliases
- Verify created nodes using fdt list command

The test case can be triggered using:
"
./u-boot -Dc 'ut fdt'
"
To dump the full output from commands used during test, add '-v' flag.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agotest: cmd: fdt: Test fdt set
Marek Vasut [Thu, 2 Mar 2023 03:08:36 +0000 (04:08 +0100)]
test: cmd: fdt: Test fdt set

Add 'fdt set' test which works as follows:
- Create fuller FDT, map it to sysmem
- Set either existing property to overwrite it, or new property
- Test setting both single properties as well as string and integer arrays
- Test setting to non-existent nodes and aliases
- Verify set values using 'fdt get value'

The test case can be triggered using:
"
./u-boot -Dc 'ut fdt'
"
To dump the full output from commands used during test, add '-v' flag.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agotest: cmd: fdt: Test fdt get size
Marek Vasut [Thu, 2 Mar 2023 03:08:35 +0000 (04:08 +0100)]
test: cmd: fdt: Test fdt get size

Add 'fdt get size' test which works as follows:
- Create fuller FDT, map it to sysmem
- Get size of various properties
- Get node count of available nodes
- Test non-existent nodes and properties

The test case can be triggered using:
"
./u-boot -Dc 'ut fdt'
"
To dump the full output from commands used during test, add '-v' flag.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agotest: cmd: fdt: Test fdt get addr
Marek Vasut [Thu, 2 Mar 2023 03:08:34 +0000 (04:08 +0100)]
test: cmd: fdt: Test fdt get addr

Add 'fdt get addr' test which works as follows:
- Create fuller FDT, map it to sysmem
- Get address of various properties
- Compare addresses calculated by UT and fdt command

This test is special in that it has to go through gruesome remapping scheme
where the test calculates:
- pointer offsets of the generated FDT root and the property being tested
- map_sysmem() result of environment variable "fdtaddr" and the one set
  by the test matching address of property being tested
- difference between the later and the former, to obtain offset of the
  DT property from start of DT
The offsets must match in both the UT and the tested U-Boot, if they do
not, the test fails.

The test case can be triggered using:
"
./u-boot -Dc 'ut fdt'
"
To dump the full output from commands used during test, add '-v' flag.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agotest: cmd: fdt: Test fdt get name
Marek Vasut [Thu, 2 Mar 2023 03:08:33 +0000 (04:08 +0100)]
test: cmd: fdt: Test fdt get name

Add 'fdt get name' test which works as follows:
- Create fuller FDT, map it to sysmem
- Get name of / node 0, 1 and /clk-test node 0
- Compare output and validate the node name
- Get name of / node 2 and /clk-test node 1
- Compare output and validate the node is not present
- Get name of / node -1 and /clk-test node -1
- Compare output and validate the node name equals node 0 name
- Check nonexistent node, verify the command errors out

The test case can be triggered using:
"
./u-boot -Dc 'ut fdt'
"
To dump the full output from commands used during test, add '-v' flag.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agotest: cmd: fdt: Test fdt resize
Marek Vasut [Thu, 2 Mar 2023 03:08:31 +0000 (04:08 +0100)]
test: cmd: fdt: Test fdt resize

Add 'fdt resize' test which works as follows:
- Create simple FDT with extra size 0, map it to sysmem
- 'resize' the FDT by 0x2000 bytes
- Verify the new space has been added to the FDT

The test case can be triggered using:
"
./u-boot -Dc 'ut fdt'
"
To dump the full output from commands used during test, add '-v' flag.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agotest: cmd: fdt: Test fdt move
Marek Vasut [Thu, 2 Mar 2023 03:08:30 +0000 (04:08 +0100)]
test: cmd: fdt: Test fdt move

Add 'fdt move' test which works as follows:
- Create simple FDT, map it to sysmem
- 'move' the FDT into new zeroed out sysmem location
- Verify newly active FDT is in the new location
- Compare both locations

The test case can be triggered using:
"
./u-boot -Dc 'ut fdt'
"
To dump the full output from commands used during test, add '-v' flag.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agotest: cmd: fdt: Test both string and integer arrays in 'fdt get value'
Marek Vasut [Thu, 2 Mar 2023 03:08:29 +0000 (04:08 +0100)]
test: cmd: fdt: Test both string and integer arrays in 'fdt get value'

The 'fdt get value' subcommand now supports extraction of integer value
from integer arrays, add test for it, including a test for special case
unindexed integer array read, which is handled as hash and treated as a
long string instead of integer.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agotest: cmd: fdt: Test alias resolution in 'fdt get value'
Marek Vasut [Thu, 2 Mar 2023 03:08:28 +0000 (04:08 +0100)]
test: cmd: fdt: Test alias resolution in 'fdt get value'

The 'fdt' command help contains the following note:
"
Dereference aliases by omitting the leading '/', e.g. fdt print ethernet0.
"
Add test for it.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agotest: cmd: fdt: Generate fuller DT internally and switch fdt get value to it
Marek Vasut [Thu, 2 Mar 2023 03:08:27 +0000 (04:08 +0100)]
test: cmd: fdt: Generate fuller DT internally and switch fdt get value to it

Implement function to generate internal test DT fragment and switch
the 'fdt get value' test to this instead of depending on the sandbox
DT. Rename clk-test node to test-node node. This FDT fragment will be
reused by other tests. No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agotest: cmd: fdt: Rename fdt_test_get() to fdt_test_get_value()
Marek Vasut [Thu, 2 Mar 2023 03:08:26 +0000 (04:08 +0100)]
test: cmd: fdt: Rename fdt_test_get() to fdt_test_get_value()

The 'fdt get' command has a 'get value' subcommand, rename the fdt_test_get()
to fdt_test_get_value() to avoid confusion about what it is testing. There is
currently no get 'get name', 'get addr', 'get size' subcommand test.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agotest: cmd: fdt: Rename fdt_test_resize() to fdt_test_addr_resize()
Marek Vasut [Thu, 2 Mar 2023 03:08:25 +0000 (04:08 +0100)]
test: cmd: fdt: Rename fdt_test_resize() to fdt_test_addr_resize()

The 'fdt' command has a 'resize' subcommand, rename the fdt_test_resize()
to fdt_test_addr_resize() to avoid confusion about what it is testing.
There is currently no resize test.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agotest: Add ut_assert_nextline_empty() empty line helper
Marek Vasut [Thu, 2 Mar 2023 03:08:24 +0000 (04:08 +0100)]
test: Add ut_assert_nextline_empty() empty line helper

Add helper macro to test for empty lines, which is an inobvious
wrapper around ut_assert_nextline("%s", "") .

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agocmd: fdt: Add support for integer arrays in fdt get value with index
Marek Vasut [Thu, 2 Mar 2023 03:08:23 +0000 (04:08 +0100)]
cmd: fdt: Add support for integer arrays in fdt get value with index

Currently any integer array value is set as long up-to-40 character
hexadecimal string into environment variable when extracted from an
FDT using 'fdt get value path prop index', because the support for
handling integer arrays is not implemented, and fdt_value_env_set()
code falls back into the hash handling behavior instead.

Implement this support simply by checking whether user supplied any
index. If index is set and the property length is multiple of four,
then this is an integer array, and the code would extract value at
specified index.

There is a subtle change where default index is set to -1 instead of 0.
This is OK, since the only place which checks for index to be less or
equal zero is the string array handling code in fdt_value_env_set() and
that code would work perfectly well with index -1 too.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agocmd: fdt: Map address returned from fdt get addr to sysmem
Marek Vasut [Thu, 2 Mar 2023 03:08:22 +0000 (04:08 +0100)]
cmd: fdt: Map address returned from fdt get addr to sysmem

The address returned from 'fdt get addr' command must be mapped
into sysmem, as this is a working FDT. Access to this address
without mapping it would lead to crash e.g. in sandbox.

The following command triggers the crash:
"
./u-boot -Dc 'fdt addr $fdtcontroladdr ; fdt get addr var / compatible ; md $var'
"

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agocmd: fdt: Handle 64bit pointers in fdt get addr
Marek Vasut [Thu, 2 Mar 2023 03:08:21 +0000 (04:08 +0100)]
cmd: fdt: Handle 64bit pointers in fdt get addr

The command assumed 32bit pointers so far, with 64bit pointer the
command would overwrite a piece of stack. Fix it by extending the
array size to cater for 64bit pointer, and use snprintf() to avoid
writing past the end of the array ever again.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agocmd: fdt: Align checksign parameter names in help text
Marek Vasut [Thu, 2 Mar 2023 03:08:20 +0000 (04:08 +0100)]
cmd: fdt: Align checksign parameter names in help text

The help text references 'addr' as an optional key start address,
but the explanation references the same as 'start', make sure they
both read as 'addr'. Also update the abbreviated 'addr' in the
explanation to 'address'.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agocmd: fdt: Check argc before accessing argv in fdt memory
Marek Vasut [Thu, 2 Mar 2023 03:08:19 +0000 (04:08 +0100)]
cmd: fdt: Check argc before accessing argv in fdt memory

On case 'fdt memory' is invoked without parameters, argv[2]/argv[3]
is not valid and this command would SEGFAULT in sandbox environment.
Add missing argc test to avoid the crash and rather print usage help
message.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agocmd: fdt: Check argc before accessing argv in fdt bootcpu
Marek Vasut [Thu, 2 Mar 2023 03:08:18 +0000 (04:08 +0100)]
cmd: fdt: Check argc before accessing argv in fdt bootcpu

On case 'fdt bootcpu' is invoked without parameters, argv[2] is not
valid and this command would SEGFAULT in sandbox environment. Add
missing argc test to avoid the crash and rather print usage help
message.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agocmd: fdt: Fix fdt rsvmem behavior on non-existent index and error message space
Marek Vasut [Thu, 2 Mar 2023 03:08:17 +0000 (04:08 +0100)]
cmd: fdt: Fix fdt rsvmem behavior on non-existent index and error message space

In case 'fdt rsvmem delete index' is passed a non-existent index, one
which does not exist in 'fdt rsvmem print', then the following command
triggers a print of help message for 'fdt' command instead of erroring
out:
=> fdt rsvmem delete 1234
This is because the subcommand errornously returns 'err' instead of
CMD_RET_FAILURE, fix it. Furthermore, align the number of spaces past
fdt_del_mem_rsv() and fdt_add_mem_rsv() in error message with the rest
of the code.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agocmd: fdt: Fix fdt rm behavior on non-existent property and error message space
Marek Vasut [Thu, 2 Mar 2023 03:08:16 +0000 (04:08 +0100)]
cmd: fdt: Fix fdt rm behavior on non-existent property and error message space

In case an FDT contains a node '/test-node@1234' , with no property
called 'noprop' in that node, the following command triggers a print
of help message for 'fdt' command instead of erroring out:
=> fdt rm /test-node@1234 noprop
This is because the subcommand errornously returns 'err' instead of
CMD_RET_FAILURE, fix it. Furthermore, align the number of spaces past
fdt_delprop() in error message with the rest of the code.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agocmd: fdt: Fix handling of empty properties for fdt get addr and fdt get size
Marek Vasut [Thu, 2 Mar 2023 03:08:15 +0000 (04:08 +0100)]
cmd: fdt: Fix handling of empty properties for fdt get addr and fdt get size

It is perfectly valid to request an address or size of FDT property
without value, the only special case if requesting of the value of
FDT property without value. Invert the test such, that properties
without value still set the variable from 'fdt get addr/size' to
address of the property or size of the property, where the later
is 0.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agocmd: fdt: Import is_printable_string() from DTC to fix u32 misprint
Marek Vasut [Thu, 2 Mar 2023 03:08:14 +0000 (04:08 +0100)]
cmd: fdt: Import is_printable_string() from DTC to fix u32 misprint

Import is_printable_string() implementation from DTC 1.7.0 as of
DTC commit 039a994 ("Bump version to v1.7.0") . This fixes a print
of u32 property which so far used to be printed as string by U-Boot
fdt print command.

We might see the case where the parsed property value, in this case
it is a 32-bit integer, identified as a printable string or a null byte
(concatenated strings) because of its last character happens to be:
  0x00 (null character), 0xB (vertical tab character) or
  0x10 (line feed character)
In this situation, if the string is identified as printable string,
it will be displayed as character instead of hex value

When the isprint() condition is true, there are two possibilities:
  1) The character is ASCII character (except the first 32)
  2) The character is extended ASCII character

For example,
NG property in device tree:
    clock-frequency = <16640000>;
by default, would be displayed as
    clock-frequency = "", "ýè";
and with this patch applied, would be displayed as
    clock-frequency = <0x00fde800>;

Full investigation was done by Nam and Hai, patch reworked by Marek
to use common code from DTC.

Signed-off-by: Hai Pham <hai.pham.ud@renesas.com>
Signed-off-by: Nam Nguyen <nam.nguyen.yh@renesas.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Mon, 6 Mar 2023 19:56:05 +0000 (14:56 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- mvebu: Use 4K sector for Thecus N2350 SPI flash (Tony)