Commit graph

94956 commits

Author SHA1 Message Date
Sughosh Ganu
be222ac029 list: use list_count_nodes() to count list entries
Use the API function list_count_nodes() to count the number of list
entries.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2024-08-30 13:51:38 -06:00
Jonas Karlman
e83ced1a24 bootstage: Fix unstash of records from SPL
The commit b81e31a1e6 ("bootstash: Do not provide a default address
for all") changed a bootstage unstash call to bootstage stash, this
has resulted in bootstage records stashed in SPL no longer get unstaged
in U-Boot proper. Fix this by changing back to a unstage call.

Fixes: b81e31a1e6 ("bootstash: Do not provide a default address for all")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2024-08-28 10:07:59 -06:00
Franco Venturi
cf85cd84aa mmc: fix signed vs unsigned compare in read check in _spl_load()
Fix signed vs unsigned compare in read check in _spl_load()

Issue: when info->read() returns a negative value because of an error,
       the comparison of 'read' (signed) with 'sizeof(*header)'
       (unsigned silently converts the negative value into a very
       large unsigned value and the check on the error condition
       always return false, i.e. the error is not detected
Symptoms: if spl_load_image_fat() is unable to find the file 'uImage',
          the SPL phase of the boot process just hangs after displaying
          the following line:
          Trying to boot from MMC1
Fix: cast 'sizeof(*header)' to int so the compare is now between
     signed types
Reference: https://stackoverflow.com/questions/17293749/sizeof-operator-in-if-statement

Signed-off-by: Franco Venturi <fventuri@comcast.net>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2024-08-27 18:04:05 -06:00
Billy Tsai
7c2c235a27 gpio: Add G7 Aspeed gpio controller driver
In the 7th generation of the SoC from Aspeed, the control logic of the
GPIO controller has been updated to support per-pin control. Each pin now
has its own 32-bit register, allowing for individual control of the pin’s
value, direction, interrupt type, and other settings.

Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
2024-08-27 18:01:38 -06:00
Hiago De Franco
1bf048f21b tools/scripts/Kconfig: Update references from kconfig-language.txt to rst
The Linux kernel documentation has transitioned from using
kconfig-language.txt to kconfig-language.rst. Therefore update all
occurrences of kconfig-language.txt.

Signed-off-by: Hiago De Franco <hiago.franco@toradex.com>
2024-08-27 18:01:32 -06:00
Gaskell, Oliver
716ab3fb23 dm: core: Make SPL_DM_SEQ_ALIAS select SPL_STRTO
Enabling CONFIG_DM_SEQ_ALIAS enables code which relies on
`trailing_strtol()` - which is only linked in SPL when CONFIG_SPL_STRTO
is enabled.

CONFIG_SPL_STRTO is not enabled by default - to ensure this function is
available in SPL, CONFIG_SPL_DM_SEQ_ALIAS should select
CONFIG_SPL_STRTO.

Signed-off-by: Oliver Gaskell <Oliver.Gaskell@analog.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2024-08-27 18:01:28 -06:00
Jim Liu
df5286e82d arm: dts: nuvoton: add dts support for npcm845 yosemite4
Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
2024-08-27 18:01:24 -06:00
Maxim Moskalets
d8503a45df lib: move phdr increment to for loop heading
Shifting this pointer in the loop will be more logical when working
with the code later, because you can see at a glance what exactly
changes at each iteration. Moreover, the code remains equivalent
because this variable is not used after the loop.

Signed-off-by: Maxim Moskalets <maximmosk4@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2024-08-27 18:01:21 -06:00
Tom Rini
314fdd2e73 Merge patch series "dm: core: Avoid multiple calls to fdt_parent_offset()"
Jonas Karlman <jonas@kwiboo.se> says:

Use of fdt_parent_offset() is very expensive as detailed by the function
documentation:

  NOTE: This function is expensive, as it must scan the device tree
  structure from the start to nodeoffset, *twice*.

This series remove multiple calls to fdt_parent_offset() or
ofnode_get_parent() when instead a single call can be made and the
returned value can be reused.

This series help reduce boot time by around:
- ~137ms on a Radxa ROCK Pi 4 (RK3399)
- ~33ms on a Radxa ZERO 3W (RK3566)
2024-08-27 15:37:19 -06:00
Jim Liu
b70865e6b9 timer: npcm: Change counter source
The counter value read from TDR register may not be correct.
Read SECCNT and CNTR25M instead to get the correct timestamp.

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
2024-08-27 15:37:18 -06:00
Jonas Karlman
6f5b168661 dm: core: regmap: Avoid multiple calls to ofnode_get_parent()
Until a live tree is used in U-Boot proper after relocation, use of
ofnode_get_parent() will trigger a call to the very expensive
fdt_parent_offset(), as detailed by the function documentation:

  NOTE: This function is expensive, as it must scan the device tree
  structure from the start to nodeoffset, *twice*.

Re-use the returned value from a single call instead of having to make
multiple calls for same node.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
2024-08-27 14:32:49 -06:00
Jonas Karlman
445406afbb dm: core: ofnode: Avoid multiple calls to ofnode_get_parent()
Until a live tree is used in U-Boot proper after relocation, use of
ofnode_get_parent() will trigger a call to the very expensive
fdt_parent_offset() as detailed by the function documentation:

  NOTE: This function is expensive, as it must scan the device tree
  structure from the start to nodeoffset, *twice*.

Re-use the returned value from a single call instead of having to make
multiple calls for same node.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
2024-08-27 14:32:49 -06:00
Jonas Karlman
d6330529a5 dm: core: fdtaddr: Avoid multiple calls to fdt_parent_offset()
Use of fdt_parent_offset() is very expensive as detailed by the function
documentation:

  NOTE: This function is expensive, as it must scan the device tree
  structure from the start to nodeoffset, *twice*.

Re-use the returned value from a single call instead of having to make
multiple calls for same nodeoffset.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
2024-08-27 14:32:49 -06:00
Jim Liu
7c17f02283 gpio: npcm: Add SGPIO support for Nuvoton NPCM SoCs
Add Nuvoton BMC NPCM7xx/NPCM8xx sgpio driver.
BMC can use this driver to increase 64 GPI pins and 64 GPO pins to use.

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
2024-08-27 14:31:55 -06:00
Love Kumar
ce6895dd12 test/py: spi: Add tests for SPI flash device
Add test cases for sf commands to verify various SPI flash operations
such as erase, write and read. It also adds qspi lock unlock cases.
This test relies on boardenv_* configurations to run it for different
SPI flash family such as single SPI, QSPI, and OSPI.

Signed-off-by: Love Kumar <love.kumar@amd.com>
2024-08-27 14:31:08 -06:00
Zixun LI
56274888fc cmd: bind: Use device sequence instead for driver bind/unbind
Currently uclass index is used for bind/unbind which ignores alias
sequence numbering. Use device sequence number instead as it's
the number explicitly set in the DT.

Also update documentation to use sequence number.

Signed-off-by: Zixun LI <admin@hifiphile.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2024-08-27 14:30:14 -06:00
Zixun LI
2d76e724b4 dm: core: Show device sequence instead in dm_dump_tree()
Currently uclass index is shown in DM tree dump which ignores alias
sequence numbering. The result could be confusing since these 2 numbers
could be different. Show device sequence number instead as it's more
meaningful.

Also update documentation to use sequence number.

Signed-off-by: Zixun LI <admin@hifiphile.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2024-08-27 14:30:02 -06:00
Vignesh Raghavendra
8a5642fa84 mtd: nand: raw: omap_gpmc: Check return value of gpmc_nand_init
If the function is called with no NAND device attached, then this
function can return error value, proceeding further ignoring the same
can cause system crash. This is seen when "mtd list" is run with no NAND
addon cards connected.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Acked-by: Roger Quadros <rogerq@kernel.org>
2024-08-27 14:27:44 -06:00
Derald D. Woods
f85dafa9af omap3: omap3evm: Migrate to OF_UPSTREAM
This commit brings the omap3evm inline with the remaining OMAP3XXX variants.

Signed-off-by: Derald D. Woods <woods.technical@gmail.com>
2024-08-27 11:17:39 -06:00
Sean Anderson
274e0c7299 sandbox: Fix pinmux warnings with non-test devicetrees
The sandbox pinmux driver is used in the non-test devicetree as well as
the test one. I didn't realize this when I modified the driver for
tests, and so broke the regular use case (which only resulted in
warnings). First, making the pinmux and the UART group available
pre-relocation to avoid ENODEV errors. Then, convert the pin groups and
functions to the new style, adding onewire group as well.

Fixes: 7f0f1806e3 ("test: pinmux: Add test for pin muxing")
Closes: https://source.denx.de/u-boot/u-boot/-/issues/2
Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2024-08-27 11:17:39 -06:00
Heinrich Schuchardt
101d9a6a53 ata: sata_rescan must scan for block devices
A system may have multiple SATA controller. Removing the controller with
the lowest sequence number before probing all SATA controllers makes no
sense.

In sata_rescan we remove all block devices which are children of SATA
controllers. We also have to remove the bootdev devices as they will be
created when scanning for block devices.

After probing all SATA controllers we must scan for block devices otherwise
we end up without any SATA block device.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2024-08-27 11:17:39 -06:00
Christian Marangi
a60c20bda8 pci: mediatek: add support for upstream split PCIe node
Add support for upstream linux split PCIe node.

Upstream linux have an alternative way to declare PCIe nodes that splits
them in dedicated nodes for each line instead of putting them all in one
node.

Detect this by checking if the mediatek,generic-pciecfg node is passed
as it's used to reference the common address for all the PCIe lines.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-08-27 11:17:39 -06:00
MD Danish Anwar
6dd95456f7 remoteproc: uclass: Modify uc_pdata->name to use combination of device name and device's parent name
uc_pdata->name is populated from device tree property "remoteproc-name".
For those devcices that don't set "remoteproc-name", uc_pdata->name
falls back to dev->name.

If two devices have same name, this will result into uc_pdata->name not
being unique and rproc_init() will fail.

Fix this by using combination of dev->name and dev->parent->name instead
of using just the dev->name to populate uc_pdata->name.

Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
Reviewed-by: Roger Quadros <rogerq@kernel.org>
Reviewed-by: Andrew Davis <afd@ti.com>
2024-08-27 11:17:39 -06:00
Heinrich Schuchardt
a7026b0003 ata: dwc_ahsata: create boot device
For each block device we must create a sibling boot device.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-08-27 11:17:39 -06:00
Tom Rini
a41c1aeefb Merge patch series "bootstd: Try again to resolve infinite-loop bug"
Simon Glass <sjg@chromium.org> says:

This little series tries to resolve a problem found with an earlier
fix.
2024-08-27 11:17:39 -06:00
Tom Rini
e5a6ce5d33 Merge patch series "arch: arm: dts: ti: Add missing fss range"
Jonathan Humphreys <j-humphreys@ti.com> says:

Upstream DTS added explicit ranges to the fss node. It did not include
the 32 bit memory space needed by the R5 to access OSPI. With the
upstream DTS sync, OSPI boot no longer works.

Adding the missing range here. It is also being added in the upstream DTS,
so after the next upstream DTS sync, these patches can be removed.

Fixes: 5024a96db8 ("Subtree merge tag 'v6.10-dts' of devicetree-rebasing repo [1] into dts/upstream")
2024-08-27 11:17:39 -06:00
Simon Glass
cae1ad02f7 bootstd: Make bootdev_next_prio() continue after failure
When a device fails to probe, the next device should be tried, until
either we find a suitable device or run out of devices. A device
should never be tried twice.

When we run out of devices of a particular priority, the hunter should
be used to generate devices of the next priority. Only if all attempts
fail should this function return an error.

Update the function to use the latent 'found' boolean to determine
whether another loop iteration is warranted, rather than setting 'dev'
to NULL, which creates confusion, suggesting that no devices have been
scanned and the whole process is starting from the beginning.

Note that the upcoming bootflow_efi() test is used to test this
behaviour.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: https://source.denx.de/u-boot/custodians/u-boot-dm/-/issues/17
2024-08-27 10:09:07 -06:00
Simon Glass
aad8b18a52 Revert "bootdev: avoid infinite probe loop"
This turns out to be insufficient to fix the problem, since when
bootdev_next_prio() exits, the caller has no idea that this really
is the end. Nor is it, since there may be other devices which should
be checked.

The caller iterates which calls iter_incr() which calls
bootdev_next_prio() again, which finds the same device and the loop
continues.

We never did create a test for this[1], which makes it hard to be
sure which problem was fixed.

The original code had the virtue of staying in the loop looking for a
bootdev, so let's go back to that and try to fix this another way.

A future patch will make bootdev_next_prio() continue after failure
which should provide same effect.

This reverts commit 9d92c418ac.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-27 10:09:07 -06:00
Jonathan Humphreys
f36432a8c8 arch: arm: dts: k3-j721e-r5-sk: Add missing fss range
Upstream DTS added explicit ranges to the fss node.  It did not include the
32 bit memory space needed by the R5 to access OSPI.  With the upstream DTS
sync, OSPI boot no longer works.

Adding the missing range here. It is also being added in the upstream DTS,
so after the next upstream DTS sync, this patch can be removed.  See
0c0e03ec22 (arm64: dts: ti: k3-j721e: Use exact ranges for FSS node)

Fixes: 5024a96db8 ("Subtree merge tag 'v6.10-dts' of devicetree-rebasing repo [1] into dts/upstream")

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
2024-08-27 10:02:35 -06:00
Jonathan Humphreys
4b91ded762 arch: arm: dts: k3-j721e-r5-evm: Add missing fss range
Upstream DTS added explicit ranges to the fss node.  It did not include the
32 bit memory space needed by the R5 to access OSPI.  With the upstream DTS
sync, OSPI boot no longer works.

Adding the missing range here. It is also being added in the upstream DTS,
so after the next upstream DTS sync, this patch can be removed.  See
0c0e03ec22 (arm64: dts: ti: k3-j721e: Use exact ranges for FSS node)

Fixes: 5024a96db8 ("Subtree merge tag 'v6.10-dts' of devicetree-rebasing repo [1] into dts/upstream")

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
2024-08-27 10:02:35 -06:00
Jonathan Humphreys
0bc48353fa arch: arm: dts: k3-j7200-r5-evm: Add missing fss range
Upstream DTS added explicit ranges to the fss node.  It did not include the
32 bit memory space needed by the R5 to access OSPI.  With the upstream DTS
sync, OSPI boot no longer works.

Adding the missing range here. It is also being added in the upstream DTS,
so after the next upstream DTS sync, this patch can be removed. See
f00e626085 (arm64: dts: ti: k3-j7200: Use exact ranges for FSS node)

Fixes: 5024a96db8 ("Subtree merge tag 'v6.10-dts' of devicetree-rebasing repo [1] into dts/upstream")

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
Reviewed-by: Aniket Limaye <a-limaye@ti.com>
2024-08-27 10:02:35 -06:00
Jonathan Humphreys
0f116942b8 arch: arm: dts: k3-am69-r5-sk: Add missing fss range
Upstream DTS added explicit ranges to the fss node.  It did not include the
32 bit memory space needed by the R5 to access OSPI.  With the upstream DTS
sync, OSPI boot no longer works.

Adding the missing range here. It is also being added in the upstream DTS,
so after the next upstream DTS sync, this patch can be removed. See
f062a015f4 (arm64: dts: ti: k3-j784s4: Use exact ranges for FSS node)

Fixes: 5024a96db8 ("Subtree merge tag 'v6.10-dts' of devicetree-rebasing repo [1] into dts/upstream")

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
2024-08-27 10:02:35 -06:00
Jonathan Humphreys
9151844547 arch: arm: dts: k3-j784s4-r5-evm: Add missing fss range
Upstream DTS added explicit ranges to the fss node.  It did not include the
32 bit memory space needed by the R5 to access OSPI.  With the upstream DTS
sync, OSPI boot no longer works.

Adding the missing range here. It is also being added in the upstream DTS,
so after the next upstream DTS sync, this patch can be removed. See
f062a015f4 (arm64: dts: ti: k3-j784s4: Use exact ranges for FSS node)

Fixes: 5024a96db8 ("Subtree merge tag 'v6.10-dts' of devicetree-rebasing repo [1] into dts/upstream")

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
Reviewed-by: Andrew Davis <afd@ti.com>
2024-08-27 10:02:35 -06:00
Tom Rini
9735cfaf90 Merge patch series "Tidy up console recording in tests"
Simon Glass <sjg@chromium.org> says:

This series started as a small fix for checking for an empty line,
but in the process several other problems were found and fixed:

- fix tests which use console recording but don't set the flag
- drop unnecessary resetting of the console in tests
- drop unnecessary blank line before MMC output
- update the docs a little
- fix buildman test failure on newer Pythons
- a few other minor things

This series also renames the confusing flag names, so that they are
easier to remember - just a UTF_ (unit-test flags) prefix.
2024-08-26 18:52:18 -06:00
Simon Glass
695b464532 doc: Add a few notes about how to use console checking
Tidy up the existing docs in line with current conventions.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26 18:51:49 -06:00
Simon Glass
e6f498e70b test: Tidy up checking for console end
Use the ut_assert_console_end() function provided, rather than doing it
separately.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26 18:51:49 -06:00
Simon Glass
d3ac70aac4 test: Use UTF_CONSOLE in remaining tests
Set this flag rather than doing things manually in the test.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26 18:51:49 -06:00
Simon Glass
75c535c37d test: log: Use UTF_CONSOLE in tests
Set this flag rather than doing things manually in the test.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26 18:51:49 -06:00
Simon Glass
d77519652a test: hush: Use UTF_CONSOLE in tests
Set this flag rather than doing things manually in the test.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2024-08-26 18:51:49 -06:00
Simon Glass
675fde825a test: dm: Use UTF_CONSOLE in tests
Set this flag rather than doing things manually in the test.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26 18:51:49 -06:00
Simon Glass
0af38d12d9 test: cmd: Drop unnecessary console_record_reset_enable()
It is seldom necessary to call this function. Drop its use in the
command tests.

Add a few extra checks to the wget test so that resetting is not
needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26 18:51:49 -06:00
Simon Glass
0e77c2b611 test: cmd: Use UTF_CONSOLE in tests
Set this flag rather than doing things manually in the test.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26 18:51:49 -06:00
Simon Glass
2b60f8c8b1 test: fdt: Move common code into the setup functions
Quite a lot of tests have the same two lines of code at the start. Move
this into the two setup functions to reduce redundancy.

Add a line to check the output from set_working_fdt_addr() since this is
always emitted.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26 18:51:49 -06:00
Simon Glass
b8133039fb test: fdt: Check internal-function return values
Some functions are using asserts but the result of the functions
themselves is not checked. This means that if a test fails, the result
is not noticed until later, which can be confusing to debug.

Add the missing asserts.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26 18:51:49 -06:00
Simon Glass
a6a80b3b29 test: boot: Use UTF_CONSOLE in tests
Set this flag rather than doing things manually in the test.

Drop unnecessary calls to console_record_reset_enable()

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2024-08-26 18:51:49 -06:00
Simon Glass
f034becd06 test: bloblist: Use UTF_CONSOLE in tests
Set this flag rather than doing things manually in the test.

Drop the code which is now unnecessary.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26 18:51:49 -06:00
Simon Glass
5c27fd7ef9 test: Update NAND test to avoid extra macros
Write out the tests in full to allow the test to be found more easily
when there is a failure. We could use a single test function with a
for() loop but this would stop at the first failure, and some variations
might while other pass.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26 18:51:49 -06:00
Simon Glass
eccd4ca387 mmc: Drop the blank line before accesses
Several mmc subcommand print a blank line before starting and after
finishing. It isn't necessary to do both, so drop the first one.

It is questionable whether these command should produce any output at
all, but leave it for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26 18:51:49 -06:00
Simon Glass
9b99762eff test: Rename UTF_CONSOLE_REC to UTF_CONSOLE
The _REC suffix doesn't add much. Really what we want to know is whether
the test uses the console, so rename this flag.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2024-08-26 18:51:49 -06:00
Simon Glass
b073d48e8d test: Drop the blank line before test macros
Most tests don't have this. It helps to keep the test declaration
clearly associated with the function it relates to, rather than the next
one in the file. Remove the extra blank line and mention this in the
docs.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-26 18:51:49 -06:00