]> git.ipfire.org Git - thirdparty/u-boot.git/log
thirdparty/u-boot.git
7 months agoclk: qcom: Allow polling for clock status in qcom_gate_clk_en()
Stephan Gerhold [Thu, 24 Apr 2025 09:16:44 +0000 (11:16 +0200)] 
clk: qcom: Allow polling for clock status in qcom_gate_clk_en()

GATE_CLK() in its current state is unsafe: A simple write to the clock
enable register does not guarantee that the clock is immediately running.
Without polling the clock status, we may issue writes to registers before
the necessary clocks start running. This doesn't seem to cause issues in
U-Boot at the moment, but for example removing the CLK_OFF polling in TF-A
for the SMMU clocks on DB410c reliably triggers an exception during boot.

Make it possible to poll the branch clock status register, by adding a new
GATE_CLK_POLLED() macro that takes the extra register address. Existing
usages work just as before, without polling the clock status. Ideally all
usages should be updated to specify the correct poll address in the future.

The Qualcomm naming for these clocks is "branch" and not "gate", but let's
keep the existing naming for now to avoid confusion until all others
drivers have been converted.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
Reviewed-by: Casey Connolly <casey.connolly@linaro.org>
Link: https://lore.kernel.org/r/20250424-apq8016-clock-fixes2-v2-4-fcc371c9e45f@linaro.org
Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
7 months agoclk: qcom: Use setbits_le32() for qcom_gate_clk_en()
Stephan Gerhold [Thu, 24 Apr 2025 09:16:43 +0000 (11:16 +0200)] 
clk: qcom: Use setbits_le32() for qcom_gate_clk_en()

The other clock enable functions in clock-qcom.c use setbits_le32() to
read/modify/write the enable registers. Use the same for qcom_gate_clk_en()
to simplify the code a bit.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
Reviewed-by: Casey Connolly <casey.connolly@linaro.org>
Link: https://lore.kernel.org/r/20250424-apq8016-clock-fixes2-v2-3-fcc371c9e45f@linaro.org
Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
7 months agoclk: qcom: Move qcom_gate_clk_en() to C file
Stephan Gerhold [Thu, 24 Apr 2025 09:16:42 +0000 (11:16 +0200)] 
clk: qcom: Move qcom_gate_clk_en() to C file

This avoids having to inline it separately into every single clock driver,
when U-Boot is built with support for multiple SoCs.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
Reviewed-by: Casey Connolly <casey.connolly@linaro.org>
Link: https://lore.kernel.org/r/20250424-apq8016-clock-fixes2-v2-2-fcc371c9e45f@linaro.org
Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
7 months agoclk: qcom: apq8016: Fix SDCC clock addresses
Stephan Gerhold [Thu, 24 Apr 2025 09:16:41 +0000 (11:16 +0200)] 
clk: qcom: apq8016: Fix SDCC clock addresses

The SDCC_...(n) macros in clock-apq8016.c result in the wrong addresses:

 - SDCC1: SDCC_APPS_CBCR(0) = ((0 * 0x1000) + 0x41018) = 0x41018
   Should be 0x42018, this is an invalid register close to the USB clocks.
 - SDCC2: SDCC_APPS_CBCR(1) = ((1 * 0x1000) + 0x41018) = 0x42018
   Should be 0x43018, this is the SDCC1 clock.

When we try to enable SDCC2, we actually end up enabling SDCC1. When we try
to enable SDCC1, we just issue some broken register writes.

This hasn't caused any trouble so far, because the boot firmware is keeping
both SDCC clocks running. However, if these clocks are disabled when
entering U-Boot, MMC initialization is failing.

Fix this by using the proper offset for the macros. The SDCC_CMD_RCGR() was
already correct, but change it the same way for consistency.

Fixes: 085921368b7d ("arm: Add support for Qualcomm Snapdragon family")
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
Reviewed-by: Casey Connolly <casey.connolly@linaro.org>
Link: https://lore.kernel.org/r/20250424-apq8016-clock-fixes2-v2-1-fcc371c9e45f@linaro.org
Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
7 months agopower: qcom_vbus_regulator: add and fix support for pmic variants
Rui Miguel Silva [Sat, 12 Apr 2025 17:41:31 +0000 (18:41 +0100)] 
power: qcom_vbus_regulator: add and fix support for pmic variants

Fix and add support for different pmic variants pm8x50b to handle
the vbus regulator.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Link: https://lore.kernel.org/r/20250412174157.104419-1-rui.silva@linaro.org
Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
7 months agoboard: dragonboard410c: Enable support for KASLR in Linux
Stephan Gerhold [Thu, 17 Apr 2025 13:49:13 +0000 (15:49 +0200)] 
board: dragonboard410c: Enable support for KASLR in Linux

When booting Linux, there is currently the following warning in the console
when using the default dragonboard410c_defconfig:

  [    0.000000] KASLR disabled due to lack of seed

Fix this by enabling DM_RNG and RNG_MSM in the defconfig to generate the
KASLR seed:

  [    0.000000] KASLR enabled

Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
Reviewed-by:
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20250417-db410c-fixes2-v1-3-76ad994da152@linaro.org
Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
7 months agoboard: dragonboard410c: Drop custom reduced malloc size
Stephan Gerhold [Thu, 17 Apr 2025 13:49:12 +0000 (15:49 +0200)] 
board: dragonboard410c: Drop custom reduced malloc size

At the moment, the dragonboard410c_defconfig specifies a custom
SYS_MALLOC_LEN, lower than the default for Qualcomm boards defined in
arch/arm/mach-snapdragon/Kconfig. It looks like it's too low, since
flashing larger sparse partition images using Fastboot fails with:

  FAILED (remote: 'Malloc failed for: CHUNK_TYPE_RAW')

We are not really that memory-constrained for U-Boot on DB410c, so fix
this by just dropping the custom malloc size and using the default.

Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
Reviewed-by:
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20250417-db410c-fixes2-v1-2-76ad994da152@linaro.org
Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
7 months agoboard: dragonboard410c: Fix button cmd name
Stephan Gerhold [Thu, 17 Apr 2025 13:49:11 +0000 (15:49 +0200)] 
board: dragonboard410c: Fix button cmd name

Commit 359e1d4a57e0 ("board: dragonboard410c: Use button_cmd instead of
custom code") was made in parallel with commit 8f5685d5d32f ("button:
qcom-pmic: prettify and standardise button labels"), which changed the
default button label from "vol_down" to "Volume Down". This is causing
errors in the console during boot now:

  No button labelled 'vol_down'

Fix this by using the new label.

Fixes: 359e1d4a57e0 ("board: dragonboard410c: Use button_cmd instead of custom code")
Fixes: 8f5685d5d32f ("button: qcom-pmic: prettify and standardise button labels")
Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
Reviewed-by:
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20250417-db410c-fixes2-v1-1-76ad994da152@linaro.org
Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
7 months agoMerge tag 'u-boot-dfu-next-20250602' of https://source.denx.de/u-boot/custodians...
Tom Rini [Mon, 2 Jun 2025 14:43:10 +0000 (08:43 -0600)] 
Merge tag 'u-boot-dfu-next-20250602' of https://source.denx.de/u-boot/custodians/u-boot-dfu into next

u-boot-dfu-20250602

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

Usb gadget:
dwc2: Fix incorrect ULPI_UTMI_SEL bit setting
dwc2: Fix HBstLen setting for external DMA mode
dwc2: Various refactors to get the code closer to Linux
dwc2: Support reset logic for v4.20a

7 months agoMerge tag 'i2cfixes-for-2025.07-rc4' of https://source.denx.de/u-boot/custodians...
Tom Rini [Mon, 2 Jun 2025 14:42:04 +0000 (08:42 -0600)] 
Merge tag 'i2cfixes-for-2025.07-rc4' of https://source.denx.de/u-boot/custodians/u-boot-i2c

i2c bugfixes for v2025.07-rc4
- designware_i2c: fix globally wrong return value -1 into -ETIMEDOUT
  in driver, which leaded in silent errors as a timeout resulted in
  an uninitialized value being returned, potentially causing
  unexpected behavior.

7 months agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Mon, 2 Jun 2025 14:40:37 +0000 (08:40 -0600)] 
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-riscv

CI: https://source.denx.de/u-boot/custodians/u-boot-riscv/-/pipelines/26455

Thanks Conor and Yao for catching this issue.

- Revert "RISC-V 32/64 images support" to fix compatibility issue

7 months agoi2c: designware_i2c Return -ETIMEDOUT for timeout errors
Wojciech Szamocki [Fri, 23 May 2025 10:57:07 +0000 (12:57 +0200)] 
i2c: designware_i2c Return -ETIMEDOUT for timeout errors

Change the return value for timeout errors in i2c-designware from 1 to
-ETIMEDOUT. Returning errors as negative values is standard practice in the
u-boot, which enhances error handling consistency across the codebase.

The current behavior can lead to silent errors when functions check for
negative return values to identify errors. For example, in
`dm_i2c_reg_read` from i2c-uclass.c, a timeout results in an uninitialized
value being returned, potentially causing unexpected behavior.

Cc: Heiko Schocher <hs@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Cc: Wojciech Szamocki <wojciech.szamocki@nokia.com>
Signed-off-by: Wojciech Szamocki <wojciech.szamocki@nokia.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
7 months agoRevert "riscv: image: Add new image type for RV64"
Mayuresh Chitale [Thu, 29 May 2025 03:30:51 +0000 (03:30 +0000)] 
Revert "riscv: image: Add new image type for RV64"

This reverts commit 14a4792a71db3561bea065415ac1f2ac69ef32b5 as
discussed in [1].

[1] https://lists.denx.de/pipermail/u-boot/2025-May/590841.html

Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
7 months agoRevert "riscv: Select appropriate image type"
Mayuresh Chitale [Thu, 29 May 2025 03:30:50 +0000 (03:30 +0000)] 
Revert "riscv: Select appropriate image type"

This reverts commit 027a316828528da95a77d20632370b1bc2823f0b as
discussed in [1].

[1] https://lists.denx.de/pipermail/u-boot/2025-May/590841.html

Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
7 months agoRevert "booti/bootm: riscv: Verify image arch type"
Mayuresh Chitale [Thu, 29 May 2025 03:30:49 +0000 (03:30 +0000)] 
Revert "booti/bootm: riscv: Verify image arch type"

This reverts commit 37b0b22d8b7bbed6aa95b6daed06dcbf4a66f211 as
discussed in [1].

[1] https://lists.denx.de/pipermail/u-boot/2025-May/590841.html

Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
7 months agousb: dwc2: Refactor register operations with clrsetbits macros
Junhui Liu [Sun, 26 Jan 2025 08:29:59 +0000 (00:29 -0800)] 
usb: dwc2: Refactor register operations with clrsetbits macros

Refactor DWC2 USB gadget driver to replace manual read-modify-write
operations with `clrsetbits_le32`, `setbits_le32`, and `clrbits_le32`
macros, which simplify the code and improve readability.

Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Link: https://lore.kernel.org/r/20250126-dwc2-clrsetbits-refactor-v1-1-68c27e1b6f84@pigmoral.tech
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
7 months agousb: dwc2: Replace uint<x>_t types with u<x>
Kongyang Liu [Fri, 10 Jan 2025 13:55:27 +0000 (21:55 +0800)] 
usb: dwc2: Replace uint<x>_t types with u<x>

Updates all instances of uint8_t, uint16_t, and uint32_t to u8, u16, and
u32 respectively, ensuring consistent use of kernel-preferred types and
resolving checkpatch.pl warnings.

Signed-off-by: Kongyang Liu <seashell11234455@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Link: https://lore.kernel.org/r/20250110-dwc2-dev-v4-8-987f4fd6f8b2@pigmoral.tech
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
7 months agousb: dwc2: Unify flush and reset logic with v4.20a support
Kongyang Liu [Fri, 10 Jan 2025 13:55:26 +0000 (21:55 +0800)] 
usb: dwc2: Unify flush and reset logic with v4.20a support

This patch merges flush and reset logic for both host and gadget code
into a common set of functions, reducing duplication. It also adds support
for the updated reset logic to compatible with core version since v4.20a.

This patch mainly refers to the patch in the kernel.
link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=65dc2e725286106f99c6f6b78e3d9c52c15f3a9c
Signed-off-by: Kongyang Liu <seashell11234455@gmail.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Link: https://lore.kernel.org/r/20250110-dwc2-dev-v4-7-987f4fd6f8b2@pigmoral.tech
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
7 months agousb: dwc2: Extract macro definitions to common header
Kongyang Liu [Fri, 10 Jan 2025 13:55:25 +0000 (21:55 +0800)] 
usb: dwc2: Extract macro definitions to common header

Some macros are shared between host and gadget code, causing duplicated
definitions. Move DWC2 macro definitions from host and gadget code into a
common header to reduce duplication.

Signed-off-by: Kongyang Liu <seashell11234455@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Link: https://lore.kernel.org/r/20250110-dwc2-dev-v4-6-987f4fd6f8b2@pigmoral.tech
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
7 months agousb: dwc2: Align macros with Linux kernel definitions
Kongyang Liu [Fri, 10 Jan 2025 13:55:24 +0000 (21:55 +0800)] 
usb: dwc2: Align macros with Linux kernel definitions

Update the DWC2 macros to match those used in the Linux kernel, making
it easier to synchronize updates with kernel. Also removed some unused
macros to cleanup the code.

Signed-off-by: Kongyang Liu <seashell11234455@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
Link: https://lore.kernel.org/r/20250110-dwc2-dev-v4-5-987f4fd6f8b2@pigmoral.tech
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
7 months agousb: dwc2: Clean up with bitfield macros
Kongyang Liu [Fri, 10 Jan 2025 13:55:23 +0000 (21:55 +0800)] 
usb: dwc2: Clean up with bitfield macros

Use FIELD_PREP, FIELD_GET, BIT, and GENMASK macros to standardize bit
manipulation across the DWC2 code, improving readability and
maintainability without altering functionality.

Signed-off-by: Kongyang Liu <seashell11234455@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
Link: https://lore.kernel.org/r/20250110-dwc2-dev-v4-4-987f4fd6f8b2@pigmoral.tech
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
7 months agousb: dwc2: Fix HBstLen setting for external DMA mode
Kongyang Liu [Fri, 10 Jan 2025 13:55:22 +0000 (21:55 +0800)] 
usb: dwc2: Fix HBstLen setting for external DMA mode

The loop used to calculate HBstLen for extern DMA mode does not produce
the correct result according to the datasheet [1]. Replacing that loop
with a direct calculation using LOG2 to correctly assign the burst length
in the GAHBCFG register for external DMA mode.

[1] https://rockchip.fr/RK312X%20TRM/chapter-26-usb-otg-2-0.pdf#page=24

Signed-off-by: Kongyang Liu <seashell11234455@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
Link: https://lore.kernel.org/r/20250110-dwc2-dev-v4-3-987f4fd6f8b2@pigmoral.tech
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
7 months agousb: dwc2: Fix incorrect ULPI_UTMI_SEL bit setting
Junhui Liu [Fri, 10 Jan 2025 13:55:21 +0000 (21:55 +0800)] 
usb: dwc2: Fix incorrect ULPI_UTMI_SEL bit setting

The ULPI_UTMI_SEL bit in the DWC2 driver was set incorrectly. According
to the datasheet [1], this bit should be set to 0 for UTMI interface and 1
for ULPI interface. The existing code had this logic reversed,
causing the interface selection to be incorrect.

This commit corrects the ULPI_UTMI_SEL bit setting to match the
datasheet's description. Referencing the kernel's code [2] also confirms
this fix.

[1] https://rockchip.fr/RK312X%20TRM/chapter-26-usb-otg-2-0.pdf#page=30
[2] https://github.com/torvalds/linux/blob/v6.13-rc3/drivers/usb/dwc2/core.c#L1106

Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
Link: https://lore.kernel.org/r/20250110-dwc2-dev-v4-2-987f4fd6f8b2@pigmoral.tech
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
7 months agousb: dwc2: Extract register definitions to common header file
Kongyang Liu [Fri, 10 Jan 2025 13:55:20 +0000 (21:55 +0800)] 
usb: dwc2: Extract register definitions to common header file

The same registers are accessed in both the otg and gatet drivers of
dwc2, and these registers are repeatedly defined in these two parts.
Extract register definitions into a common header file to reduce
redundancy and make the code more maintainable.

Signed-off-by: Kongyang Liu <seashell11234455@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
Link: https://lore.kernel.org/r/20250110-dwc2-dev-v4-1-987f4fd6f8b2@pigmoral.tech
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
7 months agonet: gem: ignore tx_clk if MII is used
Martin Kaistra [Tue, 15 Apr 2025 15:04:00 +0000 (17:04 +0200)] 
net: gem: ignore tx_clk if MII is used

If the MII interface is used, the PHY is the clock master, thus don't
set the clock rate. On Zynq-7000, this will prevent the following
error:
  zynq_gem ethernet@e000b000: failed to set tx clock rate 25000000

Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
Link: https://lore.kernel.org/r/20250415150400.136723-1-martin.kaistra@linutronix.de
Signed-off-by: Michal Simek <michal.simek@amd.com>
7 months agophy: zynqmp: Fix sgmii clk ctrl GTR lane bit shift
Frantisek Bohacek [Thu, 22 May 2025 06:07:03 +0000 (08:07 +0200)] 
phy: zynqmp: Fix sgmii clk ctrl GTR lane bit shift

The bitshift in GEM_CLK_CTRL register is five bits, not two. There are
four bits for each GEM, and one bit reserved in between.

This has caused that using more than one GEM is impossible,
additionally corrupting the GEM0's configuration, leaving GEM0
unusable as well (ie. if GEM0 and GEM1 are used, GEM1 configuration is
going to write to GEM0's registers wrong value, leaving GEM0 unusable)

Signed-off-by: Frantisek Bohacek <rutherther@ditigal.xyz>
Link: https://lore.kernel.org/r/20250522060703.4863-1-rutherther@ditigal.xyz
Signed-off-by: Michal Simek <michal.simek@amd.com>
7 months agodrivers: fpga: intel_sdm_mb: Flush cache before FPGA configuration
Naresh Kumar Ravulapalli [Tue, 6 May 2025 01:28:51 +0000 (18:28 -0700)] 
drivers: fpga: intel_sdm_mb: Flush cache before FPGA configuration

FPGA configuration encounters failure when the cache is not flushed.
Add cache flushing to the memory region that holds the FPGA
configuration bitstream.

Signed-off-by: Naresh Kumar Ravulapalli <nareshkumar.ravulapalli@altera.com>
Link: https://lore.kernel.org/r/20250506012851.30039-1-nareshkumar.ravulapalli@altera.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
7 months agopci: zynqmp: Fix the pcireg base
Venkatesh Yadav Abbarapu [Fri, 16 May 2025 09:23:14 +0000 (14:53 +0530)] 
pci: zynqmp: Fix the pcireg base

The pcireg base is not assigned to any address, reading the
pcireg base with PS_LINKUP_OFFSET which is incorrect and
giving random values. So update the pcireg base from
devicetree so that we can read the valid PCIE link status
and PHY ready status.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Link: https://lore.kernel.org/r/20250516092314.939424-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
7 months agoMerge tag 'u-boot-imx-next-20250601' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Sun, 1 Jun 2025 15:36:18 +0000 (09:36 -0600)] 
Merge tag 'u-boot-imx-next-20250601' 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/26436

- Add i.MX6UL clk driver.
- Improve the .MX6UL NAND controller performance.
- Add imx6ulz BSH SMM M2B board.
- Several improvements for imx8m venice boards.

7 months agobsh: imx6ulz_smm_m2: Add imx6ulz BSH SMM M2B board
Michael Trimarchi [Sat, 31 May 2025 14:54:33 +0000 (16:54 +0200)] 
bsh: imx6ulz_smm_m2: Add imx6ulz BSH SMM M2B board

Introduce the BSH SystemMaster (SMM) M2B board. Notably, the M2B is
designed to leverage the existing device tree of its predecessor, the M2.
The primary distinction arises from memory incompatibilities with the M2.
To address this, we've implemented a configuration system that allows for
selective inclusion of the desired memory components.

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
7 months agoconfigs/imx6ulz_smm_m2_defconfig: Enable clock framework
Michael Trimarchi [Fri, 30 May 2025 15:16:46 +0000 (17:16 +0200)] 
configs/imx6ulz_smm_m2_defconfig: Enable clock framework

Enable the clock framework on the m2 platform.
This helps to increase the NAND controller performance.

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
7 months agomtd: nand: Add support for EDO mode 1-5 to IMX6ULL platform
Michael Trimarchi [Fri, 30 May 2025 15:16:45 +0000 (17:16 +0200)] 
mtd: nand: Add support for EDO mode 1-5 to IMX6ULL platform

The clock driver allows to boost the NAND performance
controller. Make changes to let it use the new clock driver

=> time nand read ${loadaddr} kernel

NAND read: device 0 offset 0x500000, size 0x800000
 8388608 bytes read: OK

time: 0.488 seconds

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
7 months agomtd: mxs_nand_dt: Move from clk_get/clk_enable to clk_bulk api
Michael Trimarchi [Fri, 30 May 2025 15:16:44 +0000 (17:16 +0200)] 
mtd: mxs_nand_dt: Move from clk_get/clk_enable to clk_bulk api

Make simple the clock registration and enable and allow later
to add support for other platforms

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
7 months agoclk: imx: add i.MX6UL clk driver
Michael Trimarchi [Fri, 30 May 2025 15:16:43 +0000 (17:16 +0200)] 
clk: imx: add i.MX6UL clk driver

Add i.MX6UL clk driver for i.MX6UL CLK driver model usage

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Christoph Niedermaier <cniedermaier@dh-electronics.com>
Tested-by: Christoph Niedermaier <cniedermaier@dh-electronics.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
7 months agoimx8mp-venice-gw74xx: add w_disable2 gpio configuration
Tim Harvey [Fri, 23 May 2025 17:20:18 +0000 (10:20 -0700)] 
imx8mp-venice-gw74xx: add w_disable2 gpio configuration

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

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

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

Append the optional board configuration string to the model info.

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

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

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

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

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

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

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

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

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

Add support for it by providing its device-tree.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

See: doc/README.gpt for examples

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

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

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
7 months agoMerge tag 'dm-pull-30may25' of git://git.denx.de/u-boot-dm into next
Tom Rini [Fri, 30 May 2025 19:53:50 +0000 (13:53 -0600)] 
Merge tag 'dm-pull-30may25' of git://git.denx.de/u-boot-dm into next

Bring in recent expo enhancements:
- multi-line text
- highlighting of menu items
- rationalisation of menu and expo code
- support for object alignment
- editable strings
- various bug fixes and tweaks

This also includes some required abuf improvements.

7 months agoimage: android: fix ramdisk default address
Eddie Kovsky [Wed, 21 May 2025 21:26:59 +0000 (15:26 -0600)] 
image: android: fix ramdisk default address

Commit 21e7fa0e3ac5 ("image: android: handle ramdisk default address")
changed the default behavior for header versions less than or equal to 2.

The ramdisk address (img_data.ramdisk_ptr) is only assigned to *rd_data
if the physical load address (img_data.ramdisk_addr) is equal to 0 or
the Android default ramdisk address.

    /* Ramdisk can be used in-place, use current ptr */
    if (img_data.ramdisk_addr == 0 ||
            img_data.ramdisk_addr == ANDROID_IMAGE_DEFAULT_RAMDISK_ADDR) {
        *rd_data = img_data.ramdisk_ptr;
    } else {
        ramdisk_ptr = img_data.ramdisk_addr;
        *rd_data = ramdisk_ptr;
        memcpy((void *)(ramdisk_ptr), (void *)img_data.ramdisk_ptr,
                img_data.ramdisk_size);
    }

When the img_data.ramdisk_addr and the img_data.kernel_addr are the same
*rd_data needs to be assigned to the ramdisk address (ramdisk_ptr), not
the physical address (ramdisk_addr).

As a result of the current behavior, we can no longer boot a kernel on
the Renesas R-Car S4 board.

Add an additional check to the if clause so that the ramdisk address is
assigned when the kernel address and the ramdisk address are the same,
restoring the previous default behavior.

Fixes: 21e7fa0e3ac5 ("image: android: handle ramdisk default address")
Signed-off-by: Eddie Kovsky <ekovsky@redhat.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
Tested-by: Mattijs Korpershoek <mkorpershoek@kernel.org> # khadas vim3
7 months agobootm: Fix bmi->images pointer not initialized in some cases
Benjamin ROBIN [Tue, 20 May 2025 20:35:15 +0000 (22:35 +0200)] 
bootm: Fix bmi->images pointer not initialized in some cases

When building with only bootz command, without bootm, images pointer
inside bootm_info structure is not initialized. And since this structure
is stored in stack, the generated error is kind of random, but most of
the time this will generate: "ramdisk - allocation error".

Also, after analysis, this problem could occur with the command booti,
if the command bootm is disabled.

Currently bootm_init() is called by: do_bootz(), do_bootm(), do_booti()
and by do_stm32prog(). And all of these commands execute bootm_run_states()
which access the images pointer stored into bootm_info structure.

So, to fix this issue, just do the assignment unconditionally.

Fixes: c2211ff65136 ("bootm: Add more fields to bootm_info")
Signed-off-by: Benjamin ROBIN <dev@benjarobin.fr>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 months agoenv: Fix network support when CONFIG_NET_LWIP is set
Benjamin ROBIN [Sat, 17 May 2025 20:09:30 +0000 (22:09 +0200)] 
env: Fix network support when CONFIG_NET_LWIP is set

When lwIP (CONFIG_NET_LWIP) is used instead of legacy stack (CONFIG_NET),
environment flags support associated with network was not built: restore
support of "i" and "m" environment flags.

Signed-off-by: Benjamin ROBIN <dev@benjarobin.fr>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 months agoMerge patch series "test/py: enable HTTP testing"
Tom Rini [Fri, 30 May 2025 16:26:33 +0000 (10:26 -0600)] 
Merge patch series "test/py: enable HTTP testing"

Adriano Cordova <adrianox@gmail.com> says:

Enable HTTP server in CI to support HTTP tests in pytest

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Tom Rini <trini@konsulko.com> says:

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

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

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

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

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

Signed-off-by: Tom Rini <trini@konsulko.com>
7 months agoexpo: Drop the special theme code for bootflow_menu
Simon Glass [Fri, 2 May 2025 14:46:58 +0000 (08:46 -0600)] 
expo: Drop the special theme code for bootflow_menu

The expo now has all that is needed to apply a suitable theme, so drop
this unnecessary code. Any further tweaks can be added to the generic
expo code.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Set up menu fully in bootflow_menu_start()
Simon Glass [Fri, 2 May 2025 14:46:57 +0000 (08:46 -0600)] 
expo: Set up menu fully in bootflow_menu_start()

Apply the theme, calculate dimensions, highlight the menu and arrange
the scene correctly, so that everything is ready to go when the expo
is rendered.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Split setting up the menu from adding items
Simon Glass [Fri, 2 May 2025 14:46:56 +0000 (08:46 -0600)] 
expo: Split setting up the menu from adding items

Some callers may wish to add items later as they are discovered. Split
the setup code into its own function, to permit this.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Update bootflow_menu_poll() to return a sequence ID
Simon Glass [Fri, 2 May 2025 14:46:55 +0000 (08:46 -0600)] 
expo: Update bootflow_menu_poll() to return a sequence ID

Rather than returning a bootflow, return the index of the bootflow. This
will allow callers to do their own translation to bootflows or some
other data structure.

Also return a special code when the user tries to move the pointer, so
that the caller can cancel the boot-menu timeout, if this is in use.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Improve the visual appearance of the menu
Simon Glass [Fri, 2 May 2025 14:46:54 +0000 (08:46 -0600)] 
expo: Improve the visual appearance of the menu

The menu is currently quite basic. Make use of some recently added
features in expo, to:

- Show proper prompts
- Highlight the current item
- Centre text
- Use multi-line text instead of two independent lines
- Put a box around the items

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Provide a way to position things relative to display
Simon Glass [Fri, 2 May 2025 14:46:53 +0000 (08:46 -0600)] 
expo: Provide a way to position things relative to display

It is often necessary to centre objects within the display area. Add a
special position value to indicate this.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Drop the render from expo_poll()
Simon Glass [Fri, 2 May 2025 14:46:52 +0000 (08:46 -0600)] 
expo: Drop the render from expo_poll()

Within tests it is useful to be able to control rendering of the expo.
Drop the automatic call to expo_render() within expo_poll() and adjust
its callers to handle this instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Adjust expo_poll() to avoid looping forever
Simon Glass [Fri, 2 May 2025 14:46:51 +0000 (08:46 -0600)] 
expo: Adjust expo_poll() to avoid looping forever

If the user does not quickly provide some input, exit so that other
things can be done, such as searching for the next OS.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Support highlighting menu items
Simon Glass [Fri, 2 May 2025 14:46:50 +0000 (08:46 -0600)] 
expo: Support highlighting menu items

Expo normally uses a pointer to show the current item. Add support for
highlighting as well, since this makes it easier for the user to see the
current item.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Add forward declarations to scene_internal.h
Simon Glass [Fri, 2 May 2025 14:46:49 +0000 (08:46 -0600)] 
expo: Add forward declarations to scene_internal.h

Provide some forward declarations for types used in this file, to keep
the LSP happy and avoid errors if the caller happens not to include the
required header.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Drop the gap between groups of menu items
Simon Glass [Fri, 2 May 2025 14:46:48 +0000 (08:46 -0600)] 
expo: Drop the gap between groups of menu items

The gap is intended to separate options which are on different bootdevs,
but most of the time there is only one. So drop this gap.

Keep the code around in case it becomes useful to have it in the style,
or based on some other mechanism.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Use a simpler name for USB media
Simon Glass [Fri, 2 May 2025 14:46:47 +0000 (08:46 -0600)] 
expo: Use a simpler name for USB media

For USB devices we use the string 'usb_mass_storage' which is a bit
verbose. Use 'USB' instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Begin implementation of a text editor
Simon Glass [Fri, 2 May 2025 14:46:46 +0000 (08:46 -0600)] 
expo: Begin implementation of a text editor

It is useful to be able to edit text, e.g. to allow the user to edit the
environment or the command-line arguments for the OS.

Add the beginnings of an implementation. Future work is needed to finish
this: keypress handling and scrolling. For now it just displays the
text.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Support object alignment
Simon Glass [Fri, 2 May 2025 14:46:45 +0000 (08:46 -0600)] 
expo: Support object alignment

Add support for left, right and centred alignment for text, in the
horizontal dimension.

Also support top, bottom and centred in the vertical dimension, for the
text object as a whole.

Alignment is not yet implemented for images. It has no meaning for
menus. A textline object uses a text object internally, so alignment
is supported there.

Provide some documentation to explain how objects are positioned.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Implement a box
Simon Glass [Fri, 2 May 2025 14:46:44 +0000 (08:46 -0600)] 
expo: Implement a box

It is useful to be able to draw a box around elements in the menu. Add
support for an unfilled box with a selectable thickness.

Note that there is no support for selecting the colour for any expo
objects yet.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Support white-on-black in the theme
Simon Glass [Fri, 2 May 2025 14:46:43 +0000 (08:46 -0600)] 
expo: Support white-on-black in the theme

Allow this setting to be controlled from the theme.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Support rendering multiple lines of text
Simon Glass [Fri, 2 May 2025 14:46:42 +0000 (08:46 -0600)] 
expo: Support rendering multiple lines of text

Use the measurement info to write each line of text separately, thus
respecting word-wrapping and newlines.

Fix up the comment for scene_obj_render() while we are here.

Since a lineedit does not support alignment, add a special case to just
display the text if there is no measurement. This happens assuming the
lineedit is initially empty.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Check the screen contents after rendering
Simon Glass [Fri, 2 May 2025 14:46:41 +0000 (08:46 -0600)] 
expo: Check the screen contents after rendering

Make sure that the screen contents are as expected when a scene has been
rendered.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Allow strings to be editable
Simon Glass [Fri, 2 May 2025 14:46:40 +0000 (08:46 -0600)] 
expo: Allow strings to be editable

In some cases dynamic text is needed, e.g. for a menu countdown. Add a
function which handles this, allowing the caller to take control of the
text that is shown on each render.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Tidy up scene_txt_render()
Simon Glass [Fri, 2 May 2025 14:46:39 +0000 (08:46 -0600)] 
expo: Tidy up scene_txt_render()

Add an early return if there is no string. Move all declarations to the
top of the function.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Move text-rendering into its own function
Simon Glass [Fri, 2 May 2025 14:46:38 +0000 (08:46 -0600)] 
expo: Move text-rendering into its own function

The code to render text is quite long, so put it in its own function.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Create a struct for generic text attributes
Simon Glass [Fri, 2 May 2025 14:46:37 +0000 (08:46 -0600)] 
expo: Create a struct for generic text attributes

In preparation for adding more text types, refactor the common fields
into a new structure. This will allow common code to be used.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Line up all menu objects
Simon Glass [Fri, 2 May 2025 14:46:36 +0000 (08:46 -0600)] 
expo: Line up all menu objects

At present labels are lined up vertically. Do the same with keys and
descriptions, since it looks nicer.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Support setting the size and bounds of an object
Simon Glass [Fri, 2 May 2025 14:46:35 +0000 (08:46 -0600)] 
expo: Support setting the size and bounds of an object

Add a function to allow the size of an object to be set independently
of its position.

Also add a function to permit the object's bounding box to be set
independently of its dimensions.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Make bounding-box calculation more flexible
Simon Glass [Fri, 2 May 2025 14:46:34 +0000 (08:46 -0600)] 
expo: Make bounding-box calculation more flexible

In some cases it is useful to obtain more than just two bounding boxes
from a menu, e.g. to line up all descriptions vertically.

Use an array to obtain bounding-box information and calculate it
separately for each item.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Separate dimensions from the bounding box
Simon Glass [Fri, 2 May 2025 14:46:33 +0000 (08:46 -0600)] 
expo: Separate dimensions from the bounding box

At present each object has a width and height and the bounding box is
implicit in that.

This is not flexible enough to handle objects which are larger than
their contents might need. For example, when centring a text object we
might want to have it stretch across the whole width of the display even
if the text itself does not need that much space.

Create a new 'dimensions' field and convert the existing width/height
into x1/y1 coordinates.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Use an abuf to hold strings
Simon Glass [Fri, 2 May 2025 14:46:32 +0000 (08:46 -0600)] 
expo: Use an abuf to hold strings

It is more convenient to put strings in an abuf so they can easily be
resized. Adjust the struct accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Rename x and y in struct scene_obj_bbox
Simon Glass [Fri, 2 May 2025 14:46:31 +0000 (08:46 -0600)] 
expo: Rename x and y in struct scene_obj_bbox

These coordinates are the top left values, so rename them to x0 and y0
in preparation for changing the width and height to x1 and y1

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Rename scene_dim to scene_obj_bbox
Simon Glass [Fri, 2 May 2025 14:46:30 +0000 (08:46 -0600)] 
expo: Rename scene_dim to scene_obj_bbox

At present we assume that each object is a simple box and that it fills
the whole box.

This is quite limiting for text objects, which we may want to centre
within the box. We need a position within the box where drawing starts.

Rename the scene_dim struct to indicate that it is a bounding box.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Allow adding a single bootflow to a menu
Simon Glass [Fri, 2 May 2025 14:46:29 +0000 (08:46 -0600)] 
expo: Allow adding a single bootflow to a menu

Refactor bootflow_menu_add_all() to call a new bootflow_menu_add() to
add each of its bootflows.

Move the last_bootdev value into struct menu_priv to make this work.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Split bootflow_menu_new() into two pieces
Simon Glass [Fri, 2 May 2025 14:46:28 +0000 (08:46 -0600)] 
expo: Split bootflow_menu_new() into two pieces

Split the iteration piece of this function into bootflow_menu_add_all()
so that it is possible for the caller to be in control of adding items
to the menu.

Move the expo_destroy() call into the caller.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Split bootflow_menu_run() into two pieces
Simon Glass [Fri, 2 May 2025 14:46:27 +0000 (08:46 -0600)] 
expo: Split bootflow_menu_run() into two pieces

Split the starting piece of this function into bootflow_menu_start()
and the polling part into bootflow_menu_poll() so that it is possible
for the caller to be in control of the event loop.

Move the expo_destroy() call into the caller.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Test editing a lineedit
Simon Glass [Fri, 2 May 2025 14:46:26 +0000 (08:46 -0600)] 
expo: Test editing a lineedit

Open the lineedit and add a few characters, to check that things look
right.

At present when the user moves to a new menu item, the menu code
handles this immediately. This means it is not possible to use an expo
action to effect the same change.

Update this so that EXPOACT_POINT_ITEM is handled in cedit_do_action().

Expand the test to cover this.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Adjust how menu items are highlighted
Simon Glass [Fri, 2 May 2025 14:46:25 +0000 (08:46 -0600)] 
expo: Adjust how menu items are highlighted

At present when the user moves to a new menu item, the menu code
handles this immediately. This means it is not possible to use an expo
action to effect the same change.

Update this so that EXPOACT_POINT_ITEM is handled in cedit_do_action().

Expand the test to cover this.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Provide access to the current menu item
Simon Glass [Fri, 2 May 2025 14:46:24 +0000 (08:46 -0600)] 
expo: Provide access to the current menu item

Add functions to allow a caller to find out the current menu item and to
select a different one.

Update the event handling so that an attempt to change the current item
(e.g. by pressing the up-arrow key) is reported to the caller, since
this may be used to cancel an autoboot timeout.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Test rendering a lineedit
Simon Glass [Fri, 2 May 2025 14:46:23 +0000 (08:46 -0600)] 
expo: Test rendering a lineedit

Check the rendering output when adding characters to a line-edit object.

Add a separate test to check behaviour when starting with existing text
in the lineedit. The cursor should start at the end.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Pass in the video device for cedit_prepare()
Simon Glass [Fri, 2 May 2025 14:46:22 +0000 (08:46 -0600)] 
expo: Pass in the video device for cedit_prepare()

At present this function locates it own video device. Pass it in to
provide more flexibility.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Test some cedit actions
Simon Glass [Fri, 2 May 2025 14:46:21 +0000 (08:46 -0600)] 
expo: Test some cedit actions

Refactor the action-processing code into a new cedit_do_action()
function so we can call it from a test. Check moving to a new field and
opening the menu, to ensure that rendering is correct.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Move cedit-state fields into expo
Simon Glass [Fri, 2 May 2025 14:46:20 +0000 (08:46 -0600)] 
expo: Move cedit-state fields into expo

Move the boolean flags into struct expo so that the state can be
maintained over function calls.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Create a rendering test for cedit
Simon Glass [Fri, 2 May 2025 14:46:19 +0000 (08:46 -0600)] 
expo: Create a rendering test for cedit

Add a test to check that the cedit renders as expected.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 months agoexpo: Destroy the cedit expo when done
Simon Glass [Fri, 2 May 2025 14:46:17 +0000 (08:46 -0600)] 
expo: Destroy the cedit expo when done

Once 'cedit run' is completed, destroy the expo so that a fresh one is
used for any future editing.

Signed-off-by: Simon Glass <sjg@chromium.org>