pandora-u-boot.git
2 months agoMerge tag 'u-boot-imx-master-20250411' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Fri, 11 Apr 2025 15:11:38 +0000 (09:11 -0600)]
Merge tag 'u-boot-imx-master-20250411' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx

CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/25652

- Add i.MX8MP LDB support.
- Various phycore-imx93 environment improvements.
- Add support for Toradex SMARC iMX8MP.

2 months agoMerge tag 'efi-2025-07-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Fri, 11 Apr 2025 15:09:08 +0000 (09:09 -0600)]
Merge tag 'efi-2025-07-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request efi-2025-07-rc1

CI:

* https://source.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/25648

Documentation:

* Update authenticated capsules documentation

UEFI:

* Add support for loading FIT images including initrd
  - efi_loader: efi_load_initrd: provide a memory mapped initrd
  - efi_loader: binary_run: register an initrd
  - bootm: add support for initrd in do_bootm_efi
* efi_selftest: remove un-needed NULL checks
* efi: Fix efiboot for payloads loaded from memory

* Print extra information from the bootmgr
* Move public cert for capsules to .rodata
* Set EFI capsule dfu_alt_info env explicitly
* Make FDT extra space configurable
* Install the ACPI table from the bloblist
* Handle GD_FLG_SKIP_RELOC
* Handle malloc() errors

Others:

* acpi: select CONFIG_BLOBLIST
* smbios: select CONFIG_BLOBLIST
* xilinx: dfu: Fill directly update_info.dfu_string
* cmd: fwu: Dump custom fields from mdata structure
* board: remove capsule update support in set_dfu_alt_info()

2 months agoMerge tag 'mmc-2025-04-11' of https://source.denx.de/u-boot/custodians/u-boot-mmc
Tom Rini [Fri, 11 Apr 2025 14:50:55 +0000 (08:50 -0600)]
Merge tag 'mmc-2025-04-11' of https://source.denx.de/u-boot/custodians/u-boot-mmc

CI: https://source.denx.de/u-boot/custodians/u-boot-mmc/-/pipelines/25640

- Support Sandisk and Micron eMMC BOOT/RPMB hardware partition resizing
- Optimize eMMC erasing time
- Simplify poll CD logic
- Fix possible Synchronous Abort for sdhci
- Kconfig dependencies fix
- Minor code update, return fail if mmc_complete_init, avoid uniniting twice

2 months agoboard: phycore-imx93: env: Add common RAUC boot logic
Martin Schwan [Thu, 10 Apr 2025 08:41:22 +0000 (10:41 +0200)]
board: phycore-imx93: env: Add common RAUC boot logic

Add a common RAUC boot logic environment and make use of it in the
i.MX93 environment. The RAUC boot logic is deactivated by default and
can be activated by setting "doraucboot" to "1".

Signed-off-by: Martin Schwan <m.schwan@phytec.de>
Reviewed-by: Leonard Anderweit <l.anderweit@phytec.de>
Signed-off-by: Primoz Fiser <primoz.fiser@norik.com>
2 months agoboard: phycore-imx93: env: Move bootcmd from defconfig to env
Leonard Anderweit [Thu, 10 Apr 2025 08:41:21 +0000 (10:41 +0200)]
board: phycore-imx93: env: Move bootcmd from defconfig to env

Move the default bootcmd from the defconfig to the board environment in
preparation for RAUC support. No change in functionality.

Signed-off-by: Leonard Anderweit <l.anderweit@phytec.de>
Signed-off-by: Primoz Fiser <primoz.fiser@norik.com>
2 months agoboard: phycore-imx93: env: Add option to disable bootenv.txt import
Primoz Fiser [Thu, 10 Apr 2025 08:41:20 +0000 (10:41 +0200)]
board: phycore-imx93: env: Add option to disable bootenv.txt import

Add support for disabling external environment import (bootenv.txt) by
setting the ${no_bootenv} environment variable.

Signed-off-by: Primoz Fiser <primoz.fiser@norik.com>
2 months agoboard: phycore-imx93: env: Add prepare_mcore to environment
Primoz Fiser [Thu, 10 Apr 2025 08:41:19 +0000 (10:41 +0200)]
board: phycore-imx93: env: Add prepare_mcore to environment

Add prepare_mcore script to environment to be able to notify Linux about
the state of M33 core via the kernel cmdline by appending to ${optargs}.

Signed-off-by: Primoz Fiser <primoz.fiser@norik.com>
2 months agoboard: phycore-imx93: env: Add optargs to environment
Primoz Fiser [Thu, 10 Apr 2025 08:41:18 +0000 (10:41 +0200)]
board: phycore-imx93: env: Add optargs to environment

Add the optargs variable so we can set optional arguments while booting.

Signed-off-by: Primoz Fiser <primoz.fiser@norik.com>
2 months agoboard: phycore-imx93: env: Move fdt and bootenv addresses
Primoz Fiser [Thu, 10 Apr 2025 08:41:17 +0000 (10:41 +0200)]
board: phycore-imx93: env: Move fdt and bootenv addresses

Move the load addresses for FDTs and bootenv.txt to create space for
loading OS image. Otherwise, parts of the image might get corrupted.
and the following boot error will be present:

  ERROR: FDT image overlaps OS image (OS=80400000..832a0000)

Moreover, this commit also syncs addresses with downstream PHYTEC
u-boot for i.MX93 in preparation for FIT image support in the future.

Signed-off-by: Primoz Fiser <primoz.fiser@norik.com>
2 months agoboard: toradex: add Toradex SMARC iMX8MP
Vitor Soares [Mon, 7 Apr 2025 13:04:36 +0000 (14:04 +0100)]
board: toradex: add Toradex SMARC iMX8MP

Add support for the Toradex SMARC iMX8MP.

Link: https://www.toradex.com/computer-on-modules/smarc-arm-family/nxp-imx-8m-plus
Link: https://www.toradex.com/products/carrier-board/smarc-development-board-kit
Signed-off-by: Vitor Soares <vitor.soares@toradex.com>
2 months agotoradex: tdx-cfg-block: add 0096 Toradex SMARC iMX95
Vitor Soares [Mon, 7 Apr 2025 13:04:35 +0000 (14:04 +0100)]
toradex: tdx-cfg-block: add 0096 Toradex SMARC iMX95

Add PID4 0096 Toradex SMARC iMX95 Hexa 8GB WB IT to config block handling.

Signed-off-by: Vitor Soares <vitor.soares@toradex.com>
2 months agoarm: dts: imx8mp: sync with Linux v6.15-rc1
Vitor Soares [Mon, 7 Apr 2025 13:04:34 +0000 (14:04 +0100)]
arm: dts: imx8mp: sync with Linux v6.15-rc1

Sync imx8mp.dtsi with Linux v6.15-rc1.

Signed-off-by: Vitor Soares <vitor.soares@toradex.com>
2 months agoefi_selftest: remove un-needed NULL checks
Bryan Brattlof [Tue, 8 Apr 2025 06:06:58 +0000 (01:06 -0500)]
efi_selftest: remove un-needed NULL checks

Because we've already returned early in the event 'handle' is NULL we
don't need these extra not NULL checks. Remove them

Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 months agodoc/buildman: typo 'require'
Heinrich Schuchardt [Mon, 7 Apr 2025 06:59:24 +0000 (08:59 +0200)]
doc/buildman: typo 'require'

%s/require/required/

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 months agosmbios: select CONFIG_BLOBLIST
Heinrich Schuchardt [Mon, 7 Apr 2025 06:44:24 +0000 (08:44 +0200)]
smbios: select CONFIG_BLOBLIST

Since commit 53d5a221632e ("emulation: Use bloblist to hold tables")
`make qemu-riscv64_smode_defconfig acpi.config && make` fails with

    drivers/misc/qfw_smbios.c:93:(.text.qfw_evt_write_smbios_tables+0xe):
    undefined reference to `bloblist_add'

Build with bloblist support.

Fixes: 53d5a221632e ("emulation: Use bloblist to hold tables")
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 months agoacpi: select CONFIG_BLOBLIST
Heinrich Schuchardt [Mon, 7 Apr 2025 06:44:23 +0000 (08:44 +0200)]
acpi: select CONFIG_BLOBLIST

Since commit 53d5a221632e ("emulation: Use bloblist to hold tables")
`make qemu-riscv64_smode_defconfig acpi.config && make` fails with

    qfw_acpi.c:146:(.text.evt_write_acpi_tables+0xc):
    undefined reference to `bloblist_add'

Build with bloblist support.

Fixes: 53d5a221632e ("emulation: Use bloblist to hold tables")
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 months agofirmware: scmi: smt: Interrupt communication enable
Viorel Suman [Tue, 1 Apr 2025 07:56:35 +0000 (15:56 +0800)]
firmware: scmi: smt: Interrupt communication enable

i.MX95 System Manager uses interrupt driven communication which requires
the caller to set Bit[0] of channel flags to 1. When transmission
completes and the previous general purpose interrupt has been processed
by the other core, i.MX95 System Manager will set General Purpose
Interrupt Control Register (GCR). U-Boot polls General-purpose Status
(GSR) to check if the operation is finished.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Alice Guo <alice.guo@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Marek Vasut <marex@denx.de>
2 months agotoradex: apalis-imx6: Fix build failure when CONFIG_VIDEO_IPUV3 is enabled
Rafael Beims [Fri, 28 Mar 2025 10:20:40 +0000 (11:20 +0100)]
toradex: apalis-imx6: Fix build failure when CONFIG_VIDEO_IPUV3 is enabled

If CONFIG_VIDEO_IPUV3 is enabled without also having CONFIG_IMX_HDMI
enabled, the build fails for the Apalis iMX6 board.

Fixes: 592f4aed6db7 ("arm: imx: initial support for apalis imx6")
Signed-off-by: Rafael Beims <rafael.beims@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 months agodoc: Update authenticated capsules documentation
Ilias Apalodimas [Tue, 1 Apr 2025 11:27:26 +0000 (14:27 +0300)]
doc: Update authenticated capsules documentation

Now that we moved out the capsule signature from the DTB, remove the
relevant documentation.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agoefi_loader: Move public cert for capsules to .rodata
Ilias Apalodimas [Tue, 1 Apr 2025 11:27:25 +0000 (14:27 +0300)]
efi_loader: Move public cert for capsules to .rodata

commit ddf67daac39d ("efi_capsule: Move signature from DTB to .rodata")
was reverted in
commit 47a25e81d35c ("Revert "efi_capsule: Move signature from DTB to .rodata"")
because that's what U-Boot was usually doing -- using the DT to store
configuration and data. Some of the discussions can be found here [0].

(Ab)using the device tree to store random data isn't ideal though.
On top of that with new features introduced over the years, keeping
the certificates in the DT has proven to be problematic.
One of the reasons is that platforms might send U-Boot a DTB
from the previous stage loader using a transfer list which won't contain
the signatures since other loaders are not  aware of internal
U-Boot ABIs. On top of that QEMU creates the DTB on the fly, so adding
the capsule certificate there does not work and requires users to dump
it and re-create it injecting the public keys.

Now that we have proper memory permissions for arm64, move the certificate
to .rodata and read it from there.

[0] https://lore.kernel.org/u-boot/CAPnjgZ2uM=n8Qo-a=DUkx5VW5Bzp5Xy8=Wgmrw8ESqUBK00YJQ@mail.gmail.com/

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Tested-by: Jonathan Humphreys <j-humphreys@ti.com> # on TI sk-am62p-lp
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on AML-A311D-CC
Tested-by: Raymond Mao <raymond.mao@linaro.org>
2 months agoefi_loader: handle malloc() errors
Vincent Stehlé [Tue, 1 Apr 2025 11:15:00 +0000 (13:15 +0200)]
efi_loader: handle malloc() errors

The new_packagelist() function of the HII Protocols implementation is
calling malloc() without checking its return code; fix this.

Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agoefi_loader: Print extra information from the bootmgr
Ilias Apalodimas [Fri, 28 Mar 2025 12:58:18 +0000 (14:58 +0200)]
efi_loader: Print extra information from the bootmgr

Instead of just printing the label, add information for the Device
path as well so it's easier to see if we are booting from disk, network
etc

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agoefi_loader: Handle GD_FLG_SKIP_RELOC
Varadarajan Narayanan [Wed, 26 Mar 2025 05:46:53 +0000 (11:16 +0530)]
efi_loader: Handle GD_FLG_SKIP_RELOC

If the EFI runtime services pointers are relocated even though
relocation is skipped, it corrupts some other data resulting in some
unexpected behaviour.

In this specific case, it overwrote some page table entries resulting in
the device memory address range's mappings getting removed. Eventually,
after the completion of efi_runtime_relocate(), when a driver tries to
access its device's registers it crashes since the mappings are absent.

Signed-off-by: Varadarajan Narayanan <quic_varada@quicinc.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agoefi: Fix efiboot for payloads loaded from memory
Christian Kohlschütter [Sun, 23 Mar 2025 19:03:03 +0000 (20:03 +0100)]
efi: Fix efiboot for payloads loaded from memory

Calling bootefi on an address that was loaded from memory (e.g., cramfs
or SPI flash via "sf read", etc.), currently results in the EFI binary
not being able to access the EFI image device path.

For example, iPXE would fail with an error "EFI could not get loaded
image's device path: Error 0x7f39e082 (https://ipxe.org/7f39e082)".

This is due to an incomplete special-case in efi_binary_run, where a new
device path was created but not used in all required places.

Fix the in-memory special case, set the "bootefi_device_path" to the
generated "file_path".

iPXE will now boot, and report the device path as
"/MemoryMapped(0x0,0xSTART,0xLEN)"

Signed-off-by: Christian Kohlschütter <christian@kohlschutter.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 months agocmd: fwu: Dump custom fields from mdata structure
Michal Simek [Fri, 21 Mar 2025 10:25:48 +0000 (11:25 +0100)]
cmd: fwu: Dump custom fields from mdata structure

The commit cb9ae40a16f0 ("tools: mkfwumdata: add logic to append vendor
data to the FWU metadata") added support for adding vendor data to mdata
structure but it is not visible anywhere that's why extend fwu command to
dump it.

Tested-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Signed-off-by: Michal Simek <michal.simek@amd.com>
2 months agobootm: add support for initrd in do_bootm_efi
Adriano Cordova [Wed, 19 Mar 2025 14:45:01 +0000 (11:45 -0300)]
bootm: add support for initrd in do_bootm_efi

Pass a pointer to a memory mapped initrd and its size to
efi_binary_run. The EFI stack will register an EFI_LOAD_FILE2_PROTOCOL
for the next boot stage to access this initrd.

Signed-off-by: Adriano Cordova <adriano.cordova@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agoefi_loader: binary_run: register an initrd
Adriano Cordova [Wed, 19 Mar 2025 14:45:00 +0000 (11:45 -0300)]
efi_loader: binary_run: register an initrd

Add support to install an initrd when running an EFI binary
with efi_binary_run

Signed-off-by: Adriano Cordova <adriano.cordova@canonical.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agoefi_loader: efi_load_initrd: provide a memory mapped initrd
Adriano Cordova [Wed, 19 Mar 2025 14:44:59 +0000 (11:44 -0300)]
efi_loader: efi_load_initrd: provide a memory mapped initrd

U-Boot can pass an initrd to subsequent boot stages via the
EFI_LOAD_FILE2_PROTOCOL. The current implementation only supports
this functionality via the efi boot manager: the initrd is taken
from the load options of the BootCurrent variable. This commit adds
support for registering a memory mapped initrd, e.g. loaded from a
FIT image. For now this new method takes precedence over loading the
initrd from the BootCurrent variable (if both are present) because
the BootCurrent variable is not cleared on exiting the boot manager.

Signed-off-by: Adriano Cordova <adriano.cordova@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agoefi: Make FDT extra space configurable
Pawel Kochanowski [Tue, 18 Mar 2025 09:22:18 +0000 (10:22 +0100)]
efi: Make FDT extra space configurable

U-Boot currently reserves only 0x3000 bytes when copying the FDT
in copy_fdt(), which may not be sufficient if additional nodes
(such as FMAN firmware) are added later.

This patch uses the exisitng SYS_FDT_PAD to reserve space for FDT fixup
instead of hardcoded value.

This change prevents potential corruption when resizing FDT after
EFI boot, especially when firmware like FMAN requires additional
space.

Signed-off-by: Gabriel Nesteruk <gnesteruk@sii.pl>
Signed-off-by: Pawel Kochanowski <pkochanowski@sii.pl>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 months agoefi_loader: Install the ACPI table from the bloblist
Simon Glass [Thu, 6 Mar 2025 14:31:24 +0000 (07:31 -0700)]
efi_loader: Install the ACPI table from the bloblist

When BLOBLIST_TABLES is used, the ACPI tables are not currently added to
the list of EFI tables. While we don't want to create a new memory
region, we do want to tell EFI about the tables.

Fix this by covering this case. At some point the non-bloblist code can
likely be removed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 3da59ee9579 ("efi_loader: Avoid mapping the ACPI tables twice")
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
2 months agoboard: remove capsule update support in set_dfu_alt_info()
Jonathan Humphreys [Wed, 26 Feb 2025 22:35:47 +0000 (16:35 -0600)]
board: remove capsule update support in set_dfu_alt_info()

Now that capsule update sets the dfu_alt_info environment variable
explicitly, there is no need to support it in the set_dfu_alt_info()
function. Decouple SET_DFU_ALT_INFO from EFI_CAPSULE_FIRMWARE_FIT and
EFI_CAPSULE_FIRMWARE_RAW. For many boards, this was the only use of
set_dfu_alt_info() so remove the function entirely.

Fixes: a9e6f01a941f ("efi: Define set_dfu_alt_info() for boards with UEFI capsule update enabled")

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> # for board/libre-computer/*
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Wadim Egorov <w.egorov@phytec.de> # for
2 months agoefi_firmware: set EFI capsule dfu_alt_info env explicitly
Jonathan Humphreys [Wed, 26 Feb 2025 22:35:46 +0000 (16:35 -0600)]
efi_firmware: set EFI capsule dfu_alt_info env explicitly

The current implementation of EFI capsule update uses set_dfu_alt_info() to
set the dfu_alt_info environment variable with the settings it requires.
However, set_dfu_alt_info() is doing this for all DFU operations, even
those unrelated to capsule update.

Thus other uses of DFU, such as DFU boot which sets its own value for the
dfu_alt_info environment variable, will have that setting overwritten with
the capsule update setting. Similarly, any user defined value for the
dfu_alt_info environment variable would get overwritten when any DFU
operation was performed, including simply performing a "dfu 0 list"
command.

The solution is stop using the set_dfu_alt_info() mechanism to set the
dfu_alt_info environment variable and instead explicitly set it to the
capsule update's setting just before performing the capsule update's DFU
operation, and then restore the environment variable back to its original
value.

This patch implements the explicit setting and restoring of the
dfu_alt_info environment variable as part of the EFI capsule update
operation.

The fix is fully implemented in a subsequent patch that removes the capsule
update dfu_alt_info support in set_dfu_alt_info().

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agoxilinx: dfu: Fill directly update_info.dfu_string
Michal Simek [Wed, 26 Feb 2025 22:35:45 +0000 (16:35 -0600)]
xilinx: dfu: Fill directly update_info.dfu_string

Directly fill update_info.dfu_string to prepare platforms to switch
from using dfu_alt_info variable to dfu_string which contains description
for capsule update when switch is done.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agommc: mmc_boot: Support Sandisk and Micron eMMC BOOT/RPMB hardware partition resizing
Luke Wang [Tue, 25 Mar 2025 08:29:14 +0000 (16:29 +0800)]
mmc: mmc_boot: Support Sandisk and Micron eMMC BOOT/RPMB hardware partition resizing

Current mmc bootpart-resize command only support Samsung eMMC BOOT/RPMB
hardware partition resizing. Add Sandisk and Micron eMMC BOOT/RPMB hardware
partition resizing support. The commands and parameters for resizing
partitions are different for each manufacturer. Select the corresponding
function according to CID.

Signed-off-by: Luke Wang <ziniu.wang_1@nxp.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 months agommc: Avoid uniniting twice
Simon Glass [Sun, 16 Feb 2025 12:55:59 +0000 (05:55 -0700)]
mmc: Avoid uniniting twice

Each MMC device has a child which ihs a block device. At present we call
mmc_deinit() when the block device is removed.

But the MMC struct (i.e. struct mmc) is attached to the MMC's device,
not its child.

So at present, when an MMC device is removed, mmc_deinit() is called
twice, once for the MMC device and once for its block device. This
results in a double call to cyclic_unregister().

Fix this by adding a 'remove' method to the uclass and calling
mmc_deinit() from there.

Also drop the call to device_probe() within the block-device's probe()
method. The device is already in the process of being probed, so this
call does nothing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: c822c1a50bd ("mmc: call device_probe() after scanning")
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 months agommc: sdhci: Fix possible Synchronous Abort using PIO mode
Jonas Karlman [Thu, 23 Jan 2025 21:48:48 +0000 (21:48 +0000)]
mmc: sdhci: Fix possible Synchronous Abort using PIO mode

When MMC_SDHCI_SDMA=y or MMC_SDHCI_ADMA=y and PIO mode is used
dma_unmap_single() is called on an unmapped address, 0x0. This may
result in a Synchronous Abort:

  ## Checking hash(es) for Image atf-1 ... sha256+ OK
  CMD_SEND:16
                  ARG                      0x00000200
                  MMC_RSP_R1,5,6,7         0x00000900
  CMD_SEND:18
                  ARG                      0x00004005
  "Synchronous Abort" handler, esr 0x96000147
  elr: 00000000400015bc lr : 0000000040012b4c
  x 0: 0000000000008000 x 1: 0000000000092600
  x 2: 0000000000000040 x 3: 000000000000003f
  x 4: 0000000000000030 x 5: 0000000000000001
  x 6: 0000000000000001 x 7: 0000000000000000
  x 8: 000000000000000a x 9: 0000000000000090
  x10: 0000000043dffc68 x11: 0000000043c00440
  x12: 0000000043c00440 x13: ffffffffbfe00000
  x14: 000000000000031c x15: 0000000240000000
  x16: 000000004001145c x17: 0000000000000032
  x18: 0000000043dffef0 x19: 0000000043c00000
  x20: 0000000043dffbc8 x21: 0000000000000000
  x22: 00000000000f3d95 x23: 0000000000000002
  x24: 0000000000000493 x25: 0000000000092600
  x26: 0000000000000001 x27: 0000000000000001
  x28: 0000000000000008 x29: 0000000043dffab0

  Code: d2800082 9ac32042 d1000443 8a230000 (d5087620)
  Resetting CPU ...

  resetting ...

Fix this by only dma_unmap_single() when DMA mode is used and
sdhci_prepare_dma() has been called to map host->start_addr.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 months agommc: Optimize eMMC erase speed
Peng Fan [Mon, 20 Jan 2025 04:30:09 +0000 (12:30 +0800)]
mmc: Optimize eMMC erase speed

Per JESD84-B51 6.6.9 Erase:
The host can erase a contiguous range of Erase Groups. Starting the erase
process is a three steps sequence. First the host defines the start address
of the range using the ERASE_GROUP_START (CMD35) command, next it defines
the last address of the range using the ERASE_GROUP_END (CMD36) command and
finally it starts the erase process by issuing the ERASE (CMD38) command
with argument bits set to zero. See Table 11 for the arguments supported by
CMD38.  The address field in the erase commands is an Erase Group address,
in byte units for densities up to 2GB, and in sector units for densities
greater than 2GB. The Device will ignore all LSB's below the Erase Group
size, effectively rounding the address down to the Erase Group boundary.

So choose 2GB bytes as check condition.

If the erase size is larger that 2GB, use 2GB to avoid breaking non high
capacity cards. If erase size is less than 2GB and larger than a grp, use
'grpcnt * mmc->erase_grp_size' to cover all the sectors, else use
the number of sectors.

With test erasing 20GB eMMC

board:  Evk_8ulp Evk_8mm   Evk_8mn             Evk_8mp   Mek_8qxpc0 Mek_8qm
   kingston  sandisk
before: 37.683s   112.738s  129.365s  28.238s   112.605s  500.470s  490.708s
after:  0.093s    0.111s    0.951s    0.080s    0.121s    6.960s    6.915s

Tested-by: Faqiang Zhu <faqiang.zhu@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 months agommc: Exit from mmc_init() if mmc_complete_init() fails
Marek Vasut [Sat, 18 Jan 2025 03:27:34 +0000 (04:27 +0100)]
mmc: Exit from mmc_init() if mmc_complete_init() fails

In case mmc_complete_init() returns error, exit from mmc_init()
without possibly calling cyclic_register(), which at that point
would be undesired.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 months agommc: Simplify poll CD logic in case cyclic framework is enabled
Marek Vasut [Sat, 18 Jan 2025 03:09:53 +0000 (04:09 +0100)]
mmc: Simplify poll CD logic in case cyclic framework is enabled

Simplify 90cc07fd786d ("mmc: Poll CD in case cyclic framework is enabled")
according to suggestions by Rasmus. The struct cyclic_info is zero-size in
case CONFIG_CYCLIC is not enabled and does not add any size to struct mmc,
so it can unconditionally be part of that structure. This allows clean up
of all the other conditionals in mmc.c which can now be unconditionally
present, as they also add no extra space.

Suggested-by: Rasmus Villemoes <ravi@prevas.dk>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 months agommc: Kconfig: Correct dependencies SDHCI ADMA options
Tom Rini [Wed, 15 Jan 2025 02:07:36 +0000 (20:07 -0600)]
mmc: Kconfig: Correct dependencies SDHCI ADMA options

The option MMC_SDHCI_ADMA_FORCE_32BIT is only tested or used when
MMC_SDHCI_ADMA or SPL_MMC_SDHCI_ADMA is enabled. And for
MMC_SDHCI_ADMA_64BIT the same is true except we also require
MMC_SDHCI_ADMA_FORCE_32BIT to be disabled.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
2 months agodrivers: scsi: Add 'erase' support
Varadarajan Narayanan [Tue, 1 Apr 2025 10:09:59 +0000 (15:39 +0530)]
drivers: scsi: Add 'erase' support

UFS devices uses the block and scsi frameworks. Enable UFS erase
support by adding erase support to SCSI.

Signed-off-by: Varadarajan Narayanan <quic_varada@quicinc.com>
2 months agodm: blk: Add 'erase' generic block device commands
Varadarajan Narayanan [Tue, 1 Apr 2025 10:09:58 +0000 (15:39 +0530)]
dm: blk: Add 'erase' generic block device commands

Add support for doing 'erase' using the generic block commands
framework.

Signed-off-by: Varadarajan Narayanan <quic_varada@quicinc.com>
2 months agobootm: Support load images when os is elf
牛 志宏 [Tue, 1 Apr 2025 07:44:34 +0000 (07:44 +0000)]
bootm: Support load images when os is elf

This extends the bootm command to allow find images when os type is elf.

Signed-off-by: Niu Zhihong <zone.niuzh@hotmail.com>
2 months agotools/fit_check_sign: make key optional
Daniel Golle [Sat, 29 Mar 2025 23:24:31 +0000 (23:24 +0000)]
tools/fit_check_sign: make key optional

Allow invoking fit_check_sig without the key parameter, allowing to
validate only checksums and hashes for unsigned images.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2 months agoimage-fit-sig: skip in tools build if key is missing
Daniel Golle [Sat, 29 Mar 2025 23:23:51 +0000 (23:23 +0000)]
image-fit-sig: skip in tools build if key is missing

Skip signature verification in case no public key was given in order to
allow using fit_check_sign also to validate uImage.FIT images without
signatures. Guarded by USE_HOSTCC macro the behavior on target is
unchanged.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2 months agobootm: Add support for passing arguments to elf app
牛 志宏 [Mon, 24 Mar 2025 03:05:56 +0000 (03:05 +0000)]
bootm: Add support for passing arguments to elf app

This extends the bootm command to allow passing arguments to standalone
ELF applications.

Signed-off-by: Niu Zhihong <zone.niuzh@hotmail.com>
2 months agoarmv8: start.S: Subordinate CPUs psci setup vector
Xu Zhang [Wed, 26 Mar 2025 01:44:12 +0000 (09:44 +0800)]
armv8: start.S: Subordinate CPUs psci setup vector

As current design, only Manager CPU called armv8_setup_psci() before
jump to next stage(such as Linux Kernel), Subordinate CPUs also need
setup psci vector to handle trap request which comes from higher EL
level.

Signed-off-by: Xu Zhang <423756212@qq.com>
[trini: Guard with !CONFIG_XPL_BUILD check]

2 months agovideo: imx: Add LCDIF driver
Miquel Raynal [Thu, 3 Apr 2025 07:39:12 +0000 (09:39 +0200)]
video: imx: Add LCDIF driver

Add support for the LCD interfaces (LCDIF1/2). When probed, these
interfaces request numerous clocks and power domains, attach the bridge
and look for a panel in order to retrieve its capabilities and
properties.

There is a similar existing driver in the upper folder for other i.MX
targets, I discovered this driver a bit late. It is not targeting the
i.MX8MP and I have no idea how different can the LCDIF be on this SoC,
but I did not manage to get it work, especially because it is not fully
compliant with the device-model, especially on the clocks/power
management side which is all ad-hoc. This is normal though, it was
contributed more than ten years ago.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2 months agovideo: imx: Add LDB driver
Miquel Raynal [Thu, 3 Apr 2025 07:39:11 +0000 (09:39 +0200)]
video: imx: Add LDB driver

Add support for the LVDS Display Bridge (LDB) found on i.MX8MP.

When attached, the bridge driver looks for panels connected to one of
its two outputs and adapts its own configuration to use them. There is
currently no support for merged/split displays.

Note regarding the clock configuration:
The LDB output clock should be absolutely identical to the LCDIF output
clock so both blocks can talk to each other synchronously. However, the
LDB clock has an internal divisor of 7 (respectively 3.5 in dual
configuration) which means the LDB input clock must be explicitly set
once we know the configuration.

This driver was tested on i.MX8MP using a single panel connected to the
LVDS2 interface.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2 months agovideo: imx: Fix Makefile in order to be able to add other imx drivers
Miquel Raynal [Thu, 3 Apr 2025 07:39:10 +0000 (09:39 +0200)]
video: imx: Fix Makefile in order to be able to add other imx drivers

The IPUv3 is one IP part of the imx world, there are others, and
selecting the whole imx/ folder based on such a specific Kconfig symbol
is sub-optimal. Let's always enter the imx/ folder, and then selectively
compile parts of the folder based on the configuration.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2 months agoimx: power-domain: Add support for the MEDIAMIX control block
Miquel Raynal [Thu, 3 Apr 2025 07:39:09 +0000 (09:39 +0200)]
imx: power-domain: Add support for the MEDIAMIX control block

This block delivers power and clocks to the whole display and rendering
pipeline.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2 months agoimx: power-domain: Describe the i.MX8 MEDIAMIX domain
Miquel Raynal [Thu, 3 Apr 2025 07:39:08 +0000 (09:39 +0200)]
imx: power-domain: Describe the i.MX8 MEDIAMIX domain

Add support for the i.MX8 MEDIAMIX domain which is driving the power
over the whole display/rendering pipeline.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 months agoclk: imx8mp: Add media related clocks
Miquel Raynal [Thu, 3 Apr 2025 07:39:07 +0000 (09:39 +0200)]
clk: imx8mp: Add media related clocks

These are all the clocks needed to get an LCD panel working, going
through one of the LCDIF and the LDB. The media AXI and APB clocks are
also described.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2 months agoclk: Ensure the parent clocks are enabled while reparenting
Miquel Raynal [Thu, 3 Apr 2025 07:39:06 +0000 (09:39 +0200)]
clk: Ensure the parent clocks are enabled while reparenting

Reparenting a clock C with a new parent P means that C will only
continue clocking if P is already clocking when the mux is updated. In
case the parent is currently disabled, failures (stalls) are likely to
happen.

This is exactly what happens on i.MX8 when enabling the video
pipeline. We tell LCDIF clocks to use the VIDEO PLL as input, while the
VIDEO PLL is currently off. This all happens as part of the
assigned-clocks handling procedure, where the reparenting happens before
the enable() calls. Enabling the parents as part of the reparenting
procedure seems sane and also matches the logic applied in other parts
of the CCM.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2 months agopower-domain: Add refcounting
Miquel Raynal [Thu, 3 Apr 2025 07:39:05 +0000 (09:39 +0200)]
power-domain: Add refcounting

It is very surprising that such an uclass, specifically designed to
handle resources that may be shared by different devices, is not keeping
the count of the number of times a power domain has been
enabled/disabled to avoid shutting it down unexpectedly or disabling it
several times.

Doing this causes troubles on eg. i.MX8MP because disabling power
domains can be done in recursive loops were the same power domain
disabled up to 4 times in a row. PGCs seem to have tight FSM internal
timings to respect and it is easy to produce a race condition that puts
the power domains in an unstable state, leading to ADB400 errors and
later crashes in Linux.

CI tests using power domains are slightly updated to make sure the count
of on/off calls is even and the results match what we *now* expect.

As we do not want to break existing users while stile getting
interesting error codes, the implementation is split between:
- a low-level helper reporting error codes if the requested transition
  could not be operated,
- a higher-level helper ignoring the "non error" codes, like EALREADY and
  EBUSY.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2 months agotest: dm: test-fdt: Add checks for uclass_get_device_by_endpoint()
Miquel Raynal [Thu, 3 Apr 2025 07:39:04 +0000 (09:39 +0200)]
test: dm: test-fdt: Add checks for uclass_get_device_by_endpoint()

This is a new DM core helper. There is now a graph endpoint
representation in the sandbox test DTS, so we can just use it to verify
the helper proper behavior.

Suggested-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2 months agodm: core: Add a helper to retrieve devices through graph endpoints
Miquel Raynal [Thu, 3 Apr 2025 07:39:03 +0000 (09:39 +0200)]
dm: core: Add a helper to retrieve devices through graph endpoints

There are already several helpers to find a udevice based on its
position in a device tree, like getting a child or a node pointed by a
phandle, but there was no support for graph endpoints, which are very
common in display pipelines.

Add a new helper, named uclass_get_device_by_endpoint() which enters the
child graph reprensentation, looks for a specific port, then follows the
remote endpoint, and finally retrieves the first parent of the given
uclass_id.

This is a very handy and straightforward way to get a bridge or a panel
handle.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2 months agodm: doc: Fix example
Miquel Raynal [Thu, 3 Apr 2025 07:39:02 +0000 (09:39 +0200)]
dm: doc: Fix example

`.priv_data_size` does not exist. I believe the actual structure member
was supposed to be `.priv_auto`.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2 months agocore: ofnode_graph: Fix a comment
Miquel Raynal [Thu, 3 Apr 2025 07:39:01 +0000 (09:39 +0200)]
core: ofnode_graph: Fix a comment

Naming between the parameter list, the prototype and the main comment do
not match. Fix the comment which seems the be the one that is incorrect.

Fixes: 9057077cf4e1 ("core: ofnode: add of_graph parsing helpers")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com>
2 months agocommon: console: move break; statement
Andre Przywara [Tue, 25 Mar 2025 17:47:44 +0000 (17:47 +0000)]
common: console: move break; statement

In console_setfile(), there is some #ifdef'ed code, updating monitor
functions for a U-Boot proper build. This is called inside a switch/case
statement, but the closing "break;" is inside the #ifdef section.
This doesn't look right: we should not fall through to the error case
for an SPL/TPL build.

Move the "break" to be always effective, solving a compiler warning about
an untagged implicit fallthrough.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 months agoMerge patch series "*** Add Ethernet boot support for AM62Ax + phyCORE-AM62 SoMs...
Tom Rini [Thu, 10 Apr 2025 21:04:09 +0000 (15:04 -0600)]
Merge patch series "*** Add Ethernet boot support for AM62Ax + phyCORE-AM62 SoMs ***"

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

Add general ethernet boot support for AM62Ax SoC.
Some of the work is based on TI's downstream u-boot patches found in
[1], patches touching code in mach-k3 and *.yaml board config files.

Also, provide defconfigs and device tree changes for phyCORE-AM62x and
phyCORE-AM62Ax to support booting via ethernet.

[1] https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1307981/sk-am62a-lp-rgmii-boot-mode-problem

Link: https://lore.kernel.org/r/20250325035824.2304200-1-w.egorov@phytec.de
2 months agoconfigs: Add phycore_am62ax_r5_ethboot_defconfig
Wadim Egorov [Tue, 25 Mar 2025 03:58:24 +0000 (04:58 +0100)]
configs: Add phycore_am62ax_r5_ethboot_defconfig

Provide a defconfig for booting the phycore-am62ax via Ethernet.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
2 months agoboard: phytec: phycore_am62ax: Share ethernet resources with boot r5 core
Nathan Morrisson [Tue, 25 Mar 2025 03:58:23 +0000 (04:58 +0100)]
board: phytec: phycore_am62ax: Share ethernet resources with boot r5 core

During the U-Boot SPL R5 boot stage the code is running on the MAIN R5
core, which means a host ID of 36 is used for DM/TIFS communication,
see [1]. In order to enable Ethernet boot update the DMA resources used
to be shared with the MAIN R5 core instead of the MCU R5 core.

[1] https://software-dl.ti.com/tisci/esd/latest/5_soc_doc/am62ax/hosts.html

Based on patch 19 from https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1307981/sk-am62a-lp-rgmii-boot-mode-problem

Signed-off-by: Nathan Morrisson <nmorrisson@phytec.com>
Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
2 months agoarch: arm: mach-k3: r5: am62ax: Update SoC auto-gen data to enable CPSW boot
Andreas Dannenberg [Tue, 25 Mar 2025 03:58:22 +0000 (04:58 +0100)]
arch: arm: mach-k3: r5: am62ax: Update SoC auto-gen data to enable CPSW boot

This data was generated using the ksswtool-autogen project with the
followig commit:

eed7492 ("soc: am62ax: Add cpsw_3guss_main_0 id to the dev list")

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Nathan Morrisson <nmorrisson@phytec.com>
Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
2 months agoarch: arm: mach-k3: am62a7: Probe CPSW NUSS in board_init_f()
Nathan Morrisson [Tue, 25 Mar 2025 03:58:21 +0000 (04:58 +0100)]
arch: arm: mach-k3: am62a7: Probe CPSW NUSS in board_init_f()

Probe CPSW NUSS in am62a7 board_init_f() to support ethernet boot.

Signed-off-by: Nathan Morrisson <nmorrisson@phytec.com>
Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
2 months agoarch: arm: dts: k3-am62a7-phyboard-lyra-rdk-u-boot: Disable Ethernet2
Daniel Schultz [Tue, 25 Mar 2025 03:58:20 +0000 (04:58 +0100)]
arch: arm: dts: k3-am62a7-phyboard-lyra-rdk-u-boot: Disable Ethernet2

Don't initialize Ethernet2 in SPL. We cannot boot from that source anyways
and it throws an error during boot.

This will remove following error message during network boot:

Error: ethernet@8000000port@2 No valid MAC address found.ethernet@8000000port@1
Waiting for PHY auto negotiation to complete....... done

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
2 months agoconfigs: phycore_am62x_a53_defconfig: Update for ethernet boot
Wadim Egorov [Tue, 25 Mar 2025 03:58:19 +0000 (04:58 +0100)]
configs: phycore_am62x_a53_defconfig: Update for ethernet boot

Add support for ethernet boot in the A53 SPL. Increase the SPL Size
limit and update SPL_STACK_R_ADDR.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
2 months agoconfigs: Add phycore_am62x_r5_ethboot_defconfig
Wadim Egorov [Tue, 25 Mar 2025 03:58:18 +0000 (04:58 +0100)]
configs: Add phycore_am62x_r5_ethboot_defconfig

Provide a defconfig for booting the phycore-am62x via Ethernet.
We need a separate defconfig because the AM62x has not enough internal
SRAM to support all boot sources.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
2 months agoarm: dts: k3-am625-phyboard-lyra-rdk: Add boot phase tag to phy_gmii_sel
Wadim Egorov [Tue, 25 Mar 2025 03:58:17 +0000 (04:58 +0100)]
arm: dts: k3-am625-phyboard-lyra-rdk: Add boot phase tag to phy_gmii_sel

Add bootph-all tag to phy_gmii_sel node. This is needed for booting via
Ethernet. While at it, drop main_pktdma reg redefinitions which are already
provided by the top-level SoC device tree file.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Tested-by: Daniel Schultz <d.schultz@phytec.de>
2 months agoMerge patch series "scsi: ensure writes are flushed to disk"
Tom Rini [Thu, 10 Apr 2025 20:21:46 +0000 (14:21 -0600)]
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
2 months agoata: ahci: implement SCSI_SYNC_CACHE
Caleb Connolly [Wed, 26 Mar 2025 12:24:10 +0000 (13:24 +0100)]
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>
2 months agoscsi: sync cache on write
Caleb Connolly [Wed, 26 Mar 2025 12:24:09 +0000 (13:24 +0100)]
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>
2 months agoscsi: fix typo in setup_read_ext()
Caleb Connolly [Wed, 26 Mar 2025 12:24:08 +0000 (13:24 +0100)]
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>
2 months agoMerge patch series "Add UBIFS Support"
Tom Rini [Thu, 10 Apr 2025 20:21:34 +0000 (14:21 -0600)]
Merge patch series "Add UBIFS Support"

Santhosh Kumar K <s-k6@ti.com> says:

This series adds support for UBIFS in AM64x, AM62x, AM62Px.

Test logs: https://gist.github.com/santhosh21/be687f10086fe3b02d76cf5126a99861

Link: https://lore.kernel.org/r/20250326121220.1831975-1-s-k6@ti.com
2 months agoconfigs: am62px: Add UBIFS support
Santhosh Kumar K [Wed, 26 Mar 2025 12:12:20 +0000 (17:42 +0530)]
configs: am62px: Add UBIFS support

Add UBIFS support on top of MTD devices by enabling the required
configs.

Signed-off-by: Santhosh Kumar K <s-k6@ti.com>
2 months agoconfigs: am62x: Add UBIFS support
Santhosh Kumar K [Wed, 26 Mar 2025 12:12:19 +0000 (17:42 +0530)]
configs: am62x: Add UBIFS support

Add UBIFS support on top of MTD devices by enabling the required
configs.

Signed-off-by: Santhosh Kumar K <s-k6@ti.com>
2 months agoconfigs: am64x: Add UBIFS support
Santhosh Kumar K [Wed, 26 Mar 2025 12:12:18 +0000 (17:42 +0530)]
configs: am64x: Add UBIFS support

Add UBIFS support on top of MTD devices by enabling the required
configs.

Signed-off-by: Santhosh Kumar K <s-k6@ti.com>
2 months agodtc: introduce label relative path references
Patrice Chotard [Fri, 28 Mar 2025 16:31:15 +0000 (17:31 +0100)]
dtc: introduce label relative path references

Since introduction of OF_UPSTREAM flag, U-Boot's dtc must be able
to compile Kernel's device tree.

Since kernel commit 7de129f5389b ("ARM: dts: stm32: stm32mp151a-prtt1l:
Fix QSPI configuration"), label relative path references has been
introduced. These label relative path references is not supported
by current U-Boot dtc version 1.5.0: (see mailing list discussion [1]).

In order to support such label relative patch references
adds following commit from upstream DTC tree:

commit 651410e54cb9 ("util: introduce xstrndup helper")
commit ec7986e682cf ("dtc: introduce label relative path references")

[1] https://lore.kernel.org/all/20250115144428.GZ3476@bill-the-cat/T/

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 months agoenv: mmc: Fix test for ENV_IS_EMBEDDED
Tom Rini [Tue, 1 Apr 2025 16:21:25 +0000 (10:21 -0600)]
env: mmc: Fix test for ENV_IS_EMBEDDED

The symbol "ENV_IS_EMBEDDED" is an environment internal define and not a
real CONFIG symbol. The IS_ENABLED() macro is still valid to use here,
so update the check.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agotools: add pkg-config for preload_check_sign
Raymond Mao [Thu, 27 Mar 2025 23:10:44 +0000 (16:10 -0700)]
tools: add pkg-config for preload_check_sign

The cflags and ldflags of preload_check_sign depend on the openssl
package thus pkg-config is needed to get the location where openssl
is installed.
This fix a potential build failure when openssl is not from the
distro and installed in a varied place.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
2 months agotest/py: memtest: Fix test for non-trivial parameters
Andrew Goodbody [Fri, 28 Mar 2025 16:30:37 +0000 (16:30 +0000)]
test/py: memtest: Fix test for non-trivial parameters

When using non-trivial values for parameters for this test it
will cause a spurious failure as the test passes a decimal value
to the mtest command which will interpret it as hexadecimal and
result in failure as below.

test/py/tests/test_memtest.py:66: in test_memtest_ddr
    assert expected_response in response
E   AssertionError: assert 'Tested 16 iteration(s) with 0 errors.' in 'Refusing to do empty test\r\nmtest - simple RAM read/write test\r\n\r\nUsage:\r\nmtest [start [end [pattern [iterations]]]]'
----------------------------- Captured stdout call -----------------------------
U-Boot> mtest 134217728 0x8001000 90 0x10
Refusing to do empty test
mtest - simple RAM read/write test
Usage:
mtest [start [end [pattern [iterations]]]]

The fix is to ensure that all the parameters to the mtest command are
passed as hexadecimal values.

Fixes: 22efc1cf276c ("test/py: memtest: Add tests for mtest command")
Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: Love Kumar <love.kumar@amd.com>
2 months agopatman: Show base commit on each patch when no cover letter
Simon Glass [Fri, 28 Mar 2025 13:02:20 +0000 (07:02 -0600)]
patman: Show base commit on each patch when no cover letter

If a series is sent without a cover letter, there is no indication of
the base commit. Add support for this, since single patches of small
series may not always have a cover letter.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agobinman: Fix a typo in elf.py
Simon Glass [Fri, 28 Mar 2025 13:02:08 +0000 (07:02 -0600)]
binman: Fix a typo in elf.py

Fix an 'EFL' typo. It should be 'ELF'.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
2 months agopatman: Show the base commit and branch
Simon Glass [Thu, 27 Feb 2025 19:27:30 +0000 (12:27 -0700)]
patman: Show the base commit and branch

It is helpful to know which commit patches are based on, even if that
commit might not be available to readers. Add a tag for this in the
cover letter.

Also add the local-branch name since that may be useful to the writer.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agoCI: Move to latest container images
Tom Rini [Thu, 10 Apr 2025 15:15:05 +0000 (09:15 -0600)]
CI: Move to latest container images

- Bump up "Jammy" tag to jammy-20250404
- Include most recent changes to the Dockerfile itself

Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agoDockerfile: Add fdisk
Tom Rini [Thu, 10 Apr 2025 16:54:03 +0000 (10:54 -0600)]
Dockerfile: Add fdisk

We had previously gotten this package through a chain of dependencies
with guestfs-tools. Now that we no longer install that package, install
fdisk (for sfdisk) directly.

Fixes: eb1b90ec57a4 ("Dockerfile: Update to drop virt-make-fs packages")
Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agoDockerfile: Download the Arm FVP and extract it
Tom Rini [Tue, 8 Apr 2025 20:21:41 +0000 (14:21 -0600)]
Dockerfile: Download the Arm FVP and extract it

There are some reference platforms from Arm which are not found in QEMU
but instead in the FVP tool. As we can make use of this in CI later on,
download and extract it in our Dockerfile today.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agoDockerfile: Update to a more current TF-A release tag
Tom Rini [Tue, 8 Apr 2025 20:21:40 +0000 (14:21 -0600)]
Dockerfile: Update to a more current TF-A release tag

In preparation for using TF-A more in our CI loops, switch to the
current release tag for TF-A.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agoDockerfile: install byacc
Leonard Anderweit [Tue, 1 Apr 2025 08:46:41 +0000 (10:46 +0200)]
Dockerfile: install byacc

Install byacc required to build cst from source.

Signed-off-by: Leonard Anderweit <l.anderweit@phytec.de>
2 months agoDockerfile: Update to gcc-14.2.0 and clang-18
Tom Rini [Tue, 28 Jan 2025 23:02:05 +0000 (17:02 -0600)]
Dockerfile: Update to gcc-14.2.0 and clang-18

Outside of changing versions here the other visible change is that we
tell grub that riscv64 does not have "large model" support. Without this
change the resulting mkimage is non-functional. This is known upstream
already.

Link: https://savannah.gnu.org/bugs/?65909
Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agoMerge tag 'u-boot-dfu-20250410' of https://source.denx.de/u-boot/custodians/u-boot-dfu
Tom Rini [Thu, 10 Apr 2025 14:01:11 +0000 (08:01 -0600)]
Merge tag 'u-boot-dfu-20250410' of https://source.denx.de/u-boot/custodians/u-boot-dfu

u-boot-dfu-20250410

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

Usb gadget:
- Add SAM9X60 support to atmel driver
- Fix memory leaks in f_mass_storage gadget driver
- Fix comment typo in dwc3 gadget driver

Fastboot:
- Lift restrictions on !NET_LWIP for USB

Android:
- Fix possible NULL ptr when AVB is out of memory

2 months agobootstd: android: avoid possible null pointer dereference
Gary Bisson [Wed, 2 Apr 2025 14:42:19 +0000 (16:42 +0200)]
bootstd: android: avoid possible null pointer dereference

- avb_slot_verify_data_free() doesn't check its data parameter
- out_data can be null if avb_slot_verify() fails to allocate memory

Signed-off-by: Gary Bisson <bisson.gary@gmail.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
Link: https://lore.kernel.org/r/20250402144219.1875067-1-bisson.gary@gmail.com
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
2 months agousb: gadget: atmel: Add SAM9X60 support
Zixun LI [Mon, 31 Mar 2025 16:26:07 +0000 (18:26 +0200)]
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>
2 months agousb: gadget: f_mass_storage: Fix memory leak of fsg buffers
Mattijs Korpershoek [Fri, 28 Mar 2025 08:15:44 +0000 (09:15 +0100)]
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>
2 months agousb: gadget: f_mass_storage: Fix NULL dereference in fsg_add()
Mattijs Korpershoek [Fri, 28 Mar 2025 08:15:43 +0000 (09:15 +0100)]
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>
2 months agousb: gadget: f_mass_storage: Drop invalid kfree() in fsg_common_release()
Mattijs Korpershoek [Fri, 28 Mar 2025 08:15:42 +0000 (09:15 +0100)]
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>
2 months agousb: gadget: f_mass_storage: Remove kref structure use
Mattijs Korpershoek [Fri, 28 Mar 2025 08:15:41 +0000 (09:15 +0100)]
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>
2 months agofastboot: lift restrictions on !NET_LWIP for USB
Michael Walle [Wed, 12 Mar 2025 07:36:55 +0000 (08:36 +0100)]
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>
2 months agousb: dwc3: gadget: Fix excepts/expects typo
Marek Vasut [Mon, 24 Mar 2025 14:39:43 +0000 (15:39 +0100)]
usb: dwc3: gadget: Fix excepts/expects typo

Fix the excepts typo to expects , no functional change.

Fixes: 0916053ebc56 ("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>
2 months agoCI: Disable evb-ast2600
Tom Rini [Thu, 10 Apr 2025 00:31:21 +0000 (18:31 -0600)]
CI: Disable evb-ast2600

Currently, this platform is failing in CI due to seemingly platform
specific reasons. For now, remove it from CI until the maintainers have
a chance to look in to it.

Signed-off-by: Tom Rini <trini@konsulko.com>