]> git.ipfire.org Git - thirdparty/u-boot.git/log
thirdparty/u-boot.git
17 months agorockchip: rk3399: grf: Fix enum typos for UART2
Chen-Yu Tsai [Tue, 4 Feb 2025 17:29:53 +0000 (01:29 +0800)] 
rockchip: rk3399: grf: Fix enum typos for UART2

In the GRF header file, some instances of UART2 pinmux are prefixed with
"GRF_UART2DBG" while others have "GRF_UART2DGB".

Since UART2 is the default console UART and used for debugging, it is
more likely the name should be UART2DBG.

Fix the ones that are wrong.

Fixes: a2c08df3813b ("pinctrl: add driver for rk3399")
Fixes: fa72de10452c ("rockchip: arm64: rk3399: move grf register definitions to grf_rk3399.h")
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Paul Kocialkowski <paulk@sys-base.io>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
17 months agoRevert "rockchip: rk3399: Fix TPL build of bob and kevin"
Jonas Karlman [Sat, 8 Feb 2025 22:49:40 +0000 (22:49 +0000)] 
Revert "rockchip: rk3399: Fix TPL build of bob and kevin"

These power rails must be on very early for the U-Boos TPL banner to be
show over debug UART.

This reverts commit 4576e65a5d6b10fd207c3a44061676ce0220d794.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
17 months agorockchip: rk3399-gru: Enable TPL_GPIO for bob and kevin
Jonas Karlman [Sat, 8 Feb 2025 22:49:39 +0000 (22:49 +0000)] 
rockchip: rk3399-gru: Enable TPL_GPIO for bob and kevin

The PP1500 and PP3000 power rails must be on very early for the U-Boot
TPL banner to be shown on debug UART.

Enable TPL_GPIO Kconfig option for bob and kevin to allow use of
spl_gpio.h functions in TPL.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
17 months agoRevert "rockchip: rk3399: Drop unneeded bob and kevin board specific code"
Jonas Karlman [Sat, 8 Feb 2025 22:49:38 +0000 (22:49 +0000)] 
Revert "rockchip: rk3399: Drop unneeded bob and kevin board specific code"

These power rails must be on very early for the U-Boos SPL banner to be
show over debug UART.

This reverts commit af518a1dfe637cb4dc486d7a832585e4a48bc970.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
17 months agoboard: verdin-am62: add dram_init_banksize
Stefan Eichenberger [Mon, 10 Feb 2025 07:27:47 +0000 (08:27 +0100)] 
board: verdin-am62: add dram_init_banksize

Add the dram_init_banksize function to the board file to properly set
DRAM memory sizes during boot.

The commit bc07851897bd ("board: ti: Pull redundant DDR functions to a
common location and Fixup DDR size when ECC is enabled") relocated the
dram_init_banksize function from architecture specific initialization to
the TI board initialization code. As a result, boards relying on the
previous setup now require this function to be defined within their
board file to handle DRAM sizing correctly.

Without this function defined the following error appears during boot:
    ERROR: Failed to allocate 0x1000 bytes below 0x0.

Fixes: bc07851897bd ("board: ti: Pull redundant DDR functions to a common location and Fixup DDR size when ECC is enabled")
Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
Acked-by: Francesco Dolcini <francesco.dolcini@toradex.com>
17 months agogpio: pca953x: support pcal6408 and pcal6416
Emanuele Ghidoli [Tue, 11 Feb 2025 21:06:00 +0000 (22:06 +0100)] 
gpio: pca953x: support pcal6408 and pcal6416

Add support to NXP GPIO expanders pcal6408, documented at [1], and
pcal6416, documented at [2].

[1] https://www.nxp.com/docs/en/data-sheet/PCAL6408A.pdf
[2] https://www.nxp.com/docs/en/data-sheet/PCAL6416A.pdf

Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
17 months agonet: designware: Add npcm8xx sgmii pcs support
Jim Liu [Tue, 11 Feb 2025 02:02:01 +0000 (10:02 +0800)] 
net: designware: Add npcm8xx sgmii pcs support

The PCS exists only in GMAC1 and relates to SGMII interface and
is used to control the SGMII PHY.

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
[trini: Adjust slightly for white space and to move 'start' to within if
        block]

17 months agoboard: verdin-am62: add dram_init_banksize
Stefan Eichenberger [Mon, 10 Feb 2025 07:27:47 +0000 (08:27 +0100)] 
board: verdin-am62: add dram_init_banksize

Add the dram_init_banksize function to the board file to properly set
DRAM memory sizes during boot.

The commit bc07851897bd ("board: ti: Pull redundant DDR functions to a
common location and Fixup DDR size when ECC is enabled") relocated the
dram_init_banksize function from architecture specific initialization to
the TI board initialization code. As a result, boards relying on the
previous setup now require this function to be defined within their
board file to handle DRAM sizing correctly.

Without this function defined the following error appears during boot:
    ERROR: Failed to allocate 0x1000 bytes below 0x0.

Fixes: bc07851897bd ("board: ti: Pull redundant DDR functions to a common location and Fixup DDR size when ECC is enabled")
Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
Acked-by: Francesco Dolcini <francesco.dolcini@toradex.com>
17 months agoboard: nuvoton: use an event to replace last_stage_init()
Michael Chang [Mon, 10 Feb 2025 02:37:10 +0000 (10:37 +0800)] 
board: nuvoton: use an event to replace last_stage_init()

Add a new event which handles this function refer to commit
("91caa3bb89b1 event: Use an event to replace last_stage_init()")

Signed-off-by: Michael Chang <zhang971090220@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
17 months agotools: Fix potential null-deref with result of strtok_r
Maks Mishin [Sun, 9 Feb 2025 15:46:21 +0000 (18:46 +0300)] 
tools: Fix potential null-deref with result of strtok_r

Return value of a function 'strtok_r' is dereferenced at kwbimage.c:1655
without checking for NULL, but it is usually checked for this function.

Signed-off-by: Maks Mishin <maks.mishinFZ@gmail.com>
17 months agou-boot-initial-env: Add missing dependencies
Tom Rini [Sun, 9 Feb 2025 14:34:09 +0000 (08:34 -0600)] 
u-boot-initial-env: Add missing dependencies

When performing a build consisting of only a defconfig target and then
this tool, we were missing two dependencies. Add them.

Signed-off-by: Tom Rini <trini@konsulko.com>
17 months agofs/erofs: fix an integer overflow in symlink resolution
Gao Xiang [Thu, 13 Feb 2025 11:28:47 +0000 (19:28 +0800)] 
fs/erofs: fix an integer overflow in symlink resolution

See the original report [1], otherwise len + 1 will be overflowed.

Note that EROFS archive can record arbitary symlink sizes in principle,
so we don't assume a short number like 4096.

[1] https://lore.kernel.org/r/20250210164151.GN1233568@bill-the-cat

Fixes: 830613f8f5bb ("fs/erofs: add erofs filesystem support")
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
17 months agoled: fix coverity scan error
Heiko Schocher [Wed, 12 Feb 2025 09:10:55 +0000 (10:10 +0100)] 
led: fix coverity scan error

The following was reported by Covervity scan:

*** CID 541279:    (TAINTED_SCALAR)
/drivers/led/led-uclass.c: 284 in led_get_function_name()
278                     if (!ret) {
279                             snprintf(uc_plat->name, LED_MAX_NAME_SIZE,
280                                      "%s:%s-%d",
281                                      cp ? "" : led_colors[color],
282                                      func ? func : "", enumerator);
283                     } else {
>>>     CID 541279:    (TAINTED_SCALAR)
>>>     Using tainted variable "color" as an index into an array "led_colors".

Fix it.
Addresses-Coverity-ID: 541279 (TAINTED_SCALAR)
Link: https://lists.denx.de/pipermail/u-boot/2025-February/580250.html
Signed-off-by: Heiko Schocher <hs@denx.de>
17 months agotools: use cryptographically safe RNG
Heinrich Schuchardt [Tue, 11 Feb 2025 13:55:22 +0000 (14:55 +0100)] 
tools: use cryptographically safe RNG

The PRNG implementing the random() function only has 2^31 states and
therefore is unsafe to use for cryptography. Use arc4random() instead.

Fixes: cc34f04efd63 ("tools: image-host.c: use random instead of rand")
Addresses-Coverity-ID: 312953 Calling risky function
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
17 months agopower: regulator: tps65941: Fix voltage calculation for ldo
Udit Kumar [Tue, 11 Feb 2025 17:51:58 +0000 (23:21 +0530)] 
power: regulator: tps65941: Fix voltage calculation for ldo

As per TRM[0] Section 8.7.1 "TPS6594-Q1 Registers", LDOx_Vout
bit 6-1, define the NVM voltage settings.
Along side table 8-4 of above TRM, shows voltage to value mapping.

Driver wrongly using bits 5-1 to calculate voltage, and to convert
voltage to value driver was using buck's calculation.
So fix those calculation.

[0]: https://www.ti.com/lit/ds/symlink/tps6594-q1.pdf

Fixes: 5d7dbd22cf7d ("power: regulator: tps65941: use function callbacks for conversion ops")
Signed-off-by: Udit Kumar <u-kumar1@ti.com>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
17 months agotpm: unconstify tpm_tis_chip_data
Ilias Apalodimas [Thu, 6 Feb 2025 09:28:56 +0000 (11:28 +0200)] 
tpm: unconstify tpm_tis_chip_data

The struct contains an iomem pointer that we later remap and update.
Remove const from the struct definition.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
17 months agoMerge tag 'u-boot-at91-2025.07-a' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Tue, 18 Feb 2025 13:59:59 +0000 (07:59 -0600)] 
Merge tag 'u-boot-at91-2025.07-a' of https://source.denx.de/u-boot/custodians/u-boot-at91 into next

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

This feature set includes improvements on the atmel-quadspi driver, a
fix for the nand driver, and improvements on the pinctrl driver to be
able to use the Linux DT (also sync on the DT side as well).

17 months agou_boot_pylib: Move gitutil into the library
Simon Glass [Sun, 9 Feb 2025 21:26:00 +0000 (14:26 -0700)] 
u_boot_pylib: Move gitutil into the library

Move this file into U-Boot's Python library, so that it is no-longer
part of patman.

This makes a start on:

https://source.denx.de/u-boot/custodians/u-boot-dm/-/issues/35

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agoGitlab: Add missing symlink for qemu_arm64_lwip boardenv file
Tom Rini [Sun, 16 Feb 2025 16:29:03 +0000 (10:29 -0600)] 
Gitlab: Add missing symlink for qemu_arm64_lwip boardenv file

When adding the symlink for the conf file so qemu_arm64_lwip uses
qemu_arm64 configuration information, the symlink for the boardenv file
was missed in Gitlab (but not Azure). Add that in now.

Fixes: fd10d156db3f ("CI: add qemu_arm64_lwip to the test matrix")
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
17 months agoboard: acer: picasso: add Acer Iconia Tab A500 support
Svyatoslav Ryhel [Sun, 21 Jan 2024 13:37:57 +0000 (15:37 +0200)] 
board: acer: picasso: add Acer Iconia Tab A500 support

The Acer Iconia A500 is a tablet computer designed, developed and
marketed by Acer Inc. It is powered by 1 GHz Nvidia Tegra 2 processor
and 1GB DDR2 RAM. The A500 is sold with 64 GB, although both 16 GB
and 32 GB models are available.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
17 months agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sh
Tom Rini [Sat, 15 Feb 2025 21:29:20 +0000 (15:29 -0600)] 
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sh

Add empty weak assembler function armv8_switch_to_el2_prep() which is
jumped to just before U-Boot determines which EL it is running in and
decides which path to take to boot the Linux kernel. Add
IH_TYPE_TFA_BL31 into supported images type, to allow implementation of
board specific U_BOOT_FIT_LOADABLE_HANDLER(IH_TYPE_TFA_BL31, ...) TFA
BL31 loadable handler for fitImages.

This PR contains common hooks which are noop, R-Car Gen4 board specific
implementation using these hooks is coming in next PR.

17 months agoimage: Add support for starting TFA BL31 as fitImage loadables
Marek Vasut [Wed, 29 Jan 2025 21:59:19 +0000 (22:59 +0100)] 
image: Add support for starting TFA BL31 as fitImage loadables

Add support for starting TFA from U-Boot running in EL3 as part of
fitImage boot, so the user can start U-Boot in the highest privilege
level on the platform, bundle TFA, Linux, DT into a single fitImage
and boot such a bundle as a whole.

There are two main benefits of this approach. First is the ability
to run U-Boot in EL3, where it has unrestricted access to the entire
system and can act as a useful debug tool, as it was always intended
to be used. Second is the ability to easily and safely update of any
component in the fitImage, be it TFA, Linux or DT.

The boot process is similar to regular Linux with DT fitImage boot
process, except the TFA has to be bundled into the fitImage. For the
bundling instructions, see below. The TFA is started as a 'loadables'
with custom U_BOOT_FIT_LOADABLE_HANDLER and armv8_switch_to_el2_prep()
handling implemented in board code, and performing the handoff and
boot in case the TFA was loaded.

The loadables handler is optional and meant to set up any sort of
handoff structures used by the TFA BL31 or perform any other setup
that is needed by the blob. The custom armv8_switch_to_el2_prep()
has to implement the jump to TFA BL31 with return to U-Boot just
before booting the Linux kernel.

Example fitImage image and configuration section:

/dts-v1/;

/ {
    description = "Linux kernel with FDT blob and TFA BL31";

    images {
        kernel-1 { ... };
        fdt-1 { ... };
        atf-1 {                  /* This is the TFA BL31 image */
            description = "TFA BL31";
            data = /incbin/("../build/plat/release/bl31.bin");
            type = "tfa-bl31";
            arch = "arm64";
            os = "arm-trusted-firmware";
            compression = "none";
            load = <0x46400000>;
            entry = <0x46400000>;
        };
    };

    configurations {
        default = "conf-1";
        conf-1 {
            description = "Boot Linux";
            kernel = "kernel-1";
            fdt = "fdt-1";
            loadables = "atf-1"; /* This is the TFA BL31 loadable */
        };
    };
};

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
17 months agoarm64: Add late jump to kernel board hook
Marek Vasut [Wed, 29 Jan 2025 21:59:18 +0000 (22:59 +0100)] 
arm64: Add late jump to kernel board hook

Add empty weak assembler function armv8_switch_to_el2_prep() which is
jumped to just before U-Boot determines which EL it is running in and
decides which path to take to boot the Linux kernel.

This weak function is meant to be used by architecture specific code
to implement jump to a firmware blob, which then returns right past
this weak function and continues execution of U-Boot code which then
boots the Linux kernel. One example of such use case is when U-Boot
jump tp TFA BL31, which switches from EL3 to EL2 and then returns to
U-Boot code newly running in EL2 and starts the Linux kernel.

The weak function is called with caches already disabled and DM shut
down. Any preparatory work or even loading of more data must be done
in board_prep_linux(), this hook is meant only for the final jump to
the firmware and return to U-Boot before booting Linux.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
17 months agospi: soft_spi: Add support for SPI_3WIRE
Hironori KIKUCHI [Fri, 31 Jan 2025 01:38:41 +0000 (10:38 +0900)] 
spi: soft_spi: Add support for SPI_3WIRE

When 3-wire mode is claimed on the bus, use the MOSI (output) pin to
receive data. In this mode, since the transfer can only be either TX
or RX, return -EINVAL if both are required at the same time.

Signed-off-by: Hironori KIKUCHI <kikuchan98@gmail.com>
17 months agoMerge patch series "Rework requirements.txt files"
Tom Rini [Fri, 14 Feb 2025 23:11:37 +0000 (17:11 -0600)] 
Merge patch series "Rework requirements.txt files"

Tom Rini <trini@konsulko.com> says:

A challenge we've run in to is making it easier for more people to use
various python tools that we include in the tree. Part of the problem is
that when we have a requirements.txt file, aside from the doc one we
share with the kernel, I created it using "pip freeze". And while this
might have been a best (or at least OK) practice at the time, that's no
longer the case and is why our files have so many things in them. What
this series does is create multiple files, one per project/tool and then
has CI install them as needed. There's a few places here where this
means that we update the requirements as well, but we keep a few big
things where they are currently. This is because updating them
introduces problems of their own and delaing with that would best be a
follow up series. I've put this through GitLab and Azure to make sure
everything is still going fine on both platforms.

Link: https://lore.kernel.org/r/20250205000743.949790-1-trini@konsulko.com
17 months agoDockerfile: Update for having more requirements.txt files
Tom Rini [Tue, 4 Feb 2025 23:12:09 +0000 (17:12 -0600)] 
Dockerfile: Update for having more requirements.txt files

Now that we have more requirements.txt files we need to grab all of them
for creating our cache. Also, we do longer should install
python3-pyelftools on the host as it's not used.

Signed-off-by: Tom Rini <trini@konsulko.com>
17 months agopython: Recreate test/py and tools/buildman requirements.txt files
Tom Rini [Tue, 4 Feb 2025 23:12:08 +0000 (17:12 -0600)] 
python: Recreate test/py and tools/buildman requirements.txt files

Use the "pipreqs" tool to re-create these files, with a few manual
corrections. We still need to include pytest-xdist which the tool does
not detect. We also for now don't upgrade most of the required tools as
that creates problems with various tests, which should be resolved
independently.

Signed-off-by: Tom Rini <trini@konsulko.com>
17 months agoCI: Invoke pip once rather than multiple times
Tom Rini [Tue, 4 Feb 2025 23:12:07 +0000 (17:12 -0600)] 
CI: Invoke pip once rather than multiple times

We can invoke pip once to install the various requirements.txt files
that we need rather than invoking the tool multiple times.

Signed-off-by: Tom Rini <trini@konsulko.com>
17 months agoCI: Consistently install our requirements.txt files
Tom Rini [Tue, 4 Feb 2025 23:12:06 +0000 (17:12 -0600)] 
CI: Consistently install our requirements.txt files

We should install all of our requirements.txt files after starting the
virtualenv rather than ad-hoc throughout each test.

Signed-off-by: Tom Rini <trini@konsulko.com>
17 months agoCI: Be consistent in creating and starting our virtualenv
Tom Rini [Tue, 4 Feb 2025 23:12:05 +0000 (17:12 -0600)] 
CI: Be consistent in creating and starting our virtualenv

Before we invoke pip we should always have first created and started our
virtualenv. This was done most of the time, but not always.

Signed-off-by: Tom Rini <trini@konsulko.com>
17 months agopython: Create requirements.txt files for each "project"
Tom Rini [Tue, 4 Feb 2025 23:12:04 +0000 (17:12 -0600)] 
python: Create requirements.txt files for each "project"

Rather than have a requirements.txt file that's shared between multiple
python projects within U-Boot, create one for each using "pipreqs".

Signed-off-by: Tom Rini <trini@konsulko.com>
17 months agoboard: ti: am62px: tifs-rm-cfg/rm-cfg: Update DMA resource sharing for CPSW
Siddharth Vadapalli [Wed, 5 Feb 2025 13:14:40 +0000 (18:44 +0530)] 
board: ti: am62px: tifs-rm-cfg/rm-cfg: Update DMA resource sharing for CPSW

The CPSW3G instance of CPSW on AM62PX SoC provides Ethernet functionality.
Currently, Ethernet is supported on Linux which runs on the A53 core on the
SoC, by allocating all of the DMA resources associated with CPSW to A53_2.

In order to enable use-cases where the Ethernet traffic is sent from or
consumed by various CPU cores on the SoC simultaneously, while at the
same time, maintaining backward compatibility with the existing use-case
of A53 being the sole entity that exchanges traffic with CPSW via DMA,
update the DMA resource sharing scheme on AM62PX SoC to the following:

---------------      --------------   -------------  ----------------
   Resource              WKUP_R5         MCU_R5            A53_2
---------------      --------------   -------------  ----------------
TX Channels [8]  =>    4 (Primary)     4 (Primary)     8 (Secondary)
TX Rings   [64]  =>   32 (Primary)    32 (Primary)    64 (Secondary)
RX Channels [1]  =>    1 (Primary)     0               1 (Secondary)
RX Flows   [16]  =>    6 (Primary)    10 (Primary)    16 (Secondary)

In the absence of primary owners of resources (existing use-case
where A53 owns all of the CPSW DMA resources), the secondary owner
can claim all of the resources as its own. For shared use-cases,
the resources that are not claimed by the primary are communicated
to the secondary owner allowing it to claim them. This ensures that
Linux on A53_2 can continue claiming all DMA resources associated
with CPSW in the absence of primary owners, while at the same time
providing users the flexibility to share CPSW DMA resources across
various CPU cores listed above if needed.

While Linux has been mentioned as the Operating System running
on A53, there is no dependency between the Operating System
running on A53 and its ability to claim the CPSW DMA resources
listed above.

Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
17 months agoMerge patch series "Introduce K3 remoteproc driver for M4 subsystem"
Tom Rini [Fri, 14 Feb 2025 19:17:47 +0000 (13:17 -0600)] 
Merge patch series "Introduce K3 remoteproc driver for M4 subsystem"

Judith Mendez <jm@ti.com> says:

Some K3 devices like am62x and am64x have a M4 processor in the MCU
voltage domain. This patch series introduces remoteproc M4 driver which
will be used to load firmware into and start the M4 remote core.

This series also adds support for R5F cores on am64x SoCs in patch 2 and
sets up environment to load FW in remote cores in patch 3,4,5.

This patch series also enables remoteproc drivers by default as per what
remoteproc sybsystem is supported per SoC, thus all remoteproc options
are now deleted in configs/* since they are no longer required.

This patch series was tested on am64x EVM, am62x SK, am62ax SK,
am62px SK boards.

Any additional tested by's are welcome since I was not able to
test any additional boards.

Tested by running the following commands in u-boot prompt:

=> setenv dorprocboot 1
=> run boot_rprocs

Link: https://lore.kernel.org/r/20250210202944.1071931-1-jm@ti.com
17 months agoconfigs: am6*/j7*: Remove remoteproc configs
Judith Mendez [Mon, 10 Feb 2025 20:29:44 +0000 (14:29 -0600)] 
configs: am6*/j7*: Remove remoteproc configs

Now that remoteproc configs are enabled by default in Kconfig
files, remove these configs which are no longer needed to be
defined here in configs/.

Signed-off-by: Judith Mendez <jm@ti.com>
Reviewed-by: Andrew Davis <afd@ti.com>
17 months agoarm: mach-k3: Enable remoteproc drivers by default for K3 ARCH
Judith Mendez [Mon, 10 Feb 2025 20:29:43 +0000 (14:29 -0600)] 
arm: mach-k3: Enable remoteproc drivers by default for K3 ARCH

Add remoteproc config options to enable remoteproc drivers by
default as per what remotproc subsystem is supported on each
SoC.

Signed-off-by: Judith Mendez <jm@ti.com>
17 months agocmd: Enable CMD remoteproc by default for K3 ARCH
Judith Mendez [Mon, 10 Feb 2025 20:29:42 +0000 (14:29 -0600)] 
cmd: Enable CMD remoteproc by default for K3 ARCH

Enable CMD_REMOTEPROC by default if building for K3 ARCH so
that it does not have to be defined in each board defconfig
file.

Signed-off-by: Judith Mendez <jm@ti.com>
17 months agospl: Enable SPL remoteproc by default for K3 ARCH
Judith Mendez [Mon, 10 Feb 2025 20:29:41 +0000 (14:29 -0600)] 
spl: Enable SPL remoteproc by default for K3 ARCH

If building for v7R and K3 architecture, enable SPL
remoteproc so that it does not have to be defined in each
board defconfig file.

Signed-off-by: Judith Mendez <jm@ti.com>
17 months agoremoteproc: Enable ARM64 remoteproc driver by default for K3 ARCH
Judith Mendez [Mon, 10 Feb 2025 20:29:40 +0000 (14:29 -0600)] 
remoteproc: Enable ARM64 remoteproc driver by default for K3 ARCH

If SYS_K3_SPL_ATF is enabled, for K3 ARCH enable the
remoteproc ARM64 driver by default so that it does not
have to be defined in each board defconfig file.

Signed-off-by: Judith Mendez <jm@ti.com>
Reviewed-by: Andrew Davis <afd@ti.com>
17 months agoboard: ti: am62px: Add remoteproc specific env support
Hari Nagalla [Mon, 10 Feb 2025 20:29:39 +0000 (14:29 -0600)] 
board: ti: am62px: Add remoteproc specific env support

Add remoteproc specific env support for am62px device. If the
remoteproc CMD is defined, include the K3 remoteproc environment.
Also define rproc_fw_binaries which holds a list of remoteproc FW
binaries for u-boot loading of remote cores.

Signed-off-by: Hari Nagalla <hnagalla@ti.com>
Signed-off-by: Judith Mendez <jm@ti.com>
Reviewed-by: Andrew Davis <afd@ti.com>
17 months agoboard: ti: am62x: Add remoteproc specific env support
Hari Nagalla [Mon, 10 Feb 2025 20:29:38 +0000 (14:29 -0600)] 
board: ti: am62x: Add remoteproc specific env support

Add remoteproc specific env support for am62x device. If the
remoteproc CMD is defined, include the K3 remoteproc environment.
Also define rproc_fw_binaries which holds a list of remoteproc FW
binaries for u-boot loading of remote cores.

Signed-off-by: Hari Nagalla <hnagalla@ti.com>
Signed-off-by: Judith Mendez <jm@ti.com>
Reviewed-by: Andrew Davis <afd@ti.com>
17 months agoboard: ti: am64x: Add remoteproc specific env support
Hari Nagalla [Mon, 10 Feb 2025 20:29:37 +0000 (14:29 -0600)] 
board: ti: am64x: Add remoteproc specific env support

Add remoteproc specific env support for am64x device. If the
remoteproc CMD is defined, include the K3 remoteproc environment.
Also define rproc_fw_binaries which holds a list of remoteproc FW
binaries for u-boot loading of remote cores.

Signed-off-by: Hari Nagalla <hnagalla@ti.com>
Signed-off-by: Judith Mendez <jm@ti.com>
Reviewed-by: Andrew Davis <afd@ti.com>
17 months agoremoteproc: k3-r5: Add support for R5F cores on AM64x SoCs
Hari Nagalla [Mon, 10 Feb 2025 20:29:36 +0000 (14:29 -0600)] 
remoteproc: k3-r5: Add support for R5F cores on AM64x SoCs

AM64x SoCs have two R5F clusters in the main power domain.
Extend support for R5F remote proc driver on AM64x with compatible
strings.

Signed-off-by: Hari Nagalla <hnagalla@ti.com>
Signed-off-by: Judith Mendez <jm@ti.com>
Reviewed-by: Daniel Schultz <d.schultz@phytec.de>
Reviewed-by: Andrew Davis <afd@ti.com>
17 months agoremoteproc: k3-m4: Introduce K3 remote proc driver for M4 subsystem
Hari Nagalla [Mon, 10 Feb 2025 20:29:35 +0000 (14:29 -0600)] 
remoteproc: k3-m4: Introduce K3 remote proc driver for M4 subsystem

Some K3 devices like AM64, AM62 devices have a M4 processor in MCU
voltage domain.

Add a remote proc driver to support this subsystem to be able to load
and boot the M4 core.

Signed-off-by: Hari Nagalla <hnagalla@ti.com>
[Ryan: Fix implicitly include warning]
Signed-off-by: Ryan Eatmon <reatmon@ti.com>
[Judith: Cleanup driver, fix warnings, remove lreset logic]
Signed-off-by: Judith Mendez <jm@ti.com>
Tested-by: Daniel Schultz <d.schultz@phytec.de>
Reviewed-by: Andrew Davis <afd@ti.com>
17 months agoKconfig: Move CONFIG_BOOTCOUNT_ALTBOOTCMD to Kconfig
Tomas Peterka [Fri, 31 Jan 2025 10:08:44 +0000 (11:08 +0100)] 
Kconfig: Move CONFIG_BOOTCOUNT_ALTBOOTCMD to Kconfig

Add CONFIG_BOOTCOUNT_ALTBOOTCMD so the developer is able to add
custom altbootcmd via Kconfig when they enable BOOTCOUNT. With this now
in Kconfig, we need to move it from environment files / config.h files
and in to the defconfig file.

This was done by generating u-boot-initial-env for all platforms before
the Kconfig change, to extract altbootcmd values and then again after to
compare the result.

[trini: Perform migration to defconfigs, reword commit message]
Signed-off-by: Tom Rini <trini@konsulko.com>
17 months agoMerge branch 'misc' of https://source.denx.de/u-boot/custodians/u-boot-tegra
Tom Rini [Thu, 13 Feb 2025 18:37:26 +0000 (12:37 -0600)] 
Merge branch 'misc' of https://source.denx.de/u-boot/custodians/u-boot-tegra

Improvements for PMIC GPIO children, tegra20 pinmux driver fix, tegra
dts updates, various small adjustments and tweaks.

17 months agoMerge patch series "test: Complete the suite migration"
Tom Rini [Thu, 13 Feb 2025 15:52:16 +0000 (09:52 -0600)] 
Merge patch series "test: Complete the suite migration"

Simon Glass <sjg@chromium.org> says:

This series completes the removal of test commands for suites. With this
it is possible to declare a suite (including init and uninit functions)
without needing to write a command.

It also adds timing for test suites, so we can keep track of how long
things take.

Link: https://lore.kernel.org/all/20250207183121.117663-1-sjg@chromium.org/
17 months agombedtls/external: remove broken git submodule
ZHANG Yuntian [Tue, 11 Feb 2025 07:30:27 +0000 (15:30 +0800)] 
mbedtls/external: remove broken git submodule

When we squash imported mbedtls, the git submodule "framework" was
preserved in the commit. However, U-Boot itself does not use git
submodule, and provides no .gitmodules file to specify the submodule
repository.

This is normally not an issue when cloning U-Boot repository. However,
when U-Boot is imported as a submodule, this will break git option
`--recurse-submodules` as it fails to resolve "framework".

As we do not use the submodule, remove it to unbreak existing workflows.

Fixes: 12f1212e95fe ("Merge commit '0344c602eadc0802776b65ff90f0a02c856cf53c' as 'lib/mbedtls/external/mbedtls'")
Signed-off-by: ZHANG Yuntian <yt@radxa.com>
17 months agoboard: transformer-t30: fix model detection
Svyatoslav Ryhel [Sat, 28 Dec 2024 13:21:03 +0000 (15:21 +0200)] 
board: transformer-t30: fix model detection

PCBID1 seems to be high not only on TF600T, but on TF700T as well,
that caused boot failure for TF700T. Switching PCBID1 to PCBID7
should fix this issue.

Co-developed-by: Ion Agorria <ion@agorria.com>
Signed-off-by: Ion Agorria <ion@agorria.com>
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
17 months agodoc: board: tegra: update device information
Svyatoslav Ryhel [Tue, 3 Dec 2024 10:50:45 +0000 (12:50 +0200)] 
doc: board: tegra: update device information

Adjust and update existing manuals to reflect the most recent
updates.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
17 months agoARM: tegra124: dts: mark HOST1X and DC with pre-relocation flag
Svyatoslav Ryhel [Wed, 20 Nov 2024 07:26:38 +0000 (09:26 +0200)] 
ARM: tegra124: dts: mark HOST1X and DC with pre-relocation flag

Same as on previous SoC generations this is required for proper
video output work.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
17 months agoMerge branch 'u-boot-net-20250212' of https://source.denx.de/u-boot/custodians/u...
Tom Rini [Wed, 12 Feb 2025 14:41:36 +0000 (08:41 -0600)] 
Merge branch 'u-boot-net-20250212' of https://source.denx.de/u-boot/custodians/u-boot-net

CI: https://source.denx.de/u-boot/custodians/u-boot-net/-/pipelines/24577

net-lwip:
* Fix incorrect selection of ethernet device on boards having more than
  one
* Fix TFTP option processing
* Make the WGET_HTTPS Kconfig symbol depend on DM_RNG

lib:
* Add strnstr()

17 months agonet: Kconfig: depend on DM_RNG for WGET_HTTPS
Jerome Forissier [Tue, 4 Feb 2025 16:00:49 +0000 (17:00 +0100)] 
net: Kconfig: depend on DM_RNG for WGET_HTTPS

net/lwip/wget.c/mbedtls_hardware_poll() is calling dm_rng_read() but
dependency is not recorded anywhere that's why depend on DM_RNG
when WGET_HTTPS is used.

Suggested-by: Michal Simek <michal.simek@amd.com>
Co-developed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Tested-by: Michal Simek <michal.simek@amd.com>
17 months agonet: use strnstr() for lwip_strnstr()
Heinrich Schuchardt [Mon, 3 Feb 2025 09:12:02 +0000 (10:12 +0100)] 
net: use strnstr() for lwip_strnstr()

Using strstr() instead of strnstr() creates a security concern.

Fixes: 1c41a7afaa15 ("net: lwip: build lwIP")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
17 months agotest: unit tests for strstr() and strnstr()
Heinrich Schuchardt [Mon, 3 Feb 2025 09:12:01 +0000 (10:12 +0100)] 
test: unit tests for strstr() and strnstr()

Add unit tests for the library functions.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
[jf: drop unwanted change to lib/string.c]
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
17 months agolib: implement strnstr()
Heinrich Schuchardt [Mon, 3 Feb 2025 09:12:00 +0000 (10:12 +0100)] 
lib: implement strnstr()

Implement library function strnstr().
Implement strstr() using strnstr().
Sort the includes.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
[jf: replace <stdint.h> by <limits.h>, folded from next patch]
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
17 months agonet: lwip: tftp: fix find_option()
Heinrich Schuchardt [Mon, 3 Feb 2025 09:11:59 +0000 (10:11 +0100)] 
net: lwip: tftp: fix find_option()

Find_option() is used to retrieve the block size value in an option
acknowledgment in response to a request containing a block size option
according to RFC2348.

The format of an OACK response is described in RFC2347 as

+-------+---~~---+---+---~~---+---+---~~---+---+---~~---+---+
|  opc  |  opt1  | 0 | value1 | 0 |  optN  | 0 | valueN | 0 |
+-------+---~~---+---+---~~---+---+---~~---+---+---~~---+---+

The current implementation of find_option() only works if

* blksize is the first option
* lwip_strnstr() ignores the length parameter,
  i.e. is implemented via strstr()

The OACK messages starts with  0x00 0x06. If 'blksize' is the first option,
strstr() reports a match when the first parameter points to 0x06. Adding
the string length of 'blksize' plus 2 to the location of the 0x06 byte
points to the value.

Find_option() would report a match for option 'blksize' if the response
contained an option called 'foo_blksize_bar'. In this case find_option()
would return 'bar' as the value string.

If 'blksize' were the second option, find_option() would return a pointer
to the second character of the value string.

Furthermore find_option() does not detect if the value string is NUL
terminated. This may lead to a buffer overrun.

Provide an implementation that correctly steps from option to option.

Fixes: 27d7ccda94fa ("net: lwip: tftp: add support of blksize option to client")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (qemu_arm64_lwip)
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
17 months agonet: lwip: move eth_init() out of new_netif()
Jerome Forissier [Thu, 30 Jan 2025 08:22:20 +0000 (09:22 +0100)] 
net: lwip: move eth_init() out of new_netif()

Move the initialization of the ethernet devices out of the new_netif()
function. Indeed, new_netif() accepts a struct device argument, which
is expected to be valid and active. The activation and selection of
this device are achieved by eth_init() (on first time the network
stack is used) and eth_set_current(). This is what takes care of the
ethrotate and ethact environment variables. Therefore, move these calls
to a new function: net_lwip_set_current(), and use it whenever a
net-lwip command is run.

This patch hopefully fixes the incorrect net-lwip behavior observed on
boards with multiple ethernet interfaces [1].

Tested on an i.MX8MPlus EVK equipped wih two ethernet ports. The dhcp
command succeeds whether the cable is plugged into the first or second
port.

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

Reported-by: E Shattow <e@freeshell.de>
Tested-by: E Shattow <e@freeshell.de>
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
17 months agomtd: nand: raw: atmel: Fix pulse read timing for certain NAND flashes
Alexander Dahl [Mon, 15 Apr 2024 07:57:55 +0000 (09:57 +0200)] 
mtd: nand: raw: atmel: Fix pulse read timing for certain NAND flashes

From reading the S34ML02G1 and the SAM9X60 datasheets again, it seems
like we have to wait tREA after rising RE# before sampling the data.
Thus pulse time must be at least tREA.

Without this fix we got PMECC errors when reading, after switching to
ONFI timing mode 3 on SAM9X60 SoC with S34ML02G1 raw NAND flash chip.

The approach to set timings used before worked on sam9g20 and sama5d2
with the same flash (S34ML02G1), probably because those have a slower
mck clock rate and thus the resolution of the timings setup is not as
tight as with sam9x60.

The approach to fix the issue was carried over from at91bootstrap, and
has been successfully tested in at91bootstrap, U-Boot and Linux.

Link: https://github.com/linux4sam/at91bootstrap/issues/174
Cc: Li Bin <bin.li@microchip.com>
Signed-off-by: Alexander Dahl <ada@thorsis.com>
17 months agoARM: tegra124: dts: add missing DSI nodes
Svyatoslav Ryhel [Mon, 18 Nov 2024 06:32:13 +0000 (08:32 +0200)] 
ARM: tegra124: dts: add missing DSI nodes

Bind missing DSI and MIPI calibration devices.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
17 months agoARM: tegra30: dts: complete DSI nodes
Svyatoslav Ryhel [Sun, 24 Nov 2024 12:27:17 +0000 (14:27 +0200)] 
ARM: tegra30: dts: complete DSI nodes

Sync DSI nodes with Linux tree.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
17 months agoARM: tegra210: clock: implement PLLD2 support
Svyatoslav Ryhel [Fri, 29 Nov 2024 06:14:21 +0000 (08:14 +0200)] 
ARM: tegra210: clock: implement PLLD2 support

PLLD2 is a simple clock (controlled by 2 registers) and appears starting
from T30. Primary use of PLLD2 is as main HDMI clock parent.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
17 months agoARM: tegra124: clock: implement PLLD2 support
Svyatoslav Ryhel [Fri, 15 Nov 2024 19:13:15 +0000 (21:13 +0200)] 
ARM: tegra124: clock: implement PLLD2 support

PLLD2 is a simple clock (controlled by 2 registers) and appears starting
from T30. Primary use of PLLD2 is as main HDMI clock parent.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
17 months agoboard: asus: convert SPL to XPL
Svyatoslav Ryhel [Fri, 29 Nov 2024 17:30:54 +0000 (19:30 +0200)] 
board: asus: convert SPL to XPL

Not sure why these files were omitted, but SPL should
be converted to XPL.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
17 months agopinctrl: tegra20: adjust pin type detection
Svyatoslav Ryhel [Fri, 6 Dec 2024 15:50:58 +0000 (17:50 +0200)] 
pinctrl: tegra20: adjust pin type detection

Pin detection on t20 depends on node name. With recent changes
in node naming, let's remove '_' to be safe about both '_' or
'-' use.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
17 months agopmic: palmas: bind sysreset to parent node
Svyatoslav Ryhel [Mon, 9 Dec 2024 10:58:19 +0000 (12:58 +0200)] 
pmic: palmas: bind sysreset to parent node

Bind SYSRESET child to parent node since it does not have
its own node in the device tree.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
17 months agopmic: max77663: bind children to parent node
Svyatoslav Ryhel [Mon, 9 Dec 2024 10:51:33 +0000 (12:51 +0200)] 
pmic: max77663: bind children to parent node

Bind GPIO and SYSRESET children to parent node since they
do not have their own nodes in the device tree.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
17 months agoRevert "drivers: gpio-uclass: support PMIC GPIO children"
Svyatoslav Ryhel [Mon, 9 Dec 2024 10:45:18 +0000 (12:45 +0200)] 
Revert "drivers: gpio-uclass: support PMIC GPIO children"

Requesting of PMIC's GPIO child should be done by binding
GPIO driver to PMIC's node is GPIO driver does not have
its own node.

This reverts commit c03cd98d1a163666b4addcdd9a34fc0c77dfd0a5.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
17 months agoARM: dts: at91: Align pinctrl node with Linux Devicetree
Manikandan Muralidharan [Mon, 10 Feb 2025 06:51:43 +0000 (12:21 +0530)] 
ARM: dts: at91: Align pinctrl node with Linux Devicetree

The GPIO banks are added as sub nodes or child nodes under the
pinctrl node (as per Linux ABI) and the reg property which points
to an array of controllers physical base address is removed
to align with the Linux devicetree.

Signed-off-by: Charan Pedumuru <charan.pedumuru@microchip.com>
Signed-off-by: Manikandan Muralidharan <manikandan.m@microchip.com>
17 months agopinctrl: at91: Add support to align with Linux Devicetree
Manikandan Muralidharan [Mon, 10 Feb 2025 06:51:42 +0000 (12:21 +0530)] 
pinctrl: at91: Add support to align with Linux Devicetree

U-Boot pinctrl driver expects a reg property explicitly unlike linux.
To align the DT of U-boot with the Linux, reg property is also arrvied
from child GPIO bank nodes when configured under the pinctrl node.

Signed-off-by: Manikandan Muralidharan <manikandan.m@microchip.com>
17 months agopinctrl: at91: Bind GPIO driver to the pinctrl DT node
Manikandan Muralidharan [Mon, 10 Feb 2025 06:51:41 +0000 (12:21 +0530)] 
pinctrl: at91: Bind GPIO driver to the pinctrl DT node

In Linux DT,the pinctrl node acts as parent nodes with all other
gpio banks as child nodes and a single driver in Linux handles both
pinctrl settings and gpio requests.Current U-Boot DT maintains both
pinctrl and gpio nodes as separate nodes and offers two different class
of U-Boot drivers: UCLASS_PINCTRL which handles pin functions and
UCLASS_GPIO which handles gpio requests. In order to align the DT
of U-Boot with the DT of Linux, a hook is been added in the pinctrl
driver to bind the gpio driver with the pinctrl driver so that
when adding gpio nodes as subnodes to pinctrl node (as per the Linux ABI),
the corresponding APIs will be redirected and handled by valid
drivers attached to the pinctrl driver.

Signed-off-by: Manikandan Muralidharan <manikandan.m@microchip.com>
17 months agoARM: dts: at91: sam9x60: Add missing pinctrl node properties
Manikandan Muralidharan [Mon, 10 Feb 2025 06:51:40 +0000 (12:21 +0530)] 
ARM: dts: at91: sam9x60: Add missing pinctrl node properties

Add the missing properties for the pinctrl node and for its
corresponding GPIO bank nodes to align with the Linux DT.

Signed-off-by: Manikandan Muralidharan <manikandan.m@microchip.com>
Reviewed-by: Eugen Hristev <eugen.hristev@linaro.org>
17 months agoARM: dts: at91: sam9x60: Move pinmux node to board DTS
Manikandan Muralidharan [Mon, 10 Feb 2025 06:51:39 +0000 (12:21 +0530)] 
ARM: dts: at91: sam9x60: Move pinmux node to board DTS

Move pinmux nodes defined under the pinctrl node from sam9x60 SoC
DT to its board specific DTS files.

Signed-off-by: Manikandan Muralidharan <manikandan.m@microchip.com>
Reviewed-by: Eugen Hristev <eugen.hristev@linaro.org>
17 months agoARM: dts: at91: sam9x60: Define pinctrl node with its label
Balamanikandan Gunasundar [Mon, 10 Feb 2025 06:51:38 +0000 (12:21 +0530)] 
ARM: dts: at91: sam9x60: Define pinctrl node with its label

Define the pinctrl nodes with its label to align with the Linux DT.
Without this change the pinmux nodes are grouped under an additional
'pinctrl' child node which is not identified by the pinctrl driver
when the GPIO banks are made as child nodes of pinctrl node.

Signed-off-by: Balamanikandan Gunasundar <balamanikandan.gunasundar@microchip.com>
Signed-off-by: Manikandan Muralidharan <manikandan.m@microchip.com>
Reviewed-by: Eugen Hristev <eugen.hristev@linaro.org>
17 months agoARM: dts: at91: sam9x60: Add AIC node
Manikandan Muralidharan [Mon, 10 Feb 2025 06:51:37 +0000 (12:21 +0530)] 
ARM: dts: at91: sam9x60: Add AIC node

Add Advanced Interrupt Controller node and define it as interrupt
parent in sam9x60 SoC DT.

Signed-off-by: Manikandan Muralidharan <manikandan.m@microchip.com>
Reviewed-by: Eugen Hristev <eugen.hristev@linaro.org>
17 months agospi: atmel-quadspi: Improve probe debugging
Alexander Dahl [Thu, 23 Jan 2025 12:12:15 +0000 (13:12 +0100)] 
spi: atmel-quadspi: Improve probe debugging

Report spi clk speed and make use of `log_ret()`.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
17 months agospi: atmel-quadspi: Add support for classic SPI mode
Alexander Dahl [Thu, 23 Jan 2025 12:12:14 +0000 (13:12 +0100)] 
spi: atmel-quadspi: Add support for classic SPI mode

The qspi controller on sama5d2 and sam9x60 supports "classic" SPI mode
without spi-mem enhancements and accelerations, very similar to the old
SPI controller on sam9g20 or the modern flexcom controllers of the same
SoC family.

Register interface differs somewhat, especially because only one
hardware controlled CS line is supported.  Some fields are missing, some
are in different registers, but in principal it works similar.  So code
is very much inspired by the old atmel-spi driver.

Tested on sam9x60 with a non-mainline driver to configure an FPGA.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
17 months agospi: atmel-quadspi: Allow setting SMM to classic SPI mode
Alexander Dahl [Thu, 23 Jan 2025 12:12:13 +0000 (13:12 +0100)] 
spi: atmel-quadspi: Allow setting SMM to classic SPI mode

Switching between Serial Memory Mode (SMM) and (classic) SPI mode is a
preparation for implementing .xfer() in the future.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
17 months agospi: atmel-quadspi: Remove default mode setting at probe time
Alexander Dahl [Thu, 23 Jan 2025 12:12:12 +0000 (13:12 +0100)] 
spi: atmel-quadspi: Remove default mode setting at probe time

The Serial Memory Mode (SMM) is enabled with atmel_qspi_set_cfg() on
each invocation of atmel_qspi_exec_op().  Setting SMM through
atmel_qspi_init() at probe time is redundant.

Removing the SMM setting at probe time should therefore 1) be safe to do
and 2) allows for setting it to a different value in a future
implementation of .xfer() which needs to disable SMM.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
17 months agospi: atmel-quadspi: Avoid overwriting MR register settings
Alexander Dahl [Thu, 23 Jan 2025 12:12:11 +0000 (13:12 +0100)] 
spi: atmel-quadspi: Avoid overwriting MR register settings

Port these commits:

v6.11-rc5-90-g329ca3eed4a9a ("spi: atmel-quadspi: Avoid overwriting delay register settings")
v6.12-rc1-1-g162d9b5d2308c ("spi: atmel-quadspi: Fix wrong register value written to MR").
v6.13-rc2-27-gf663898d047a7 ("spi: atmel-quadspi: Factor out switching to Serial Memory Mode to function")

Cc: Csókás Bence <csokas.bence@prolan.hu>
Signed-off-by: Alexander Dahl <ada@thorsis.com>
17 months agospi: atmel-quadspi: Port collected fixes from Linux v5.10 and v5.15
Alexander Dahl [Thu, 23 Jan 2025 12:12:10 +0000 (13:12 +0100)] 
spi: atmel-quadspi: Port collected fixes from Linux v5.10 and v5.15

Port changes from a 4 piece patch series from Linux kernel v5.10, merged
with v5.10-rc1-83-gc732b7567d869 ("Merge series "spi: atmel-quadspi: Fix
AHB memory accesses" from Tudor Ambarus …").

Port the single fix v5.15-rc1-14-g09134c5322df9 ("spi: Fixed division by
zero warning").

Reduces differences between linux and u-boot driver.

Cc: Tudor Ambarus <tudor.ambarus@microchip.com>
Cc: Yoshitaka Ikeda <ikeda@nskint.co.jp>
Signed-off-by: Alexander Dahl <ada@thorsis.com>
17 months agospi: atmel-quadspi: Depend on SPI_MEM
Alexander Dahl [Thu, 23 Jan 2025 07:37:13 +0000 (08:37 +0100)] 
spi: atmel-quadspi: Depend on SPI_MEM

Most other spi-mem drivers also depend on SPI_MEM.  Fixes this build
error:

    arm-v5te-linux-gnueabi-ld.bfd: drivers/spi/atmel-quadspi.o: in function `atmel_qspi_supports_op':
    /mnt/data/adahl/src/u-boot/drivers/spi/atmel-quadspi.c:460: undefined reference to `spi_mem_default_supports_op'
    make[1]: *** [/mnt/data/adahl/src/u-boot/Makefile:1821: u-boot] Error 1

Signed-off-by: Alexander Dahl <ada@thorsis.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
17 months agospi: ca_sflash: Remove redundant dependency
Alexander Dahl [Thu, 23 Jan 2025 07:37:12 +0000 (08:37 +0100)] 
spi: ca_sflash: Remove redundant dependency

This is inside of an 'if DM_SPI' block, and thus always true.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
17 months agotest: Update documentation
Simon Glass [Fri, 7 Feb 2025 18:31:00 +0000 (11:31 -0700)] 
test: Update documentation

Update documentation for how to write tests and the 'ut' command.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agotest: Do flag-processing in the correct place
Simon Glass [Fri, 7 Feb 2025 18:30:59 +0000 (11:30 -0700)] 
test: Do flag-processing in the correct place

At present the 'ut' command handles its flags in a strange way, in that
they must come after the subcommand.

So, we must use 'ut bloblist -r2' to run the bloblist tests twice. This
is an artefact of the way tests were run, through subcommands.

It is now possible to correct this, by doing flag-processing before
running the suite.

Update the code to handle this, so that 'ut -r2 bloblist' works. Update
the 'test_suite' test to check the new arguments.

Add a sanity-check for -I while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agotest: Move code out of cmd_ut_category()
Simon Glass [Fri, 7 Feb 2025 18:30:58 +0000 (11:30 -0700)] 
test: Move code out of cmd_ut_category()

Move the logic from this function into run_suite(), on the way to having
flag parsing in the top-level 'ut' command instead of its children.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agotest: Allow running a selection of suites
Simon Glass [Fri, 7 Feb 2025 18:30:57 +0000 (11:30 -0700)] 
test: Allow running a selection of suites

Enhance the ut command to accept a comma-separated list of test suites
to run. Report the summary information for these at the end.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agotest: Drop suites.h
Simon Glass [Fri, 7 Feb 2025 18:30:56 +0000 (11:30 -0700)] 
test: Drop suites.h

This file is empty now. Remove it and its uses.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agotest: Make cmd_ut_category() static
Simon Glass [Fri, 7 Feb 2025 18:30:55 +0000 (11:30 -0700)] 
test: Make cmd_ut_category() static

This function is not used outside the cmd_ut file anymore, so make it
static.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agotest: Drop support for test commands
Simon Glass [Fri, 7 Feb 2025 18:30:54 +0000 (11:30 -0700)] 
test: Drop support for test commands

Now that everything is using the new test-suite features, drop support
for running commands.

Fix a missing closing-bracket while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agotest: Rename optee test-file
Simon Glass [Fri, 7 Feb 2025 18:30:53 +0000 (11:30 -0700)] 
test: Rename optee test-file

This has nothing to do with commands anymore, so rename the file.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agotest: Drop the function for running optee tests
Simon Glass [Fri, 7 Feb 2025 18:30:52 +0000 (11:30 -0700)] 
test: Drop the function for running optee tests

Use the new suite-runner to run these tests instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agotest: Split optee tests into three functions
Simon Glass [Fri, 7 Feb 2025 18:30:51 +0000 (11:30 -0700)] 
test: Split optee tests into three functions

These tests run three different checks on the nodes, but the logic is
currently all in one tests.

Split the code out into three different tests, which do different setup
and then run the same checks.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agotest: Update optee to do init and uninit from tests
Simon Glass [Fri, 7 Feb 2025 18:30:50 +0000 (11:30 -0700)] 
test: Update optee to do init and uninit from tests

Rather than having an init function and then running the tests, create a
test-init function to do it. This will allow us to get rid of the
command function.

Fix the comment abotu 'environment' while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agotest: Drop the function for running bootstd tests
Simon Glass [Fri, 7 Feb 2025 18:30:49 +0000 (11:30 -0700)] 
test: Drop the function for running bootstd tests

Use the new suite-runner to run these tests instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agotest: Update bootstd to do init from tests
Simon Glass [Fri, 7 Feb 2025 18:30:48 +0000 (11:30 -0700)] 
test: Update bootstd to do init from tests

Rather than having an init function and then running the tests, create a
test-init function to do it. This will allow us to get rid of the
command function.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agotest: Drop the function for running fdt_overlay tests
Simon Glass [Fri, 7 Feb 2025 18:30:47 +0000 (11:30 -0700)] 
test: Drop the function for running fdt_overlay tests

Use the new suite-runner to run these tests instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agotest: Update fdt_overlay to do init from tests
Simon Glass [Fri, 7 Feb 2025 18:30:46 +0000 (11:30 -0700)] 
test: Update fdt_overlay to do init from tests

Rather than having an init function and then running the tests, create a
test-init function to do it. This will allow us to get rid of the
command function.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agotest: Update fdt_overlay test to use fdtdec functions
Simon Glass [Fri, 7 Feb 2025 18:30:45 +0000 (11:30 -0700)] 
test: Update fdt_overlay test to use fdtdec functions

Use the helpers provided for this purpose, rather than different ones in
this particular test.

Leave fdt_getprop_str() alone as it seems to have more value.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agotest: Move fdt_overlay init into a function
Simon Glass [Fri, 7 Feb 2025 18:30:44 +0000 (11:30 -0700)] 
test: Move fdt_overlay init into a function

Move the init code into a separate function since it is quite large.
Adjust it to use unit-test functions which have become available since
the test was written.

Signed-off-by: Simon Glass <sjg@chromium.org>
17 months agotest: Make all tests depend on UNIT_TEST
Simon Glass [Fri, 7 Feb 2025 18:30:43 +0000 (11:30 -0700)] 
test: Make all tests depend on UNIT_TEST

Rather than having this condition defined separately for each suite,
bracket all options with 'if UNIT_TEST'.

Signed-off-by: Simon Glass <sjg@chromium.org>