]> git.ipfire.org Git - thirdparty/u-boot.git/log
thirdparty/u-boot.git
7 weeks agopwm: ti: am33xx: Fix build warnings in dev_dbg()
Sukrut Bellary [Fri, 30 May 2025 21:22:31 +0000 (14:22 -0700)] 
pwm: ti: am33xx: Fix build warnings in dev_dbg()

If CONFIG_PWM_TI_EHRPWM is enabled, it throws the build warning in
dev_dbg() due to incorrect format specifier as,

"warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but
argument 4 has type ‘fdt_addr_t’ {aka ‘unsigned int’}".

Fix this with the correct format specifier.

Signed-off-by: Sukrut Bellary <sbellary@baylibre.com>
7 weeks agopwm: ti: am33xx: Enable Auxiliary PWM using eCAP
Sukrut Bellary [Fri, 30 May 2025 21:22:30 +0000 (14:22 -0700)] 
pwm: ti: am33xx: Enable Auxiliary PWM using eCAP

In am33xx SoC[1], enhanced capture (eCAP) supports auxiliary PWM (APWM).
This series adds the PWM driver support for the APWM feature for eCAP on
AM33xx.

eCAP HW also supports the capture mode. Currently, this driver only
supports APWM.

This is based on the Linux kernel driver -> drivers/pwm/pwm-tiecap.c
Version: v6.12

Tested on AM335x EVM[2].

[1] AM335x TRM - https://www.ti.com/lit/ug/spruh73q/spruh73q.pdf
[2] AM335x EVM - https://www.ti.com/tool/TMDXEVM3358

Signed-off-by: Sukrut Bellary <sbellary@baylibre.com>
2 months agoimx8mp-venice-gw74xx: add w_disable2 gpio configuration
Tim Harvey [Fri, 23 May 2025 17:20:18 +0000 (10:20 -0700)] 
imx8mp-venice-gw74xx: add w_disable2 gpio configuration

The GW74xx D revision has added a M2SKT_WDIS2# GPIO which routes to the
W_DISABLE2# pin of the M.2 socket.

Add the iomux and a line name for this and rename the existing
m2_wdis# signal to m2_wdis1#.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2 months agoboard: venice: append configuration string to model
Tim Harvey [Fri, 23 May 2025 17:20:17 +0000 (10:20 -0700)] 
board: venice: append configuration string to model

Append the optional board configuration string to the model info.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2 months agoboard: venice: update model representation for venice-flex
Tim Harvey [Fri, 23 May 2025 17:20:16 +0000 (10:20 -0700)] 
board: venice: update model representation for venice-flex

Update the model string representation for the Venice-Flex product
family (GW8xxx).

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2 months agoboard: venice: add FSA support
Tim Harvey [Fri, 23 May 2025 17:20:15 +0000 (10:20 -0700)] 
board: venice: add FSA support

The Gateworks Flexible Socket Adapters adapt common
busses such as SDIO/UART/USB/PCI to various connectors
such as M.2 B-Key, M.2 E-Key, M.2 M-Key, and MiniPCIe.

Each FSA has an EEPROM onboard describing its details as well as an
optional port-expander for configurable GPIO's.

Add support for identifying the FSA's and configuring their
details such as user description and GPIO's:
 - enable pca953x, pca954x and eeprom support for communicating
   with the I2C eeprom and gpio port expander on the FSA
 - add FSA detection support
 - add FSA gpio configuration support

Each FSA is identified in the device-tree by an alias to it's I2C
bus where an eeprom@54 node must exist as well as an gpio@20 node
for an io-expander. These nodes must be enabled so that
they can be probed to determine if they are actually present in
the system. If not present or not enabled the gpio expander can
not be used. This also requires livetree as the gpio expander
node if not present must be disabled.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2 months agoboard: venice: add imx8mp-gw82xx support
Tim Harvey [Fri, 23 May 2025 17:20:14 +0000 (10:20 -0700)] 
board: venice: add imx8mp-gw82xx support

The Gateworks GW82XX-2X is an ARM based single board computer (SBC)
comprised of the i.MX8M Plus based gw702x SoM and the gw82xx
baseboard featuring:
 - i.MX8M Plus SoC
 - LPDDR4 DRAM
 - eMMC FLASH
 - Gateworks System Controller (GSC)
 - microSD (1.8V/3.3V Capable)
 - panel status bi-color LED
 - pushbutton switch
 - fan controller with tachometer
 - USB Type-C connector
 - PCIe switch
 - 2x GbE RJ45 connectors
 - multi-protocol RS232/RS485/RS422 Serial ports
 - 2x Flexible Socket Adapters with SDIO/UART/USB/PCIe
   (for M.2 and miniPCIe expansion)
 - 2x isolated CAN
 - GPS
 - accelerometer
 - magnetometer
 - off-board connectors for: SPI, GPIO, I2C, ADC
 - Wide range DC power input
 - support for 802.3at PoE (via adapter)

Add support for it by providing its device-tree.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2 months agoboard: venice: flip logic for GSC supervisor enable
Tim Harvey [Fri, 23 May 2025 17:20:13 +0000 (10:20 -0700)] 
board: venice: flip logic for GSC supervisor enable

Flip the logic used to determine if a board has the proper hardware to
support enabling the GSC voltage supervisor so that we do not need to
keep adding new models to the list.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2 months agoboard: venice: use SOM model for PMIC adjustment on SOM
Tim Harvey [Fri, 23 May 2025 17:20:12 +0000 (10:20 -0700)] 
board: venice: use SOM model for PMIC adjustment on SOM

Use the SOM model to adjust PMIC settings on SOM's.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2 months agoboard: venice: use baseboard model for family
Tim Harvey [Fri, 23 May 2025 17:20:11 +0000 (10:20 -0700)] 
board: venice: use baseboard model for family

The venice family of baseboards which is normally GW7xxx
is being expanded to GW8xxx so we need to use the baseboard
number instead of the som.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2 months agoboard: venice: fix dram size for GW7901-SP486
Tim Harvey [Fri, 23 May 2025 17:20:10 +0000 (10:20 -0700)] 
board: venice: fix dram size for GW7901-SP486

The GW7901-SP486 with the exception of the -C revision has 2GB DRAM
loaded but incorrectly specifies 1GB in the EEPROM. Adjust the DRAM size
to account for this.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2 months agoboard: venice: fix dram bus config for GW7902/GW7903/GW7904
Tim Harvey [Fri, 23 May 2025 17:20:09 +0000 (10:20 -0700)] 
board: venice: fix dram bus config for GW7902/GW7903/GW7904

The GW7902/GW7903/GW7904 have an alternate databus layout affecting a few
of the DDRC and DDR PHY registers.

The 512MB configuration used this alternate bus layout. Change
the 512MB config to the standard bus configuration and add a generic
function to patch the DDRC/PHY configs for the alternate bus layout.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2 months agoboard: venice: move soc-specific dram config into soc-specific files
Tim Harvey [Fri, 23 May 2025 17:20:08 +0000 (10:20 -0700)] 
board: venice: move soc-specific dram config into soc-specific files

Move the determination of the dram timings into the soc-specific files.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2 months agoconfigs: imx8m*_venice: enable GPT support
Tim Harvey [Fri, 23 May 2025 17:20:07 +0000 (10:20 -0700)] 
configs: imx8m*_venice: enable GPT support

Enable support for working with General Partition Tables via the 'gpt'
command. Also enable support for generating random UUID's for GPT.

See: doc/README.gpt for examples

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2 months agoconfigs: imx8m*_venice: enable several commands useful for scripting
Tim Harvey [Fri, 23 May 2025 17:20:06 +0000 (10:20 -0700)] 
configs: imx8m*_venice: enable several commands useful for scripting

enable cat, xxd, and the ability for setexpr to return values in
variables which are all useful for scripting.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2 months agoMerge patch series "test/py: enable HTTP testing"
Tom Rini [Fri, 30 May 2025 16:26:33 +0000 (10:26 -0600)] 
Merge patch series "test/py: enable HTTP testing"

Adriano Cordova <adrianox@gmail.com> says:

Enable HTTP server in CI to support HTTP tests in pytest

QEMU does not emulate an HTTP server, unlike other services like DHCP or TFTP.
To enable HTTP  tests during CI runs, start a simple Python HTTP server
on port 80. This allows tests that require HTTP access to run.

The HTTP server is launched on the host. For QEMU environments launched
with '-netdev,user' this means that the HTTP server runs together with DHCP
at 10.0.2.2.  HTTP testing needs to be explicitly enabled with
env__efi_helloworld_net_http_test_skip = False.

We also default `WGET=y` in `ARCH_QEMU` configurations so that these HTTP
tests are included automatically when using QEMU in CI.

Link: https://lore.kernel.org/r/20250516085256.30386-1-adriano.cordova@canonical.com
2 months agocmd/Kconfig: select CMD_WGET if ARCH_QEMU
Adriano Cordova [Fri, 16 May 2025 08:52:56 +0000 (04:52 -0400)] 
cmd/Kconfig: select CMD_WGET if ARCH_QEMU

select CMD_WGET for ARCH_QEMU. This way HTTP can be tested
on the qemu platforms in CI.

Signed-off-by: Adriano Cordova <adriano.cordova@canonical.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agoCI testing: add http server to CI tests
Adriano Cordova [Fri, 16 May 2025 08:52:55 +0000 (04:52 -0400)] 
CI testing: add http server to CI tests

Add an http server to CI tests so that HTTP booting and
loading can be tested.

Signed-off-by: Adriano Cordova <adriano.cordova@canonical.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agoimage: Fix FIT image loadable section custom processing
Marek Vasut [Mon, 12 May 2025 15:58:39 +0000 (17:58 +0200)] 
image: Fix FIT image loadable section custom processing

The original commit always generated linker list entries with the same
entry variable name, because _function passed to ll_entry_declare() is
not a variable and therefore was interpreted as fixed string. Change it
to _type which is a variable and which does allow generation of multiple
unique linker list entries, one for each U_BOOT_FIT_LOADABLE_HANDLER().

Fixes: d7be50921ed3 ("image: Add FIT image loadable section custom processing")
Signed-off-by: Marek Vasut <marek.vasut@mailbox.org>
2 months agoGitlab: Rework sjg-lab calling test.py to be closer to test.py stage
Tom Rini [Tue, 6 May 2025 14:04:12 +0000 (08:04 -0600)] 
Gitlab: Rework sjg-lab calling test.py to be closer to test.py stage

There are a few differences between how the test.py stage invokes
test.py and how the sjg-lab stage invokes test.py. As a start of making
both the code and the output and artifacts similar, this updates the
sjg-lab stage with the following:
- Pass "-ra" so that we get the summary information in the job
- Make use of TEST_PY_EXTRA for passing "--capture=tee-sys"
- Re-order some of the arguments to be the same order when possible.

And most importantly:
- Create and save as an artifact the junitxml output.

The last part here is the kind of test result information that in the
future we should determine how to archive for future reference.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agoMerge patch series "Almost complete DM_SERIAL migration"
Tom Rini [Fri, 30 May 2025 16:17:40 +0000 (10:17 -0600)] 
Merge patch series "Almost complete DM_SERIAL migration"

Tom Rini <trini@konsulko.com> says:

In a private thread, Simon asked about what's needed to get PowerPC
migrated to DM_SERIAL. I went and took a look, and to complete the
entire DM_SERIAL migration (excluding SPL/TPL) we're actually nearly
there. This series first migrates PowerPC (and some NXP Layerscape
boards that share history more clearly with PowerPC parts), with the
biggest change being to make sure we still use the correct legacy
drivers in SPL/TPL (where SPL is extremely constrained). With that out
of the way, I looked at what was left. With two exceptions, it's
platforms which can be trivially enabled for conversion, and so we do
that.

Link: https://lore.kernel.org/r/20250502201226.1369013-1-trini@konsulko.com
2 months agoglobal: Convert almost all remaining non-DM_SERIAL users
Tom Rini [Fri, 2 May 2025 20:07:40 +0000 (14:07 -0600)] 
global: Convert almost all remaining non-DM_SERIAL users

This converts almost all of the remaining non-DM_SERIAL users to enable
DM_SERIAL. These are platforms where there have long been other SoC
boards that have switched and so it's been a matter of inertia keeping
these from being converted. Do so now.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agoPowerPC / Layerscape: Finish migration to DM_SERIAL
Tom Rini [Fri, 2 May 2025 20:07:39 +0000 (14:07 -0600)] 
PowerPC / Layerscape: Finish migration to DM_SERIAL

Migrate the few ARM Layerscape platforms that had not been switched
along with all remaining PowerPC platforms to DM_SERIAL. For PowerPC,
this means that platforms which use SPL/TPL, keeping the non-DM serial
driver enabled there as they do not use DM. We also rework the guards
on how to define CFG_SYS_NS16550_CLK so that this is mostly in one place
now.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agoMerge patch series "Update kbuild"
Tom Rini [Fri, 30 May 2025 00:43:15 +0000 (18:43 -0600)] 
Merge patch series "Update kbuild"

Ilias Apalodimas <ilias.apalodimas@linaro.org> says:

Last time the kbuild scripts were synced with the Linux kernel was on the
4.20 release. Updating directly to 6.x makes the diff difficult to read, so
let's do the changes incrementally and bump to 5.1 first.

Since the number of commits is big, I am splitting this in multiple series.
This one includes most of the commits for Makefile.build,
Makefile.lib and some from Makefile.

commit eeb5687a7139649e ("kbuild: add -Werror=strict-prototypes flag unconditionally")
commit 3812b8c5c5d5 ("kbuild: make -r/-R effective in top Makefile for old Make versions")
commit b421b8a6cb87 ("kbuild: remove unused archmrproper")
commit 1a49b2fd8f58 ("kbuild: strip whitespace in cmd_record_mcount findstring")
commit 88110713ca9dfb ("kbuild: hardcode genksyms path and remove GENKSYMS variable")
commit 1d8001ef358 ("kbuild: generate modules.order only when CONFIG_MODULES=y")
commit 45c4372d00 ("kbuild: refactor quiet_modtag")
commit b39a691617e4 commit ("kbuild: remove redundant quiet_modtag for $(obj-m)")
commit 5439f09f488f ("kbuild: remove redundant 'set -e' from cmd_* defines")
commit e5d289100d3a ("kbuild: remove trailing semicolon from cmd_* passed to if_changed_rule")
commit 3a2429e1faf4 ("kbuild: change if_changed_rule for multi-line recipe")
commit ee3e46b7efd2 ("kbuild: refactor modversions build rules")
commit 4317ee3b6a5e ("kbuild: remove redundant 'set -e' from sub_cmd_record_mcount")
commit 392885ee82d3 ("kbuild: let fixdep directly write to .*.cmd files")
commit 898f5a009f22 ("kbuild: move archive command to scripts/Makefile.lib")
commit b79c6aa6a1f1 ("kbuild: remove unnecessary in-subshell execution")
commit afa974b77128 ("kbuild: add real-prereqs shorthand for $(filter-out FORCE,$^)")
commit ecbd10d90e94 ("kbuild: simplify rules of data compression with size appending")
commit 58156ba4468f ("kbuild: skip 'addtree' and 'flags' magic for external module build")
commit 172caf1993b7 ("kbuild: remove redundant target cleaning on failure")
commit f3fd4a3f3a38 ("kbuild: remove redundant 'set -e' from filechk_offsets")
commit a2237fec1e06 ("kbuild: Enable dtc graph_port warning by default")
commit 70523a3ce5ff ("kbuild: disable dtc simple_bus_reg warnings by default")
commit e4aca4595005 ("kbuild: de-duplicate fixdep usage")

Link: https://lore.kernel.org/r/20250520052153.307194-1-ilias.apalodimas@linaro.org
2 months agokbuild: add -Werror=strict-prototypes flag unconditionally
Ilias Apalodimas [Tue, 20 May 2025 05:21:35 +0000 (08:21 +0300)] 
kbuild: add -Werror=strict-prototypes flag unconditionally

Backported from kernel
commit eeb5687a7139649e ("kbuild: add -Werror=strict-prototypes flag unconditionally")

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agokbuild: make -r/-R effective in top Makefile for old Make versions
Ilias Apalodimas [Tue, 20 May 2025 05:21:34 +0000 (08:21 +0300)] 
kbuild: make -r/-R effective in top Makefile for old Make versions

Backported from kernel
commit 3812b8c5c5d5 ("kbuild: make -r/-R effective in top Makefile for old Make versions")

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agokbuild: remove unused archmrproper
Ilias Apalodimas [Tue, 20 May 2025 05:21:33 +0000 (08:21 +0300)] 
kbuild: remove unused archmrproper

Backported from kernel
commit b421b8a6cb87 ("kbuild: remove unused archmrproper")

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agokbuild: strip whitespace in cmd_record_mcount findstring
Ilias Apalodimas [Tue, 20 May 2025 05:21:32 +0000 (08:21 +0300)] 
kbuild: strip whitespace in cmd_record_mcount findstring

Backport from kernel
commit 1a49b2fd8f58 ("kbuild: strip whitespace in cmd_record_mcount findstring")

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agokbuild: hardcode genksyms path and remove GENKSYMS variable
Ilias Apalodimas [Tue, 20 May 2025 05:21:31 +0000 (08:21 +0300)] 
kbuild: hardcode genksyms path and remove GENKSYMS variable

Back port from kernel although it's not used since it makes diffing
easier.
commit 88110713ca9dfb ("kbuild: hardcode genksyms path and remove GENKSYMS variable")

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agokbuild: generate modules.order only when CONFIG_MODULES=y
Ilias Apalodimas [Tue, 20 May 2025 05:21:30 +0000 (08:21 +0300)] 
kbuild: generate modules.order only when CONFIG_MODULES=y

Backport from kernel although it is unused since it makes diffing easier.
commit 1d8001ef358 ("kbuild: generate modules.order only when CONFIG_MODULES=y")

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agokbuild: refactor quiet_modtag
Ilias Apalodimas [Tue, 20 May 2025 05:21:29 +0000 (08:21 +0300)] 
kbuild: refactor quiet_modtag

Backport from kernel
commit 45c4372d00 ("kbuild: refactor quiet_modtag")

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agokbuild: remove redundant quiet_modtag for $(obj-m)
Ilias Apalodimas [Tue, 20 May 2025 05:21:28 +0000 (08:21 +0300)] 
kbuild: remove redundant quiet_modtag for $(obj-m)

Backported from kernel
commit b39a691617e4 commit ("kbuild: remove redundant quiet_modtag for $(obj-m)")

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agokbuild: remove redundant 'set -e' from cmd_* defines
Ilias Apalodimas [Tue, 20 May 2025 05:21:27 +0000 (08:21 +0300)] 
kbuild: remove redundant 'set -e' from cmd_* defines

Backported from kernel
commit 5439f09f488f ("kbuild: remove redundant 'set -e' from cmd_* defines")

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agokbuild: remove trailing semicolon from cmd_* passed to if_changed_rule
Ilias Apalodimas [Tue, 20 May 2025 05:21:26 +0000 (08:21 +0300)] 
kbuild: remove trailing semicolon from cmd_* passed to if_changed_rule

Backport from kernel
commit e5d289100d3a ("kbuild: remove trailing semicolon from cmd_* passed to if_changed_rule")

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agokbuild: change if_changed_rule for multi-line recipe
Ilias Apalodimas [Tue, 20 May 2025 05:21:25 +0000 (08:21 +0300)] 
kbuild: change if_changed_rule for multi-line recipe

Backport from kernel
commit 3a2429e1faf4 ("kbuild: change if_changed_rule for multi-line recipe")

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agokbuild: refactor modversions build rules
Ilias Apalodimas [Tue, 20 May 2025 05:21:24 +0000 (08:21 +0300)] 
kbuild: refactor modversions build rules

Backport from kernel
commit ee3e46b7efd2 ("kbuild: refactor modversions build rules")

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agokbuild: remove redundant 'set -e' from sub_cmd_record_mcount
Ilias Apalodimas [Tue, 20 May 2025 05:21:23 +0000 (08:21 +0300)] 
kbuild: remove redundant 'set -e' from sub_cmd_record_mcount

Back from kernel
commit 4317ee3b6a5e ("kbuild: remove redundant 'set -e' from sub_cmd_record_mcount")

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agokbuild: let fixdep directly write to .*.cmd files
Ilias Apalodimas [Tue, 20 May 2025 05:21:22 +0000 (08:21 +0300)] 
kbuild: let fixdep directly write to .*.cmd files

Backport from kernel
commit 392885ee82d3 ("kbuild: let fixdep directly write to .*.cmd files")

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agokbuild: move archive command to scripts/Makefile.lib
Ilias Apalodimas [Tue, 20 May 2025 05:21:21 +0000 (08:21 +0300)] 
kbuild: move archive command to scripts/Makefile.lib

Backport from kernel
commit 898f5a009f22 ("kbuild: move archive command to scripts/Makefile.lib")

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agokbuild: remove unnecessary in-subshell execution
Ilias Apalodimas [Tue, 20 May 2025 05:21:20 +0000 (08:21 +0300)] 
kbuild: remove unnecessary in-subshell execution

Backport kernel changes

commit b79c6aa6a1f1 ("kbuild: remove unnecessary in-subshell execution")

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agokbuild: add real-prereqs shorthand for $(filter-out FORCE, $^)
Ilias Apalodimas [Tue, 20 May 2025 05:21:19 +0000 (08:21 +0300)] 
kbuild: add real-prereqs shorthand for $(filter-out FORCE, $^)

Backport from kernel
commit afa974b77128 ("kbuild: add real-prereqs shorthand for $(filter-out FORCE,$^)")

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agokbuild: simplify rules of data compression with size appending
Ilias Apalodimas [Tue, 20 May 2025 05:21:18 +0000 (08:21 +0300)] 
kbuild: simplify rules of data compression with size appending

Backport kernel changes
commit ecbd10d90e94 ("kbuild: simplify rules of data compression with size appending")

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agokbuild: skip 'addtree' and 'flags' magic for external module build
Ilias Apalodimas [Tue, 20 May 2025 05:21:17 +0000 (08:21 +0300)] 
kbuild: skip 'addtree' and 'flags' magic for external module build

Backport from kernel
commit 58156ba4468f ("kbuild: skip 'addtree' and 'flags' magic for external module build")

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agokbuild: remove redundant target cleaning on failure
Ilias Apalodimas [Tue, 20 May 2025 05:21:16 +0000 (08:21 +0300)] 
kbuild: remove redundant target cleaning on failure

Bacport from the kernel

commit 172caf1993b7 ("kbuild: remove redundant target cleaning on failure")

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agokbuild: remove redundant 'set -e' from filechk_offsets
Ilias Apalodimas [Tue, 20 May 2025 05:21:15 +0000 (08:21 +0300)] 
kbuild: remove redundant 'set -e' from filechk_offsets

Backport changes from the kernel

commit f3fd4a3f3a38 ("kbuild: remove redundant 'set -e' from filechk_offsets")

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agokbuild: Enable dtc graph_port warning by default
Ilias Apalodimas [Tue, 20 May 2025 05:21:14 +0000 (08:21 +0300)] 
kbuild: Enable dtc graph_port warning by default

Backport changes from the kernel
commit a2237fec1e06 ("kbuild: Enable dtc graph_port warning by default")

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agokbuild: disable dtc simple_bus_reg warnings by default
Ilias Apalodimas [Tue, 20 May 2025 05:21:13 +0000 (08:21 +0300)] 
kbuild: disable dtc simple_bus_reg warnings by default

Backport changes from the kernel
commit 70523a3ce5ff ("kbuild: disable dtc simple_bus_reg warnings by default")

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agokbuild: de-duplicate fixdep usage
Ilias Apalodimas [Tue, 20 May 2025 05:21:12 +0000 (08:21 +0300)] 
kbuild: de-duplicate fixdep usage

Backported from the linux kernel
commit e4aca4595005 ("kbuild: de-duplicate fixdep usage")

A lot of the kernels kbuild depend on that patch. Backport it and pull in
the 'rule_as_o_S'a rule as well. This might end up being unused but it
doesn't break anything and makes diffing the files easier.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agoMerge patch series "Enable env in SCSI"
Tom Rini [Thu, 29 May 2025 20:24:11 +0000 (14:24 -0600)] 
Merge patch series "Enable env in SCSI"

Varadarajan Narayanan <quic_varada@quicinc.com> says:

The qcs9100 based Ride platforms have UFS as their primary storage.
Hence add support to U-Boot env framework to be able to save and
retrieve the environment from UFS. The environment will be
saved/retrieved from the partition specified in the config option
CONFIG_SCSI_ENV_PART.

Also add an API to convert partition UUID string to block device
descriptor for UFS. This API will be used to get the block device
descriptor for the partition specified in CONFIG_SCSI_ENV_PART.

Link: https://lore.kernel.org/r/20250513091710.3719292-1-quic_varada@quicinc.com
2 months agoconfigs: qcs9100: Enable env in SCSI
Varadarajan Narayanan [Tue, 13 May 2025 09:17:10 +0000 (14:47 +0530)] 
configs: qcs9100: Enable env in SCSI

Enable CONFIG_ENV_IS_IN_SCSI to store environment variables in SCSI.
Set env variables partition UUID as seen in qcs9100 based boards.

Signed-off-by: Varadarajan Narayanan <quic_varada@quicinc.com>
Reviewed-by: Casey Connolly <casey.connolly@linaro.org>
2 months agoenv: Add support for storing env variables in SCSI devices
Varadarajan Narayanan [Tue, 13 May 2025 09:17:08 +0000 (14:47 +0530)] 
env: Add support for storing env variables in SCSI devices

Allow SCSI to be able to store environment variables.

Signed-off-by: Varadarajan Narayanan <quic_varada@quicinc.com>
Acked-by: Casey Connolly <casey.connolly@linaro.org>
2 months agoscsi: Implement get_blk() function
Varadarajan Narayanan [Tue, 13 May 2025 09:17:07 +0000 (14:47 +0530)] 
scsi: Implement get_blk() function

Add a function to obtain the block device for SCSI.

Signed-off-by: Varadarajan Narayanan <quic_varada@quicinc.com>
Acked-by: Casey Connolly <casey.connolly@linaro.org>
2 months agodisk: part: implement generic function part_get_info_by_uuid()
Varadarajan Narayanan [Tue, 13 May 2025 09:17:06 +0000 (14:47 +0530)] 
disk: part: implement generic function part_get_info_by_uuid()

Add function to search for a partition by UUID as partition
names may not be unique.

Signed-off-by: Varadarajan Narayanan <quic_varada@quicinc.com>
Acked-by: Casey Connolly <casey.connolly@linaro.org>
2 months agoMerge patch series "Remove clocks from R5 dtsi for missed boards."
Tom Rini [Thu, 29 May 2025 14:33:17 +0000 (08:33 -0600)] 
Merge patch series "Remove clocks from R5 dtsi for missed boards."

Manorit Chawdhry <m-chawdhry@ti.com> says:

Fix some of the boards that could be affected by the change done in [0].

[0]: https://lore.kernel.org/u-boot/20241121-b4-upstream-pll-fix-v1-0-904f618897a7@ti.com/T/#mecb70b415a364fdf322a94241438db7b5607e92b
Link: https://lore.kernel.org/r/20250515-b4-upstream-k3-pll-miss-v1-0-e38b89f027b8@ti.com
2 months agoarm: dts: k3-am62a7-phycore-r5*: Remove clocks from main_timer0
Manorit Chawdhry [Thu, 15 May 2025 11:38:37 +0000 (17:08 +0530)] 
arm: dts: k3-am62a7-phycore-r5*: Remove clocks from main_timer0

The commit 79d91e77f4c2 ("clk: ti: clk-k3-pll: Add additional robustness
steps to the PLL sequence") introduced a change which requires the
main_timer0 to not rely on it's own clocks which anyways was wrong.

Fix it by removing the clock dependency for it, also while at it, move
it from u-boot.dtsi to R5 as that is the only entity that should require
it as DM isn't up.

Fixes: 5d1aac358f3c ("arm: dts: k3-*-r5: Remove clocks from mcu_timer0")
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
Acked-by: Wadim Egorov <w.egorov@phytec.de>
2 months agoarm: dts: k3-am625-verdin-r5*: Remove clocks from main_timer0
Manorit Chawdhry [Thu, 15 May 2025 11:38:36 +0000 (17:08 +0530)] 
arm: dts: k3-am625-verdin-r5*: Remove clocks from main_timer0

The commit 79d91e77f4c2 ("clk: ti: clk-k3-pll: Add additional robustness
steps to the PLL sequence") introduced a change which requires the
main_timer0 to not rely on it's own clocks which anyways was wrong.

Fix it by removing the clock dependency for it, also while at it, move
it from u-boot.dtsi to R5 as that is the only entity that should require
it as DM isn't up.

Fixes: 5d1aac358f3c ("arm: dts: k3-*-r5: Remove clocks from mcu_timer0")
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
Acked-by: Francesco Dolcini <francesco.dolcini@toradex.com>
2 months agoarm: dts: k3-am625-phycore-r5*: Remove clocks from main_timer0
Manorit Chawdhry [Thu, 15 May 2025 11:38:35 +0000 (17:08 +0530)] 
arm: dts: k3-am625-phycore-r5*: Remove clocks from main_timer0

The commit 79d91e77f4c2 ("clk: ti: clk-k3-pll: Add additional robustness
steps to the PLL sequence") introduced a change which requires the
main_timer0 to not rely on it's own clocks which anyways was wrong.

Fix it by removing the clock dependency for it, also while at it, move
it from u-boot.dtsi to R5 as that is the only entity that should require
it as DM isn't up.

Fixes: 5d1aac358f3c ("arm: dts: k3-*-r5: Remove clocks from mcu_timer0")
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
Tested-by: Wadim Egorov <w.egorov@phytec.de>
2 months agoarm: dts: k3-am625-beagleplay-r5*: Remove clocks from main_timer0
Manorit Chawdhry [Thu, 15 May 2025 11:38:34 +0000 (17:08 +0530)] 
arm: dts: k3-am625-beagleplay-r5*: Remove clocks from main_timer0

The commit 79d91e77f4c2 ("clk: ti: clk-k3-pll: Add additional robustness
steps to the PLL sequence") introduced a change which requires the
main_timer0 to not rely on it's own clocks which anyways was wrong.

Fix it by removing the clock dependency for it, also while at it, move
it from u-boot.dtsi to R5 as that is the only entity that should require
it as DM isn't up.

Fixes: 5d1aac358f3c ("arm: dts: k3-*-r5: Remove clocks from mcu_timer0")
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
2 months agoMerge patch series "Print Reset Reason for K3 based devices"
Tom Rini [Thu, 29 May 2025 14:32:52 +0000 (08:32 -0600)] 
Merge patch series "Print Reset Reason for K3 based devices"

Wadim Egorov <w.egorov@phytec.de> says:

Although AM62x, AM62Ax, AM64x, and AM62Px share the same register for
reset reason, not all TRMs document this consistently. To avoid relying
on undocumented behavior, introduce SoC-specific implementations for
now. If TI confirms all SoCs share the same register, this can be moved to
common.c for reuse.

It will be mostly copy&paste for the mentioned devices.

Also, I am not sure how this Register operates exactly. I noticed that
two bits can be set at once, so I started to check for set bits instead
of having a switch/case logic.

Link: https://lore.kernel.org/r/20250515111554.2916254-1-w.egorov@phytec.de
2 months agoarm: mach-k3: am62x: Implement get_reset_reason()
Wadim Egorov [Thu, 15 May 2025 11:15:54 +0000 (13:15 +0200)] 
arm: mach-k3: am62x: Implement get_reset_reason()

Implement get_reset_reason() for AM62x to enable reporting of
the reset cause in the cpuinfo output.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
2 months agoarm: mach-k3: Detect and print reset reason
Wadim Egorov [Thu, 15 May 2025 11:15:53 +0000 (13:15 +0200)] 
arm: mach-k3: Detect and print reset reason

Call get_reset_reason() during CPU info output and display the result
if the SoC provides the implementation. This helps in debugging by
providing context on the last system reset reason.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
2 months agoMerge patch series "Remove <env.h> from <net.h>"
Tom Rini [Thu, 29 May 2025 14:31:07 +0000 (08:31 -0600)] 
Merge patch series "Remove <env.h> from <net.h>"

Tom Rini <trini@konsulko.com> says:

Hey all,

This is a v3 of Simon's series[1] and depends on the series[2] I posted
the other day that removes <env.h> from <command.h>. With this series
done, I believe we've tackled all of the current cases of headers which
include <env.h> without directly needing it. Much of this series is in
fact Simon's v2 with the main differneces being:
- Removing <env.h> from <net.h> at the end
- Removing env_to_ip() given how little it's used rather than shuffling
  around where it's declared and un-inline'ing it. For a rarely used
  helper, this ends up being cleaner I think. Especially looking at some
  of the users (which called env_get repeatedly). If there's strong
  opinion here about using the other method[3] we can do that instead.
- Setting aside for now how to handle CMD_ELF=y and NO_NET=y because
  today it's actually fine as we unconditionally build lib/net_utils.c
  where string_to_ip() is defined. I'm unsure if a further series is
  warranted here or not. We rely on link-time optimization to keep code
  readable too.

[1]: https://lore.kernel.org/all/20250501010456.3930701-1-sjg@chromium.org
[2]: https://lore.kernel.org/all/20250514225002.15361-1-trini@konsulko.com
[3]: https://lore.kernel.org/all/20250501010456.3930701-23-sjg@chromium.org
Link: https://lore.kernel.org/r/20250515234154.1859366-1-trini@konsulko.com
2 months agoinclude/net.h: Drop <env.h>
Tom Rini [Thu, 15 May 2025 23:31:51 +0000 (17:31 -0600)] 
include/net.h: Drop <env.h>

Now that all of the cases of code that relied on <net.h> to provide
<env.h> (or one of the headers that it includes, and so forth) have been
fixed, we can drop the include from here.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agoglobal: Avoid indirect inclusion of <env.h> from <net.h>
Tom Rini [Thu, 15 May 2025 23:31:50 +0000 (17:31 -0600)] 
global: Avoid indirect inclusion of <env.h> from <net.h>

Now that env_get_ip() has been removed, the include file <net.h> does
not need anything from <env.h>. Furthermore, include/env.h itself
includes other headers which can lead to longer indirect inclusion
paths. To prepare to remove <env.h> from <net.h> fix all of the
remaining places which had relied on this indirect inclusion to instead
include <env.h> directly.

Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> # net/lwip
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Martyn Welch <martyn.welch@collabora.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agonet: dc2114x: Include env.h to permit reading the environment
Simon Glass [Thu, 15 May 2025 23:31:49 +0000 (17:31 -0600)] 
net: dc2114x: Include env.h to permit reading the environment

This file uses the environment but does not include the header file.
Update it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agonet: Include env.h in pcap.c
Simon Glass [Thu, 15 May 2025 23:31:48 +0000 (17:31 -0600)] 
net: Include env.h in pcap.c

This file uses the environment but does not include the header file.
Update it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agonet: Include byteorder in net6.h
Simon Glass [Thu, 15 May 2025 23:31:47 +0000 (17:31 -0600)] 
net: Include byteorder in net6.h

This file uses byteorder but does not include the header file. Update
it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agotechnexion: Include env.h to permit reading the environment
Simon Glass [Thu, 15 May 2025 23:31:46 +0000 (17:31 -0600)] 
technexion: Include env.h to permit reading the environment

This file reads from the environment but does not include the correct
header. Update it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agoliebherr: Include env.h to permit reading the environment
Simon Glass [Thu, 15 May 2025 23:31:45 +0000 (17:31 -0600)] 
liebherr: Include env.h to permit reading the environment

This file reads from the environment but does not include the correct
header. Update it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
2 months agogoogle: Include env.h to permit reading the environment
Simon Glass [Thu, 15 May 2025 23:31:44 +0000 (17:31 -0600)] 
google: Include env.h to permit reading the environment

This file reads from the environment but does not include the correct
header. Update it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agofreescale: Include env.h to permit reading the environment
Simon Glass [Thu, 15 May 2025 23:31:43 +0000 (17:31 -0600)] 
freescale: Include env.h to permit reading the environment

This file reads from the environment but does not include the correct
header. Update it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agoamlogic: Include env.h to permit reading the environment
Simon Glass [Thu, 15 May 2025 23:31:42 +0000 (17:31 -0600)] 
amlogic: Include env.h to permit reading the environment

This file reads from the environment but does not include the correct
header. Update it.

Reviewed-by: Viacheslav Bocharov <adeep@lexina.in>
Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agosynology: Include env.h to permit reading the environment
Simon Glass [Thu, 15 May 2025 23:31:41 +0000 (17:31 -0600)] 
synology: Include env.h to permit reading the environment

This file reads from the environment but does not include the correct
header. Update it.

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tony Dinh <mibodhi@gmail.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agotegra: Include env.h to permit reading the environment
Simon Glass [Thu, 15 May 2025 23:31:40 +0000 (17:31 -0600)] 
tegra: Include env.h to permit reading the environment

This file reads from the environment but does not include the correct
header. Update it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agoadvantech: Include env.h in imx8qm_dmsse20_a1
Simon Glass [Thu, 15 May 2025 23:31:39 +0000 (17:31 -0600)] 
advantech: Include env.h in imx8qm_dmsse20_a1

This file uses the environment but does not include the header file.
Update it.

Acked-by: Oliver Graute <oliver.graute@kococonnector.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agotoradex: Include env.h to permit reading the environment
Simon Glass [Thu, 15 May 2025 23:31:38 +0000 (17:31 -0600)] 
toradex: Include env.h to permit reading the environment

Two files read from the environment but don't not include the correct
header. Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agoronetix: Include env.h to permit reading the environment
Simon Glass [Thu, 15 May 2025 23:31:37 +0000 (17:31 -0600)] 
ronetix: Include env.h to permit reading the environment

This file reads from the environment but does not include the correct
header. Update it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agophytec: Include env.h to permit reading the environment
Simon Glass [Thu, 15 May 2025 23:31:36 +0000 (17:31 -0600)] 
phytec: Include env.h to permit reading the environment

This file reads from the environment but does not include the correct
header. Update it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agovenice: Include env.h to permit reading the environment
Simon Glass [Thu, 15 May 2025 23:31:35 +0000 (17:31 -0600)] 
venice: Include env.h to permit reading the environment

This file reads from the environment but does not include the correct
header. Update it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agonet: Include string.h in net-legacy.h
Simon Glass [Thu, 15 May 2025 23:31:34 +0000 (17:31 -0600)] 
net: Include string.h in net-legacy.h

This file uses memcpy() but does not include the header file. Update it.

Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agoimx8ulp_evk: Include env.h to permit reading the environment
Simon Glass [Thu, 15 May 2025 23:31:33 +0000 (17:31 -0600)] 
imx8ulp_evk: Include env.h to permit reading the environment

This file reads from the environment but does not include the correct
header. Update it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agodhelectronics: Include env.h to permit reading the environment
Simon Glass [Thu, 15 May 2025 23:31:32 +0000 (17:31 -0600)] 
dhelectronics: Include env.h to permit reading the environment

This file reads from the environment but does not include the correct
header. Update it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agocongatec: Include env.h to permit reading the environment
Simon Glass [Thu, 15 May 2025 23:31:31 +0000 (17:31 -0600)] 
congatec: Include env.h to permit reading the environment

This file reads from the environment but does not include the correct
header. Update it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agonet: Remove env_get_ip helper() function
Tom Rini [Thu, 15 May 2025 23:31:30 +0000 (17:31 -0600)] 
net: Remove env_get_ip helper() function

Currently, we have the function env_get_ip which takes an IP address
in string form and returns a struct in_addr representation of that
address. It is however little used and means that a number of places
indirectly (and unclearly) get <env.h> via <net.h>. To clean this up
start by replacing env_get_ip() calls with string_to_ip() calls. This is
generally a no-op as env_get_ip(str) is an inline of
string_to_ip(env_get(str)) but in a few cases we can or already have
stored the result of env_get(str) and can save the additional call.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agoMerge patch series "Start removing <env.h> from headers when not required"
Tom Rini [Thu, 29 May 2025 14:29:24 +0000 (08:29 -0600)] 
Merge patch series "Start removing <env.h> from headers when not required"

Tom Rini <trini@konsulko.com> says:

Given Simon's series at [1] I started looking in to what brings in
<env.h> when not strictly required and in turn has some unintended
implicit includes. This series takes care of the places where, commonly,
<linux/string.h> or <env.h> itself were required along with a few other
less common cases. This sets aside for the moment what to do about
net-common.h and env_get_ip() as I'm not entirely sure what's best
there.

[1]: https://patchwork.ozlabs.org/project/uboot/list/?series=454939&state=*
Link: https://lore.kernel.org/r/20250514225002.15361-1-trini@konsulko.com
2 months agoinclude/command.h: Drop <env.h>
Tom Rini [Wed, 14 May 2025 22:46:04 +0000 (16:46 -0600)] 
include/command.h: Drop <env.h>

Now that all of the cases of code that relied on <command.h> to provide
<env.h> (or one of the headers that it includes, and so forth) have been
fixed, we can drop the include from here.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agoglobal: Avoid indirect inclusion of <env.h> from <command.h>
Tom Rini [Wed, 14 May 2025 22:46:03 +0000 (16:46 -0600)] 
global: Avoid indirect inclusion of <env.h> from <command.h>

The include file <command.h> does not need anything from <env.h>.
Furthermore, include/env.h itself includes other headers which can lead
to longer indirect inclusion paths. To prepare to remove <env.h> from
<command.h> fix all of the places which had relied on this indirect
inclusion to instead include <env.h> directly.

Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org> # android, bcb
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> # spawn
Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agogpio: pca953x: Add missing <asm/byteorder.h>
Tom Rini [Wed, 14 May 2025 22:46:02 +0000 (16:46 -0600)] 
gpio: pca953x: Add missing <asm/byteorder.h>

This driver takes a long implicit include path to get this header which
it directly uses. Add it.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agocmd/mem.c, test/cmd/mem_copy.c: Add <compiler.h>
Tom Rini [Wed, 14 May 2025 22:46:01 +0000 (16:46 -0600)] 
cmd/mem.c, test/cmd/mem_copy.c: Add <compiler.h>

These files require <compiler.h> in order to have MEM_SUPPORT_64BIT_DATA
be defined but currently rely on a long indirect include path to get it.
Add this directly.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agoglobal: Add <linux/string.h> instead of long indirect include path
Tom Rini [Wed, 14 May 2025 22:46:00 +0000 (16:46 -0600)] 
global: Add <linux/string.h> instead of long indirect include path

In a number of cases we have C files which rely on a chain of indirect
include paths to get <linux/string.h> to be included via <command.h>. To
facilitate cleaning up <command.h> make this code directly include
<linux/string.h>.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agoMerge patch series "regex patches"
Tom Rini [Thu, 29 May 2025 14:27:13 +0000 (08:27 -0600)] 
Merge patch series "regex patches"

Rasmus Villemoes <ravi@prevas.dk> says:

This started as a rather simple patch, 1/12, adding the ability to
more conveniently do regex matching in shell.

But with that, it became very easy to see what the slre library can
and especially what it cannot do, and that way I found both outright
bugs and a "wow, doesn't it support that syntax" gotcha. I couldn't
find any tests ('git grep slre -- test/' was empty), so I added a
small test suite and tweaked slre.c.

Link: https://lore.kernel.org/r/20250513084034.654865-1-ravi@prevas.dk
2 months agodoc: document test command
Rasmus Villemoes [Tue, 13 May 2025 08:40:34 +0000 (10:40 +0200)] 
doc: document test command

Add documentation for the test command, including the newly added =~
operator and some gotchas wrt. the numeric comparisons.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
2 months agotest: slre: add tests for character ranges
Rasmus Villemoes [Tue, 13 May 2025 08:40:33 +0000 (10:40 +0200)] 
test: slre: add tests for character ranges

The first of these, { "U-Boot", "^[B-Uo-t]*$", 0 }, would match
previously when the - and the letters were all interpreted literally.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
2 months agoslre: implement support for ranges in character classes
Rasmus Villemoes [Tue, 13 May 2025 08:40:32 +0000 (10:40 +0200)] 
slre: implement support for ranges in character classes

When trying to use U-Boot's regex facility, it is a rather large
gotcha that [a-z] range syntax is not supported. It doesn't require a
lot of extra code to implement that; we just let the regular parsing
emit the start and end literal symbols as usual, and add a new
"escape" code RANGE.

At match time, this means the code will first just see an 'a' and try
to match that, and only then recognize that it's actually part of a
range and then do the 'a' <= ch <= 'z' test.

Of course, this means that a - in the middle of a [] pair no longer
matches a literal dash, but I highly doubt anybody relies on
that. Putting it first or last, or escaping it with \, as in most
other RE engines, continues to work.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
2 months agotest: slre: add test cases for escape char in character class
Rasmus Villemoes [Tue, 13 May 2025 08:40:31 +0000 (10:40 +0200)] 
test: slre: add test cases for escape char in character class

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
2 months agoslre: fix matching of escape sequence used inside character class
Rasmus Villemoes [Tue, 13 May 2025 08:40:30 +0000 (10:40 +0200)] 
slre: fix matching of escape sequence used inside character class

At the compile stage, the anyof() function clearly intends to handle escape
sequences like \d (for digits) inside square brackets, since the logic
emits a 0 byte followed by the code representing the character
class (NONSPACE, SPACE or DIGIT).

However, this is not handled in the corresponding match helper
is_any_of(); it just naively loops over all the bytes in the ->data
array emitted by anyof() and compares those directly to the current
character. For example, this means that the string "\x11" (containing
the single character with value 17) is matched by the regex "[#%\d]",
because DIGIT happens to be 17.

Fix that by recognizing a zero byte as indicating something special
and act accordingly. In order not to repeat the "increment *ofs and
return 1" in all places, put those two lines after a new match: label.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
2 months agoslre: refactor is_any_but()
Rasmus Villemoes [Tue, 13 May 2025 08:40:29 +0000 (10:40 +0200)] 
slre: refactor is_any_but()

As preparation for fixing the handling of backslash-escapes used
inside a character class, refactor is_any_but() to be defined in terms
of is_any_of() so we don't have to repeat the same logic in two places.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
2 months agotest: slre: add some (negative) character class tests
Rasmus Villemoes [Tue, 13 May 2025 08:40:28 +0000 (10:40 +0200)] 
test: slre: add some (negative) character class tests

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
2 months agotest: slre: add more test cases
Rasmus Villemoes [Tue, 13 May 2025 08:40:27 +0000 (10:40 +0200)] 
test: slre: add more test cases

Add some tests for the "drop wrong anchored optimization". Without
the previous commit, the first, fifth and seventh of these would fail,
i.e. those:

{ "xby", "^a|b", 1},
{ "", "x*$", 1},
{ "yy", "x*$", 1},

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
2 months agoslre: drop wrong "anchored" optimization
Rasmus Villemoes [Tue, 13 May 2025 08:40:26 +0000 (10:40 +0200)] 
slre: drop wrong "anchored" optimization

The regex '^a|b' means "does the string start with a, or does it have
a b anywhere", not "does the string start with a or b" (the latter
should be spelled '^[ab]' or '^(a|b)'). It should match exactly the
same strings as 'b|^a'. But the current implementation hard-codes an
assumption that when the regex starts with a ^, the whole regex must
match from the beginning, i.e. it only attempts at offset 0.

It really should be completely symmetrical to 'b|c$' ("does it have a
b anywhere or end with c?"), which is treated correctly.

Another quirk is that currently the regex 'x*$', which should match
all strings (because it just means "does the string end
with 0 or more x'es"), does not, because in the unanchored case we
never attempt to match at ofs==len. In the anchored case, '^x*$', this
works correctly and matches exactly strings (including the empty
string) consisting entirely of x'es.

Fix both of these issues by dropping all use of the slre->anchored
member and always test at all possible offsets. If the regex does have
a ^ somewhere (including after a | branch character), that is
correctly handled by the match engine by only matching when *ofs is 0.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>