Commit graph

26316 commits

Author SHA1 Message Date
Tom Rini
d82f7bc94c Merge patch series "scsi: ensure writes are flushed to disk"
Caleb Connolly <caleb.connolly@linaro.org> says:

SCSI devices like UFS may maintain their own cache to speed up writes,
however this is lost on board reset (and may be lost on device removal
or reset by OS drivers).

Currently this can be worked around by "waiting for a while" after
writing data to disk, but of course this is not an acceptable solution.

Ideally U-Boot would have a mechanism to flush caches during board
reset, but until that logic is hooked up let's be sure that all writes
are actually propagated to the storage device so that we don't lose data
on board reset.

The same logic was already implemented just for the AHCI backend, this
duplicated logic has been removed and support for the SYNC_CACHE command
is added to AHCI.

This is particularly noticeable during capsule updates, since the update
file is deleted and the board is reset immediately afterwards which
resulted in the same capsule update being applied over and over again.

This specifically fixes Qualcomm SDM845 devices with UFS 2.1, but likely
all UFS devices that use a cache.

Link: https://lore.kernel.org/r/20250326-scsi-sync-on-write-v2-0-12ab05bd464b@linaro.org
2025-04-10 14:21:46 -06:00
Caleb Connolly
77c13f30b6 ata: ahci: implement SCSI_SYNC_CACHE
The SCSI layer now issues a SYNC_CACHE command after every write to
ensure there is no data loss due to a board reset after write.

Implement support for this command and remove the same logic from the
ATA write path to be consistent with other SCSI backends.

Ranges are not supported and the whole cache will be flushed in all
cases.

This was done per iteration in ata_scsiop_read_write(), but it's not
clear why this was the case, calling it once for the entire write ought
to achieve the same result.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-04-10 14:21:41 -06:00
Caleb Connolly
ffe4e6ab42 scsi: sync cache on write
We don't have a mechanism to safely shutdown block devices prior to a
baord reset or driver removal. Prevent data loss by synchronizing the
SCSI cache after every write.

In particular this solves the issue of capsule updates looping on some
devices because the board resets immediately after deleting the capsule
file and this write wouldn't be flushed in time.

This may impact NAND wear, but should be negligible given the usecases
for disk write in U-Boot.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-04-10 14:21:41 -06:00
Caleb Connolly
0cd3c1e7d0 scsi: fix typo in setup_read_ext()
This clears the 6th byte of cmd twice rather than setting the 9th byte
to 0. Fix it.

The only other command that sets the 9th byte is the 64-bit read, so
this likely never caused issues in practise.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
2025-04-10 14:21:41 -06:00
Zixun LI
dc22cf37af usb: gadget: atmel: Add SAM9X60 support
Compared to SAM9X5 the only difference is the DPRAM memory from the
USB High Speed Device Port (UDPHS) hardware block was increased,
so we can reuse the same endpoint data.

Also add compatible "microchip,sam9x60-udc".

Signed-off-by: Zixun LI <admin@hifiphile.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
Link: https://lore.kernel.org/r/20250331162611.1557759-2-admin@hifiphile.com
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2025-04-10 10:02:06 +02:00
Mattijs Korpershoek
c76a7090f6 usb: gadget: f_mass_storage: Fix memory leak of fsg buffers
In fsg_common_init, we allocate some buffers via memalign().
However, these buffers are never freed.

Because of that, we cannot call => ums command multiple times on boards
with low memory (CONFIG_SYS_MALLOC_LEN=0x81000):

=> ums 0 mmc 2
UMS: LUN 0, dev mmc 2, hwpart 0, sector 0x0, count 0x3a3e000
|crq->brequest:0x0
CTRL+C - Operation aborted
=> ums 0 mmc 2
UMS: LUN 0, dev mmc 2, hwpart 0, sector 0x0, count 0x3a3e000
failed to start <NULL>: -12
g_dnl_register: failed!, error: -12
g_dnl_register failed

Make sure the fsg buffers are freed when the gadget is unbound by
calling fsg_common_release() in fsg_unbind().

Reported-by: Zixun LI <admin@hifiphile.com>
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Zixun LI <admin@hifiphile.com> # on SAM9X60
Link: https://lore.kernel.org/r/20250328-ums-gadget-leak-v1-4-3b677db99bde@baylibre.com
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2025-04-10 10:00:24 +02:00
Mattijs Korpershoek
6c9eaec55a usb: gadget: f_mass_storage: Fix NULL dereference in fsg_add()
fsg_common_init() can fail when memory is low. In that case, it returns
PTR_ERR().
fsg_add() does not check for failure, and thus dereferences an invalid
fsg_common later, which crashes.

Verify if we receive an error from fsg_common_init() and handle it
gracefully.

Reported-by: Zixun LI <admin@hifiphile.com>
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Zixun LI <admin@hifiphile.com> # on SAM9X60
Link: https://lore.kernel.org/r/20250328-ums-gadget-leak-v1-3-3b677db99bde@baylibre.com
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2025-04-10 10:00:24 +02:00
Mattijs Korpershoek
47fd46db94 usb: gadget: f_mass_storage: Drop invalid kfree() in fsg_common_release()
Boards with low memory (CONFIG_SYS_MALLOC_LEN=0x81000), can be crashed
using the => ums command twice in row:

=> ums 0 mmc 2
UMS: LUN 0, dev mmc 2, hwpart 0, sector 0x0, count 0x3a3e000
|crq->brequest:0x0
CTRL+C - Operation aborted
=> ums 0 mmc 2
UMS: LUN 0, dev mmc 2, hwpart 0, sector 0x0, count 0x3a3e000
"Synchronous Abort" handler, esr 0x96000004, far 0xfffffffff2ea20f0
elr: 000000000102ea78 lr : 000000000105e028 (reloc)
elr: 00000000f2f33a78 lr : 00000000f2f63028
x0 : 0000000100000000 x1 : 0000000100000000
x2 : 0000000000000000 x3 : fffffffff2ea20e0
x4 : 00000000f2fc9720 x5 : 00000000f2ea20e0
x6 : 00000000f2fc9730 x7 : 00000000f2ee4780
x8 : 000000000000003f x9 : 0000000000000004
x10: 0000000000000058 x11: 00000000000058c4
x12: 0000000000000000 x13: 00000000f2e60800
x14: 00000000f4ec0040 x15: 0000000000000000
x16: 00000000f2f62f2c x17: 0000000000c0c0c0
x18: 00000000f2e73e00 x19: 00000000f2ea2010
x20: 00000000fffffff4 x21: 00000000f2e9b500
x22: 00000000f2ea20f0 x23: 00000000f2ea2050
x24: 00000000f2f61eec x25: 00000000f2fcf000
x26: 00000000f2e9fcd0 x27: 0000000000000000
x28: 0000000000000000 x29: 00000000f2e60290

Code: d00004a6 911cc0c6 cb000063 8b000021 (f9400860)
Resetting CPU ...

This happens when fsg_common_init() fails to allocate memory and calls
fsg_common_release().
fsg_common_release() then calls kfree() which frees common->luns.
However, common->luns was never allocated via kmalloc/calloc(),
resulting in a crash.

Drop the invalid kfree. The memory from common->luns will be
reclaimed when we kfree(common) later in fgs_common_release().

Reported-by: Zixun LI <admin@hifiphile.com>
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Zixun LI <admin@hifiphile.com> # on SAM9X60
Link: https://lore.kernel.org/r/20250328-ums-gadget-leak-v1-2-3b677db99bde@baylibre.com
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2025-04-10 10:00:23 +02:00
Mattijs Korpershoek
a4317be9db usb: gadget: f_mass_storage: Remove kref structure use
The kref structure is locally to f_mass_storage and is not used
anywhere beside in fsg_common_release().

Remove it and use struct fsg_common* instead.

No functional change.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Zixun LI <admin@hifiphile.com> # on SAM9X60
Link: https://lore.kernel.org/r/20250328-ums-gadget-leak-v1-1-3b677db99bde@baylibre.com
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2025-04-10 10:00:23 +02:00
Michael Walle
d3c9f810f2 fastboot: lift restrictions on !NET_LWIP for USB
Fastboot works either over TCP, UDP or USB. The latter doesn't have
anything to do with networking, thus should work just fine with
regardless which network stack is selected. In practice, header symbols
are used inside common code paths. Add some ifdeffery to guard against
that.

This will make fastboot over USB work with the new LWIP stack.

Signed-off-by: Michael Walle <mwalle@kernel.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Link: https://lore.kernel.org/r/20250312073655.2281377-1-mwalle@kernel.org
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2025-04-10 09:59:37 +02:00
Marek Vasut
7cedd20ed3 usb: dwc3: gadget: Fix excepts/expects typo
Fix the excepts typo to expects , no functional change.

Fixes: 0916053ebc ("usb: dwc3: gadget: Fix match_ep callback for NXP UUU tool")
Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Link: https://lore.kernel.org/r/20250324143956.91791-1-marex@denx.de
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2025-04-10 09:58:56 +02:00
Tom Rini
1f0281294d Merge patch series "Annotate switch/case fallthrough cases"
Andre Przywara <andre.przywara@arm.com> says:

C's implicit fallthrough behaviour in switch/case statements can lead to
subtle bugs. Quite some while ago many compilers introduced warnings in
those cases, requiring intentional fallthrough's to be annotated.

So far we were not enabling that compiler option, so many ambiguities
and some bugs in the code went unnoticed.

This series adds the required annotations in code paths that the first
stage of the U-Boot CI covers. There is a large number of cases left
in the libbz2 code. The usage of switch/case is borderline insane there,
labels are hidden in macros, and there are no breaks, but just goto's.
Upstream still uses very similar code, without any annotations. I still
am not 100% sure those are meant to fall through or not, and plan to do
further investigations, but didn't want to hold the rest of the patches
back. You can see for yourself by applying patch 18/18 and building for
sandbox64, for instance.

Because of this we cannot quite enable the warning in the Makefile yet,
but those fixes are worth regardless, and be it to increase readability.

Please note that those patches do not fix anything, really, they just add
those fallthrough annotations, so the series is not really critical.

Link: https://lore.kernel.org/r/20250327153313.2105227-1-andre.przywara@arm.com
2025-04-08 16:24:12 -06:00
Andre Przywara
3f61113c27 mtd: rawnand: nand_base: annotate switch/case fallthrough
The raw NAND flash code uses an implicit switch/case fallthrough to
share code when dealing with different ECC modes, and also when handling
some read command.

Add our "fallthrough;" statement-like macro before the respective labels
in the NAND code, to avoid a warning when GCC's -Wimplicit-fallthrough
warning option is enabled.

This copies the fallthrough annotations that the original kernel code
gained, before this function got refactored there.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Michael Trimrachi <michael@amarulasolutions.com>
2025-04-08 16:23:51 -06:00
Andre Przywara
452dfcc3b4 mtd: spi-nor-tiny: annotate switch/case fallthrough
The SPI NOR code uses an implicit switch/case fallthrough when checking
different vendors to determine how to deal with extended addressig modes.

Add our "fallthrough;" statement-like macro before some label in the
4-byte addressing mode code, to avoid a warning when GCC's
-Wimplicit-fallthrough warning option is enabled.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-04-08 16:23:51 -06:00
Andre Przywara
64bc012458 mtd: ubi: annotate fallthrough
The UBI code uses an implicit switch/case fallthrough when handling two
related cases of bad header errors. Also there is a switch/case for unit
prefix handling (G/M/K), which accumulates multiplications.

Add our "fallthrough;" statement-like macro before the respective labels
in both cases, to avoid a warning when GCC's -Wimplicit-fallthrough
warning option is enabled.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
2025-04-08 16:23:51 -06:00
Andre Przywara
960d3d933d net: e1000: annotate switch/case fallthrough
The E1000 driver uses an implicit switch/case fallthrough for sharing
some code supporting different PHYs.

Add our "fallthrough;" statement-like macro before the two labels in
e1000_set_phy_type(), to avoid a warning when GCC's -Wimplicit-fallthrough
warning option is enabled.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2025-04-08 16:23:51 -06:00
Andre Przywara
2c22efbb37 video: annotate switch/case fall-through
The generic DM video code uses an implicit switch/case fallthrough to
provide fallback code paths when certain colour depths are not enabled.

Add our "fallthrough;" statement-like macro to the video_fill() function
to avoid a warning when GCC's -Wimplicit-fallthrough warning option is
enabled.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-04-08 16:23:51 -06:00
Andre Przywara
4d108c884b usb: xhci: annotate switch/case fallthrough properly
The USB XHCI code uses an implicit switch/case fallthrough to share code
for handling full speed and low speed transfers.

Add our "fallthrough;" statement-like macro before the second label in
the XHCI code, to avoid a warning when GCC's -Wimplicit-fallthrough
warning option is enabled.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-04-08 16:23:51 -06:00
Andre Przywara
921e4d480d usb: ohci-hcd: annotate switch/case fallthrough
The USB OCHI code uses an implicit switch/case fallthrough after checking
for valid descriptor IDs.

Add our "fallthrough;" statement-like macro before the default branch in
the OHCI code, to avoid a warning when GCC's -Wimplicit-fallthrough
warning option is enabled.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2025-04-08 16:23:51 -06:00
Andre Przywara
5ddb7d1265 net: sun8i-emac: annotate fallthrough
The Allwinner sun8i EMAC driver uses an implicit switch/case fallthrough
when setting up the MAC/PHY communication protocol, to handle the case
when RMII is requested, but would not be supported by the hardware.

Add our "fallthrough;" statement-like macro before the default branch in
sun8i_emac_set_syscon(), to avoid a warning when GCC's
-Wimplicit-fallthrough warning option is enabled.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2025-04-08 16:23:51 -06:00
Andre Przywara
06b1ebfe52 fastboot: annotate switch/case fallthrough case
The fastboot command handling uses an implicit switch/case fallthrough
when receiving the OEM_CONSOLE command, but when this command is not
enabled in Kconfig, to report this command as unknown.

Add our "fallthrough;" statement-like macro before the default branch in
the fastboot code, to avoid a warning when GCC's -Wimplicit-fallthrough
warning option is enabled.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2025-04-08 16:23:51 -06:00
Andre Przywara
2938eb1e02 gadget: f_thor: annotate switch/case fallthrough
Even though we seem to catch POWEROFF and EFSCLEAR commands in the THOR
protocol request handling, we ultimately do not seem to handle them
(apart from sending a response), so those commands still print an error
message.

Annotate the switch/case fallthrough in this case, to make this clear to
the compiler.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2025-04-08 16:23:51 -06:00
Vincent Stehlé
a345f44a60 ata: ahci: remove bad free
In the case of a memory allocation error, the ahci_port_start() function
tries to free the `pp' pointer.
This pointer was not dynamically allocated but does in fact point to an
element of the port[] array member of the struct ahci_uc_priv.
Remove the erroneous call to free() to fix this.

Fixes: 4782ac80b0 ("Add AHCI support to u-boot")
Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Jason Jin <jason.jin@freescale.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
2025-04-08 16:23:27 -06:00
Tom Rini
9d9fbdab0e Merge tag 'ubifixes-for-2025.07-rc1' of https://source.denx.de/u-boot/custodians/u-boot-ubi
ubi fixes for v2025.07-rc1

- ubi: fix bug creating partitions for non-existent volumes
  from Oskar Nilsson
2025-04-08 15:07:23 -06:00
Tom Rini
ff61d6bfd1 Merge branch 'next'
Note that this undoes the changes of commit cf6d4535cc ("x86:
emulation: Disable bloblist for now") as that was intended only for the
release due to time.
2025-04-08 11:43:23 -06:00
Oskar Nilsson
3d1cc840a0 ubi: fix bug creating partitions for non-existent volumes
The part_get_info_ubi() function was incorrectly returning 0 (success)
when a UBI volume was not found for a given partition index. This caused
the part_create_block_devices() function in blk-uclass.c to continue
creating devices for non-existent partitions up to MAX_SEARCH_PARTITIONS

Fix the issue by returning -1 when a volume is not found, signaling to
the part_create_block_devices() function that no more valid volumes
exist.

Before patch, 128 blk_partition are created:
Class   Index  Probed  Driver        Name
-------------------------------------------------
root        0  [ + ]  root_driver    root_driver
thermal     0  [   ]  imx_thermal    |-- imx_thermal
simple_bus  0  [ + ]  simple_bus     |-- soc
mtd         0  [ + ]  mxs-nand-dt    |   |-- nand-controller@1806000
blk         0  [   ]  ubi_blk        |   |   `-- nand-controller@1806000.blk
partition   0  [   ]  blk_partition  |   |       |-- nand-controller@1806000.blk:1
...
partition 127  [   ]  blk_partition  |   |       `-- nand-controller@1806000.blk:128

After patch, the expected blk_partition are created:
Class   Index  Probed  Driver        Name
-------------------------------------------------
root        0  [ + ]  root_driver    root_driver
thermal     0  [   ]  imx_thermal    |-- imx_thermal
simple_bus  0  [ + ]  simple_bus     |-- soc
mtd         0  [ + ]  mxs-nand-dt    |   |-- nand-controller@1806000
blk         0  [   ]  ubi_blk        |   |   `-- nand-controller@1806000.blk
partition   0  [   ]  blk_partition  |   |       |-- nand-controller@1806000.blk:1
partition   1  [   ]  blk_partition  |   |       |-- nand-controller@1806000.blk:2
partition   2  [   ]  blk_partition  |   |       |-- nand-controller@1806000.blk:3
partition   3  [   ]  blk_partition  |   |       `-- nand-controller@1806000.blk:4
simple_bus  1  [ + ]  simple_bus     |   |-- bus@2000000

Signed-off-by: Oskar Nilsson <onilsson@rums.se>
Cc: Kyungmin Park <kmpark@infradead.org>
Cc: Heiko Schocher <hs@denx.de>
Cc: Alexey Romanov <avromanov@salutedevices.com>

Changed in v2:
 - Change return from -1 to -ENOENT
Reviewed-by: Heiko Schocher <hs@denx.de>
2025-04-08 06:52:24 +02:00
Tom Rini
2015662a67 Merge patch series "Enable MUX_MMIO at SPL stage"
Anurag Dutta <a-dutta@ti.com> says:

This series enables MUX_MMIO at SPL stage for j7200 and j721e
as it is required for successful hyperflash boot.

Test logs :
https://gist.github.com/anuragdutta731/b4c79ef8da56d8c50b38d953c9da4d45

Link: https://lore.kernel.org/r/20250320063004.1069653-1-a-dutta@ti.com
2025-04-05 18:28:02 -06:00
Andrew Davis
03e3fdd3d0 arm: mach-k3: j721e: Split out J7200 SoC support from J721e
Currently in j721e_init.c we check which firewalls to remove using
the board configuration (e.g CONFIG_TARGET_J721E_R5_EVM). We do this
as J721e and J7200 have different IP and firewalls but use the same
SoC definition (SOC_K3_J721E) even though they are different SoCs.

The idea was they would be similar enough that they both could use
the same SoC config to help with common code sharing. Board checks
would then be used differentiate.

This has grown far too messy to maintain any more, especially now
that there is more than one board using J721e (EVM, SK, Beagle AI64).
As differentiation is done based on board, every one of these boards
would have to have checks added for them. Instead let's split J7200
support out from J721e like how normal new SoC support is done.

This patch touches several subsystems and could not be split much better
as when we add SOC_K3_J7200 we want to make use of it in all spots that
once used the combined SOC_K3_J721E so we can turn off SOC_K3_J721E when
building for J7200 boards.

Signed-off-by: Andrew Davis <afd@ti.com>
2025-04-05 18:28:02 -06:00
Anurag Dutta
9b838d0d7b mux: Kconfig: Add Kconfig options for MUX_MMIO
Add Kconfig options for MUX_MMIO so that it can be enabled
in SPL stage.

Signed-off-by: Anurag Dutta <a-dutta@ti.com>
2025-04-05 09:35:25 -06:00
Tom Rini
c5032bf3f6 Merge patch series "cmd: fuse: Introduce fuse writebuff sub-system and clean up"
Harsha Vardhan V M <h-vm@ti.com> says:

This patch series introduces the fuse writebuff sub-system command and
makes improvements to the existing fuse implementation by removing the
custom string functions. The patches are required to be applied in
sequence.

The series consists of the following changes:
Patch 1 removes custom string functions and replaces them with standard
string functions.
Patch 2 introduces fuse.rst documentation for fuse commands.
Patch 3 introduces the fuse writebuff sub-system command, allowing to
write a structured buffer in memory to fuses, and implementing the
necessary function calls.
Patch 4 enables the fuse sub-system in the K3 platform.
Patch 5 updates the fuse.rst documentation to include details about the
new fuse writebuff command.

These changes aim to improve the fuse sub-system by the removal of
custom string functions and the addition of the fuse writebuff
command improves fuse programming workflows by allowing to write a
structured buffer in memory to efuses.

Link: https://lore.kernel.org/r/20250319084714.335777-1-h-vm@ti.com
2025-04-04 12:25:11 -06:00
Harsha Vardhan V M
ed5f2e5bed drivers: k3_fuse: Add fuse sub-system func calls
Add K3_FUSE config option to add and enable fuse sub-system
implementation function calls.

Signed-off-by: Harsha Vardhan V M <h-vm@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-04-04 12:25:02 -06:00
Tom Rini
1aa8b03c01 Merge patch series "membuff: Add tests and update to support a flag for empty/full"
Simon Glass <sjg@chromium.org> says:

The membuff implementation curently has no tests. It also assumes that
head and tail can never correspond unless the buffer is empty.

This series provides a compile-time flag to support a 'full' flag. It
also adds some tests of the main routines.

The data structure is also renamed to membuf which fits better with
U-Boot.

There may be some cases in the code which could be optimised a little,
but the implementation is functional.

Link: https://lore.kernel.org/r/20250318152059.1464369-1-sjg@chromium.org
2025-04-03 16:54:59 -06:00
Simon Glass
68b0af2127 membuf: Rename struct
Rename the struct to match the function prefix and filenames.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-04-03 16:54:49 -06:00
Simon Glass
4662e5286a membuff: Rename functions to have membuf_ prefix
The double 'f' is not necessary and is a bit annoying as elsewhere in
U-Boot we use 'buf'. Rename all the functions before it is used more
widely.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-04-03 16:54:49 -06:00
Tom Rini
1f2a3d066c Merge patch series "x86: Improve operation under QEMU"
Simon Glass <sjg@chromium.org> says:

U-Boot can start and boot an OS in both qemu-x86 and qemu-x86_64 but it
is not perfect.

With both builds, executing the VESA ROM causes an intermittent hang, at
least on some AMD CPUs.

With qemu-x86_64 kvm cannot be used since the move to long mode (64-bit)
is done in a way that works on real hardware but not with QEMU. This
means that performance is 4-5x slower than it could be, at least on my
CPU.

We can work around the first problem by using Bochs, which is anyway a
better choice than VESA for QEMU. The second can be addressed by using
the same descriptor across the jump to long mode.

With an MTRR fix this allows booting into Ubuntu on qemu-x86_64

In v3 some e820 patches are included to make booting reliable and avoid
ACPI tables being dropped. Also, several MTTR problems are addressed, to
support memory sizes above 4GB reliably.

Link: https://lore.kernel.org/all/20250315142643.2600605-1-sjg@chromium.org/
2025-04-03 11:43:38 -06:00
Simon Glass
15ca25e31e x86: emulation: Support BLOBLIST_TABLES properly
The existing QEMU implementation mostly ignored BLOBLIST_TABLES and
allocates the bulk of the tables with malloc(). Update it to place all
tables in the bloblist. Since QEMU declares a size of 128KB regardless
of the size of its tables, this requires a larger bloblist.

Fix up the e820 table to handle this, keeping the old code as an option
for now, to assist with any future bug-fixing.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-04-03 11:41:55 -06:00
Tom Rini
ccb3826054 Merge patch series "Introduce J742S2 SoC and EVM"
Manorit Chawdhry <m-chawdhry@ti.com> says:

The series adds support for J742S2 family of SoCs. Also adds J742S2 EVM
Support and re-uses most of the stuff from the superset device J784s4.

This device is a subset of J784S4 and shares the same memory map and
thus the code is being reused from J784S4 to avoid duplication.

It initially cleans up the J784s4 and AM69 files so that they can be
re-usable for j742s2 and then it introduces J742S2.

The DT for the following SoC will be coming to U-boot during 6.13 Sync
so the series is kept as RFC till then.

Here are some of the salient features of the J742S2 automotive grade
application processor:

The J742S2 SoC belongs to the K3 Multicore SoC architecture platform,
providing advanced system integration in automotive, ADAS and industrial
applications requiring AI at the network edge. This SoC extends the K3
Jacinto 7 family of SoCs with focus on raising performance and
integration while providing interfaces, memory architecture and compute
performance for multi-sensor, high concurrency applications.

Some changes that this devices has from J784S4 are:
* 4x Cortex-A72 vs 8x Cortex-A72
* 3x C7x DSP vs 4x C7x DSP
* 4 port ethernet switch vs 8 port ethernet switch
* 2 DDR controller vs 4 DDR controller

Test logs:
https://gist.github.com/manorit2001/f7df0e8cca1e9973b4361f0559c6f53d

Link: https://lore.kernel.org/r/20250317-b4-upstream-j742s2-v4-0-4ba88bfd357a@ti.com
2025-04-03 11:37:57 -06:00
Manorit Chawdhry
dd837d6c88 arm: mach-k3: j742s2: Introduce clock and device files for J742S2 SoC
Re-use j784s4 clocks and power domains for j742s2 family of device.

Reviewed-by: Udit Kumar <u-kumar1@ti.com>
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
2025-04-03 11:37:46 -06:00
Manorit Chawdhry
201b08702e soc: Add information to identify the J742S2 SoC family
J742S2 has the same part number as J784S4 but JTAG_DEVICE_ID has a
PKG bit that tells about J742S2.

Add support for reading JTAG_DEVICE_ID and set family as J742S2 based
on that.

Link: https://www.ti.com/lit/pdf/spruje3 (TRM)
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
2025-04-03 11:37:46 -06:00
Ilias Apalodimas
37a33d326e acpi: Fix table length for QEMU
The end of the ACPI table is set to 'addr' instead of 'end'. The ACPI
code for QEMU relies on those values to mark memory as 'ACPI Reclaim'
and as a result the ACPI RSDP ends up in Boot services Data.

Reported-by: Björn Töpel <bjorn@kernel.org>
Fixes: commit 638cc36348 ("acpi: enable writing ACPI tables on QEMU")
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2025-04-03 08:58:27 +02:00
Tom Rini
9b4b86f90c Kconfig: Fix "warning: style: quotes recommended" warnings
We have three warnings about needing to use quotes around some strings
in Kconfig files today. In two of these cases we can just add the
missing strings. In the case of INTEL_PINCTRL_PADCFG_PADTOL the symbol
is never referenced and should be dropped.

Signed-off-by: Tom Rini <trini@konsulko.com>
2025-04-01 08:46:18 -06:00
Tom Rini
80c61c5ce8 Merge patch series "airoha: Add initial support AN7581"
Christian Marangi <ansuelsmth@gmail.com> says:

This little series adds initial support for Airoha AN7581 SoC.

With the help of some backport patch, this use OF_UPSTREAM
directly.

Posting this to have the targer and the very basic driver.

Ethernet, SNAND and eMMC support is already ready downstream
and will be posted shortly after this gets approved.

Having the first driver ready permits to separately push
dedicate series for SNAND, eMMC and Ethrnet as they all depends
on basic support of clock and reset and nothing else.

Link: https://lore.kernel.org/r/20250314185941.27834-1-ansuelsmth@gmail.com
2025-04-01 08:45:46 -06:00
Christian Marangi
b02b8b7676 reset: airoha: Add driver for controlling reset line of AN7581
Add driver for controlling the reset lines of AN7581. This is a detached
version of the clock controller driver present in Linux only used to
control reset lines. Driver gets loaded with the bind of the clock
driver and doesn't require a compatible. This is needed as they share
the same registers.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2025-04-01 08:44:51 -06:00
Christian Marangi
d0b81afb5e clk: airoha: Add support for Airoha AN7581 SoC clock
Add support for Airoha AN7581 SoC clock driver. This mainly needed for
eMMC support to correctly get the current clock applied.

Based on the Linux clk-en7523.c but majorly reworked for U-Boot that
doesn't require CCF subsystem.

Major modification, support for set_rate, realtime get_rate and split
for reset part to a different driver.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2025-04-01 08:44:51 -06:00
Sukrut Bellary
b565d7f201 video: ti: am335x: Fix tilcdc clock names.
The commit 211b3d7263 ("arm: dts: am3x: Non-functional changes sync
with v6.3-rc6") changed the tilcdc clock names.
Fix the tilcdc driver to use the new clock names.

Signed-off-by: Sukrut Bellary <sbellary@baylibre.com>
2025-03-31 17:04:20 -06:00
Richard Genoud
2f132281cc net: am65-cpsw: cpsw_mdio: fix typo in error message
Replace "froced" by "forced"

Signed-off-by: Richard Genoud <richard.genoud@bootlin.com>
2025-03-31 17:04:20 -06:00
Weijie Gao
f87b959080 pwm: mediatek: add pwm support for MediaTek MT7987 SoC
This patch adds pwm support for MediaTek MT7987 SoC.

Signed-off-by: Sam Shih <sam.shih@mediatek.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2025-03-30 09:14:44 -06:00
Tom Rini
f1895bc1e7 Merge patch series "Clarify DM_FLAG_PROBE_AFTER_BIND behaviour"
Caleb Connolly <caleb.connolly@linaro.org> says:

In Simon's series reworking autoprobe, a discussion came up about
DM_FLAG_PROBE_AFTER_BIND, specifically that it wasn't very clear where
this flag should be used.

This series implements my suggestions made there to clarify the use of
this flag, and fixup the two driver which erroneously apply it to their
driver struct (this does nothing).

Link: https://lore.kernel.org/u-boot/20241120153642.861633-1-sjg@chromium.org/
Link: https://lore.kernel.org/r/20250117-clarify-probe-after-bind-v1-0-273f046ce5dd@linaro.org
2025-03-30 09:11:07 -06:00
Caleb Connolly
44450434ea drivers: remove bogus DM_FLAG_PROBE_AFTER_BIND flags
Some drivers set DM_FLAG_PROBE_AFTER_BIND, this does nothing since it's
only every applied on a per-device basis.

Remove the flags.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Michal Simek <michal.simek@amd.com>
2025-03-30 09:09:04 -06:00
Tom Rini
490aee46f7 Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-sh into next
More basic DBSC5 DRAM controller clean ups and improvements.
2025-03-29 10:39:06 -06:00