]> git.ipfire.org Git - thirdparty/u-boot.git/log
thirdparty/u-boot.git
8 months agothermal: rcar_gen3: Add Renesas R-Car Gen3/Gen4 and RZ/G2 thermal driver
Marek Vasut [Sat, 6 Sep 2025 00:04:19 +0000 (02:04 +0200)] 
thermal: rcar_gen3: Add Renesas R-Car Gen3/Gen4 and RZ/G2 thermal driver

Add support for R-Car Gen3/Gen4 and RZ/G2 thermal sensors.
Fuse readout support is present, including fallback trimming.

Example usage using the 'temperature' command on R-Car V4H Sparrow Hawk:

"
=> temperature list
| Device                        | Driver                        | Parent
| thermal-rcar-gen3-tsc.0       | thermal-rcar-gen3-tsc         | thermal@e6198000
| thermal-rcar-gen3-tsc.1       | thermal-rcar-gen3-tsc         | thermal@e6198000
| thermal-rcar-gen3-tsc.2       | thermal-rcar-gen3-tsc         | thermal@e6198000
| thermal-rcar-gen3-tsc.3       | thermal-rcar-gen3-tsc         | thermal@e6198000

=> for i in 0 1 2 3 ; do temperature get thermal-rcar-gen3-tsc.$i ; done
thermal-rcar-gen3-tsc.0: 56 C
thermal-rcar-gen3-tsc.1: 50 C
thermal-rcar-gen3-tsc.2: 48 C
thermal-rcar-gen3-tsc.3: 52 C
"

Ported from Linux 6.16-rc6 commit
9e1dc0360fcf ("thermal/drivers/rcar_gen3: Add support for R-Car V4H default trim values")

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
8 months agothermal: Make U_BOOT_DRIVER entries unique
Tom Rini [Thu, 25 Sep 2025 20:56:20 +0000 (14:56 -0600)] 
thermal: Make U_BOOT_DRIVER entries unique

All instances of the U_BOOT_DRIVER must use a unique name or they will
lead to link time failures due to name space conflicts when both are
present. In this case the driver was reusing the ti_bandgap name.

Signed-off-by: Tom Rini <trini@konsulko.com>
8 months agospmi: sandbox: Make U_BOOT_DRIVER entries unique
Tom Rini [Thu, 25 Sep 2025 20:56:18 +0000 (14:56 -0600)] 
spmi: sandbox: Make U_BOOT_DRIVER entries unique

All instances of the U_BOOT_DRIVER must use a unique name or they will
lead to link time failures due to name space conflicts when both are
present. In this case the driver was reusing the msm name.

Signed-off-by: Tom Rini <trini@konsulko.com>
8 months agortc: Make U_BOOT_DRIVER entries unique
Tom Rini [Thu, 25 Sep 2025 20:56:16 +0000 (14:56 -0600)] 
rtc: Make U_BOOT_DRIVER entries unique

All instances of the U_BOOT_DRIVER must use a unique name or they will
lead to link time failures due to name space conflicts when both are
present. In this case the driver was reusing the max313xx name.

Signed-off-by: Tom Rini <trini@konsulko.com>
8 months agogpio: aspeed: Make U_BOOT_DRIVER entries unique
Tom Rini [Thu, 25 Sep 2025 20:56:12 +0000 (14:56 -0600)] 
gpio: aspeed: Make U_BOOT_DRIVER entries unique

All instances of the U_BOOT_DRIVER must use a unique name or they will
lead to link time failures due to name space conflicts when both are
present. In this case gpio-aspeed-g7 was using the same name as
gpio-aspeed.

Signed-off-by: Tom Rini <trini@konsulko.com>
8 months agopci: Remove pcie_intel_fpga driver
Tom Rini [Thu, 25 Sep 2025 20:43:14 +0000 (14:43 -0600)] 
pci: Remove pcie_intel_fpga driver

This driver has never been enabled by a platform since introduction and
does not currently compile. Remove it.

Signed-off-by: Tom Rini <trini@konsulko.com>
8 months agoarm: dts: k3-am654: add vin-supply regulators for DDR
Bryan Brattlof [Fri, 3 Oct 2025 12:15:45 +0000 (07:15 -0500)] 
arm: dts: k3-am654: add vin-supply regulators for DDR

As of commit f98d812e5353 ("power: regulator: Add vin-supply for GPIO
and Fixed regulators") we must ensure the parent nodes of a regulator
are present in DT if they are described in the vin-supply property

For the am65x reference board the DRAM chips are fed by the 3v3 rail
which is fed by the main 12v rail. Add the bootph properties to these DT
nodes to prevent them from being pruned during the SPL build so we can
enable power to the DRAM chips

Signed-off-by: Bryan Brattlof <bb@ti.com>
Tested-by: Nishanth Menon <nm@ti.com>
8 months agofs: ubifs: Fix and rework error handling in ubifs_finddir
Andrew Goodbody [Fri, 3 Oct 2025 10:42:52 +0000 (11:42 +0100)] 
fs: ubifs: Fix and rework error handling in ubifs_finddir

Add a null check for 'file' before dereferencing it and also rework the
error handling to be a bit more sane.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
8 months agofs: ubifs: Need to check return for being an error pointer
Andrew Goodbody [Fri, 3 Oct 2025 10:42:51 +0000 (11:42 +0100)] 
fs: ubifs: Need to check return for being an error pointer

The return value from alloc_super can be an error pointer so the error
check needs to detect this as well as checking the pointer for being
NULL.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
8 months agofs: ubifs: Ensure buf is freed before return
Andrew Goodbody [Fri, 3 Oct 2025 10:42:50 +0000 (11:42 +0100)] 
fs: ubifs: Ensure buf is freed before return

Returning directly after buf has been allocated will result in a memory
leak. Instead set the error code and goto the common unwind code to
ensure that buf will be freed before returning.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
8 months agoubi: extend support for LED activity
Yegor Yefremov [Thu, 2 Oct 2025 11:35:50 +0000 (13:35 +0200)] 
ubi: extend support for LED activity

Add LED activity for ubi_dev_scan() and ubi_volume_read() routines.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
8 months agodrivers/mtd/ubispl/ubispl.c: limit copy size
Benedikt Spranger [Wed, 17 Sep 2025 09:14:17 +0000 (11:14 +0200)] 
drivers/mtd/ubispl/ubispl.c: limit copy size

The fastmap VID header is embedded in struct ubi_scan_info. During fastmap
scan, the header is copied into struct ubi_scan_info, if valid. The former
code mixed up the amount of copied bytes and copied more bytes than
nessesary. This had no side effect, since the affected struct members are
uninitialized at that point and overwritten later.

Limit the copied bytes to the VID header size.

Signed-off-by: Benedikt Spranger <b.spranger@linutronix.de>
Reported-by: Andrew Goodbody <andrew.goodbody@linaro.org>
8 months agomtd: ubi: Remove test that always fails
Andrew Goodbody [Fri, 1 Aug 2025 11:49:48 +0000 (12:49 +0100)] 
mtd: ubi: Remove test that always fails

When checking the VID header of a static volume there is an early test
for data_size == 0 so testing for that condition again is guaranteed to
fail. Just remove this piece of code.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
8 months agocmd/dma: implement dmareset command
briansune [Tue, 23 Sep 2025 18:12:54 +0000 (02:12 +0800)] 
cmd/dma: implement dmareset command

This adds a new U-Boot command 'c5_pl330_dma' for Cyclone V SoCDK
boards. It provides access to the Reset Manager's Per2ModRst register
to release the reset for ARM PrimeCell PL330 DMA channels. This allows
software to initialize and use the PL330 DMA controller properly after
reset.

Signed-off-by: Brian Sune <briansune@gmail.com>
[trini: Minor style fixes]
Signed-off-by: Tom Rini <trini@konsulko.com>
8 months agomkimage: Add help text for bundling TFA BL31 in mkimage -f auto
Marek Vasut [Thu, 25 Sep 2025 13:47:35 +0000 (15:47 +0200)] 
mkimage: Add help text for bundling TFA BL31 in mkimage -f auto

Add missing help text for the -y and -Y parameters of mkimage.

Fixes: 6dfd14e1228e ("mkimage: Add support for bundling TFA BL31 in mkimage -f auto")
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
8 months agoboard: ti: am335x: Do not call disabled PMIC functions
Maarten Brock [Mon, 22 Sep 2025 09:22:48 +0000 (09:22 +0000)] 
board: ti: am335x: Do not call disabled PMIC functions

When PMIC drivers are disabled their undefined functions cannot be called.

Signed-off-by: Maarten Brock <maarten.brock@sttls.nl>
8 months agomisc: fs_loader: Use buffer pointer in request_firmware_into_buf_via_script()
Marek Vasut [Sun, 21 Sep 2025 22:35:18 +0000 (00:35 +0200)] 
misc: fs_loader: Use buffer pointer in request_firmware_into_buf_via_script()

Use plain buffer pointer in request_firmware_into_buf_via_script()
instead of a pointer to pointer. The later is not necessary as the
request_firmware_into_buf_via_script() does not modify the buffer
pointer. Update the mediatek driver to match.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Weijie Gao <weijie.gao@mediatek.com>
8 months agoairoha: rework RAM size handling to support multiple RAM size
Christian Marangi [Wed, 10 Sep 2025 08:37:35 +0000 (10:37 +0200)] 
airoha: rework RAM size handling to support multiple RAM size

There are multiple version of the same reference board with different
RAM size and it's not enough to base the RAM size entirely from DT. To
better support it use the get_ram_size way to scan for the actual RAM
size of Airoha SoC and increase the size of the memory map.

Also rework the memory map to account for 2 memory map. The first one of
2GB for 32bit DMA and for safe usage of U-Boot. The second one for the
rest of the RAM since up to 8GB are supported.

Reviewed-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
8 months agoMerge patch series "Add support for secure falcon mode: load kernel image before...
Tom Rini [Tue, 7 Oct 2025 19:02:52 +0000 (13:02 -0600)] 
Merge patch series "Add support for secure falcon mode: load kernel image before args"

Anshul Dalal <anshuld@ti.com> says:

During the implementation of falcon mode for TI's K3 devices [1], I encountered
several limitations in regards to the current falcon mode support in U-Boot
especially in ensuring a secure boot flow.

Although the current implementation allows for loading of a signed fitImage as
the SPL payload, there are still a few edge cases that might allow bypassing the
verified boot path.

The following issues with current falcon mode need to be resolved:

1) No fallback:
    We currently fallback to regular boot flow if falcon mode fails,
    this might not be secure.

2) No arguments file:
    We currently load a kernel file (which could be a raw image or FIT)
    alongside an args file (usually the DT). The args file here doesn't have
    any verification mechanism, so should be skipped altogether as the FIT can
    contain the DT.

3) No access to env:
    In ext and fat fs boot, currently we also reads the environment to get the
    names of the kernel and the arg file. This should be disabled in secure
    falcon flow as the env might not be secure.

4) No raw image boot:
    Boot should fail when the kernel file is a raw kernel image, only FIT should
    be allowed.

As per the recommendation of maintainers[2], I have decided to split the above
set of tasks into multiple patch series. This is the first one which fixes the
load order of kernel image and the args file in falcon mode. Along with some
minor cleanup.

[1]: https://lore.kernel.org/u-boot/20250603142452.2707171-1-anshuld@ti.com/
[2]: https://lore.kernel.org/u-boot/20250911172313.GT124814@bill-the-cat/

Link: https://lore.kernel.org/r/20250923124639.667718-1-anshuld@ti.com
8 months agospl: ext, fat: cleanup use of CONFIG_SPL_LIBCOMMON_SUPPORT
Anshul Dalal [Tue, 23 Sep 2025 12:46:38 +0000 (18:16 +0530)] 
spl: ext, fat: cleanup use of CONFIG_SPL_LIBCOMMON_SUPPORT

Minor cleanup of spl_ext and spl_fat files, removing the outdated
CONFIG_SPL_LIBCOMMON_SUPPORT symbols similar to the commit 1847129025e0
("spl: mmc: Drop checks for CONFIG_SPL_LIBCOMMON_SUPPORT") and adding a
few extra failure reports.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Anshul Dalal <anshuld@ti.com>
8 months agospl: mmc: load kernel image before args in falcon
Anshul Dalal [Tue, 23 Sep 2025 12:46:37 +0000 (18:16 +0530)] 
spl: mmc: load kernel image before args in falcon

Load the kernel image before args in falcon mode to be consistent with
the load order for other boot media.

Signed-off-by: Anshul Dalal <anshuld@ti.com>
8 months agospl: ext: load kernel image before args in falcon
Anshul Dalal [Tue, 23 Sep 2025 12:46:36 +0000 (18:16 +0530)] 
spl: ext: load kernel image before args in falcon

Load the kernel image before args in falcon mode to be consistent with
the load order for other boot media.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Anshul Dalal <anshuld@ti.com>
8 months agospl: fat: load kernel image before args in falcon
Anshul Dalal [Tue, 23 Sep 2025 12:46:35 +0000 (18:16 +0530)] 
spl: fat: load kernel image before args in falcon

Currently in falcon mode, the FS and raw mmc boot loads the args file
first followed by the kernel image whereas others load in the opposite
order. This inconsistency means falcon boot doesn't behave the same
across various boot media.

For example, in the case where the kernel file is a FIT with the kernel
image present alongside the dtb and the args file is another DT, which
DT should be picked? The one form the FIT or the one set by the args
file? Currently this depends entirely on how the boot media handles
falcon mode.

Therefore, this patch enforces the load order of the kernel image first
followed by the args file in FAT FS boot. So in the above example, the
args file would take precedence.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Anshul Dalal <anshuld@ti.com>
8 months agoimx: kontron-sl-mx8mm: Convert to OF_UPSTREAM
Frieder Schrempf [Tue, 7 Oct 2025 08:16:10 +0000 (10:16 +0200)] 
imx: kontron-sl-mx8mm: Convert to OF_UPSTREAM

Switch to OF_UPSTREAM to make use of the upstream devicetree.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
8 months agoimx: kontron-sl-mx8mm: Force default environment for serial loader boot
Eberhard Stoll [Tue, 7 Oct 2025 08:16:09 +0000 (10:16 +0200)] 
imx: kontron-sl-mx8mm: Force default environment for serial loader boot

Enable CONFIG_ENV_IS_NOWHERE and force default environment when SoC
boots from serial loader. In this case the U-Boot environment cannot
be stored to flash with the 'saveenv' command.

This makes serial loader boot completely independent from any
environment stored in flash.

Signed-off-by: Eberhard Stoll <eberhard.stoll@kontron.de>
Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
8 months agoimx: kontron-sl-mx8mm: Autostart fastboot if booted from USB
Frieder Schrempf [Tue, 7 Oct 2025 08:16:08 +0000 (10:16 +0200)] 
imx: kontron-sl-mx8mm: Autostart fastboot if booted from USB

This is useful for development and manufacturing setups as fastboot
can be used without requiring any user input on the device.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
8 months agoimx: kontron-sl-mx8mm: Enable USB hub on BL i.MX8MM OSM-S board
Frieder Schrempf [Tue, 7 Oct 2025 08:16:07 +0000 (10:16 +0200)] 
imx: kontron-sl-mx8mm: Enable USB hub on BL i.MX8MM OSM-S board

Probe the USB hub on the BL i.MX8MM OSM-S board.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
8 months agoimx: kontron-sl-mx8mm: Enable standard boot and disable legacy distro boot
Frieder Schrempf [Tue, 7 Oct 2025 08:16:06 +0000 (10:16 +0200)] 
imx: kontron-sl-mx8mm: Enable standard boot and disable legacy distro boot

The bootstd framework is the new way to support various bootflows
and media. Use it instead of legacy distro boot.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
8 months agoimx: kontron-sl-mx8mm: Enable multiple useful commands, drivers and features
Frieder Schrempf [Tue, 7 Oct 2025 08:16:05 +0000 (10:16 +0200)] 
imx: kontron-sl-mx8mm: Enable multiple useful commands, drivers and features

Enable a bunch of useful features such as:

* Linux devicetree fixups
* devicetree overlay support
* secure boot dependencies
* commands (filesystems, disks, etc.)
* fastboot support
* USB storage/ethernet

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
8 months agoimx: kontron-sl-mx8mm: Export current env config to devicetree
Frieder Schrempf [Tue, 7 Oct 2025 08:16:04 +0000 (10:16 +0200)] 
imx: kontron-sl-mx8mm: Export current env config to devicetree

This allows userspace tools like libubootenv to determine the
location of the currently used environment and select a
matching config.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
8 months agoimx: kontron-sl-mx8mm: Use eMMC boot part for environment if booting from eMMC
Frieder Schrempf [Tue, 7 Oct 2025 08:16:03 +0000 (10:16 +0200)] 
imx: kontron-sl-mx8mm: Use eMMC boot part for environment if booting from eMMC

Depending on the MMC boot device, select the proper location for the
environment.

* SD card and eMMC main partition: use offsets from CONFIG_ENV_OFFSET
  and CONFIG_ENV_OFFSET_REDUND.
* eMMC boot partition: use offset -2*ENV_SIZE and -ENV_SIZE from the
  end of the partition.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
8 months agoimx: kontron-sl-mx8mm: Add support for EEPROM on OSM-S module
Frieder Schrempf [Tue, 7 Oct 2025 08:16:02 +0000 (10:16 +0200)] 
imx: kontron-sl-mx8mm: Add support for EEPROM on OSM-S module

Enable config options to access the EEPROM on the OSM-S i.MX8MM
SoM module.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
8 months agoimx: kontron-sl-mx8mm: Enable fixed regulators
Frieder Schrempf [Tue, 7 Oct 2025 08:16:01 +0000 (10:16 +0200)] 
imx: kontron-sl-mx8mm: Enable fixed regulators

Enable support for using fixed regulators from the devicetree and
auto enable them if requested.

This way U-Boot will enable the CARRIER_PWR_EN signal of the OSM
module automatically while initializing the board.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
8 months agoimx: kontron-sl-mx8mm: Remove deprecation warning for old modules
Frieder Schrempf [Tue, 7 Oct 2025 08:16:00 +0000 (10:16 +0200)] 
imx: kontron-sl-mx8mm: Remove deprecation warning for old modules

The module version this warning is referring to never really existed
except for in-house development and there is a conflict with the
I2C address used for detecting it and the I2C EEPROM of the latest
OSM-S module. Remove the check.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
8 months agoimx: kontron-sl-mx8mm: Enable SDP support for loading via USB
Frieder Schrempf [Tue, 7 Oct 2025 08:15:59 +0000 (10:15 +0200)] 
imx: kontron-sl-mx8mm: Enable SDP support for loading via USB

Enable everything that is required to load via USB. The SPL needs
SDP support so it can load the U-Boot proper image via USB after
it has been loaded via serial loader mode of the i.MX.

This way we can use the uuu tool for loading SPL and U-Boot
proper like this:

  uuu -brun flash.bin

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
8 months agoimx: kontron-sl-mx8mm: Increase CONFIG_SPL_MAX_SIZE
Frieder Schrempf [Tue, 7 Oct 2025 08:15:58 +0000 (10:15 +0200)] 
imx: kontron-sl-mx8mm: Increase CONFIG_SPL_MAX_SIZE

The limit of 0x27000 (156 KiB) was valid at times the DDR firmware
required a fixed amount of 96 KiB of space. Now that we use binman
to include the DDR firmware it only needs around 57 KiB of space and
there is more room for the SPL.

Increase the max SPL size to 196 KiB so there is still 60 KiB for DDR
firmware. This allows us to enable USB and SDP support in SPL.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
8 months agoboard: phytec: phycore_imx8mp: Add rauc to bootmeths
Martin Schwan [Thu, 2 Oct 2025 11:20:37 +0000 (13:20 +0200)] 
board: phytec: phycore_imx8mp: Add rauc to bootmeths

Add rauc to bootmeths variable if BOOTMETH_RAUC is enabled. This is
setting a proper default for RAUC enabled systems.

Signed-off-by: Martin Schwan <m.schwan@phytec.de>
8 months agoMerge branch 'next'
Tom Rini [Mon, 6 Oct 2025 19:20:24 +0000 (13:20 -0600)] 
Merge branch 'next'

Merge the outstanding changes from the 'next' branch to master.

8 months agoPrepare v2025.10 v2025.10
Tom Rini [Mon, 6 Oct 2025 19:13:09 +0000 (13:13 -0600)] 
Prepare v2025.10

Signed-off-by: Tom Rini <trini@konsulko.com>
8 months agocmd: mtd: add benchmark option to the help
Mikhail Kshevetskiy [Tue, 30 Sep 2025 11:03:02 +0000 (14:03 +0300)] 
cmd: mtd: add benchmark option to the help

The patch adds benchmark option to the help of mtd command. For the
'mtd write' case the help line exceed 80 characters. Ignore this issue
as modern terminals are capable to handle more characters.

The patch also formats other command to make sure all device names
starts on the same collumn.

Fixes: d246e70cf81d0 ("cmd: mtd: Enable speed benchmarking")
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agocmd: mtd: fix speed measurement in the speed benchmark
Mikhail Kshevetskiy [Tue, 30 Sep 2025 11:03:01 +0000 (14:03 +0300)] 
cmd: mtd: fix speed measurement in the speed benchmark

The shown speed is inversely proportional to the data size.
See the output:

  spi-nand: spi_nand nand@0: Micron SPI NAND was found.
  spi-nand: spi_nand nand@0: 256 MiB, block size: 128 KiB, page size: 2048, OOB size: 128
  ...
  => mtd read.benchmark spi-nand0 $loadaddr 0 0x40000
  Reading 262144 byte(s) (128 page(s)) at offset 0x00000000
  Read speed: 63kiB/s
  => mtd read.benchmark spi-nand0 $loadaddr 0 0x20000
  Reading 131072 byte(s) (64 page(s)) at offset 0x00000000
  Read speed: 127kiB/s
  => mtd read.benchmark spi-nand0 $loadaddr 0 0x10000
  Reading 65536 byte(s) (32 page(s)) at offset 0x00000000
  Read speed: 254kiB/s

In the spi-nand case 'io_op.len' is not always the same as 'len', thus
we are using the wrong amount of data to derive the speed.

Also make sure we are using 64-bit calculation to get a more precise
results.

Fixes: d246e70cf81d0 ("cmd: mtd: Enable speed benchmarking")
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agocmd: mtd: add nand_read_test command support
Mikhail Kshevetskiy [Wed, 24 Sep 2025 04:20:33 +0000 (07:20 +0300)] 
cmd: mtd: add nand_read_test command support

This patch implements read-only test of nand flash devices.

Test reads blocks of NAND flash in normal and raw modes and compares
results. The following statuses can be returned for a block:
 * non-ecc reading failed,
 * ecc reading failed,
 * block is bad,
 * bitflips is above maximum,
 * actual number of biflips above reported one,
 * bitflips reached it maximum value,
 * bitflips above threshold,
 * block is ok.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agocmd: mtd: add nand_write_test command support
Mikhail Kshevetskiy [Wed, 24 Sep 2025 04:20:32 +0000 (07:20 +0300)] 
cmd: mtd: add nand_write_test command support

Some nand flashes (like spi-nand one) are registered with mtd
subsystem only, thus nand command can't be used to work with
such flashes. As result some functionality is missing.

This patch implements 'nand torture' functionality for mtd command.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agocmd: mtd: add markbad command support
Mikhail Kshevetskiy [Wed, 24 Sep 2025 04:20:31 +0000 (07:20 +0300)] 
cmd: mtd: add markbad command support

Some nand flashes (like spi-nand one) are registered with mtd
subsystem only, thus nand command can't be used to work with
such flashes. As result some functionality is missing.

This patch implements 'nand markbad' functionality for mtd command.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agomtd: spinand: repeat reading in regular mode if continuous reading fails
Mikhail Kshevetskiy [Tue, 30 Sep 2025 00:21:09 +0000 (03:21 +0300)] 
mtd: spinand: repeat reading in regular mode if continuous reading fails

Continuous reading may result in multiple flash pages reading in one
operation. Unfortunately, not all spinand controllers support such
large reading. They will read less data. Unfortunately, the operation
can't be continued.

In this case:
 * disable continuous reading on this (not good enough) spi controller
 * repeat reading in regular mode.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agomtd: spinand: try a regular dirmap if creating a dirmap for continuous reading fails
Mikhail Kshevetskiy [Tue, 30 Sep 2025 00:21:08 +0000 (03:21 +0300)] 
mtd: spinand: try a regular dirmap if creating a dirmap for continuous reading fails

Continuous reading may result in multiple flash pages reading in one
operation. Typically only one flash page has read/written (a little bit
more than 2-4 Kb), but continuous reading requires the spi controller
to read up to 512 Kb in one operation without toggling CS in beetween.

Roughly speaking spi controllers can be divided on 2 categories:
 * spi controllers without dirmap acceleration support
 * spi controllers with dirmap acceleration support

Firt of them will have issues with continuous reading if restriction on
the transfer length is implemented in the adjust_op_size() handler.
Second group often supports acceleration of single page only reading.
Thus enabling of continuous reading can break flash reading.

This patch tries to create dirmap for continuous reading first and
fallback to regular reading if spi controller refuses to create it.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agomtd: spinand: fix direct mapping creation sizes
Mikhail Kshevetskiy [Tue, 30 Sep 2025 00:21:07 +0000 (03:21 +0300)] 
mtd: spinand: fix direct mapping creation sizes

Continuous mode is only supported for data reads, thus writing
requires only single flash page mapping.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agomtd: spinand: Sync core code and device support with Linux 6.17-rc1
Mikhail Kshevetskiy [Tue, 30 Sep 2025 00:21:06 +0000 (03:21 +0300)] 
mtd: spinand: Sync core code and device support with Linux 6.17-rc1

This makes the U-Boot SPI NAND driver almost the same as in Linux
6.17-rc1. The only major differences are:
 * support of ECC engines. The Linux driver supports different ECC
   engines while U-Boot uses on-die ECC only.
 * per operation maximum SPI bus frequency

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agomtd: spinand: Add a ->configure_chip() hook
Miquel Raynal [Tue, 30 Sep 2025 00:21:05 +0000 (03:21 +0300)] 
mtd: spinand: Add a ->configure_chip() hook

There is already a manufacturer hook, which is manufacturer specific but
not chip specific. We no longer have access to the actual NAND identity
at this stage so let's add a per-chip configuration hook to align the
chip configuration (if any) with the core's setting.

This is a port of linux commit
da55809ebb45 ("mtd: spinand: Add a ->configure_chip() hook")

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> # U-Boot port
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agomtd: spinand: propagate spinand_wait() errors from spinand_write_page()
Gabor Juhos [Tue, 30 Sep 2025 00:21:04 +0000 (03:21 +0300)] 
mtd: spinand: propagate spinand_wait() errors from spinand_write_page()

Since commit 3d1f08b032dc ("mtd: spinand: Use the external ECC engine
logic") the spinand_write_page() function ignores the errors returned
by spinand_wait(). Change the code to propagate those up to the stack
as it was done before the offending change.

This is a port of linux commit
091d9e35b85b ("mtd: spinand: propagate spinand_wait() errors from spinand_write_page()")

Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> # U-Boot port
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agomtd: spinand: Enhance the logic when picking a variant
Mikhail Kshevetskiy [Tue, 30 Sep 2025 00:21:03 +0000 (03:21 +0300)] 
mtd: spinand: Enhance the logic when picking a variant

Currently the best variant picked in the first one in the list provided
in the manufacturer driver. This worked well while all operations where
performed at the same speed, but with the introduction of DTR transfers
this no longer works correctly.

Let's continue iterating over all the alternatives, even if we find a
match, keeping a reference over the theoretically fastest
operation. Only at the end we can tell which variant is the best.

This logic happening only once at boot.

The patch is based on linux commit
666c299be696 (mtd: spinand: Enhance the logic when picking a variant)
created by Miquel Raynal <miquel.raynal@bootlin.com>

The code was a bit restricted in the functionality since not all
required functionality is supported in the u-boot.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agomtd: spinand: add OTP support
Mikhail Kshevetskiy [Tue, 30 Sep 2025 00:21:02 +0000 (03:21 +0300)] 
mtd: spinand: add OTP support

The code was ported from linux-6.15

based on a linux commit c06b1f753bea (mtd: spinand: add OTP support)
created by Martin Kurbanov <mmkurbanov@salutedevices.com>

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agomtd: spinand: Add read retry support
Cheng Ming Lin [Tue, 30 Sep 2025 00:21:01 +0000 (03:21 +0300)] 
mtd: spinand: Add read retry support

When the host ECC fails to correct the data error of NAND device,
there's a special read for data recovery method which can be setup
by the host for the next read. There are several retry levels that
can be attempted until the lost data is recovered or definitely
assumed lost.

This is the port of linux commit
f2cb43c98010 (mtd: spinand: Add read retry support)

Signed-off-by: Cheng Ming Lin <chengminglin@mxic.com.tw>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> # U-Boot port
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agomtd: spinand: add support of continuous reading mode
Mikhail Kshevetskiy [Tue, 30 Sep 2025 00:21:00 +0000 (03:21 +0300)] 
mtd: spinand: add support of continuous reading mode

The code was ported from linux-6.12. The original continuous reading
support was implemented by Miquel Raynal <miquel.raynal@bootlin.com>
in linux commit 631cfdd0520d (mtd: spi-nand: Add continuous read support).

Here is an original patch description:
--------------------------------------
A regular page read consist in:
- Asking one page of content from the NAND array to be loaded in the
  chip's SRAM,
- Waiting for the operation to be done,
- Retrieving the data (I/O phase) from the chip's SRAM.

When reading several sequential pages, the above operation is repeated
over and over. There is however a way to optimize these accesses, by
enabling continuous reads. The feature requires the NAND chip to have a
second internal SRAM area plus a bit of additional internal logic to
trigger another internal transfer between the NAND array and the second
SRAM area while the I/O phase is ongoing. Once the first I/O phase is
done, the host can continue reading more data, continuously, as the chip
will automatically switch to the second SRAM content (which has already
been loaded) and in turns trigger the next load into the first SRAM area
again.

From an instruction perspective, the command op-codes are different, but
the same cycles are required. The only difference is that after a
continuous read (which is stopped by a CS deassert), the host must
observe a delay of tRST. However, because there is no guarantee in Linux
regarding the actual state of the CS pin after a transfer (in order to
speed-up the next transfer if targeting the same device), it was
necessary to manually end the continuous read with a configuration
register write operation.

Continuous reads have two main drawbacks:
* They only work on full pages (column address ignored)
* Only the main data area is pulled, out-of-band bytes are not
  accessible. Said otherwise, the feature can only be useful with on-die
  ECC engines.

Performance wise, measures have been performed on a Zynq platform using
Macronix SPI-NAND controller with a Macronix chip (based on the
flash_speed tool modified for testing sequential reads):
- 1-1-1 mode: performances improved from +3% (2-pages) up to +10% after
              a dozen pages.
- 1-1-4 mode: performances improved from +15% (2-pages) up to +40% after
              a dozen pages.

This series is based on a previous work from Macronix engineer Jaime
Liao.
--------------------------------------

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agomtd: spinand: Introduce a way to avoid raw access
Takahiro Kuwano [Tue, 30 Sep 2025 00:20:59 +0000 (03:20 +0300)] 
mtd: spinand: Introduce a way to avoid raw access

SkyHigh spinand device has ECC enable bit in configuration register but
it must be always enabled. If ECC is disabled, read and write ops
results in undetermined state. For such devices, a way to avoid raw
access is needed.

Introduce SPINAND_NO_RAW_ACCESS flag to advertise the device does not
support raw access. In such devices, the on-die ECC engine ops returns
error to I/O request in raw mode.

Checking and marking BBM need to be cared as special case, by adding
fallback mechanism that tries read/write OOB with ECC enabled.

This is a port of linux commit
6d9d6ab3a82a (mtd: spinand: Introduce a way to avoid raw access)

Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> # U-Boot port
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agomtd: spinand: Remove write_enable_op() in markbad()
Takahiro Kuwano [Tue, 30 Sep 2025 00:20:58 +0000 (03:20 +0300)] 
mtd: spinand: Remove write_enable_op() in markbad()

We don't have to call spinand_write_enable_op() in spinand_markbad() as
it is called in spinand_write_page().

This is the port of linux commit
c6858779f1f5 (mtd: spinand: Remove write_enable_op() in markbad())

Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> # U-Boot port
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agomtd: spinand: Add support for setting plane select bits
Cheng Ming Lin [Tue, 30 Sep 2025 00:20:57 +0000 (03:20 +0300)] 
mtd: spinand: Add support for setting plane select bits

Add two flags for inserting the Plane Select bit into the column
address during the write_to_cache and the read_from_cache operation.

Add the SPINAND_HAS_PROG_PLANE_SELECT_BIT flag for serial NAND flash
that require inserting the Plane Select bit into the column address
during the write_to_cache operation.

Add the SPINAND_HAS_READ_PLANE_SELECT_BIT flag for serial NAND flash
that require inserting the Plane Select bit into the column address
during the read_from_cache operation.

This is a port of linux commit
ca229bdbef29 (mtd: spinand: Add support for setting plane select bits)

Signed-off-by: Cheng Ming Lin <chengminglin@mxic.com.tw>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20240909092643.2434479-2-linchengming884@gmail.com
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> # U-Boot port
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agomtd: spinand: set bitflip_threshold to 75% of ECC strength
Daniel Golle [Tue, 30 Sep 2025 00:20:56 +0000 (03:20 +0300)] 
mtd: spinand: set bitflip_threshold to 75% of ECC strength

Reporting an unclean read from SPI-NAND only when the maximum number
of correctable bitflip errors has been hit seems a bit late.
UBI LEB scrubbing, which depends on the lower MTD device reporting
correctable bitflips, then only kicks in when it's almost too late.

Set bitflip_threshold to 75% of the ECC strength, which is also the
default for raw NAND.

This is a port of linux commit
1824520e7477 (mtd: spinand: set bitflip_threshold to 75% of ECC strength)

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/2117e387260b0a96f95b8e1652ff79e0e2d71d53.1723427450.git.daniel@makrotopia.org
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> # U-Boot port
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agomtd: spinand: Sync core code and device support with Linux 6.10
Mikhail Kshevetskiy [Tue, 30 Sep 2025 00:20:55 +0000 (03:20 +0300)] 
mtd: spinand: Sync core code and device support with Linux 6.10

This makes the U-Boot SPI NAND driver almost the same as in Linux 6.10.
The only major difference is support of ECC engines. The Linux driver
supports different ECC engines while U-Boot uses on-die ECC only.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agomtd: spinand: Refactor ECC/OOB functions
Mikhail Kshevetskiy [Tue, 30 Sep 2025 00:20:54 +0000 (03:20 +0300)] 
mtd: spinand: Refactor ECC/OOB functions

changes:
 * Move spinand_check_ecc_status(), spinand_noecc_ooblayout_ecc(),
   spinand_noecc_ooblayout_free() and spinand_noecc_ooblayout close
   to each other.
 * some code formatting
 * remove comments not present in linux driver

This aligns the code with Linux 6.10.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agomtd: spinand: Refactor spinand_init* functions
Mikhail Kshevetskiy [Tue, 30 Sep 2025 00:20:53 +0000 (03:20 +0300)] 
mtd: spinand: Refactor spinand_init* functions

No functional changes, just some refactoring to better match linux
kernel driver.

changes:
 * move spinand configuration reading out from spinand_init_cfg_cache()
   to separate function spinand_read_cfg()
 * move spinand flash initialization to separate function
   spinand_init_flash()
 * move direct mapping initialization to the end of spinand_init()

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agomtd: spinand: Align logic for enabling ECC to match Linux kernel
Mikhail Kshevetskiy [Tue, 30 Sep 2025 00:20:52 +0000 (03:20 +0300)] 
mtd: spinand: Align logic for enabling ECC to match Linux kernel

This aligns the logic to match the Linux kernel implementation.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agomtd: spinand: Make use of spinand_to_[mtd/nand]() helpers
Mikhail Kshevetskiy [Tue, 30 Sep 2025 00:20:51 +0000 (03:20 +0300)] 
mtd: spinand: Make use of spinand_to_[mtd/nand]() helpers

Use spinand_to_nand() and spinand_to_mtd() helpers instead of
nanddev_to_mtd() and direct access to spinand structure fields.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agomtd: spinand: Extend spinand_wait() to match Linux kernel implementation
Mikhail Kshevetskiy [Tue, 30 Sep 2025 00:20:50 +0000 (03:20 +0300)] 
mtd: spinand: Extend spinand_wait() to match Linux kernel implementation

This aligns spinand_wait() with the linux kernel. Instead of calling into
spi_mem_poll_status() which is not implemented in U-Boot, we code the
polling logic and make sure that schedule() is called periodically.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agomtd: spinand: core: add missing MODULE_DEVICE_TABLE()
Alexander Lobakin [Tue, 30 Sep 2025 00:20:49 +0000 (03:20 +0300)] 
mtd: spinand: core: add missing MODULE_DEVICE_TABLE()

The module misses MODULE_DEVICE_TABLE() for both SPI and OF ID tables
and thus never autoloads on ID matches.
Add the missing declarations.
Present since day-0 of spinand framework introduction.

This is a port of linux commit
25fefc88c71f ("mtd: spinand: core: add missing MODULE_DEVICE_TABLE()")

Signed-off-by: Alexander Lobakin <alobakin@pm.me>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20210323173714.317884-1-alobakin@pm.me
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> # U-Boot port
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agomtd: nand: Add a NAND page I/O request type
Miquel Raynal [Tue, 30 Sep 2025 00:20:48 +0000 (03:20 +0300)] 
mtd: nand: Add a NAND page I/O request type

Use an enum to differentiate the type of I/O (reading or writing a
page). Also update the request iterator.

This is a port of linux commit
701981cab016 ("mtd: nand: Add a NAND page I/O request type")

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Link: https://lore.kernel.org/linux-mtd/20200827085208.16276-5-miquel.raynal@bootlin.com
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> # U-Boot port
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agomtd: spinand: Use the spi-mem dirmap API
Mikhail Kshevetskiy [Tue, 30 Sep 2025 00:20:47 +0000 (03:20 +0300)] 
mtd: spinand: Use the spi-mem dirmap API

Make use of the spi-mem direct mapping API to let advanced controllers
optimize read/write operations when they support direct mapping.

Based on a linux commit 981d1aa0697c ("mtd: spinand: Use the spi-mem dirmap API")
created by Boris Brezillon <bbrezillon@kernel.org> with additional
fixes taken from Linux 6.10.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agospi: spi-mem: Extend SPI MEM ops to match Linux 6.16
Mikhail Kshevetskiy [Tue, 30 Sep 2025 00:20:46 +0000 (03:20 +0300)] 
spi: spi-mem: Extend SPI MEM ops to match Linux 6.16

This pulls in multiple changes from the Linux kernel in order to keep
the code in sync. This also fixes octal mode support.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
8 months agoMerge branch 'next' of git://source.denx.de/u-boot-usb into next
Tom Rini [Sun, 5 Oct 2025 15:50:57 +0000 (09:50 -0600)] 
Merge branch 'next' of git://source.denx.de/u-boot-usb into next

- Make the i2c-bus property for an onboard USB hub optional

8 months agousb: onboard-hub: Make i2c-bus optional
Michal Simek [Wed, 1 Oct 2025 06:20:07 +0000 (08:20 +0200)] 
usb: onboard-hub: Make i2c-bus optional

DT binding doesn't mandate i2c-bus as required property because hub itself
doesn't need to have i2c connected.
It can be in standalone mode that only power regulator and reset should be
handled.
Or hub should be configured via spi interface.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Reviewed-by: Marek Vasut <marek.vasut@mailbox.org>
8 months agoglobal: Add expected space between '#include' and directive
Tom Rini [Sat, 4 Oct 2025 19:31:01 +0000 (13:31 -0600)] 
global: Add expected space between '#include' and directive

These files had '#include<file.h>' rather than '#include <file.h>' which
while functional is not the correct style.

Signed-off-by: Tom Rini <trini@konsulko.com>
8 months agoclk: ti: fix K3 clock driver help texts
Yegor Yefremov [Mon, 22 Sep 2025 13:27:00 +0000 (15:27 +0200)] 
clk: ti: fix K3 clock driver help texts

Add "in SPL" to the SPL related driver help texts.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
8 months agoenv: fix typo in multiple Kconfig descriptions
Thomas Bonnefille [Wed, 24 Sep 2025 19:21:51 +0000 (21:21 +0200)] 
env: fix typo in multiple Kconfig descriptions

%s/environemt/environment

Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
8 months agoMerge patch series "Drop ATAGS for B&R boards"
Tom Rini [Fri, 3 Oct 2025 21:20:58 +0000 (15:20 -0600)] 
Merge patch series "Drop ATAGS for B&R boards"

Wolfgang Wallner <wolfgang.wallner@br-automation.com> says:

There was recently a discussion on which boards need ATAGS support.
The B&R boards which have this support enabled actualyl don't need it.
This patch series drops the settings from the relevant defconfigs.

Link: https://lore.kernel.org/r/20250919134308.122437-1-wolfgang.wallner@br-automation.com
8 months agocmd: spl: Remove ATAG support from this command
Tom Rini [Mon, 15 Sep 2025 19:05:48 +0000 (13:05 -0600)] 
cmd: spl: Remove ATAG support from this command

While we continue to have some systems which support extremely legacy
OS booting methods, we do not have use cases for supporting this in
Falcon mode anymore. Remove this support and references from the
documentation.

Co-developed-by: Anshul Dalal <anshuld@ti.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
8 months agolinux/kernel.h: Update upper_NN_bits() and lower_NN_bits() macros
Marek Vasut [Mon, 22 Sep 2025 12:29:22 +0000 (14:29 +0200)] 
linux/kernel.h: Update upper_NN_bits() and lower_NN_bits() macros

Synchronize upper_NN_bits() and lower_NN_bits() macros with Linux 6.16
commit 118d777c4cb4 ("wordpart.h: Add REPEAT_BYTE_U32()"). This fixes the
lower_32_bits() macros and assures it works with 64bit systems correctly.
This also adds 16bit variants of these macros, which will be used by the
Airoha PHY driver.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 months agoconfigs: brcp170: Drop CONFIG_SUPPORT_PASSING_ATAGS
Wolfgang Wallner [Fri, 19 Sep 2025 13:43:02 +0000 (15:43 +0200)] 
configs: brcp170: Drop CONFIG_SUPPORT_PASSING_ATAGS

CONFIG_SUPPORT_PASSING_ATAGS is not needed for this board.

Signed-off-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
8 months agoconfigs: brcp150: Drop CONFIG_SUPPORT_PASSING_ATAGS
Wolfgang Wallner [Fri, 19 Sep 2025 13:43:01 +0000 (15:43 +0200)] 
configs: brcp150: Drop CONFIG_SUPPORT_PASSING_ATAGS

CONFIG_SUPPORT_PASSING_ATAGS is not needed for this board.

Signed-off-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
8 months agoconfigs: brcp1: Drop CONFIG_SUPPORT_PASSING_ATAGS
Wolfgang Wallner [Fri, 19 Sep 2025 13:43:00 +0000 (15:43 +0200)] 
configs: brcp1: Drop CONFIG_SUPPORT_PASSING_ATAGS

CONFIG_SUPPORT_PASSING_ATAGS is not needed for these boards.

Signed-off-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
8 months agoarm: armv8: remove redundant definition of mmu_status
Anshul Dalal [Tue, 16 Sep 2025 11:22:05 +0000 (16:52 +0530)] 
arm: armv8: remove redundant definition of mmu_status

mmu_status is used in io memcpy functions to prevent accesses to non
8-byte aligned addresses when the mmu is disabled. Though there is a
redundant definition enabled when icaches is turned off by setting
SYS_ICACHE_OFF.

This patch removes the redundant definition, allowing mmu_status to
properly report the status regardless of config settings. This shouldn't
be a problem since access to non 8-byte aligned data can be done
irrespective of icache state.

Fixes: 268f6ac1f95c ("arm64: Update memcpy_{from, to}io() helpers")
Signed-off-by: Anshul Dalal <anshuld@ti.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
8 months agoRevert "fdt: Make sure there is no stale initrd left"
Sam Protsenko [Mon, 29 Sep 2025 22:19:26 +0000 (17:19 -0500)] 
Revert "fdt: Make sure there is no stale initrd left"

This reverts commit 9fe2e4b46458f9c4ec6b8115ebf18b4b26fe6127.

Commit 9fe2e4b46458 ("fdt: Make sure there is no stale initrd left")
introduces a regression in case when U-Boot transfers control to an EFI
app which acts as a subsequent bootloading program. Such an app might
try to set "linux,initrd-start" and "linux,initrd-end" fdt properties,
but by that time those properties are already removed by the code added
in the mentioned commit.

Particularly, the issue was observed on the E850-96 board where GBL EFI
app [1] can't run Android successfully anymore. More specifically, the
kernel can't see the ramdisk and panics with next messages:

    /dev/root: Can't open blockdev
    VFS: Cannot open root device "" or unknown-block(0,0): error -6
    Please append a correct "root=" boot option; ...
    Kernel panic - not syncing: VFS: Unable to mount root fs on
    unknown-block(0,0)

fdt_initrd() function (where initrd dts properties are removed) is
called two times:

1. First it's called by EFI boot manager (e.g. as a part of U-Boot
Standard Boot mechanism) when it's installing FDT:

    fdt_initrd
    image_setup_libfdt
    efi_install_fdt
    efi_bootmgr_run
    efi_mgr_boot

It's already enough for EFI app to malfunction. But then it's also
called second time:

2. From the EFI app, via EFI DT fixup protocol:

    fdt_initrd
    image_setup_libfdt
    efi_dt_fixup
    struct efi_dt_fixup_protocol efi_dt_fixup_prot = {
        .fixup = efi_dt_fixup
    };

See [2] for specific GBL code which sets those fdt properties and then
runs DT fixup protocol callback.

This issue was discussed [3], but no action was taken since then. Revert
this patch for now, until a proper solution can be found.

[1] https://source.android.com/docs/core/architecture/bootloader/generic-bootloader/gbl-dev
[2] https://android.googlesource.com/platform/bootable/libbootloader/+/refs/heads/gbl-mainline/gbl/libgbl/src/android_boot/mod.rs#208
[3] https://lists.denx.de/pipermail/u-boot/2025-July/593879.html

Fixes: 9fe2e4b46458 ("fdt: Make sure there is no stale initrd left")
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
8 months agoMerge tag 'doc-202510-rc6' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Fri, 3 Oct 2025 13:43:36 +0000 (07:43 -0600)] 
Merge tag 'doc-202510-rc6' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request doc-202510-rc6

CI: https://source.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/27807

* Update coding style to recommend b4 for patch submission
* pytest: Fix inline code and other formatting
* develop: fix grammar and syntax

8 months agodoc: pytest: Fix inline code and other formatting
Martin Schwan [Wed, 1 Oct 2025 07:44:37 +0000 (09:44 +0200)] 
doc: pytest: Fix inline code and other formatting

Mainly fix inline code and some other formatting mistakes. Inline code
uses double backticks `` in reStructuredText instead of single backticks
as in Markdown.

Also fix some smaller formatting issues, such as excess colons before
literal blocks.

Signed-off-by: Martin Schwan <m.schwan@phytec.de>
8 months agodoc: Update coding style to recommend b4 for patch submission
Javier Tia [Tue, 30 Sep 2025 12:53:28 +0000 (06:53 -0600)] 
doc: Update coding style to recommend b4 for patch submission

Replace references to patman with b4 as the recommended tool for
preparing and sending patches. b4 is widely adopted in the Linux kernel
community and U-Boot ships with configuration to simplify its use with
the project mailing list.

The updated guidelines describe how to prepare series with b4, handle
cover letters and recipient lists, run style checks, and send patches
safely. Instructions also highlight how to collect and apply review tags
before resending.

This change documents the preferred workflow for contributors and
ensures consistency with common practices across related upstream
communities.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
Signed-off-by: Javier Tia <javier.tia@linaro.org>
8 months agodoc: develop: fix grammar and syntax
Yegor Yefremov [Tue, 30 Sep 2025 11:08:39 +0000 (13:08 +0200)] 
doc: develop: fix grammar and syntax

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 months agoenv: spi: Fix gd->env_valid for the first write
Michal Simek [Mon, 22 Sep 2025 16:03:39 +0000 (18:03 +0200)] 
env: spi: Fix gd->env_valid for the first write

When both SPI environment locations are invalid (gd->env_valid ==
ENV_INVALID), the first call to saveenv writes to the primary location and
sets the active flag. However, the logic for updating gd->env_valid
incorrectly sets it to ENV_REDUND, which does not match the actual location
written. This causes the first two writes to target the same location, and
alternation only begins after the second write.

Update the logic to alternate gd->env_valid based on whether the last write
was to the primary or redundant location, ensuring the first write sets
ENV_VALID and subsequent writes alternate as expected. This aligns
env_valid with the actual storage location and fixes the alternation
sequence from the first write.

With this change, the "Valid environment" printout correctly reflects the
active location after each save, and the alternation between primary and
redundant locations works as intended from the start.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Reviewed-by: Marek Vasut <marek.vasut@mailbox.org>
Acked-by: E Shattow <e@freeshell.de>
8 months agob4-config: Improve b4 config for correct operation
Andrew Goodbody [Wed, 1 Oct 2025 09:28:37 +0000 (10:28 +0100)] 
b4-config: Improve b4 config for correct operation

The recent change to .b4-config resulted in some expected recipients not
being added to the address lists. Rework the commands so that all
expected recipients are added while maintaining the ordering from the
first change.

Fixes: 26efc940c86 ("b4-config: configure `b4` for U-Boot")
Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
8 months agoMerge tag 'u-boot-dfu-next-20251001' of https://source.denx.de/u-boot/custodians...
Tom Rini [Thu, 2 Oct 2025 17:20:01 +0000 (11:20 -0600)] 
Merge tag 'u-boot-dfu-next-20251001' of https://source.denx.de/u-boot/custodians/u-boot-dfu into next

u-boot-dfu-next-20251001

CI:
- https://source.denx.de/u-boot/custodians/u-boot-dfu/-/pipelines/27791

Fastboot:
- Fix has-slot command when using nand back-end.

USB gadget:
- Add missing null checks to atmel, dwc2 drivers (smatch)
- Remove redundant check in dwc3 gadget (smatch)

8 months agoMerge tag 'u-boot-socfpga-next-20250930' of https://source.denx.de/u-boot/custodians...
Tom Rini [Tue, 30 Sep 2025 22:11:23 +0000 (16:11 -0600)] 
Merge tag 'u-boot-socfpga-next-20250930' of https://source.denx.de/u-boot/custodians/u-boot-socfpga into next

SoCFPGA updates for v2025.10:

CI: https://source.denx.de/u-boot/custodians/u-boot-socfpga/-/pipelines/27762

This pull request brings a set of updates across SoCFPGA platforms
covering Agilex5, Agilex7, N5X, and Stratix10. The changes include:

* Agilex5 enhancements:
  - USB3.1 enablement and DWC3 host driver support
  - System Manager register configuration for USB3
  - Watchdog timeout increase and SDMMC clock API integration
  - dcache handling improvements in SMC mailbox path
  - Enable SPL_SYS_DCACHE_OFF in defconfig

* Clock driver improvements:
  - Introduce dt-bindings header for Agilex clocks
  - Add enable/disable API and EMAC clock selection fixes
  - Replace manual shifts with FIELD_GET usage

* DDR updates:
  - IOSSM mailbox compatibility check
  - Correct DDR calibration status handling

* Device tree changes:
  - Agilex5: disable cache allocation for reads
  - Stratix10: add NAND IP node
  - Enable driver model watchdog
  - Enable USB3.1 node for Agilex5

* Config cleanups:
  - Simplify Agilex7 VAB defconfig
  - Remove obsolete SYS_BOOTM_LEN from N5X VAB config
  - Enable CRC32 support for SoCFPGA
  - Increase USB hub debounce timeout

Overall this set improves reliability of DDR and cache flows,
adds missing USB and MMC features for Agilex5, and refines clock
and configuration handling across platforms.

This patch set has been tested on Agilex 5 devkit, and Agilex devkit.

8 months agoMerge tag 'u-boot-amlogic-next-20250930' of https://source.denx.de/u-boot/custodians...
Tom Rini [Tue, 30 Sep 2025 22:01:05 +0000 (16:01 -0600)] 
Merge tag 'u-boot-amlogic-next-20250930' of https://source.denx.de/u-boot/custodians/u-boot-amlogic into next

- set reversed bit when using internal phy on GXL SoCs
- support gpio toggle command for amlogic gpio
- fix saradc
- remove unreachable in meson clk driver
- Stop premature exit from for loop in meson pwm driver
- fix JetHub D1 eth mac fallback generation

8 months agoARM: amlogic: fix JetHub D1 eth mac fallback generation
Viacheslav Bocharov [Wed, 3 Sep 2025 11:06:03 +0000 (14:06 +0300)] 
ARM: amlogic: fix JetHub D1 eth mac fallback generation

JetHome has allocated a special range for MAC fallback on JetHub D1/D1+
devices.

Signed-off-by: Viacheslav Bocharov <adeep@lexina.in>
Link: https://lore.kernel.org/r/20250903110726.546083-1-adeep@lexina.in
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
8 months agopwm: meson: Stop premature exit from for loop
Andrew Goodbody [Fri, 8 Aug 2025 09:34:43 +0000 (10:34 +0100)] 
pwm: meson: Stop premature exit from for loop

In meson_pwm_probe the for loop attempts to get the name of a clock but
the following if..else statements only perform useful work if -ENODATA
is returned from clk_get_by_name. If clk_get_by_name simply succeeds
then this results in a premature exit from the for loop and the
following code can never be reached. Make the else clause only apply for
an error return from clk_get_by_name.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20250808-pwm_meson-v1-1-cddb7e5f76bd@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
8 months agoclk: meson: Remove unreachable code
Andrew Goodbody [Wed, 23 Jul 2025 16:37:24 +0000 (17:37 +0100)] 
clk: meson: Remove unreachable code

A second return following the first return is unreachable code so remove
it.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20250723-clk_meson-v1-1-8cd6e73145a4@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
8 months agoadc: meson-saradc: uint cannot be less than zero
Andrew Goodbody [Tue, 22 Jul 2025 14:06:14 +0000 (15:06 +0100)] 
adc: meson-saradc: uint cannot be less than zero

timeout is declared as a uint but then tested for being less than zero
which must always fail. Change the while loop for a pre-decrement on
timeout and test timeout for being zero.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20250722-meson_saradc-v1-1-1ab45d53da9d@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
8 months agopinctrl: meson: support gpio toggle command
Yang Xiwen [Mon, 16 Jun 2025 17:01:17 +0000 (01:01 +0800)] 
pinctrl: meson: support gpio toggle command

meson_gpio_get() always assumes gpio is configured to input mode. This
is incorrect and breaks `gpio toggle` command:

gpio: pin aobus-banks2 (gpio 2) value is 0
   Warning: value of pin is still 1

Fix it by adding the logic to handle both input and output mode.

Fixes: 2009a8d03fe5 ("pinctrl: meson: add GPIO support")
Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20250617-meson_ppinctrl-v3-1-218d9321a8d2@outlook.com
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
8 months agonet: mdio: mux-meson-gxl: set reversed bit when using internal phy
Neil Armstrong [Fri, 2 May 2025 06:51:45 +0000 (08:51 +0200)] 
net: mdio: mux-meson-gxl: set reversed bit when using internal phy

This bit is necessary to receive packets from the internal PHY.
Without this bit set, no activity occurs on the interface.

Normally u-boot sets this bit, but if u-boot is compiled without
net support, the interface will be up but without any activity.

The vendor SDK sets this bit along with the PHY_ID bits.

Ported from the Linux change at [1] from Da Xu merged in
commit [2].

[1] https://lore.kernel.org/all/20250425192009.1439508-1-da@libre.computer/
[2] b23285e93bef ("net: mdio: mux-meson-gxl: set reversed bit when using internal phy")

Suggested-by: Da Xue <da@libre.computer>
Link: https://lore.kernel.org/r/20250502-u-boot-topic-mdio-mux-gxl-bit28-v1-1-399f6c3db154@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
8 months agoMerge tag 'u-boot-stm32-20250930' of https://source.denx.de/u-boot/custodians/u-boot-stm
Tom Rini [Tue, 30 Sep 2025 16:47:19 +0000 (10:47 -0600)] 
Merge tag 'u-boot-stm32-20250930' of https://source.denx.de/u-boot/custodians/u-boot-stm

CI: https://source.denx.de/u-boot/custodians/u-boot-stm/-/pipelines/27776

- stm32mp1: Fix env_get_location()
- stm32mp2: Update register used by BL31 for boot parameter

8 months agoboard: mpfs_icicle: fix pointer assignment in board_fdt_blob_setup()
Jamie Gibbons [Tue, 30 Sep 2025 15:45:34 +0000 (16:45 +0100)] 
board: mpfs_icicle: fix pointer assignment in board_fdt_blob_setup()

Correct the assignment in board_fdt_blob_setup() to use *fdtp instead of
fdtp, ensuring the caller receives the correct FDT address. This
resolves an issue where the device tree pointer was not properly set due
to assigning to the local parameter rather than the dereferenced
pointer.

Fixes: 7c16ebba1ed ("board: mpfs_icicle: implement board_fdt_blob_setup()/board_fit_config_name_match()")
Signed-off-by: Jamie Gibbons <jamie.gibbons@microchip.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
8 months agostm32mp2: update register used by BL31 for boot parameter
Patrick Delaunay [Wed, 17 Sep 2025 12:31:30 +0000 (14:31 +0200)] 
stm32mp2: update register used by BL31 for boot parameter

Use the ARM64 kernel booting register settings, defined in Linux
documentation Documentation/arch/arm64/booting.rst:

 x0 = physical address of device tree blob (dtb) in system RAM.

so kernel can replace U-Boot in FIP without modification of BL31.

Use x0 for future TF-A version and keep x2 as fallback to be compatible
with previous version of TF-A BL31.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
8 months agoMerge tag 'net-20250930' of https://source.denx.de/u-boot/custodians/u-boot-net
Tom Rini [Tue, 30 Sep 2025 14:57:25 +0000 (08:57 -0600)] 
Merge tag 'net-20250930' of https://source.denx.de/u-boot/custodians/u-boot-net

Pull request net-20250930

net-common:
- DesignWare: avoid regulator enable failure
- Fix RMII help text

net-lwip:
- Ensure alignment of packet buffers
- Use NTP server(s) obtained from DHCP