]> git.ipfire.org Git - thirdparty/u-boot.git/log
thirdparty/u-boot.git
16 months agoddr: imx: Add new rates for i.MX91
Ye Li [Tue, 3 Dec 2024 15:42:51 +0000 (23:42 +0800)] 
ddr: imx: Add new rates for i.MX91

iMX91 reuses iMX93 controller and PHY, but with lower speed,
so add new DDR rates for i.MX91.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
16 months agoclk: imx: clk-fracn-gppll: Add new PLL rate
Ye Li [Tue, 3 Dec 2024 15:42:50 +0000 (23:42 +0800)] 
clk: imx: clk-fracn-gppll: Add new PLL rate

Add new rates to integer and frac PLL to support iMX91

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
16 months agoclk: imx93: support i.MX91
Peng Fan [Tue, 3 Dec 2024 15:42:49 +0000 (23:42 +0800)] 
clk: imx93: support i.MX91

i.MX91 is a derived from i.MX93, and most clocks could be reused from
i.MX93. Also Update imx93-clock.h to sync with linux next.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
16 months agoimx: Add iMX91 support
Peng Fan [Tue, 3 Dec 2024 15:42:48 +0000 (23:42 +0800)] 
imx: Add iMX91 support

iMX91 is reduced part from iMX93 with part number: i.MX9131/11/01
It removed A55_1, M33, MIPI DSI, LVDS, etc.

i.MX9131:
  - Support 2.4GT/s DDR and HWFFC at 1.2GT/s
i.MX9121:
  - A55 at 800Mhz and DDR at 1600MTS, with low drive mode.
i.MX9111:
  - Support 1.6GT/s DDR and HWFFC at 800MT/s
i.MX9101:
  - Support 800Mhz ARM clock
  - Support 1.6GT/s DDR and HWFFC at 800MT/s
  - No parallel display, eQOS, flexcan

Updated Clock/Container/CPU and etc for i.MX91

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
16 months agoimx93: Update 9x9 part fuses checking
Ye Li [Tue, 3 Dec 2024 15:42:47 +0000 (23:42 +0800)] 
imx93: Update 9x9 part fuses checking

According to iMX93 fuse burn plan, all 9x9 parts will have USB2,
ENET1 (FEC), LVDS1, CSI1 and DSI1 disabled. The codes missed ENET1
fuse when detecting 9x9. Although it still can detect 9x9 correctly,
we add the ENET1 fuse to the check to be more accurate.

Fixes: 58da865e27f ("imx9: add i.MX93 variants support")
Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
16 months agoimx9: gpio: include types.h header
Peng Fan [Tue, 3 Dec 2024 15:42:46 +0000 (23:42 +0800)] 
imx9: gpio: include types.h header

Include types.h header for u32, following Linux Coding Style to include
necessary headers.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
16 months agoimx9: trdc: correct DEBUG usage
Peng Fan [Tue, 3 Dec 2024 15:42:45 +0000 (23:42 +0800)] 
imx9: trdc: correct DEBUG usage

Replace '#if DEBUG' with '#ifdef DEBUG', otherwise '#define DEBUG 1'
should be used and conflict with '#define DEBUG' in include/log.h

Fixes: 5fda95fb944 ("imx: imx9: Add TRDC driver for TRDC init")
Signed-off-by: Peng Fan <peng.fan@nxp.com>
16 months agogpio: imx_rgpio2p: Move 8ulp_data to data section
Peng Fan [Tue, 3 Dec 2024 15:42:44 +0000 (23:42 +0800)] 
gpio: imx_rgpio2p: Move 8ulp_data to data section

have_dual_base is set to false, so the 8ulp_data will be put in BSS
section which conflicts with the area of u-boot.dtb which padded just
after u-boot-nodtb.bin. So move 8ulp_data to data section to avoid
its content being corrupted by dtb.

Fixes: 51cfa66f2c4 ("gpio: imx_rgpio2p: support one address")
Signed-off-by: Peng Fan <peng.fan@nxp.com>
16 months agoboard: phytec: phycore_imx8mm: Add RAUC boot logic to environment
Yunus Bas [Tue, 3 Dec 2024 09:42:35 +0000 (10:42 +0100)] 
board: phytec: phycore_imx8mm: Add RAUC boot logic to environment

Add RAUC boot logic to the environment.

Signed-off-by: Yunus Bas <y.bas@phytec.de>
16 months agophycore_imx8mm: Move default bootcmd to board env
Yunus Bas [Tue, 3 Dec 2024 09:42:34 +0000 (10:42 +0100)] 
phycore_imx8mm: Move default bootcmd to board env

Move the default bootcmd from the defconfig to the board environment.

Signed-off-by: Yunus Bas <y.bas@phytec.de>
16 months agophycore_imx8mm: Switch to using env text files
Yunus Bas [Tue, 3 Dec 2024 09:42:33 +0000 (10:42 +0100)] 
phycore_imx8mm: Switch to using env text files

Move the environment into the board directory and convert header to a
txt file. In addition, this patch also applies following changes:

- Change default nfsroot path to /srv/nfs due to compliance with Linux
FHS 3.0.

- Rename specific variables as stated in the bootstd documentation.
Renamed variables:
fdt_addr => fdt_addr_r
fdt_file => fdtfile

Signed-off-by: Yunus Bas <y.bas@phytec.de>
16 months agombedtls: remove MBEDTLS_HAVE_TIME
Ilias Apalodimas [Fri, 6 Dec 2024 10:56:45 +0000 (12:56 +0200)] 
mbedtls: remove MBEDTLS_HAVE_TIME

When MbedTLS TLS features were added MBEDTLS_HAVE_TIME was defined as part
of enabling https:// support. However that pointed to the wrong function
which could crash if it received a NULL pointer.

Looking closer that function is not really needed, as it only seems to
increase the RNG entropy by using 4b of the current time and date.
The reason that was enabled is that lwIP was unconditionally requiring it,
although it's configurable and can be turned off.

Since lwIP doesn't use that field anywhere else, make it conditional and
disable it from our config.

Fixes: commit a564f5094f62 ("mbedtls: Enable TLS 1.2 support")
Reported-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
16 months agoarm: qemu: fix update_info declaration
Vincent Stehlé [Fri, 6 Dec 2024 07:58:53 +0000 (08:58 +0100)] 
arm: qemu: fix update_info declaration

Add a missing comma in the update_info structure declaration.

This fixes the following build error when building with
EFI_RUNTIME_UPDATE_CAPSULE or EFI_CAPSULE_ON_DISK:

  board/emulation/qemu-arm/qemu-arm.c:52:9: error: request for member ‘images’ in something not a structure or union

Fixes: cccea18813c4 ("efi_loader: add the number of image entries in efi_capsule_update_info")
Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
Cc: Masahisa Kojima <masahisa.kojima@linaro.org>
Cc: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Cc: Tom Rini <trini@konsulko.com>
16 months agonet: disable MBEDTLS in SPL
Heinrich Schuchardt [Fri, 6 Dec 2024 11:37:09 +0000 (12:37 +0100)] 
net: disable MBEDTLS in SPL

Building SPL fails with MBEDTLS enabled.
Currently we don't need it there.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
16 months agortc: CONFIGS_RTC_PL031 must depend on CONFIGS_DM_RTC
Heinrich Schuchardt [Thu, 5 Dec 2024 20:36:19 +0000 (21:36 +0100)] 
rtc: CONFIGS_RTC_PL031 must depend on CONFIGS_DM_RTC

Building qemu_arm64_defconfig with CONFIGS_DM_RTC=n and CONFIGS_RTC_PL031=y
leads to a build failure.

Adjust the vexpress64 configuration to avoid circular dependency.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
16 months agolmb: prohibit allocations above ram_top even from same bank
Sughosh Ganu [Mon, 2 Dec 2024 07:06:24 +0000 (12:36 +0530)] 
lmb: prohibit allocations above ram_top even from same bank

There are platforms which set the value of ram_top based on certain
restrictions that the platform might have in accessing memory above
ram_top, even when the memory region is in the same DRAM bank. So,
even though the LMB allocator works as expected, when trying to
allocate memory above ram_top, prohibit this by marking all memory
above ram_top as reserved, even if the said memory region is from the
same bank.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Tested-by: Andreas Schwab <schwab@suse.de>
16 months agoconfigs: Resync with savedefconfig
Tom Rini [Fri, 6 Dec 2024 23:40:50 +0000 (17:40 -0600)] 
configs: Resync with savedefconfig

Resync all defconfig files using qconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
16 months agoMerge patch series "board: ti: k3-am65: covert last board to OF_UPSTREAM"
Tom Rini [Fri, 6 Dec 2024 22:39:26 +0000 (16:39 -0600)] 
Merge patch series "board: ti: k3-am65: covert last board to OF_UPSTREAM"

Bryan Brattlof <bb@ti.com> says:

Hello Everyone!

This small series converts TI's AM65x reference board to use
CONFIG_OF_UPSTREAM and removes the unused device tree files from
arch/arm/dts.

Because it's the last board using a AM65x without enabling OF_UPSTREAM
it allows us to also remove all the SoC FDT files as well and keep a
single version of the SoC's DT files in the dts/upstream directory going
forward.

Link: https://lore.kernel.org/r/20241121-am65x-v1-0-fe87aff1b5fc@ti.com
16 months agoarm: dts: k3-am65: remove unsused am65x SoC fdt files
Bryan Brattlof [Thu, 21 Nov 2024 21:17:51 +0000 (15:17 -0600)] 
arm: dts: k3-am65: remove unsused am65x SoC fdt files

With all boards using TI's AM65x having enabled CONFIG_OF_UPSTREAM
cleanup the unused SoC fdt files.

Signed-off-by: Bryan Brattlof <bb@ti.com>
16 months agoarm: dts: k3-am654: cleanup unused board files
Bryan Brattlof [Thu, 21 Nov 2024 21:17:50 +0000 (15:17 -0600)] 
arm: dts: k3-am654: cleanup unused board files

With the reference board now using CONFIG_OF_UPSTREAM these board files
are unused. Remove them

Signed-off-by: Bryan Brattlof <bb@ti.com>
16 months agoboard: ti: am65x: migrate to OF_UPSTREAM
Bryan Brattlof [Thu, 21 Nov 2024 21:17:49 +0000 (15:17 -0600)] 
board: ti: am65x: migrate to OF_UPSTREAM

Rather than rely on manual updates from the arch/arm/dts directory,
enable CONFIG_OF_UPSTREAM to receive automatic device tree updates for
the am65x reference board.

Signed-off-by: Bryan Brattlof <bb@ti.com>
16 months agoMerge patch series "PLL Sequencing update"
Tom Rini [Fri, 6 Dec 2024 22:38:50 +0000 (16:38 -0600)] 
Merge patch series "PLL Sequencing update"

Manorit Chawdhry <m-chawdhry@ti.com> says:

It has done a re-write of the full driver and the commits aren't split
to keep the bisectability intact.

Boot Logs: https://gist.github.com/manorit2001/1eaba109d722715a233244da693133d3

Link: https://lore.kernel.org/r/20241121-b4-upstream-pll-fix-v1-0-904f618897a7@ti.com
16 months agoclk: ti: clk-k3-pll: Add additional robustness steps to the PLL sequence
Manorit Chawdhry [Thu, 21 Nov 2024 12:02:53 +0000 (17:32 +0530)] 
clk: ti: clk-k3-pll: Add additional robustness steps to the PLL sequence

Based on the recommendation from HW team make modifications to
the sequence for more robustness.

- Unlock the PLL registers
- Enable external bypass
- Disable the PLL
- Program pllm and pllf
- Program Ref divider
- Enable other PLL controls like DSM_EN, DAC_EN,etc
- Enable calibration if available
- Enable PLL
- Wait for PLL lock and Calibration lock
- Remove external bypass

Re-write the full sequence from scratch as the previous sequence was way
off and keep it in a single commit for bisectability.

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
16 months agoclk: ti: clk-k3-pll: Change variable name reg to base
Manorit Chawdhry [Thu, 21 Nov 2024 12:02:52 +0000 (17:32 +0530)] 
clk: ti: clk-k3-pll: Change variable name reg to base

base is more appropriate for the usage as the variable stores the base
address and seems more accurate w.r.t reg. Change reg to base.

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
16 months agoarm: dts: k3-*-r5: Remove clocks from mcu_timer0
Manorit Chawdhry [Thu, 21 Nov 2024 12:02:51 +0000 (17:32 +0530)] 
arm: dts: k3-*-r5: Remove clocks from mcu_timer0

Updated PLL driver sequencing requires us to use udelay in the PLL
driver as there is no poll bit to get the status of operations.
tick-timer(mcu_timer0/main_timer0) setting up the clocks for itself is
something that won't work as the PLL driver will be using udelay and
PLLs are configured during clock probe which would end up in a recursive
probe.

tick-timer being used by K3 devices are configured by ROM and we really
don't need to configure any of the clocks.

Remove the clock dependency from R5 stage as we don't need to setup
clocks for it.

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
16 months agoenv: Switch the callback static list to Kconfig
Christoph Niedermaier [Wed, 20 Nov 2024 16:01:35 +0000 (17:01 +0100)] 
env: Switch the callback static list to Kconfig

Switch the callback static list from the board configuration variable
CFG_ENV_CALLBACK_LIST_STATIC to Kconfig CONFIG_ENV_CALLBACK_LIST_STATIC.

Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com>
Reviewed-by: Marek Vasut <marex@denx.de>
16 months agoram: k3-ddrss: drop debug() in timing-sensitive sequence
Théo Lebrun [Fri, 15 Nov 2024 09:43:15 +0000 (10:43 +0100)] 
ram: k3-ddrss: drop debug() in timing-sensitive sequence

Those debug() calls might be useful, but beware. They can cause the DDR
controller to hang if we do not run the sequence quickly enough.

They usually are not an issue with upstream U-Boot and the default DDR
config, but they have become troublesome with custom DDR configs.

Drop those debug() statements that shouldn't be present in
time-sensitive code, to avoid anyone else falling into the trap.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
16 months agoMerge patch series "led: update LED boot/activity to new property implementation"
Tom Rini [Fri, 6 Dec 2024 19:00:52 +0000 (13:00 -0600)] 
Merge patch series "led: update LED boot/activity to new property implementation"

Christian Marangi <ansuelsmth@gmail.com> says:

This series is split in 2 part.

While adapting the LED boot and activity code to the new property
accepted by Rob in dt-schema repository, a big BUG was discovered.

The reason wasn't clear at start and took me some days to figure it
out.

This was triggered by adding a new phandle in the test.dts to
introduce test for the new OPs.

This single addition caused the sandbox CI test to fail in the
dm_test_ofnode_phandle_ot test.

This doesn't make sense as reverting the change made the CI test
to correctly finish. Also moving the uboot node down
after the first phandle (in test.dts the gpio one) also made
the CI test to correctly finish.

A little bit of searching and debugging made me realize the
parse phandle OPs didn't support other.dts at all and they
were still referencing phandle index from test.dts.
(more info in the related commit)

In short the test was broken all along and was working by
pure luck. The first 4 patch address and fix the problem for good.

The other 4 patch expand and address the property change for
LED boot/activity.

Posting in a single series as changes are trivial and just
to speedup review process. (and also because the second
part depends on the first)

All CI tested with azure pipeline.

Link: https://lore.kernel.org/r/20241110115054.2555-1-ansuelsmth@gmail.com
16 months agotest: dm: Update test for LED activity and boot
Christian Marangi [Sun, 10 Nov 2024 11:50:27 +0000 (12:50 +0100)] 
test: dm: Update test for LED activity and boot

Update test for LED activity and boot to follow new implementation with
property set to the LED node phandle.

Also update a copy-paste error in the function name for the activity
tests and actually enable the test with the DM_TEST macro.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agoled: update LED boot/activity to new property implementation
Christian Marangi [Sun, 10 Nov 2024 11:50:26 +0000 (12:50 +0100)] 
led: update LED boot/activity to new property implementation

Update LED boot/activity to reference by phandle instead of label and
add to period property the "-ms" suffix.
This is a followup request by dt-schema maintainers that required LED
node to be referenced by a phandle to the node instead of indirectly by
the LED label and for timevalue to have a suffix.

While at it generalize the LED node label parsing since the logic is
common for generic LED bind and LED activity/boot.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
16 months agotest: dm: Add test for ofnode options phandle helper
Christian Marangi [Sun, 10 Nov 2024 11:50:25 +0000 (12:50 +0100)] 
test: dm: Add test for ofnode options phandle helper

Add test for ofnode options phandle helper and add new property in the
sandbox test dts.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agodm: core: implement phandle ofnode_options helper
Christian Marangi [Sun, 10 Nov 2024 11:50:24 +0000 (12:50 +0100)] 
dm: core: implement phandle ofnode_options helper

Implement ofnode_options phandle helper to get an ofnode from a phandle
option in /options/u-boot.

This helper can be useful since new DT yaml usually require to link a
phandle of a node instead of referencing it by name or other indirect
way.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agotest: dm: Expand dm_test_ofnode_phandle(_ot) with new ofnode/tree_parse_phandle
Christian Marangi [Sun, 10 Nov 2024 11:50:23 +0000 (12:50 +0100)] 
test: dm: Expand dm_test_ofnode_phandle(_ot) with new ofnode/tree_parse_phandle

Expand dm_test_ofnode_phandle(_ot) with new ofnode/tree_parse_phandle() op.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agodm: core: implement ofnode/tree_parse_phandle() helper
Christian Marangi [Sun, 10 Nov 2024 11:50:22 +0000 (12:50 +0100)] 
dm: core: implement ofnode/tree_parse_phandle() helper

Implement ofnode/tree_parse_phandle() helper as an equivalent of
of_parse_phandle to handle simple single value phandle.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agotest: dm: fix broken dm_test_ofnode_phandle_ot and get_by_phandle_ot
Christian Marangi [Sun, 10 Nov 2024 11:50:21 +0000 (12:50 +0100)] 
test: dm: fix broken dm_test_ofnode_phandle_ot and get_by_phandle_ot

Fix broken dm_test_ofnode_phandle_ot test. They never actually worked
and were passing test by pure luck by having the same phandle index of
test.dts that coincicentally had #gpio-cells in the same index node.

It was sufficient to add a phandle to test.dts to make the test fail.

To correctly test these feature, make use oif the new OPs oftree to
parse phandle.

For consistency with the dm_test_ofnode_phandle, rework the test and
other.dts to use the same property with the other- prefix to every
node.

Also fix dm_test_ofnode_get_by_phandle_ot by making it more robust and
renaming the phandle property to other-phandle.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agodm: core: implement oftree variant of parse_phandle OPs
Christian Marangi [Sun, 10 Nov 2024 11:50:20 +0000 (12:50 +0100)] 
dm: core: implement oftree variant of parse_phandle OPs

Implement oftree variant of parse_phandle OPs.

There is currently a very hidden and laten BUG with parse_phandle OPs
that doesn't permit the support of multiple DTS in a system. One usage
example if sandbox with the usage of other.dts

The BUG is only present on live scenario where of_... OPs are used and
it's not present when fdt... OPs are used.

This is caused by an assumption made in __of_parse_phandle_with_args,
with the of_find_node_by_phandle call that pass the first arg as NULL.

This makes of_find_node_by_phandle use the default root node of the
system and doesn't permit the usage of alternative tree. This is correct
for normal system and also for the linux kernel where it's assumed a
single device tree.

It's problematic if other device tree needs to be used.

To fix this, introduce __of_root_parse_phandle_with_args to define a
root device tree for of_find_node_by_phandle.

Introduce all the variant OPs for this and in ofnode, the oftree OPs
following how it's done for other OPs with similar task.

For FDT scenario, ofnode_from_fdtdec_phandle_args is reworked to accept
a new variable, node and noffset_to_ofnode is used instead of
offset_to_ofnode. This is required to support multiple FDB blob to
calculate the correct of_offset of the ofnode.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-pmic
Tom Rini [Thu, 5 Dec 2024 14:11:35 +0000 (08:11 -0600)] 
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-pmic

CI: https://source.denx.de/u-boot/custodians/u-boot-pmic/-/pipelines/23718

- Correct a few debug/error print calls

16 months agoMerge tag 'efi-master-05122024' of https://source.denx.de/u-boot/custodians/u-boot-tpm
Tom Rini [Thu, 5 Dec 2024 14:10:51 +0000 (08:10 -0600)] 
Merge tag 'efi-master-05122024' of https://source.denx.de/u-boot/custodians/u-boot-tpm

CI: https://source.denx.de/u-boot/custodians/u-boot-tpm/-/pipelines/23719

Two fixes for the EFI subsystem coming via the TPM tree as agreed by Heinrich

The LMB patch fixes a failure in SystemReady testing. Nothing bad happens
without the patch in the device operation, but the return values are wrong
and SCT tests fail for MemoryAllocationServicesTest category.

The second is a shielding the device against mistakes in the definition of
struct fields needed by the capsule update mechanism. Instead of crashing,
print a humna readable message of what's wrong.

16 months agolmb: Fix the allocation of overlapping memory areas with !LMB_NONE
Ilias Apalodimas [Mon, 2 Dec 2024 14:42:45 +0000 (16:42 +0200)] 
lmb: Fix the allocation of overlapping memory areas with !LMB_NONE

At the moment the LMB allocator will return 'success' immediately on two
consecutive allocations if the second one is smaller and the flags match
without resizing the reserved area.

This is problematic for two reasons, first of all the new updated
allocation won't update the size and we end up holding more memory than
needed, but most importantly it breaks the EFI SCT tests since EFI
now allocates via LMB.

More specifically when EFI requests a specific address twice with the
EFI_ALLOCATE_ADDRESS flag set, the first allocation will succeed and
update the EFI memory map. Due to the LMB behavior the second allocation
will also succeed but the address ranges are already in the EFI memory
map due the first allocation. EFI will then fail to update the memory map,
returning EFI_OUT_OF_RESOURCES instead of EFI_NOT_FOUND which break EFI
conformance.

So let's remove the fast check with is problematic anyway and leave LMB
resize and calculate address properly. LMB will now
- try to resize the reservations for LMB_NONE
- return -1 if the memory is not LMB_NONE and already reserved

The LMB code needs some cleanup in that part, but since we are close to
2025.01 do the easy fix and plan to refactor it later.
Also update the dm tests with the new behavior.

Fixes: commit 22f2c9ed9f53 ("efi: memory: use the lmb API's for allocating and freeing memory")
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
16 months agoefi_loader: Check for a valid fw_name before auto generating GUIDs
Ilias Apalodimas [Tue, 3 Dec 2024 16:13:37 +0000 (18:13 +0200)] 
efi_loader: Check for a valid fw_name before auto generating GUIDs

The gen_v5_guid() is a void and does no error checking with pointers
being available etc. Instead it expects all things to be in place to
generate GUIDs. If a board capsule definition is buggy and does not
define the firmware names when enabling capsule updates, the board will
crash trying to bring up the EFI subsystem.

Check for a valid firmware name before generating GUIDs.

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
16 months agopower: regulator: replace dev_dbg() by dev_err() in regulator_post_bind()
Patrice Chotard [Tue, 3 Dec 2024 10:06:11 +0000 (11:06 +0100)] 
power: regulator: replace dev_dbg() by dev_err() in regulator_post_bind()

To ease debugging, use dev_err() instead of dev_dbg() for
alerting when regulator has nonunique value.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
16 months agopower: regulator: replace some debug() by dev_dbg()
Patrice Chotard [Tue, 3 Dec 2024 10:06:10 +0000 (11:06 +0100)] 
power: regulator: replace some debug() by dev_dbg()

Replace some debug() by dev_dbg() when dev variable
is available/valid.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
16 months agoMerge patch series "Add OPP_LOW support for J7200"
Tom Rini [Wed, 4 Dec 2024 20:30:25 +0000 (14:30 -0600)] 
Merge patch series "Add OPP_LOW support for J7200"

Aniket Limaye <a-limaye@ti.com> says:

This series adds OPP_LOW spec data in k3_avs driver and enables a config
option to select the OPP_LOW performance point.

J7200 SOC supports OPP_LOW and OPP_NOM as two Operating Performance
Points as per (7.5 Operating Performance Points) section in the
Datasheet [0].
- A72SS/MSMC at 2 GHz/1GHz operation must use OPP_NOM.
- A72SS/MSMC at 1 GHz/500 MHz operation can use OPP_NOM or OPP_LOW
  voltage (though OPP_LOW voltage is recommended to reduce power
  consumption).

The actual OPP voltage for the device is read from the efuse and
updated in k3_avs_probe().

The default j7200 devicetree and k3_avs driver set OPP_NOM spec
frequency and voltage.

In the board init file, if K3_OPP_LOW config is enabled, Check if
OPP_LOW AVS voltage read from efuse is valid and update frequency (A72
and MSMC) and voltage (VDD_CPU) as per the OPP_LOW spec.

[0]: https://www.ti.com/lit/gpn/dra821u  (J7200 Datasheet)

Test logs:
https://gist.github.com/aniket-l/328ad93ed60c2419ed7be9f85e6b6075
- With series applied on master and CONFIG_K3_OPP_LOW enabled in
  j7200_evm_r5_defconfig
- Logs shown with and without efuse register programmed for OPP_0
  (Errors out if OPP_0 not found, programs OPP_LOW spec if found)
- Voltage update verified using 'i2c md 0x4c 0xe' in u-boot
- Frequency update verified using 'k3conf clock dump' in linux

Link: https://lore.kernel.org/r/20241119003617.1871183-1-a-limaye@ti.com
16 months agoconfigs: j7200_evm_r5_defconfig: Define K3_OPP_LOW
Reid Tonking [Tue, 19 Nov 2024 00:32:59 +0000 (06:02 +0530)] 
configs: j7200_evm_r5_defconfig: Define K3_OPP_LOW

Define new CONFIG_K3_OPP_LOW under arm/mach-k3/r5/Kconfig and add
default value to j7200_evm_r5_defconfig

Signed-off-by: Reid Tonking <reidt@ti.com>
Signed-off-by: Aniket Limaye <a-limaye@ti.com>
16 months agoarm: mach-k3: j721e-init.c: Add support for CONFIG_K3_OPP_LOW
Aniket Limaye [Tue, 19 Nov 2024 00:32:58 +0000 (06:02 +0530)] 
arm: mach-k3: j721e-init.c: Add support for CONFIG_K3_OPP_LOW

The default j7200 devicetree and k3_avs driver set 2GHz/1GHz frequency
for A72/MSMC clks and the OPP_NOM voltage.

J7200 SOCs may support OPP_LOW Operating Performance Point:
1GHz/500MHz clks for A72/MSMC and OPP_LOW AVS voltage read from efuse.

Hence, add a config check in board_init_f() to select OPP_LOW specs:
- Check if OPP_LOW AVS voltage read from efuse is valid.
- Use the device IDs and clock IDs (TISCI docs [0]) to find the A72 and
  MSMC clock frequencies in the devicetree.
- Fixup the clock frequencies in devicetree as per OPP_LOW spec.

k3_avs driver programs the OPP_LOW AVS voltage for VDD_CPU through
k3_avs_notify_freq() callback from clk_k3.

[0]: https://software-dl.ti.com/tisci/esd/latest/5_soc_doc/j7200/clocks.html

Signed-off-by: Aniket Limaye <a-limaye@ti.com>
Reviewed-by: Manorit Chawdhry <m-chawdhry@ti.com>
16 months agomisc: k3_avs: Check validity of efuse voltage data
Reid Tonking [Tue, 19 Nov 2024 00:32:57 +0000 (06:02 +0530)] 
misc: k3_avs: Check validity of efuse voltage data

k3_avs driver checks opp_ids when probing and overwrites the voltage
values in vd_data for the respective board. The new k3_avs_check_opp()
can be called from board files to check the efuse data and returns 0 if
valid.

Also add the same check in k3_avs_program_voltage() to error out if
the efuse data was not valid.

Signed-off-by: Reid Tonking <reidt@ti.com>
Signed-off-by: Aniket Limaye <a-limaye@ti.com>
Reviewed-by: Manorit Chawdhry <m-chawdhry@ti.com>
16 months agomisc: k3_avs: Add OPP_LOW voltage and frequency to vd_data
Reid Tonking [Tue, 19 Nov 2024 00:32:56 +0000 (06:02 +0530)] 
misc: k3_avs: Add OPP_LOW voltage and frequency to vd_data

J7200 SOC supports OPP_LOW and OPP_NOM as two Operating Performance
Points as per (7.5 Operating Performance Points) section in the
Datasheet [0].
- A72SS/MSMC at 2 GHz/1GHz operation must use OPP_NOM.
- A72SS/MSMC at 1 GHz/500 MHz operation can use OPP_NOM or OPP_LOW
  voltage (though OPP_LOW voltage is recommended to reduce power
  consumption).

Add OPP_LOW frequency->voltage entry to vd_data.

The actual OPP voltage for the device is read from the efuse and
updated in k3_avs_probe().
OPP_NOM corresponds to OPP_1 and OPP_LOW to OPP_0 efuse register
fields, as described in the Datasheet [0]
The register offsets and fields are described in the TRM (5.2.6.1.5
WKUP_VTM_VD_OPPVID_j Register) [1].

[0]: https://www.ti.com/lit/gpn/dra821u (J7200 Datasheet)
[1]: https://www.ti.com/lit/pdf/spruiu1 (J7200 TRM)

Signed-off-by: Reid Tonking <reidt@ti.com>
Signed-off-by: Aniket Limaye <a-limaye@ti.com>
16 months agoarm: dts: k3-j7200-r5-common: Add msmc clk to a72 node
Reid Tonking [Tue, 19 Nov 2024 00:32:55 +0000 (06:02 +0530)] 
arm: dts: k3-j7200-r5-common: Add msmc clk to a72 node

The j7200 SOC has a single DDR controller and hence no need for
configuring the MSMC interleaver. Hence we do not have an explicit node
for MSMC in j7200 DT, unlike j721s2/j784s4.

Also, MSMC clk id is described under A72SS0_CORE0 Device in TISCI
documentation [0].

Considering the above, define the MSMC clk in the a72 node.

[0]: https://software-dl.ti.com/tisci/esd/latest/5_soc_doc/j7200/clocks.html#clocks-for-a72ss0-core0-device

Signed-off-by: Reid Tonking <reidt@ti.com>
Signed-off-by: Aniket Limaye <a-limaye@ti.com>
Reviewed-by: Manorit Chawdhry <m-chawdhry@ti.com>
16 months agoMerge patch series "Enable AVS support for AM68, AM69 and J784S4"
Tom Rini [Wed, 4 Dec 2024 20:29:11 +0000 (14:29 -0600)] 
Merge patch series "Enable AVS support for AM68, AM69 and J784S4"

Neha Malcom Francis <n-francis@ti.com> says:

This series adds AVS support for AM68 SK, AM69 SK and J784S4 EVM.

Boot logs:
https://gist.github.com/nehamalcom/db5dbf98357ebac46f648c24ad1a17e2

Link: https://lore.kernel.org/r/20241118105714.1973573-1-n-francis@ti.com
16 months agoconfigs: am68_sk_r5: Add AVS Configs
Udit Kumar [Mon, 18 Nov 2024 10:57:14 +0000 (16:27 +0530)] 
configs: am68_sk_r5: Add AVS Configs

Add AVS and PMIC regulator configs

Signed-off-by: Udit Kumar <u-kumar1@ti.com>
Reviewed-by: Manorit Chawdhry <m-chawdhry@ti.com>
16 months agoconfigs: j784s4_evm_r5_defconfig: Enable AVS
Neha Malcom Francis [Mon, 18 Nov 2024 10:57:13 +0000 (16:27 +0530)] 
configs: j784s4_evm_r5_defconfig: Enable AVS

Enable AVS support on J784S4 along with regulator.

Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
Reviewed-by: Manorit Chawdhry <m-chawdhry@ti.com>
16 months agoarch: arm: mach-k3: j784s4_init: Probe AVS driver
Neha Malcom Francis [Mon, 18 Nov 2024 10:57:12 +0000 (16:27 +0530)] 
arch: arm: mach-k3: j784s4_init: Probe AVS driver

Probe the AVS driver to set the AVS voltage.

Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
Reviewed-by: Manorit Chawdhry <m-chawdhry@ti.com>
16 months agoarm: dts: k3-am68-sk-r5-base-board: Add VTM node to R5 stage
Neha Malcom Francis [Mon, 18 Nov 2024 10:57:11 +0000 (16:27 +0530)] 
arm: dts: k3-am68-sk-r5-base-board: Add VTM node to R5 stage

Add the VTM node to the R5 boot stage so that AVS is correctly
configured for AM68 SK.

Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
Reviewed-by: Manorit Chawdhry <m-chawdhry@ti.com>
16 months agoarm: dts: k3-j784s4-r5: Add VTM node to R5 stage
Neha Malcom Francis [Mon, 18 Nov 2024 10:57:10 +0000 (16:27 +0530)] 
arm: dts: k3-j784s4-r5: Add VTM node to R5 stage

Add VTM node to R5 boot stage so that AVS gets correctly configured for
J784S4 EVM and AM69 SK.

Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
Reviewed-by: Manorit Chawdhry <m-chawdhry@ti.com>
16 months agoarm: dts: k3-am68: Enable OSPI boot
Udit Kumar [Tue, 19 Nov 2024 09:47:23 +0000 (15:17 +0530)] 
arm: dts: k3-am68: Enable OSPI boot

Enable OSPI node to allow OSPI boot on AM68

Signed-off-by: Udit Kumar <u-kumar1@ti.com>
16 months agodm: gpio: Return error when pull up/down is requested but set_flags ops is not implme...
Zixun LI [Mon, 21 Oct 2024 15:04:51 +0000 (17:04 +0200)] 
dm: gpio: Return error when pull up/down is requested but set_flags ops is not implmentated

Currently in _dm_gpio_set_flags() when set_flags ops is not implemented
direction_output()/_input() is used, but pull up/down is not supported by
these ops.

Signed-off-by: Zixun LI <admin@hifiphile.com>
16 months agobutton: gpio: handle broken controller
Caleb Connolly [Wed, 13 Nov 2024 04:59:24 +0000 (05:59 +0100)] 
button: gpio: handle broken controller

Avoid crashing U-Boot when the GPIO controller for a button is disabled
or failed to probe. We also need to check the priv data for each button
since even if a button fails to probe it will still be polled by the
core code.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
16 months agoboard: phytec: common: Introduce CONFIG_PHYTEC_K3_DDR_PATCH
Garrett Giordano [Tue, 12 Nov 2024 20:40:23 +0000 (12:40 -0800)] 
board: phytec: common: Introduce CONFIG_PHYTEC_K3_DDR_PATCH

Introduce CONFIG_PHYTEC_K3_DDR_PATCH to make DDR timing patch code
optional for PHYTEC K3 boards. This allows better control over which
boards receive DDR timing patches, rather than compiling the code for
all boards with K3_DDRSS enabled.

Also enable the feature by default for PHYCORE_AM62X_R5.

Signed-off-by: Garrett Giordano <ggiordano@phytec.com>
Reviewed-by: Wadim Egorov <w.egorov@phytec.de>
16 months agoeeprom: at24: add ST M24256E Additional Write lockable page support
Marek Vasut [Fri, 8 Nov 2024 18:52:26 +0000 (19:52 +0100)] 
eeprom: at24: add ST M24256E Additional Write lockable page support

The ST M24256E behaves as a regular M24C256, except for the E variant
which uses up another I2C address for Additional Write lockable page.
This page is 64 Bytes long and can contain additional data. Add entry
for it, so users can describe that page in DT. Note that users still
have to describe the main M24C256 area separately as that is on separate
I2C address from this page.

Unlike M24C32-D and M24C64-D, this part is specifically ST and does not
have any comparable M24* counterparts from other vendors, hence the st,
vendor prefix. Furthermore, the part name is M24256E without C between
the 24 and 256, this is not a typo. Finally, there is M24C256-D part,
which does contain 32 Bytes long Additional Write lockable page, which
is a different part and not supported by this patch.

Datasheet: https://www.st.com/resource/en/datasheet/m24256e-f.pdf

From Linux kernel commit:
339cb28b9ee6 ("eeprom: at24: add ST M24256E Additional Write lockable page support")

Signed-off-by: Marek Vasut <marex@denx.de>
16 months agoarm: sunxi: Use "imply" for USB without further guards
Tom Rini [Fri, 15 Nov 2024 16:53:59 +0000 (10:53 -0600)] 
arm: sunxi: Use "imply" for USB without further guards

Given that ARCH_SUNXI already implies that USB_GADGET should be enable,
we should also imply USB being enabled.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
16 months agoefi_loader: Fix Kconfig logic around OF_LIBFDT
Tom Rini [Fri, 15 Nov 2024 16:53:58 +0000 (10:53 -0600)] 
efi_loader: Fix Kconfig logic around OF_LIBFDT

Given that OF_LIBFDT is library functionality, the feature of EFI_LOADER
needs to select OF_LIBFDT rather than depend on it being already
enabled.

Acked-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
16 months agoaspeed: Fix Kconfig logic on "DM_RESET" and ASPEED_AST2500
Tom Rini [Fri, 15 Nov 2024 16:53:57 +0000 (10:53 -0600)] 
aspeed: Fix Kconfig logic on "DM_RESET" and ASPEED_AST2500

It is not the case that we can only pick ASPEED_AST2500 if DM_RESET
is enabled, but rather choosing ASPEED_AST2500 means we must select
DM_RESET.

Signed-off-by: Tom Rini <trini@konsulko.com>
16 months agoMerge tag 'efi-next-2024-12-04' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Wed, 4 Dec 2024 15:32:28 +0000 (09:32 -0600)] 
Merge tag 'efi-next-2024-12-04' of https://source.denx.de/u-boot/custodians/u-boot-efi into next

CI: https://source.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/23707

With this pull request support for the EFI_HTTP_PROTOCOL and
EFI_IP4_CONFIG2 protocols are added. This allows EFI applications
to load files via HTTP.

UEFI:
      add efi_dp_from_ipv4 function
      add efi_net_set_addr, efi_net_get_addr functions
      add support for HTTP device path
      set EFI bootdevice device path to HTTP when loaded from wget
      add support to send http requests and parse http headers
      provide EFI_IP4_CONFIG2_PROTOCOL
      provide EFI_HTTP_PROTOCOL
      support IPv4() in device path to text protocol
      provide unit tests for the HTTP and IPv4 Config2 protocols

Network:
      zero terminate string with headers in wget_fill_info()
      zero terminate string with headers in wget_lwip_fill_info()
      pass port and server_name via wget_ctx in lwIP network stack
      let wget_with_dns work with dns disabled

Others:
      Add HTTP and IPV4 Config II protocols to UUID library functions.

16 months agoefi_selftest: add test for IPv4 Config2 protocol
Adriano Cordova [Wed, 4 Dec 2024 03:05:29 +0000 (00:05 -0300)] 
efi_selftest: add test for IPv4 Config2 protocol

Add a test for the EFI_IP4_CONFIG2_PROTOCOL. The test sets the ip
policy to static, adds an ip address, and then reads the current
ip address and checks for it to be the same as the one that was set.

Signed-off-by: Adriano Cordova <adrianox@gmail.com>
16 months agoefi_selftest: add test for HTTP protocol
Adriano Cordova [Wed, 4 Dec 2024 03:05:28 +0000 (00:05 -0300)] 
efi_selftest: add test for HTTP protocol

Add a test for the EFI_HTTP_PROTOCOL and
EFI_SEVICE_BINDING_PROTOCOL.

Signed-off-by: Adriano Cordova <adrianox@gmail.com>
16 months agolib: uuid: display HTTP and IPV4 Config II protocols
Heinrich Schuchardt [Wed, 4 Dec 2024 03:05:27 +0000 (00:05 -0300)] 
lib: uuid: display HTTP and IPV4 Config II protocols

Add long texts for

* EFI HTTP Protocol
* EFI HTTP Service Binding Protocol
* EFI IPv4 Configuration II Protocol

to the uuid library.

Signed-off-by: Adriano Cordova <adrianox@gmail.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
16 months agoefi_loader: efi_net: add EFI_HTTP_PROTOCOL
Adriano Cordova [Wed, 4 Dec 2024 03:05:26 +0000 (00:05 -0300)] 
efi_loader: efi_net: add EFI_HTTP_PROTOCOL

Add an EFI HTTP driver. This commit implements the
EFI_HTTP_PROTOCOL and the EFI_HTTP_SERVICE_BINDING_PROTOCOL.
The latter is attached to the handle of th efi network
device. This is the same handle where snp, pxe, and ipconfig
are attached to.

Signed-off-by: Adriano Cordova <adrianox@gmail.com>
16 months agoefi_loader: efi_net: add EFI_IP4_CONFIG2_PROTOCOL
Adriano Cordova [Wed, 4 Dec 2024 03:05:25 +0000 (00:05 -0300)] 
efi_loader: efi_net: add EFI_IP4_CONFIG2_PROTOCOL

Add an implementation of the EFI_IP4_CONFIG2_PROTOCOL. The protocol
is attached to the handle of the efi network device. This is the same
handle where snp and pxe are attached to.

Signed-off-by: Adriano Cordova <adrianox@gmail.com>
16 months agoefi_loader: net: add support to send http requests and parse http headers
Adriano Cordova [Wed, 4 Dec 2024 03:05:24 +0000 (00:05 -0300)] 
efi_loader: net: add support to send http requests and parse http headers

Add network-stack agnostic way to send an http request and
parse http headers from efi drivers. This uses wget as a
backend and communicates with it via efi_wget_info.

The function efi_net_do_request allocates a buffer on behalf of an
efi application using efi_alloc and passes it to wget to receive
the data. If the method is GET and the buffer is too small, it
re-allocates the buffer based on the last received Content-Length
header and tries again. If the method is HEAD it just issues one
request. So issuing a HEAD request (to update Content-Length) and
then a GET request is preferred but not required.

The function efi_net_parse_headers parses a raw buffer containing
an http header into an array of EFI specific 'http_header' structs.

Signed-off-by: Adriano Cordova <adrianox@gmail.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
16 months agoefi_loader: net: set EFI bootdevice device path to HTTP when loaded from wget
Adriano Cordova [Wed, 4 Dec 2024 03:05:23 +0000 (00:05 -0300)] 
efi_loader: net: set EFI bootdevice device path to HTTP when loaded from wget

Set the device path of the efi boot device to an HTTP device path
(as formed by efi_dp_from_http) when the next boot stage is loaded
using wget (i.e., when wget is used with wget_info.set_bootdev=1).

When loaded from HTTP, the device path should account for it so that
the next boot stage is aware (e.g. grub only loads its http stack if
it itself was loaded from http, and it checks this from its device path).

Signed-off-by: Adriano Cordova <adrianox@gmail.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
16 months agoefi_loader: device_path: add support for HTTP device path
Adriano Cordova [Wed, 4 Dec 2024 03:05:22 +0000 (00:05 -0300)] 
efi_loader: device_path: add support for HTTP device path

Add efi_dp_from_http to form a device path from HTTP. The
device path is the concatenation of the device path returned
by efi_dp_from_ipv4 together with an URI node and an END node.

Signed-off-by: Adriano Cordova <adrianox@gmail.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
16 months agoefi_loader: efi_net: add efi_net_set_addr, efi_net_get_addr
Adriano Cordova [Wed, 4 Dec 2024 03:05:21 +0000 (00:05 -0300)] 
efi_loader: efi_net: add efi_net_set_addr, efi_net_get_addr

Add the functions efi_net_set_addr and  efi_net_get_addr to set
and get the ip address from efi code in a network agnostic way.
This could also go in net_common, or be compiled conditionally
for each network stack.

Signed-off-by: Adriano Cordova <adrianox@gmail.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
16 months agoefi_api: add definitions for HTTP and IP4_CONFIG2 protocols
Adriano Cordova [Wed, 4 Dec 2024 03:05:20 +0000 (00:05 -0300)] 
efi_api: add definitions for HTTP and IP4_CONFIG2 protocols

Add EFI definitions for EFI_IP4_CONFIG2_PROTOCOL,
EFI_HTTP_SERVICE_BINDING_PROTOCOL, and EFI_HTTP_PROTOCOL.
According to UEFI spec 2.10.

Signed-off-by: Adriano Cordova <adrianox@gmail.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
16 months agoefi_loader: add IPv4() to device path to text protocol
Heinrich Schuchardt [Wed, 4 Dec 2024 03:05:19 +0000 (00:05 -0300)] 
efi_loader: add IPv4() to device path to text protocol

Implement Ipv4() node support in the device path to text protocol.

Signed-off-by: Adriano Cordova <adrianox@gmail.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
16 months agoefi_loader: device_path: add efi_dp_from_ipv4
Adriano Cordova [Wed, 4 Dec 2024 03:05:18 +0000 (00:05 -0300)] 
efi_loader: device_path: add efi_dp_from_ipv4

Add efi_dp_from_ipv4 to form a device path from an ipv4 address.

Signed-off-by: Adriano Cordova <adrianox@gmail.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
16 months agoefi_loader: device_path: add definition of DEVICE_PATH_SUB_TYPE_MSG_IPV4
Adriano Cordova [Wed, 4 Dec 2024 03:05:17 +0000 (00:05 -0300)] 
efi_loader: device_path: add definition of DEVICE_PATH_SUB_TYPE_MSG_IPV4

Add definition for DEVICE_PATH_SUB_TYPE_MSG_IPV4 device path
subtype.

Signed-off-by: Adriano Cordova <adrianox@gmail.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
16 months agonet: wget: let wget_with_dns work with dns disabled
Adriano Cordova [Wed, 4 Dec 2024 03:05:16 +0000 (00:05 -0300)] 
net: wget: let wget_with_dns work with dns disabled

This was marked as TODO in the code:
 - Enable use of wget_with_dns even if CMD_DNS is disabled if
   the given uri has the ip address for the http server.
 - Move the check for CMD_DNS inside wget_with_dns.
 - Rename wget_with_dns to wget_do_request

Signed-off-by: Adriano Cordova <adrianox@gmail.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
16 months agonet-lwip: zero terminate string with headers in wget_lwip_fill_info()
Adriano Cordova [Tue, 26 Nov 2024 16:19:21 +0000 (13:19 -0300)] 
net-lwip: zero terminate string with headers in wget_lwip_fill_info()

    This patch comes as a companion to the same patch but for the legacy
    net stack. Commit 1327c2a8d6 ("net/lwip: wget: integrate struct wget_info
    into wget code") introduced function wget_fill_info() which retrieves
    the headers from the HTTP server response. As we want to parse the
    string in later patches we need to ensure that it is NUL terminated.

    We must further check that wget_info->headers in not NULL.
    Otherwise a crash occurs.

Signed-off-by: Adriano Cordova <adrianox@gmail.com>
16 months agonet: zero terminate string with headers in wget_fill_info()
Heinrich Schuchardt [Tue, 26 Nov 2024 16:19:20 +0000 (13:19 -0300)] 
net: zero terminate string with headers in wget_fill_info()

Commit 2dd076a9c1b4 ("net: wget: integrate struct wget_info into legacy
wget code") introduced function wget_fill_info() which retrieves the
headers from the HTTP server response. As we want to parse the string in
later patches we need to ensure that it is NUL terminated.

We must further check that wget_info->headers in not NULL.
Otherwise a crash occurs.

Fixes: 2dd076a9c1b4 ("net: wget: integrate struct wget_info into legacy wget code")
Signed-off-by: Adriano Cordova <adrianox@gmail.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
16 months agolwip: wget: pass port and server_name via wget_ctx
Adriano Cordova [Tue, 3 Dec 2024 12:55:34 +0000 (09:55 -0300)] 
lwip: wget: pass port and server_name via wget_ctx

Commit 5907c81 ("net: lwip: Enable https:// support for wget") was not
  correctly rebased on top of the changes introduced by Commit 6cc4d04
  ("net/lwip: wget: put server_name and port into wget_ctx") in next.
  This commit re-applies a  couple of lines from 6cc4d04.

Fixes: Commit 5907c81 ("net: lwip: Enable https:// support for wget")
Signed-off-by: Adriano Cordova <adrianox@gmail.com>
16 months agoMerge tag 'xilinx-for-v2025.04-rc1' of https://gitlab.denx.de/u-boot/custodians/u...
Tom Rini [Tue, 3 Dec 2024 21:51:56 +0000 (15:51 -0600)] 
Merge tag 'xilinx-for-v2025.04-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze into next

AMD/Xilinx changes for v2025.04-rc1

binman:
- Separate binman description from main DT

zynqmp:
- Enable binman for ZynqMP platforms
- DT sync with Linux v6.12
- Update usb5744 hub for SOMs

common:
- Drop SPL_FIT_GENERATOR support

versal2
- Enable OPTEE layers

ospi:
- Refactor the flash reset functionality

pytest:
- Fix tcminit mode handling

16 months agoMerge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-samsung
Tom Rini [Tue, 3 Dec 2024 18:37:20 +0000 (12:37 -0600)] 
Merge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-samsung

16 months agoMerge patch series "CI: Set up for an arm64 runner"
Tom Rini [Mon, 2 Dec 2024 22:36:06 +0000 (16:36 -0600)] 
Merge patch series "CI: Set up for an arm64 runner"

Tom Rini <trini@konsulko.com> says:

Hey all,

This is picking up Simon's v5 of the above-named series and making a few
more changes so that the follow-up series I have leads to arm64 being
supported for almost all jobs. To quote Simon's cover letter:

All gitlab runners are currently amd64 machines. This series attempts to
create a docker image which can also support arm64 so that sandbox tests
can be run on it.

The TARGET_... environment variables for grub could perhaps be adjusted,
using the new variables, but I have not done that for now.

Adding to what Simon said, we now build grub for all architectures as
the reason to install it was to be able to use the binaries in QEMU.
That won't provide us with amd64 binaries on arm64 hosts so we can't use
that shortcut anymore.

Link: https://lore.kernel.org/r/20241127172247.1488685-1-trini@konsulko.com
16 months agoconfigs: e850-96: Disable PSCI reset
Sam Protsenko [Tue, 19 Nov 2024 03:28:00 +0000 (21:28 -0600)] 
configs: e850-96: Disable PSCI reset

PSCI reset is not implemented in Exynos850 EL3 firmware. Disable it to
fix the reset in cases where it can be used, e.g. when running EFI
selftest.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
16 months agoCI: Add platform variable
Simon Glass [Wed, 27 Nov 2024 17:17:30 +0000 (11:17 -0600)] 
CI: Add platform variable

Add a list of possible platforms that can be used by gitlab runners.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
16 months agodocker: Install toolchains on arm64 host
Simon Glass [Wed, 27 Nov 2024 17:17:29 +0000 (11:17 -0600)] 
docker: Install toolchains on arm64 host

Refactor the code to support downloading toolchains for arm64 as well as
x86_64

There doesn't seem to be an xtensa toolchain for arm64 at the same
location, so download that only on x86

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
16 months agodocker: Fix LegacyKeyValueFormat warning with PYTHONPATH
Simon Glass [Wed, 27 Nov 2024 17:17:28 +0000 (11:17 -0600)] 
docker: Fix LegacyKeyValueFormat warning with PYTHONPATH

Fix a warning due to the syntax used for PYTHONPATH:

   LegacyKeyValueFormat: "ENV key=value" should be used instead of
      legacy "ENV key value" format (line 304)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
16 months agodocker: Adjust installed packages slightly
Simon Glass [Wed, 27 Nov 2024 17:17:27 +0000 (11:17 -0600)] 
docker: Adjust installed packages slightly

We no longer need to install libc6-i386 so we can drop that. Switch to
installing linux-image-generic as that will be available on all hosts,
to provide the /boot/vmlinu* file that's requires for various tools.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
16 months agodocker: Support building for multiple architectures
Simon Glass [Wed, 27 Nov 2024 17:17:26 +0000 (11:17 -0600)] 
docker: Support building for multiple architectures

Add instructions on how to build the file for multiple architectures.
Add a message indicating what is happening.

Update the documentation as well.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
16 months agodocker: Use cache mounts for apt
Tom Rini [Wed, 27 Nov 2024 17:17:25 +0000 (11:17 -0600)] 
docker: Use cache mounts for apt

Instead of deleting /var/lib/apt/lists after each relevant RUN line, use
a cache mount as is the current best practices.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
16 months agodocker: Build grub for all architectures
Tom Rini [Wed, 27 Nov 2024 17:17:24 +0000 (11:17 -0600)] 
docker: Build grub for all architectures

For consistency now, and future ease of testing with non-amd64 hosts,
build grub for all architectures rather than relying on host binaries
for i386/x86_64.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
16 months agodocker: Update to grub-2.12
Tom Rini [Wed, 27 Nov 2024 17:17:23 +0000 (11:17 -0600)] 
docker: Update to grub-2.12

The current release of grub is 2.12 and it will be good to pick this up
now so that we can update other parts of our stack.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
16 months agodocker: Use "make -j$(nproc)" when invoking make
Tom Rini [Wed, 27 Nov 2024 17:17:22 +0000 (11:17 -0600)] 
docker: Use "make -j$(nproc)" when invoking make

We had a few places that were not using "make -j$(nproc)" but instead
just plain "make" and so slowing down the overall build.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
16 months agodocker: Add kernel.org x86_64 toolchain
Tom Rini [Wed, 27 Nov 2024 17:17:21 +0000 (11:17 -0600)] 
docker: Add kernel.org x86_64 toolchain

Add in the x86_64 toolchain, but do not enforce using it for sandbox.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
16 months agotest: Adjust print_ut test to use unsigned char
Simon Glass [Wed, 27 Nov 2024 17:17:20 +0000 (11:17 -0600)] 
test: Adjust print_ut test to use unsigned char

Since char is unsigned on arm64, this test currently fails. It seems
better to use unsigned anyway, since 0xff is written into the string at
the start. Update the terminator-assert to use a character instead of a
byte.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Changes in v6:
- Re-introduce

Changes in v2:
- Use '\0' instead of 0

test/print_ut.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

16 months agosandbox: efi_loader: Correct use of addresses as pointers
Simon Glass [Wed, 27 Nov 2024 17:17:19 +0000 (11:17 -0600)] 
sandbox: efi_loader: Correct use of addresses as pointers

The cache-flush function is incorrect which causes a crash in the
remoteproc tests with arm64.

Fix both problems by using map_sysmem() to convert an address to a
pointer and map_to_sysmem() to convert a pointer to an address.

Also update the image-loader's cache-flushing logic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 3286d223fd7 ("sandbox: implement invalidate_icache_all()")
Acked-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Changes in v6:
- Re-introduce

Changes in v2:
- Drop message about EFI_LOADER

arch/sandbox/cpu/cache.c              |  8 +++++++-
 drivers/remoteproc/rproc-elf-loader.c | 18 +++++++++++-------
 lib/efi_loader/efi_image_loader.c     |  3 ++-
 3 files changed, 20 insertions(+), 9 deletions(-)

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
16 months agocommon: relocate fdt_blob in global_data for FDTSRC_EMBED case
Evgeny Bachinin [Mon, 25 Nov 2024 09:15:07 +0000 (12:15 +0300)] 
common: relocate fdt_blob in global_data for FDTSRC_EMBED case

Patch resolves two kind of bugs, one of which is vulnerability related
to KASLR.

=== Issue briefly ===

  Working with FDT (via non-relocated gd::fdt_blob) from inside bootm
command may lead to the reading the garbage instead of FDT nodes. And
this can result in various side-effects depending on DTS nodes, being
parsed during bootm.

  But below is my specific story how I faced with this issue due to
MESON_RNG probing failure.

=== Bugs description ===

1) Bug is revealed on:
* configuration below
* U-boot 2024.10 - f919c3a889f ("Prepare v2024.10")

  It seems, the following patch is a trigger:
ea955eea4f ("fdt: automatically add /chosen/kaslr-seed if DM_RNG is enabled")

  Generally, CONFIG_OF_EMBED=y & CONFIG_RNG_MESON=y are the most
valuable ones for reproducing the issue.
```
  CONFIG_ARCH_FIXUP_FDT_MEMORY=y
  CONFIG_CMD_FDT=y
  CONFIG_DEFAULT_FDT_FILE=""
  CONFIG_FDT_64BIT=y
  CONFIG_OF_BOARD_SETUP=y
  CONFIG_OF_CONTROL=y
  CONFIG_OF_EMBED=y
  CONFIG_OF_LIBFDT_ASSUME_MASK=0x0
  CONFIG_OF_LIBFDT_OVERLAY=y
  CONFIG_OF_LIBFDT=y
  CONFIG_OF_LIST="meson-axg-our-device-name"
  CONFIG_OF_REAL=y
  CONFIG_OF_TRANSLATE=y
  CONFIG_SUPPORT_OF_CONTROL=y
  CONFIG_SYS_FDT_PAD=0x3000
  CONFIG_TOOLS_OF_LIBFDT=y

  CONFIG_DM_RNG=y
  CONFIG_RNG_MESON=y
```

2) Due to CONFIG_OF_EMBED, the DTS is embedded into U-boot ELF and
accessible via __dtb_dt_begin symbol.

  On early boot stage (board_f.c) the fdtdec_setup() is called only
once before U-boot's relocation into top of RAM. fdtdec_setup()
initializes gd::fdt_blob for FDTSRC_EMBED case:
```
  gd->fdt_blob = dtb_dt_embedded();
  gd->fdt_src = FDTSRC_EMBED;
```

3) Then reloc_fdt() is called in board_f.c

  But due to CONFIG_OF_EMBED=y the reloc_fdt() does not update
gd::fdt_blob value (strictly speaking, it is impossible for
CONFIG_OF_EMBED=y, because U-boot ELF has not been relocated yet
at this moment).

  As a result after relocation we get fdt_blob, pointing to DTS address
before relocation:
```
   # bdinfo
  <...>
  relocaddr = 0x000000000fedf000
  reloc off = 0x000000000eedf000
  <...>
  fdt_blob = 0x010ce6c0 << points to __dtb_dt_begin before relocation
  new_fdt = 0x0000000000000000  << empty erroneously
  fdt_size = 0x0000000000000000 << zero erroneously
```

4) During bootm command (according to our ITS-config file) the Linux
is loaded into 0x01080000 (which is very close to fdt_blob addr
0x010ce6c0).
```
  ## Loading kernel from FIT Image at 04000000 ...
     Trying 'kernel' kernel subimage
       <...>
       Load Address: 0x01080000
```

  So Linux image overwrites the gd::fdt_blob memory location
in RAM (0x010ce6c0).

5) Issue:

  Hence any manipulation with DTS (say, via FDT API) inside
implementation of bootm command leads to accessing the fdt_blob area
with garbage, that can lead to two situations:

5.1) Abort.

  Call to fdt_off_dt_struct() from fdt_next_tag() :: fdt_offset_ptr()::
fdt_offset_ptr_() returns with garbage, that leads to tagp value
being out of RAM top addr (256 Mb in our board), causing the abort:
```
  Boot cmd: bootm 0x4000000#boot_evt1
  bootm_run_states()
  <...>
  image_setup_libfdt()
   fdt_chosen()
    fdt_kaslrseed()
     uclass_get_device()
      uclass_get_device_tail()
       device_probe()
        device_of_to_plat()
        meson_rng_of_to_plat()
         clk_get_by_name_optional()
          clk_get_by_name()
           clk_get_by_name_nodev()
            ofnode_stringlist_search()
             fdt_stringlist_search()
              fdt_getprop()
               fdt_get_property_namelen_()
                fdt_first_property_offset()
                 fdt_check_node_offset_()
                  fdt_next_tag():
                    ```
                      tagp = fdt_offset_ptr(fdt, offset, FDT_TAGSIZE);
                    ```
                  fdt_next_tag() tagp:0x22890766
                  fdt_next_tag() ram_top:0x10000000 (tagp OUT of RAM)
  "Synchronous Abort" handler, esr 0x96000010, far 0x22890766
  elr: 000000000108be24 lr : 000000000108be24 (reloc)
  elr: 000000000ff6fe24 lr : 000000000ff6fe24
  x0 : 0000000000000041 x1 : 0000000000000000
  x2 : 000000000ff3b57c x3 : 0000000000000012
  x4 : 000000000ded2ad5 x5 : 0000000000000020
  x6 : 00000000ffffffe8 x7 : 000000000ded2f40
  x8 : 00000000ffffffd8 x9 : 000000000000000d
  x10: 0000000000000006 x11: 000000000001869f
  x12: 000000000fffffff x13: 000000000fffffff
  x14: 0000000000000000 x15: 000000000ded2abb
  x16: 000000000ff3b080 x17: 0000000000000001
  x18: 000000000ded3dc0 x19: 0000000022890766
  x20: 00000000010cb0f0 x21: 00000000000015e4
  x22: 000000000ff8f4d8 x23: 000000000000000b
  x24: 000000000ded2fbc x25: 000000000ffe2000
  x22: 000000000ff8f4d8 x23: 000000000000000b
  x24: 000000000ded2fbc x25: 000000000ffe2000
  x26: 000000000ffe2000 x27: 000000000000000b
  x28: 000000000ff9cf2d x29: 000000000ded2f40

  Code: aa1603e1 91197484 52801742 94004de8 (b9400276)
```

5.2) Vulnerability situation "KASLR is disabled".

Almost the same as in (5.1), but 2 situations happen (depending on
the value of garbage):
  * call to fdt_offset_ptr_() :: fdt_off_dt_struct(fdt)
    returns not so big garbage, leading to tagp, being inside RAM.
  * or calculations of absoffset inside fdt_offset_ptr() leads to
    failure of the one of if() conditions with NULL as retval.

  Result is fdt_next_tag() interprets the tagp as FDT_END. And we are
returning from our callstack via functions' error paths, leading to
"No RNG device" and "KASLR disabled due to lack of seed":
```
  fdt_kaslrseed()
   uclass_get_device()
   <...>
    device_probe()
     device_of_to_plat()
      meson_rng_of_to_plat()
       clk_get_by_name()
        clk_get_by_name_nodev()
        <...>
         fdt_stringlist_search()
          fdt_getprop()
           fdt_get_property_namelen_()
            fdt_first_property_offset()
             fdt_check_node_offset_()
              fdt_next_tag():
                ```
                  tagp = fdt_offset_ptr(fdt, offset, FDT_TAGSIZE);
                ```
              fdt_next_tag() tagp:0000000001890677
              fdt_next_tag() ram_top:0x10000000 (tagp is inside RAM)
      uclass_get_device_tail():486 device_probe() ret:-22
  No RNG device
 Starting kernel ...

  [ 0.000000] Linux version 6.9.12
  [ 0.000000] KASLR disabled due to lack of seed
```

Signed-off-by: Evgeny Bachinin <EABachinin@salutedevices.com>
16 months agoRevert "global_data: Drop spl_handoff"
Simon Glass [Sun, 1 Dec 2024 14:42:35 +0000 (07:42 -0700)] 
Revert "global_data: Drop spl_handoff"

This breaks chromebook_coral which says:

   Video: No video mode configured in FSP!

This reverts commit 2e9313179a846b581c0fc3f6a49e19f3d343efa8.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobinman: Avoid skipping binman_init()
Simon Glass [Sun, 1 Dec 2024 14:42:34 +0000 (07:42 -0700)] 
binman: Avoid skipping binman_init()

A recent lwip change stopped binman's init from working, so it is not
possible to read nodes from the image description anymore.

Correct this by dropping the offending line.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 4d4d7838127 net: lwip: add TFTP support and tftpboot command
16 months agopowerpc/t2080qds: remove spurious x permission from README file
Rasmus Villemoes [Mon, 25 Nov 2024 09:37:00 +0000 (10:37 +0100)] 
powerpc/t2080qds: remove spurious x permission from README file

It doesn't make sense for a README file to be executable. Remove that
bit.

Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>