pandora-u-boot.git
2 months agoqemu-sbsa: simplify updating ACPI table header checksum
Heinrich Schuchardt [Fri, 21 Mar 2025 23:21:19 +0000 (00:21 +0100)]
qemu-sbsa: simplify updating ACPI table header checksum

Use acpi_update_checksum() to update table header.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Matthias Brugger <mbrugger@suse.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agox86/acpi: simplify updating header checksum
Heinrich Schuchardt [Fri, 21 Mar 2025 23:21:18 +0000 (00:21 +0100)]
x86/acpi: simplify updating header checksum

Use acpi_update_checksum() for updating ACPI table header checksum.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Matthias Brugger <mbrugger@suse.com>
2 months agoacpi: simplify updating header checksum
Heinrich Schuchardt [Fri, 21 Mar 2025 23:21:17 +0000 (00:21 +0100)]
acpi: simplify updating header checksum

Use acpi_update_checksum() for updating ACPI table header checksum.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Matthias Brugger <mbrugger@suse.com>
2 months agoacpi: new function acpi_update_checksum()
Heinrich Schuchardt [Fri, 21 Mar 2025 23:21:16 +0000 (00:21 +0100)]
acpi: new function acpi_update_checksum()

Introduce a new function to update ACPI table headers.
This allows to simplify the existing code.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Matthias Brugger <mbrugger@suse.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agoMerge tag 'u-boot-imx-next-20250321' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Fri, 21 Mar 2025 13:30:32 +0000 (07:30 -0600)]
Merge tag 'u-boot-imx-next-20250321' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx into next

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

- Allow the registration and enablement of the i.MX UART clocks via DM,
  without the need of manually calling init_uart_clk().
- Remove duplicated 'mmc dev ${mmcdev}' commands.
- Rework some of the RAM related Kconfig symbols for phycore_imx8mp.

2 months agoMerge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-sh into next
Tom Rini [Thu, 20 Mar 2025 14:07:56 +0000 (08:07 -0600)]
Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-sh into next

Renesas RZ/G2L USB support, remaining RAVB ethernet fix and KSZ9031 LED
errata fix.

2 months agoconfigs: Remove duplicated bootcmd 'mmc dev ${mmcdev}'
Aristo Chen [Wed, 19 Mar 2025 07:25:20 +0000 (15:25 +0800)]
configs: Remove duplicated bootcmd 'mmc dev ${mmcdev}'

The 'mmc dev ${mmcdev}' is defined twice, so remove the duplicated one

Signed-off-by: Aristo Chen <aristo.chen@canonical.com>
2 months agophycore_imx8mp: Rework some of the RAM related Kconfig symbols
Tom Rini [Sat, 15 Mar 2025 01:29:16 +0000 (19:29 -0600)]
phycore_imx8mp: Rework some of the RAM related Kconfig symbols

As the code is today, we get a warning about "select" statements on
"choice" options not doing anything. In this case we can easily fix this
by dropping the select line as the following choice statement handles
things correctly. We also drop the "default false" line as false / n is
the default.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Teresa Remmet <t.remmet@phytec.de>
2 months agoboard: beacon: imx8mp: Let clock system enable UART clock
Adam Ford [Tue, 18 Mar 2025 23:38:38 +0000 (18:38 -0500)]
board: beacon: imx8mp: Let clock system enable UART clock

Now that the UART driver can enable the required clocks, remove
the hard-coded clock enable.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2 months agoconfigs: imx8mp_beacon: Select SPL_CLK_IMX8MP
Adam Ford [Tue, 18 Mar 2025 23:38:37 +0000 (18:38 -0500)]
configs: imx8mp_beacon: Select SPL_CLK_IMX8MP

In preparation to remove manual references for enabling some clocks,
enable SPL_CLK_IMX8MP which automatically enables SPL_CCF and
SPL_CLK_COMPOSITE_CCF which permit various drivers to activate
their respective clocks automatically.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2 months agoclk: imx: select SPL_CLK_COMPOSITE_CCF when SPL_CLK_IMX8MP
Adam Ford [Tue, 18 Mar 2025 23:38:36 +0000 (18:38 -0500)]
clk: imx: select SPL_CLK_COMPOSITE_CCF when SPL_CLK_IMX8MP

If SPL_CLK_IMX8MP is selected alone, it causes a build error.
The clock composite is required when using the clock framework, so
select it when SPL_CLK_IMX8MP is enabled.  This is already being
done outside of SPL.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2 months agoboard: beacon: imx8mn: Let clock system enable UART clock
Adam Ford [Tue, 18 Mar 2025 23:38:35 +0000 (18:38 -0500)]
board: beacon: imx8mn: Let clock system enable UART clock

Now that the UART driver can enable the required clocks, remove
the hard-coded clock enable.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2 months agoboard: beacon: imx8mm: Let clock system enable UART clock
Adam Ford [Tue, 18 Mar 2025 23:38:34 +0000 (18:38 -0500)]
board: beacon: imx8mm: Let clock system enable UART clock

Now that the UART driver can enable the required clocks, remove
the hard-coded clock enable.  This requires a small re-order
of a couple functions.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2 months agoserial: mxc: Support bulk enabling clocks
Adam Ford [Tue, 18 Mar 2025 23:38:33 +0000 (18:38 -0500)]
serial: mxc: Support bulk enabling clocks

Depending on the platform, there may be multiple clock sources
required to enable a UART.  Use the bulk functions to get and
enable the clocks when the UART probes.  This can facilitate
the removal of functions to manually enable the clock.

This is made dependent on CLK_CCF which is used on imx6q,
imx8m[mnqp], several imxrt, imx9.  If/when the UART clock
registration is done for older boards, this limitation
could be updated.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2 months agoclk: imx8mn: register UART clocks
Adam Ford [Tue, 18 Mar 2025 23:38:32 +0000 (18:38 -0500)]
clk: imx8mn: register UART clocks

In order to let the serial driver enable the clocks, the UART clocks
must be registered first.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2 months agoclk: imx8mm: register UART clocks
Adam Ford [Tue, 18 Mar 2025 23:38:31 +0000 (18:38 -0500)]
clk: imx8mm: register UART clocks

In order to let the serial driver enable the clocks, the UART clocks
must be registered first.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2 months agoclk: imx6q: Register UART clocks
Adam Ford [Tue, 18 Mar 2025 23:38:30 +0000 (18:38 -0500)]
clk: imx6q: Register UART clocks

In order to use the driver model and clock system to enable UART
clocks from the serial driver, it's necessary to register the UART
clocks.  With the helper function to check for imx6qp vs other
variants, the UART can register for both scenarios.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2 months agoclk: imx6q: Properly handle imx6qp ECSPI clk_sels
Adam Ford [Tue, 18 Mar 2025 23:38:29 +0000 (18:38 -0500)]
clk: imx6q: Properly handle imx6qp ECSPI clk_sels

The ECSPI clock has the ability to select between pll3_60m and
osc on the imx6qp, where it's fixed on other variants.  Fix this
by adding using a helper function to determine SoC variant and
register the clock accordingly.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2 months agonet: phy: ksz90x1: Simplify ksz9131_config_rgmii_delay
Paul Barker [Fri, 28 Feb 2025 12:47:55 +0000 (12:47 +0000)]
net: phy: ksz90x1: Simplify ksz9131_config_rgmii_delay

We can call phy_modify_mmd() instead of manually calling drv->readext()
and drv->writeext().

Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
2 months agonet: phy: ksz90x1: Load skew values from device tree
Paul Barker [Fri, 28 Feb 2025 12:47:54 +0000 (12:47 +0000)]
net: phy: ksz90x1: Load skew values from device tree

Various signal skew values may be set in the device tree for the ksz9131
Ethernet PHY. For example, the RZ/G2L board requires non-default values
for rxc-skew-psec & txc-skew-psec.

This is based on the ksz9131 phy driver in Linux v6.11.

Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
2 months agonet: phy: ksz90x1: Handle ksz9131 LED errata
Paul Barker [Fri, 28 Feb 2025 12:47:53 +0000 (12:47 +0000)]
net: phy: ksz90x1: Handle ksz9131 LED errata

Micrel KSZ9131 PHY LED behavior is not correct when configured in
Individual Mode, LED1 (Activity LED) is in the ON state when there is
no-link.

Workaround this by setting bit 9 of register 0x1e after verifying that
the LED configuration is Individual Mode.

This issue is described in KSZ9131RNX Silicon Errata DS80000693B [*]
and according to that it will not be corrected in a future silicon
revision.

[*] https://ww1.microchip.com/downloads/en/DeviceDoc/KSZ9131RNX-Silicon-Errata-and-Data-Sheet-Clarification-80000863B.pdf

Based on commit 0316c7e66bbd in the Linux kernel.

Tested-by: Quentin Schulz <quentin.schulz@cherry.de> # RK3588 Tiger
Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
2 months agonet: phy: Port set/clear bits from Linux
Paul Barker [Fri, 28 Feb 2025 12:47:52 +0000 (12:47 +0000)]
net: phy: Port set/clear bits from Linux

To simply porting phy drivers from Linux to U-Boot, define
phy_set_bits() and phy_clear_bits() functions with a similar API to
those used in Linux.

The U-Boot versions of these functions include the `devad` argument
which is not present in the Linux versions, to keep them aligned with
the other phy functions in U-Boot.

Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
2 months agonet: ravb: Fix error handling in ravb_probe
Paul Barker [Tue, 4 Mar 2025 20:07:09 +0000 (20:07 +0000)]
net: ravb: Fix error handling in ravb_probe

In ravb_probe(), we were missing a couple of things in the error
handling path:

  * We must unregister the MDIO bus before freeing the corresponding
    struct mii_dev instance to avoid the potential for use-after-free
    bugs.

  * We must free the resources acquired by clk_get_bulk() even if the
    clocks have not yet been enabled.

Fixes: 8ae51b6f324e ("net: ravb: Add Renesas Ethernet RAVB driver")
Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2 months agorenesas_rzg2l_smarc_defconfig: Enable USB support
Paul Barker [Tue, 11 Mar 2025 20:57:47 +0000 (20:57 +0000)]
renesas_rzg2l_smarc_defconfig: Enable USB support

Enable support for USB 2.0, USB 1.1 and USB storage devices on the
Renesas RZ/G2L EVK.

Also enable the 'usb' command to support USB scanning and debugging.

Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2 months agophy: rcar: Support RZ/G2L USB PHY
Paul Barker [Tue, 11 Mar 2025 20:57:46 +0000 (20:57 +0000)]
phy: rcar: Support RZ/G2L USB PHY

Extend the existing Renesas R-Car Gen3 USB 2.0 PHY driver to support the
RZ/G2L and related SoCs.

Also enable this driver by default for the RZ/G2L SoC family.

Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
2 months agoreset: rzg2l-usbphy-ctrl: Connect up vbus regulator
Paul Barker [Tue, 11 Mar 2025 20:57:45 +0000 (20:57 +0000)]
reset: rzg2l-usbphy-ctrl: Connect up vbus regulator

Bind the USB VBUS regulator driver under the USB PHY reset driver for
the Renesas RZ/G2L and related SoCs. This additional bind is needed as
the corresponding device tree node does not contain a compatible string.

Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
2 months agoregulator: rzg2l-usbphy: Add new driver
Paul Barker [Tue, 11 Mar 2025 20:57:44 +0000 (20:57 +0000)]
regulator: rzg2l-usbphy: Add new driver

Add a new regulator driver to control the USB VBUS supply on the Renesas
RZ/G2L and related SoCs.

Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
2 months agoreset: rzg2l-usbphy-ctrl: Add new driver
Paul Barker [Tue, 11 Mar 2025 20:57:43 +0000 (20:57 +0000)]
reset: rzg2l-usbphy-ctrl: Add new driver

Add a new driver to control the USB 2.0 PHY reset controller on the
Renesas RZ/G2L and related SoCs.

Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2 months agoMerge patch series "pxe: Precursor series for supporting read_all() in extlinux ...
Tom Rini [Tue, 18 Mar 2025 19:12:51 +0000 (13:12 -0600)]
Merge patch series "pxe: Precursor series for supporting read_all() in extlinux / PXE"

Simon Glass <sjg@chromium.org> says:

This series includes some patches related to allowing read_all() to be
used with the extlinux / PXE bootmeths.

These patches were split out from the stb4 series, since it will need to
have additional patches for LWIP, to avoid breaking PXE booting when
LWIP is used.

Link: https://lore.kernel.org/r/20250306002533.2380866-1-sjg@chromium.org
2 months agonet: Provide a function to run network operations
Simon Glass [Thu, 6 Mar 2025 00:25:23 +0000 (17:25 -0700)]
net: Provide a function to run network operations

Add a new netboot_run() function which can be used for simple network
operations, such as loading a file. Put the implementation in an
internal function, used by the existing code.

Place this function into the net/ code, so that it does not need the
command line to be available.

Document which network operations are supported, i.e. a limited subset,
for now.

For the one board which uses lwip, it is not quite clear how to avoid
using the cmdline interface. This will need some discussion.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agonet: Drop #ifdef in parse_args()
Simon Glass [Thu, 6 Mar 2025 00:25:22 +0000 (17:25 -0700)]
net: Drop #ifdef in parse_args()

Use IS_ENABLED() to avoid an extra build path.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agonet: Refactor part of netboot_common() into a function
Simon Glass [Thu, 6 Mar 2025 00:25:21 +0000 (17:25 -0700)]
net: Refactor part of netboot_common() into a function

Move the core code for starting an netboot operation into a separate
function, so that we can (with additional work) move towards calling it
from outside the file.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agonet: Return the size from parse_args()
Simon Glass [Thu, 6 Mar 2025 00:25:20 +0000 (17:25 -0700)]
net: Return the size from parse_args()

Rather than setting global variables, return the size, if provided. For
tftput, use the addr argument to store the save address, to avoid adding
yet another parameter.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agonet: Return the address and size from parse_addr_size()
Simon Glass [Thu, 6 Mar 2025 00:25:19 +0000 (17:25 -0700)]
net: Return the address and size from parse_addr_size()

Rather than updating the global, update the value of some parameters,
so the action of the function is simpler.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agonet: Return the load address from parse_args()
Simon Glass [Thu, 6 Mar 2025 00:25:18 +0000 (17:25 -0700)]
net: Return the load address from parse_args()

Rather than updating the global, update the value of a parameter, so the
action of the function is simpler.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agonet: Simplify parse_args()
Simon Glass [Thu, 6 Mar 2025 00:25:17 +0000 (17:25 -0700)]
net: Simplify parse_args()

This function repeats the same code in a few places, namely setting
net_boot_file_name_explicit and copying of the filename to
net_boot_file_name

Move these two operations to the caller, with just the filename (or
NULL) returned by parse_args()

This makes things a little easier to follow.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agonet: Tidy up the comments to parse_args()
Simon Glass [Thu, 6 Mar 2025 00:25:16 +0000 (17:25 -0700)]
net: Tidy up the comments to parse_args()

This function is a bit vague as to what it does. Expand the comment a
little, to specify which args are provided and which variables are
updated.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 months agonet: Keep the bootstage functions together
Simon Glass [Thu, 6 Mar 2025 00:25:15 +0000 (17:25 -0700)]
net: Keep the bootstage functions together

Move the bootstage_mark() function just before net_loop(), so that the
IPv6 code is not in the way.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agoboot: pxe: Refactor label_run_boot() to avoid cmdline
Simon Glass [Thu, 6 Mar 2025 00:25:14 +0000 (17:25 -0700)]
boot: pxe: Refactor label_run_boot() to avoid cmdline

Adjust the remaining call in this function to use the bootm API. This
will allow PXE to work without the command line.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agopxe_utils: Simplify default fdt in label_run_boot()
Simon Glass [Thu, 6 Mar 2025 00:25:13 +0000 (17:25 -0700)]
pxe_utils: Simplify default fdt in label_run_boot()

Tidy up this code a little to avoid two calls to env_get() for both
fdt_addr and fdtcontroladdr

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Quentin Schulz <quentin.schulz@cherry.de>
2 months agoboot: pxe: Use bootm_...() functions where possible
Simon Glass [Thu, 6 Mar 2025 00:25:12 +0000 (17:25 -0700)]
boot: pxe: Use bootm_...() functions where possible

Rather than building a command line for each operation, use the
functions provided by the bootm API.

Make sure that the bootm functions are available if pxe_utils is used.

Since SYS_BOOTM_LEN is not present for the tools-only build, adjust the
code to handle that.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
2 months agoboot: Support compressed booti images in bootm
Simon Glass [Thu, 6 Mar 2025 00:25:11 +0000 (17:25 -0700)]
boot: Support compressed booti images in bootm

A compressed booti image relies on the compression-format's header at
the start to indicate which compression algorithm is used.

We don't support this elsewhere in U-Boot, so assume that a compressed
file is always a booti file. Once it is compressed, a check is made to
make sure that it actually is.

Simplify the implementation by adding a new function which returns the
booti image-type if compression is detected.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agoboot: Support booti format in bootm
Simon Glass [Thu, 6 Mar 2025 00:25:10 +0000 (17:25 -0700)]
boot: Support booti format in bootm

At present the booti format is handled separately, in its own command.
Provide a way to boot uncompressed booti images within the bootm code,
so that eventually we can boot these images without CONFIG_CMDLINE

Update bootm_init() to attach the images for all formats which use them.

Add some debugging while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agoboot: arm: riscv: sandbox: Add a format for the booti file
Simon Glass [Thu, 6 Mar 2025 00:25:09 +0000 (17:25 -0700)]
boot: arm: riscv: sandbox: Add a format for the booti file

Arm invented a new format for arm64 and something similar is also used
with RISC-V. Add this to the list of supported formats and provide a way
for the format to be detected on both architectures.

Update the genimg_get_format() function to support this.

Fix up switch() statements which don't currently mention this format.
Booti does not support a ramdisk, so this can be ignored.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agoboot: Convert IMAGE_FORMAT into an enum
Simon Glass [Thu, 6 Mar 2025 00:25:08 +0000 (17:25 -0700)]
boot: Convert IMAGE_FORMAT into an enum

Use an enum so it is clearer that these options are related. Update
genimg_get_format(), tidy up the function comment and move it to the
header file, since it is exported.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agobootm: Allow building bootm.c without CONFIG_SYS_BOOTM_LEN
Simon Glass [Thu, 6 Mar 2025 00:25:07 +0000 (17:25 -0700)]
bootm: Allow building bootm.c without CONFIG_SYS_BOOTM_LEN

This code cannot be compiled by boards which don't have this option. Add
an accessor in the header file to avoid another #ifdef

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
2 months agoboot: Pass just the FDT argument to label_process_fdt()
Simon Glass [Thu, 6 Mar 2025 00:25:06 +0000 (17:25 -0700)]
boot: Pass just the FDT argument to label_process_fdt()

Since this function only adjusts one element of the bootm command, pass
just that. This will make it easier to refactor things to remove the
bootm command.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
2 months agoboot: Split pxe label_run_boot() into two parts
Simon Glass [Thu, 6 Mar 2025 00:25:05 +0000 (17:25 -0700)]
boot: Split pxe label_run_boot() into two parts

This function is quite long. Split out the FDT processing into its own
function.

Add a function comment for the new label_process_fdt() function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
2 months agoboot: Split pxe label_boot() into two parts
Simon Glass [Thu, 6 Mar 2025 00:25:04 +0000 (17:25 -0700)]
boot: Split pxe label_boot() into two parts

This function is far too long. Split out the part which builds and runs
the bootm/i/z commands into its own function.

Add a function comment for the new label_run_boot() function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
2 months agoboot: Use strlcpy() in label_boot()
Simon Glass [Thu, 6 Mar 2025 00:25:03 +0000 (17:25 -0700)]
boot: Use strlcpy() in label_boot()

This function is recommended instead of strncpy() since it always
terminates the string.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: Drop the unnecessary base_ptr argument to zboot_dump()
Simon Glass [Thu, 6 Mar 2025 00:25:02 +0000 (17:25 -0700)]
x86: Drop the unnecessary base_ptr argument to zboot_dump()

This value is include the bootm_info, so drop the unnecessary parameter.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agobootstd: Correct display of kernel version
Simon Glass [Thu, 6 Mar 2025 00:25:01 +0000 (17:25 -0700)]
bootstd: Correct display of kernel version

The address of the bzImage is not recorded in the bootflow, so we cannot
actually locate the version at present. Handle this case, to avoid
showing invalid data.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: Move the bootm state for zimage into cmd/
Simon Glass [Thu, 6 Mar 2025 00:25:00 +0000 (17:25 -0700)]
x86: Move the bootm state for zimage into cmd/

Rather than holding the state in the implementation code, move it to the
command code. The state is now passed to the implementation functions
and can there (with future work) be pass in from bootstd, without going
through the commands.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: Rename state to bmi
Simon Glass [Thu, 6 Mar 2025 00:24:59 +0000 (17:24 -0700)]
x86: Rename state to bmi

Use the common name for the struct, in preparation for passing it around
between functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: Move x86 zboot state into struct bootm_info
Simon Glass [Thu, 6 Mar 2025 00:24:58 +0000 (17:24 -0700)]
x86: Move x86 zboot state into struct bootm_info

This structure is supposed to handle any type of booting
programmatically, i.e. without needing a command to be executed. Move
the x86-specific members into it and use it instead of
struct zboot_state. Provide a macro so access is possible without adding
lots of #ifdefs to the code.

This will allow the struct to be used for all four types of booting
(bootm, bootz, booti and zboot).

Call bootm_init() to init the state, to match other boot methods.

Note that some rationalisation could be performed on this. But this
is tricky since addresses are stored as strings in several places. Also
some strings combine multiple arguments into one. So to keep this task
somewhat manageable, we content ourselves with just getting everything
into the same struct

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: Drop duplicate definition of zimage_dump()
Simon Glass [Thu, 6 Mar 2025 00:24:57 +0000 (17:24 -0700)]
x86: Drop duplicate definition of zimage_dump()

This is now defined in bootm.h so drop the duplicate in the x86 code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: Rename zboot_run() to zboot_run_args()
Simon Glass [Thu, 6 Mar 2025 00:24:56 +0000 (17:24 -0700)]
x86: Rename zboot_run() to zboot_run_args()

Rename this function so we can (later) create a zboot_run() function
which looks the same as bootm_run()

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agox86: Make do_zboot_states() static
Simon Glass [Thu, 6 Mar 2025 00:24:55 +0000 (17:24 -0700)]
x86: Make do_zboot_states() static

This function is only called within zboot.c so make the function
private.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 months agoMerge tag 'u-boot-ufs-next-20250318' of https://source.denx.de/u-boot/custodians...
Tom Rini [Tue, 18 Mar 2025 17:03:53 +0000 (11:03 -0600)]
Merge tag 'u-boot-ufs-next-20250318' of https://source.denx.de/u-boot/custodians/u-boot-ufs into next

- initial cleanup and defines sync with Linux v6.12

2 months agoMerge tag 'u-boot-amlogic-20250318' of https://source.denx.de/u-boot/custodians/u...
Tom Rini [Tue, 18 Mar 2025 17:03:28 +0000 (11:03 -0600)]
Merge tag 'u-boot-amlogic-20250318' of https://source.denx.de/u-boot/custodians/u-boot-amlogic into next

- odroid-n2: Update docs for signing
- support Amlogic chip_id v1 and v2

2 months agoMerge patch series "vepxpress64: disable CRC32 by default and add FVP with TF-A guide"
Tom Rini [Tue, 18 Mar 2025 14:12:40 +0000 (08:12 -0600)]
Merge patch series "vepxpress64: disable CRC32 by default and add FVP with TF-A guide"

Harrison Mutai <harrison.mutai@arm.com> says:

This patch introduces two updates to the vexpress64 project:

- Disable CRC32 by default to prevent aborts in a standard FVP setup.
- Add a guide for running FVP with TF-A, providing a clear starting point for
  users.

Link: https://lore.kernel.org/r/20250304165204.53097-1-harrison.mutai@arm.com
2 months agoMerge patch series "*** Various Improvements for phyCORE-AM62/A SoMs ***"
Tom Rini [Tue, 18 Mar 2025 14:14:13 +0000 (08:14 -0600)]
Merge patch series "*** Various Improvements for phyCORE-AM62/A SoMs ***"

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

This patch series syncs the phyCORE-AM62Ax feature-wise with our other
K3-based SoMs by adding SoM overlay handling and capsule updates. It
also introduces support for USBDFU boot and includes various minor fixes.

Link: https://lore.kernel.org/r/20250305045838.3614661-1-w.egorov@phytec.de
2 months agoconfigs: j784s4-am69: Enable UFS
Udit Kumar [Wed, 5 Mar 2025 06:13:51 +0000 (11:43 +0530)]
configs: j784s4-am69: Enable UFS

J784S4 EVM board has UFS flash, So enable UFS configs

Cc: Neha Francis <n-francis@ti.com>
Signed-off-by: Udit Kumar <u-kumar1@ti.com>
2 months agoufs: core: sync ufshci.h with Linux v6.12
Neil Armstrong [Mon, 30 Dec 2024 10:31:00 +0000 (11:31 +0100)]
ufs: core: sync ufshci.h with Linux v6.12

Sync ufshci.h with the version found in the Linux v6.12
version commit adc218676eef ("Linux 6.12").

It adds new defines, and moves defines to the same place
as the Linux header.

No functional changes intended.

Acked-by: Neha Malcom Francis <n-francis@ti.com>
Tested-by: Love Kumar <love.kumar@amd.com>
[narmstrong: do not rename CFG_RESULT_CODE_MASK]
Link: https://lore.kernel.org/r/20241230-topic-ufs-cleanup-v2-6-4c6d7994a45d@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2 months agoufs: core: sync unipro.h with Linux v6.12
Neil Armstrong [Mon, 30 Dec 2024 10:30:59 +0000 (11:30 +0100)]
ufs: core: sync unipro.h with Linux v6.12

Sync unipro.h with the version found in the Linux v6.12
version commit adc218676eef ("Linux 6.12").

It adds new defines, and moves defines to the same place
as the Linux header.

No functional changes intended.

Acked-by: Neha Malcom Francis <n-francis@ti.com>
Tested-by: Love Kumar <love.kumar@amd.com>
Link: https://lore.kernel.org/r/20241230-topic-ufs-cleanup-v2-5-4c6d7994a45d@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2 months agoufs: core: move ufshci defines in a separate header
Neil Armstrong [Mon, 30 Dec 2024 10:30:58 +0000 (11:30 +0100)]
ufs: core: move ufshci defines in a separate header

Splitting the header will help synchronizing the defines
again with Linux.

Acked-by: Neha Malcom Francis <n-francis@ti.com>
Tested-by: Love Kumar <love.kumar@amd.com>
Link: https://lore.kernel.org/r/20241230-topic-ufs-cleanup-v2-4-4c6d7994a45d@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2 months agoufs: core: cosmetic fixups
Neil Armstrong [Mon, 30 Dec 2024 10:30:57 +0000 (11:30 +0100)]
ufs: core: cosmetic fixups

Fixes some alignment warnings, missing comments on write barrier,
missing parenthesis around macro parameters and a comment typo.

No functional changes intended.

Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
Tested-by: Love Kumar <love.kumar@amd.com>
Link: https://lore.kernel.org/r/20241230-topic-ufs-cleanup-v2-3-4c6d7994a45d@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2 months agoufs: core: mark unexported functions as static
Neil Armstrong [Mon, 30 Dec 2024 10:30:56 +0000 (11:30 +0100)]
ufs: core: mark unexported functions as static

Mark the remaining local functions as static to avoid build
warnings.

Also drop the EXPORT_SYMBOL of ufshcd_map_desc_id_to_length.

Tested-by: Love Kumar <love.kumar@amd.com>
Link: https://lore.kernel.org/r/20241230-topic-ufs-cleanup-v2-2-4c6d7994a45d@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2 months agoufs: core: include missing include/ufs.h
Neil Armstrong [Mon, 30 Dec 2024 10:30:55 +0000 (11:30 +0100)]
ufs: core: include missing include/ufs.h

Add missing ufs.h causing build warning on some symbols.

Tested-by: Love Kumar <love.kumar@amd.com>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
Link: https://lore.kernel.org/r/20241230-topic-ufs-cleanup-v2-1-4c6d7994a45d@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2 months agoboard: odroid-n2: Update docs for signing
Baltazár Radics [Fri, 10 Jan 2025 11:11:24 +0000 (12:11 +0100)]
board: odroid-n2: Update docs for signing

The previous instructions resulted in a bootloader that wouldn't fit in
an MBR gap. I have updated the docs based on upstream's build process.

Signed-off-by: Baltazár Radics <baltazar.radics@gmail.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20250110111335.9221-1-baltazar.radics@gmail.com
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2 months agoarch: arm: meson: support Amlogic chip_id v1 and v2
Evgeny Bachinin [Mon, 10 Feb 2025 17:50:16 +0000 (20:50 +0300)]
arch: arm: meson: support Amlogic chip_id v1 and v2

Patch introduces:
* chip_id API - useful for various things, but used now for
  device_id (did) generation as mentioned in [1] on our private board
  code. Our device_id is calculated by means of permutations of
  chip_id value.
* new SoCs (a1, s4, etc) are usually coming with the support of chip_id
  v2 right away, whereas secure monitors on old SoCs (like axg, g12b,
  g12a, etc) may support only chip_id v1. Chip_id API handles both
  cases
* meson_sm_get_serial() is described via chip_id API.

Links:
[1] https://lore.kernel.org/linux-arm-kernel/202311242104.RjBPI3uI-lkp@intel.com/T/#m630fbeea6a6e7d531290b5c0af205af4fb979757

Signed-off-by: Viacheslav Bocharov <adeep@lexina.in>
Co-developed-by: Arseniy Krasnov <avkrasnov@salutedevices.com>
Signed-off-by: Arseniy Krasnov <avkrasnov@salutedevices.com>
Signed-off-by: Evgeny Bachinin <EABachinin@salutedevices.com>
Link: https://lore.kernel.org/r/20250210-meson_chip_id_all_vers-v1-3-b98f8b6880b8@salutedevices.com
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2 months agoarm: meson: sm: get rid of SM_CHIP_ID_SIZE
Evgeny Bachinin [Mon, 10 Feb 2025 17:50:15 +0000 (20:50 +0300)]
arm: meson: sm: get rid of SM_CHIP_ID_SIZE

SM_CHIP_ID_SIZE is used nowhere. Moreover, it specifies wrong
chip_id size: Amlogic chip_id v1 and v2 is always 16 bytes long.

Signed-off-by: Evgeny Bachinin <EABachinin@salutedevices.com>
Link: https://lore.kernel.org/r/20250210-meson_chip_id_all_vers-v1-2-b98f8b6880b8@salutedevices.com
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2 months agoarm: meson: unify type being used for socinfo
Evgeny Bachinin [Mon, 10 Feb 2025 17:50:14 +0000 (20:50 +0300)]
arm: meson: unify type being used for socinfo

socinfo_ API uses u32 type, hence let's use it everywhere
for consistency.

Signed-off-by: Evgeny Bachinin <EABachinin@salutedevices.com>
Link: https://lore.kernel.org/r/20250210-meson_chip_id_all_vers-v1-1-b98f8b6880b8@salutedevices.com
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2 months agoconfigs: phycore_am62ax_a53_defconfig: Add SoM overlays to OF_OVERLAY_LIST
Wadim Egorov [Wed, 5 Mar 2025 04:58:38 +0000 (05:58 +0100)]
configs: phycore_am62ax_a53_defconfig: Add SoM overlays to OF_OVERLAY_LIST

Include SoM dt-overlays for DT control so we can include them
into our u-boot FIT image.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
2 months agoarm: dts: k3-am62a-phycore-som-binman: Add SoM overlays
Wadim Egorov [Wed, 5 Mar 2025 04:58:37 +0000 (05:58 +0100)]
arm: dts: k3-am62a-phycore-som-binman: Add SoM overlays

Include SoM dt-overlays that handle variants of our SoMs into
u-boot's FIT image.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
2 months agoboard: phytec: common: Add phyCORE-AM62Ax
Daniel Schultz [Wed, 5 Mar 2025 04:58:36 +0000 (05:58 +0100)]
board: phytec: common: Add phyCORE-AM62Ax

Add the phyCORE-AM62Ax to our common board directory to
enable our SOM detection for this product.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
2 months agoboard: phytec: common: k3: Make configure_capsule_updates() static
Wadim Egorov [Wed, 5 Mar 2025 04:58:35 +0000 (05:58 +0100)]
board: phytec: common: k3: Make configure_capsule_updates() static

This function is only used in the board.c file. Make it static.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
2 months agoarch: arm: dts: k3-am625-phyboard-lyra: Add missing boot phase tag
Wadim Egorov [Wed, 5 Mar 2025 04:58:34 +0000 (05:58 +0100)]
arch: arm: dts: k3-am625-phyboard-lyra: Add missing boot phase tag

Add the bootph-all tag to usb0_phy_ctrl node to ensure it is
properly initialized during the boot process. This fixes the
following issue:

  dwc3-am62 dwc3-usb@f900000: unable to get ti,syscon-phy-pll-refclk regmap

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
2 months agoarch: arm: dts: k3-am62a7-phyboard-lyra: Add missing boot phase tag
Wadim Egorov [Wed, 5 Mar 2025 04:58:33 +0000 (05:58 +0100)]
arch: arm: dts: k3-am62a7-phyboard-lyra: Add missing boot phase tag

Add the bootph-all tag to usb0_phy_ctrl node to ensure it is
properly initialized during the boot process. This fixes the
following issue:

  dwc3-am62 dwc3-usb@f900000: unable to get ti,syscon-phy-pll-refclk regmap

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
2 months agoboard: phytec: phycore_am62ax: Add Network/SPI/DFU env variables
Wadim Egorov [Wed, 5 Mar 2025 04:58:32 +0000 (05:58 +0100)]
board: phytec: phycore_am62ax: Add Network/SPI/DFU env variables

Include the boot logic to boot via Network, from a OSPI/QSPI
NOR flash or via USB DFU.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
2 months agoboard: phytec: phycore_am62x: Use custom k3_dfu.env fragment
Wadim Egorov [Wed, 5 Mar 2025 04:58:31 +0000 (05:58 +0100)]
board: phytec: phycore_am62x: Use custom k3_dfu.env fragment

TI's k3_dfu.env includes redundant dfu_alt_info_* data, some of which
is incompatible with our board configuration. Replace it with a custom
variant that better aligns with our setup, ensuring correct offsets and
eliminating unnecessary entries.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
2 months agoconfigs: Add phycore_am62ax_r5_usbdfu_defconfig
Wadim Egorov [Wed, 5 Mar 2025 04:58:30 +0000 (05:58 +0100)]
configs: Add phycore_am62ax_r5_usbdfu_defconfig

This config includes the phycore_am62ax_r5_defconfig file as well as
the am62x_r5_usbdfu.config fragment. We need another defconfig
because the AM62Ax has not enough internal SRAM to support all boot
sources. The normal phycore_am62ax_r5_defconfig should allow to boot
from MMC and OSPI while this new defconfig allows to boot from USB.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
2 months agodoc: phytec: k3: Add a common part for Environment and EFI Capsules
Wadim Egorov [Wed, 5 Mar 2025 04:58:29 +0000 (05:58 +0100)]
doc: phytec: k3: Add a common part for Environment and EFI Capsules

Provide a common part for our K3 based boards including general details
about environment handling and EFI capsule updates.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
2 months agoconfigs: phycore_am62ax_a53_defconfig: Enable capsule update
Wadim Egorov [Wed, 5 Mar 2025 04:58:28 +0000 (05:58 +0100)]
configs: phycore_am62ax_a53_defconfig: Enable capsule update

Enable raw & on disk capsule updates and provide configs required
for updating MTD devices. Also resync after savedefconfig.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
2 months agoinclude: configs: phycore-am62ax: Define capsule FW names
Wadim Egorov [Wed, 5 Mar 2025 04:58:27 +0000 (05:58 +0100)]
include: configs: phycore-am62ax: Define capsule FW names

Define firmware names for phycore-am62ax capsules.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
2 months agoarm: dts: k3-am62a-phycore-som-binman: Provide capsule nodes
Wadim Egorov [Wed, 5 Mar 2025 04:58:26 +0000 (05:58 +0100)]
arm: dts: k3-am62a-phycore-som-binman: Provide capsule nodes

Fill in phycore-am62ax capsule GUID properties of the base
binman capsule nodes.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
2 months agovepxress64: add guide for running FVP with TF-A
Harrison Mutai [Tue, 4 Mar 2025 16:52:02 +0000 (16:52 +0000)]
vepxress64: add guide for running FVP with TF-A

Add documentation on how to run FVP with U-Boot and TF-A. This helps
users configure and run U-Boot correctly on Arm models.

Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 months agovepxress64: disable CRC32 by default to prevent aborts
Harrison Mutai [Tue, 4 Mar 2025 16:52:01 +0000 (16:52 +0000)]
vepxress64: disable CRC32 by default to prevent aborts

On fast models, the CRC32 feature is disabled by default. When enabled
in U-Boot, it leads to synchronous aborts due to unrecognized
instructions. This change ensures CRC32 is disabled by default to
maintain compatibility.

Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 months agosandbox_vpl: Enable missing TPL_DM_I2C symbol
Tom Rini [Tue, 4 Mar 2025 20:32:35 +0000 (14:32 -0600)]
sandbox_vpl: Enable missing TPL_DM_I2C symbol

Currently this platform implicity builds CONFIG_TPL_DM_I2C support
without setting the symbol. Add it for clarity.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agoserial: Add missing TPL_SYS_NS16550_SERIAL symbol
Tom Rini [Tue, 4 Mar 2025 20:24:36 +0000 (14:24 -0600)]
serial: Add missing TPL_SYS_NS16550_SERIAL symbol

On PowerPC platforms with TPL enabled and SPL_SYS_NS16550_SERIAL
enabled, today this builds under TPL as well due to how $(XPL_) is
defined. Add the TPL_SYS_NS16550_SERIAL itself for consistency and
clarity.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 months agoboard: beagle: Add support for BeagleY-AI
Robert Nelson [Mon, 3 Mar 2025 19:15:15 +0000 (13:15 -0600)]
board: beagle: Add support for BeagleY-AI

Basic board support for BeagleY-AI. Information on this
board can be found at https://beagleboard.org/beagley-ai

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Andrew Davis <afd@ti.com>
2 months agoMerge patch series "lmb: miscellaneous fixes and improvements"
Tom Rini [Tue, 18 Mar 2025 01:39:36 +0000 (19:39 -0600)]
Merge patch series "lmb: miscellaneous fixes and improvements"

Sughosh Ganu <sughosh.ganu@linaro.org> says:

The patch series contains some fixes and improvements in the lmb
code, along with addition of corresponding test cases for the changes
made.

The lmb_reserve() function currently does not check if the requested
reservation would overlap with existing reserved regions. While some
scenarios are being handled, some corner cases still exist. These are
being handled by patch 1, along with adding test cases for these
scenarios.

Patch 2 is handling the case of reserving a new region of memory, but
that region overlaps with an existing region. The current code only
handles one particular scenario, but prints a message for the other
scenario of an encompassing overlap and returns back. The patch
handles the encompassing overlap.

Patch 3 is an improvement whereby we allow coalescing a newly reserved
region with an existing region. The current code exits this check
prematurely.

Patch 4 is removing a now superfluous check for overlapping regions
with flag other than LMB_NONE. This now gets handled at an earlier
point in lmb_reserve().

Patch 5 is clubbing the functionality to check if two regions are
adjacent, or overlap, allowing some code re-use.

Patch 6 is optimising the lmb_alloc() function by having it call
_lmb_alloc_base() directly.

Link: https://lore.kernel.org/r/20250303133231.405279-1-sughosh.ganu@linaro.org
2 months agolmb: optimise the lmb allocation functions
Sughosh Ganu [Mon, 3 Mar 2025 13:32:31 +0000 (19:02 +0530)]
lmb: optimise the lmb allocation functions

The actual logic to allocate a region of memory is in the
_lmb_alloc_base() function. The lmb_alloc() API function calls
lmb_alloc_base(), which then calls _lmb_alloc_base() to do the
allocation. Instead, call the _lmb_alloc_base() directly from both the
allocation API's, and move the error message to the _lmb_alloc_base().

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
2 months agolmb: use a common function to check if regions overlap or are adjacent
Sughosh Ganu [Mon, 3 Mar 2025 13:32:30 +0000 (19:02 +0530)]
lmb: use a common function to check if regions overlap or are adjacent

The functions to check if the two said regions are adjacent or overlap
are pretty similar in nature. Club the functionality into a single
function lmb_regions_check() and return the appropriate return value
to signify this aspect.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
2 months agolmb: remove superfluous address overlap check from lmb_add_region_flags()
Sughosh Ganu [Mon, 3 Mar 2025 13:32:29 +0000 (19:02 +0530)]
lmb: remove superfluous address overlap check from lmb_add_region_flags()

U-Boot allows re-use of already reserved memory through the
lmb_reserve() and lmb_alloc_addr() API's. This memory re-use is
allowed only when the flag of the existing reserved region and that of
the requested region is LMB_NONE. A check was put in the
lmb_add_region_flags() in commit 8b8b35a4f5e to handle the scenario
where an already reserved region was re-requested with region flag
other than LMB_NONE -- the function then returns -EEXIST in such a
scenario.

The lmb_reserve() function now does a check for a reservation request
with existing reserved regions, and returns -EEXIST in case of an
overlap but when the flag check fails. Remove this now redundant check
from lmb_add_region_flags().

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
2 months agolmb: check for a region's coalescing with all existing regions
Sughosh Ganu [Mon, 3 Mar 2025 13:32:28 +0000 (19:02 +0530)]
lmb: check for a region's coalescing with all existing regions

The lmb_add_region_flags() first checks if the new region to be added
can be coalesced with existing regions. The check stops if the two
regions are adjecent but their flags do not match. However, it is
possible that the newly added region might be adjacent with the next
existing region and with matching flags. Check for this possibility by
not breaking out of the loop.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 months agolmb: handle scenario of encompassing overlap
Sughosh Ganu [Mon, 3 Mar 2025 13:32:27 +0000 (19:02 +0530)]
lmb: handle scenario of encompassing overlap

The lmb_fix_over_lap_regions() function is called if the added region
overlaps with an existing region. The function then fixes the overlap
and removes the redundant region. However, it makes certain
assumptions. One assumption is that the overlap would not encompass
the existing region. Another assumption is that the overlap only
occurs between two regions -- the scenario of the added region
overlapping multiple existing regions is not being handled. Handle
these cases by instead calling lmb_resize_regions(). Also remove the
now superfluous lmb_fix_over_lap_regions().

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 months agolmb: check if a region can be reserved by lmb_reserve()
Sughosh Ganu [Mon, 3 Mar 2025 13:32:26 +0000 (19:02 +0530)]
lmb: check if a region can be reserved by lmb_reserve()

The logic used in lmb_alloc() takes into consideration the existing
reserved regions, and ensures that the allocated region does not
overlap with any existing allocated regions. The lmb_reserve()
function is not doing any such checks -- the requested region might
overlap with an existing region. This also shows up with
lmb_alloc_addr() as this function ends up calling lmb_reserve().

Add a function which checks if the region requested is overlapping
with an existing reserved region, and allow for the reservation to
happen only if both the regions have LMB_NONE flag, which allows
re-requesting of the region. In any other scenario of an overlap, have
lmb_reserve() return -EEXIST, implying that the requested region is
already reserved.

Add corresponding test cases which check for overlapping reservation
requests made through lmb_reserve() and lmb_alloc_addr(). And while
here, fix some of the comments in the test function being touched.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 months agoMerge branch 'next' of git://source.denx.de/u-boot-usb into next
Tom Rini [Mon, 17 Mar 2025 16:18:59 +0000 (10:18 -0600)]
Merge branch 'next' of git://source.denx.de/u-boot-usb into next

- Add USB support on Starfive JH7110

2 months agoMerge branch 'nand-next' of https://source.denx.de/u-boot/custodians/u-boot-nand...
Tom Rini [Mon, 17 Mar 2025 16:18:18 +0000 (10:18 -0600)]
Merge branch 'nand-next' of https://source.denx.de/u-boot/custodians/u-boot-nand-flash into next

CI: https://source.denx.de/u-boot/custodians/u-boot-nand-flash/-/pipelines/25178

This merge request add support for cadence raw nand driver for agilex
board and add a fix to meson driver.