]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
10 months agodoc: spl: Add info regarding memory reservation
Devarsh Thakkar [Tue, 5 Dec 2023 15:55:23 +0000 (21:25 +0530)]
doc: spl: Add info regarding memory reservation

Add details regarding scheme which need to be followed in SPL and
further stages for those regions which need to be preserved across
bootstages.

Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
Reviewed-by: Simon Glass <sjg@chromium>
10 months agodoc: spl: Add info for missing Kconfigs
Devarsh Thakkar [Tue, 5 Dec 2023 15:55:22 +0000 (21:25 +0530)]
doc: spl: Add info for missing Kconfigs

Add info regarding splash screen, video, bloblist and GPIO related
Kconfigs which were missing in the documentation.

Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
Reviewed-by: Simon Glass <sjg@chromium>
10 months agovideo: Fill video handoff in video post probe
Devarsh Thakkar [Tue, 5 Dec 2023 15:55:21 +0000 (21:25 +0530)]
video: Fill video handoff in video post probe

Fill video handoff fields in video_post_probe as at this point we have
full framebuffer-related information.

Also fill all the fields available in video hand-off struct as those
were missing earlier and U-boot framework expects them to be filled for
some of the functionalities.

While filling framebuffer size in video hand-off structure use the
actual framebuffer region size as derived from gd->video_top and
gd->video_bottom instead of directly using the size populated in
video_uc_plat as it contains unaligned size.

Reported-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agovideo: Skip framebuffer reservation if already reserved
Devarsh Thakkar [Tue, 5 Dec 2023 15:55:20 +0000 (21:25 +0530)]
video: Skip framebuffer reservation if already reserved

Skip framebufer reservation if it was already reserved from previous
stage and whose information was passed using a bloblist.

Return error in case framebuffer information received from bloblist is
invalid i.e NULL or empty.

While at it, improve the debug message to make it more clear that
address in discussion is of framebuffer and not bloblist and also match
it with printing scheme followed in video_reserve function.

Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agocommon/board_f: Catch bloblist before starting reservations
Devarsh Thakkar [Tue, 5 Dec 2023 15:55:19 +0000 (21:25 +0530)]
common/board_f: Catch bloblist before starting reservations

Start reservations needed for init sequence only after catching
bloblists from previous stage.

This is to avoid catching bloblists in the middle causing gaps while
u-boot is reserving.

Adjust the relocaddr as per video hand-off information received from
previous stage so that further reservations start only after regions
reserved for previous stages

Skip reservation for video memory if it was already filled by a
bloblist.

Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agoboard: ti: am62x: evm: Remove video_setup from spl_board_init
Devarsh Thakkar [Tue, 5 Dec 2023 15:55:18 +0000 (21:25 +0530)]
board: ti: am62x: evm: Remove video_setup from spl_board_init

Remove video_setup from evm_init sequence since video memory is getting
called at an earlier place to make sure video memory is reserved at
the end of RAM.

Suggested-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
10 months agoarm: mach-k3: common: Reserve video memory from end of the RAM
Devarsh Thakkar [Tue, 5 Dec 2023 15:55:17 +0000 (21:25 +0530)]
arm: mach-k3: common: Reserve video memory from end of the RAM

Setup video memory before page table reservation using
"spl_reserve_video_from_ram_top" which ensures framebuffer memory gets
reserved from the end of RAM.

This is done to enable the next stage to directly skip the
pre-reserved area from previous stage right from the end of RAM without
having to make any gaps/holes to accommodate those regions which was the
case before as previous stage reserved region not from the end of RAM.

Use gd->ram_top instead of local ram_top and update gd->reloc_addr after
each reservation to ensure further regions are reserved properly.

Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
Reviewed-by: Nikhil M Jain <n-jain1@ti.com>
10 months agospl: Enforce framebuffer reservation from end of RAM
Devarsh Thakkar [Tue, 5 Dec 2023 15:55:16 +0000 (21:25 +0530)]
spl: Enforce framebuffer reservation from end of RAM

Add an API which enforces framebuffer reservation from end of RAM.
This is done so that next stage can directly skip this region before
carrying out further reservations.

Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agoarm: k3: Enable instruction cache for main domain SPL
Joao Paulo Goncalves [Mon, 13 Nov 2023 19:07:21 +0000 (16:07 -0300)]
arm: k3: Enable instruction cache for main domain SPL

Change spl_enable_dcache so it also enable icache on SPL
initialization for the main domain part of the boot flow. This
improves bootloader booting time.

Link: https://lore.kernel.org/all/20231109140958.1093235-1-joao.goncalves@toradex.com/
Signed-off-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
Tested-by: Nishanth Menon <nm@ti.com>
13 months agodoc: board: ti: Add AM62A documentation
Jai Luthra [Mon, 13 Nov 2023 14:51:49 +0000 (08:51 -0600)]
doc: board: ti: Add AM62A documentation

Add generic boot-flow diagrams, and SoC-specific info around build
steps.

Signed-off-by: Jai Luthra <j-luthra@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
13 months agoconfigs: am62ax_evm_a53_defconfig: switch to stdboot
Nishanth Menon [Mon, 13 Nov 2023 14:51:48 +0000 (08:51 -0600)]
configs: am62ax_evm_a53_defconfig: switch to stdboot

Switch over to stdboot

Signed-off-by: Nishanth Menon <nm@ti.com>
13 months agoboard: ti: am62ax: env: Set the boot_targets
Nishanth Menon [Mon, 13 Nov 2023 14:51:47 +0000 (08:51 -0600)]
board: ti: am62ax: env: Set the boot_targets

Set the default boot_targets to map up SD card as priority followed by
emmc and so on.

Signed-off-by: Nishanth Menon <nm@ti.com>
13 months agoboard: ti: am62ax: env: Use default findfdt
Nishanth Menon [Mon, 13 Nov 2023 14:51:46 +0000 (08:51 -0600)]
board: ti: am62ax: env: Use default findfdt

Use the default findfdt instead of local logic.

Signed-off-by: Nishanth Menon <nm@ti.com>
13 months agoconfigs: am62ax_evm_a53_defconfig: Enable networking
Nishanth Menon [Mon, 13 Nov 2023 14:51:45 +0000 (08:51 -0600)]
configs: am62ax_evm_a53_defconfig: Enable networking

Enable networking

Signed-off-by: Nishanth Menon <nm@ti.com>
13 months agodma: ti: k3-udma: Introduce DMA support for the am62ax
Vignesh Raghavendra [Mon, 13 Nov 2023 14:51:44 +0000 (08:51 -0600)]
dma: ti: k3-udma: Introduce DMA support for the am62ax

In preparation for enabling ethernet for the am62ax family of SoCs,
introduce the initial DMA channel settings for the am62ax

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
[bb@ti.com: expanded on commit message]
Signed-off-by: Bryan Brattlof <bb@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
13 months agoarm: dts: k3-am62a*: Sync with kernel v6.7-rc1
Nishanth Menon [Mon, 13 Nov 2023 14:51:43 +0000 (08:51 -0600)]
arm: dts: k3-am62a*: Sync with kernel v6.7-rc1

Sync with kernel v6.7-rc1 and sync up the u-boot dts files accordingly.

Signed-off-by: Nishanth Menon <nm@ti.com>
13 months agoarm: mach-k3: am62a: Add main_timer0 id to the dev list
Nishanth Menon [Mon, 13 Nov 2023 14:51:42 +0000 (08:51 -0600)]
arm: mach-k3: am62a: Add main_timer0 id to the dev list

main_timer0 is used by u-boot as the tick-timer. Add it to the soc
devices list so it an be enabled via the k3 power controller.

Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
13 months agoarm: dts: k3-j721e-*: Sync with kernel v6.7-rc1
Neha Malcom Francis [Mon, 13 Nov 2023 04:30:23 +0000 (10:00 +0530)]
arm: dts: k3-j721e-*: Sync with kernel v6.7-rc1

Sync the U-Boot DTS files with those of Kernel v6.7-rc1.

Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
13 months agodt-bindings: misc: Move esm-k3.txt to ti,j721e-esm.yaml
Neha Malcom Francis [Mon, 13 Nov 2023 04:30:22 +0000 (10:00 +0530)]
dt-bindings: misc: Move esm-k3.txt to ti,j721e-esm.yaml

Move esm-k3.txt to ti,j721e-esm.yaml in line with the devicetree
documentation in kernel.

Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
13 months agodoc: board: beagle: Add BeagleBone AI-64 documentation
Nishanth Menon [Sat, 4 Nov 2023 08:11:03 +0000 (03:11 -0500)]
doc: board: beagle: Add BeagleBone AI-64 documentation

Add base documentation for BeagleBone AI-64.

Signed-off-by: Nishanth Menon <nm@ti.com>
13 months agoconfigs: Add j721e_beagleboneai64_* configs
Nishanth Menon [Sat, 4 Nov 2023 08:11:02 +0000 (03:11 -0500)]
configs: Add j721e_beagleboneai64_* configs

Add basic support for mmc/emmc and networking support for BeagleBone
AI-64.

Signed-off-by: Nishanth Menon <nm@ti.com>
13 months agoboard: beagle: Add BeagleBone AI-64 support
Nishanth Menon [Sat, 4 Nov 2023 08:11:01 +0000 (03:11 -0500)]
board: beagle: Add BeagleBone AI-64 support

Add base support for BeagleBone AI-64 board support.

Further information at  https://beagleboard.org/ai-64

Signed-off-by: Nishanth Menon <nm@ti.com>
13 months agoarm: dts: Add k3-j721e-beagleboneai64
Robert Nelson [Sat, 4 Nov 2023 08:11:00 +0000 (03:11 -0500)]
arm: dts: Add k3-j721e-beagleboneai64

BeagleBoard.org BeagleBone AI-64 is an open source hardware single
board computer based on the Texas Instruments TDA4VM SoC featuring
dual-core 2.0GHz Arm Cortex-A72 processor, C7x+MMA and 2 C66x
floating-point VLIW DSPs, 3x dual ARM Cortex-R5 co-processors,
2x 6-core Programmable Real-Time Unit and Industrial Communication
SubSystem, PowerVR Rogue 8XE GE8430 3D GPU. The board features 4GB
DDR4, USB3.0 Type-C, 2x USB SS Type-A, miniDisplayPort, 2x 4-lane
CSI, DSI, 16GB eMMC flash, 1G Ethernet, M.2 E-key for WiFi/BT, and
BeagleBone expansion headers.

This board family can be indentified by the BBONEAI-64-B0 in the
at24 eeprom:

[aa 55 33 ee 01 37 00 10  2e 00 42 42 4f 4e 45 41 |.U3..7....BBONEA|]
[49 2d 36 34 2d 42 30 2d  00 00 42 30 30 30 37 38 |I-64-B0-..B00078|]

Baseline of the devicetree is from v6.6-rc1

https://beagleboard.org/ai-64
https://git.beagleboard.org/beagleboard/beaglebone-ai-64

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
13 months agoboard: Move omap3 beagle under beagle vendor folder
Nishanth Menon [Sat, 4 Nov 2023 08:01:37 +0000 (03:01 -0500)]
board: Move omap3 beagle under beagle vendor folder

Move the omap3 beagle to the beagle vendor folder representing
BeagleBoard.org platforms.

Suggested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
13 months agodoc: board: Move am62x_beagleplay to it's own vendor
Nishanth Menon [Sat, 4 Nov 2023 08:01:36 +0000 (03:01 -0500)]
doc: board: Move am62x_beagleplay to it's own vendor

Move BeaglePlay documentation to beagle as a board vendor and update
references accordingly.

Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Bryan Brattlof <bb@ti.com>
13 months agoboard: Move beagleplay under beagle vendor folder
Nishanth Menon [Sat, 4 Nov 2023 08:01:35 +0000 (03:01 -0500)]
board: Move beagleplay under beagle vendor folder

Move beagleplay support away from ti/am62x to it's own beagle vendor
folder.

This forms the starting point for new beagle platforms added under it's
own board vendor folder.

As part of this create all the associated files with a bare minimum
beagleplay.c file.

Suggested-by: Andrew Davis <afd@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Bryan Brattlof <bb@ti.com>
[trini: Update k3-binman.dtsi to use full path to scheme.yaml now]
Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agoconfigs: Add am62x_beagleplay_*_defconfig
Nishanth Menon [Sat, 4 Nov 2023 08:01:34 +0000 (03:01 -0500)]
configs: Add am62x_beagleplay_*_defconfig

Add am62x_beagleplay_* defconfig customized for the configuration of
BeaglePlay and drop the config fragments.

This is in preparation for dropping the dependency on ti vendor folder
entirely.

Signed-off-by: Nishanth Menon <nm@ti.com>
13 months agoarm: dts: k3-am625-beagleplay-u-boot/r5: Just depend on k3-binman.dtsi
Nishanth Menon [Sat, 4 Nov 2023 08:01:33 +0000 (03:01 -0500)]
arm: dts: k3-am625-beagleplay-u-boot/r5: Just depend on k3-binman.dtsi

With the upcoming folder separation, there is no further need to depend
on am625-binman.dtsi. Duplicate the existing definitions to u-boot.dtsi
and r5.dts as appropriate.

Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Bryan Brattlof <bb@ti.com>
13 months agodoc: board: ti: j721e_evm: Use board relative path for include directives
Nishanth Menon [Sat, 4 Nov 2023 07:21:50 +0000 (02:21 -0500)]
doc: board: ti: j721e_evm: Use board relative path for include directives

When using include directives within a section that is included by non
TI board rst file, k3.rst and other include paths need to be relative to
doc/board/ base.

Signed-off-by: Nishanth Menon <nm@ti.com>
13 months agoconfigs: j7200_evm_a72_defconfig: Switch to bootstd
Nishanth Menon [Sat, 4 Nov 2023 07:21:49 +0000 (02:21 -0500)]
configs: j7200_evm_a72_defconfig: Switch to bootstd

Switch to using bootstd. Note with this change, we will stop using
distro_bootcmd and instead depend entirely on bootflow method of
starting the system up.

Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
13 months agoconfigs: j7200: Remove HBMC_AM654 config
Nishanth Menon [Sat, 4 Nov 2023 07:21:48 +0000 (02:21 -0500)]
configs: j7200: Remove HBMC_AM654 config

Kernel commit 1b77265626a4 ("arm64: dts: ti: k3-j7200-mcu-wakeup: Add
HyperBus node") was merged to kernel without its dependent patch [1].
Similar fix is needed in U-Boot, and hbmc currently breaks boot. Till
this gets fixed in U-Boot, disable the config by default so that the
hbmc probe that happens in board/ti/j721e/evm.c will not take place
and lead to boot failure.

This is similar to the approach in commit 5b2671594b80 ("configs:
j721e: Remove HBMC_AM654 config"), introduced to j7200 evm platform.

[1] https://lore.kernel.org/all/20230424184810.29453-1-afd@ti.com/

Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
13 months agoarm: mach-k3: j721e: Improve support for UDA FS
Nishanth Menon [Sat, 4 Nov 2023 07:21:47 +0000 (02:21 -0500)]
arm: mach-k3: j721e: Improve support for UDA FS

Commit 5019170970ad ("arch: arm: mach-k3: j721e: add support for UDA
FS") introduced basic UDA FS support, however, we can Take approach
similar to commit 0f1c1e8b368b ("arm: mach-k3: am625: Add support for
UDA FS"). While boot partition support with EMMC boot is useful, it is
constrained by the size of boot hardware partition itself.

In the case of K3 devices, tispl images can contain OP-TEE images that
can substantially vary in size and the u-boot image itself can vary over
time as we enable various features.

So use the CSD information in the case of EMMC_BOOT configuration being
enabled to pick boot partition or UDA FS mode operation to pick.

If EMMC_BOOT is disabled, then depend on filesystem configuration to
pick data from UDA.

Signed-off-by: Nishanth Menon <nm@ti.com>
13 months agoarm: mach-k3: arm64-mmu: Refactor to be independent of board
Nishanth Menon [Sat, 4 Nov 2023 07:21:46 +0000 (02:21 -0500)]
arm: mach-k3: arm64-mmu: Refactor to be independent of board

Refactor J721E J7200 definition to make this independent of board
macros.

Signed-off-by: Nishanth Menon <nm@ti.com>
13 months agoboard: ti: j721e: Select SOC_K3_J721E_J7200 for J7200evm
Nishanth Menon [Sat, 4 Nov 2023 07:21:45 +0000 (02:21 -0500)]
board: ti: j721e: Select SOC_K3_J721E_J7200 for J7200evm

Enable SOC_K3_J721E_J7200 when board is J7200 EVM - this allows us to
differentiate J7200 platform cleanly in board independent codebase.

Signed-off-by: Nishanth Menon <nm@ti.com>
13 months agoarm: mach-k3: Kconfig: Introduce a symbol to indicate J7200
Nishanth Menon [Sat, 4 Nov 2023 07:21:44 +0000 (02:21 -0500)]
arm: mach-k3: Kconfig: Introduce a symbol to indicate J7200

J7200 shares quite a few characteristics with J721E. However a few sets
are different. Introduce a Kconfig to differentiate the two to allow for
new boards to be introduced in a seamless manner.

Signed-off-by: Nishanth Menon <nm@ti.com>
13 months agoconfigs: j721e_evm_a72_defconfig: Switch to bootstd
Nishanth Menon [Sat, 4 Nov 2023 07:21:43 +0000 (02:21 -0500)]
configs: j721e_evm_a72_defconfig: Switch to bootstd

Switch to using bootstd. Note with this change, we will stop using
distro_bootcmd and instead depend entirely on bootflow method of
starting the system up.

Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
13 months agoboard: ti: j721e: j721e.env: Add explicit boot_targets
Nishanth Menon [Sat, 4 Nov 2023 07:21:42 +0000 (02:21 -0500)]
board: ti: j721e: j721e.env: Add explicit boot_targets

Add explicit boot_targets to indicate the specific boot sequence to
follow.

Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
13 months agoboard: ti: j721e: evm: Switch to using IS_ENABLED
Nishanth Menon [Sat, 4 Nov 2023 07:21:41 +0000 (02:21 -0500)]
board: ti: j721e: evm: Switch to using IS_ENABLED

Switch to using IS_ENABLED() for inline function usage.

Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
13 months agoboard: ti: j721e: evm: Drop board check for ESM
Nishanth Menon [Sat, 4 Nov 2023 07:21:40 +0000 (02:21 -0500)]
board: ti: j721e: evm: Drop board check for ESM

When config is enabled, the esm dt probe makes sense. Simplify by
dropping board specific checks.

Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
13 months agoboard: ti: j721e: evm: Drop unused headers
Nishanth Menon [Sat, 4 Nov 2023 07:21:39 +0000 (02:21 -0500)]
board: ti: j721e: evm: Drop unused headers

Drop headers that are no longer necessary for build

Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
13 months agoarm: mach-k3: Move TI dummy keys out of board folder
Nishanth Menon [Sat, 4 Nov 2023 02:45:11 +0000 (21:45 -0500)]
arm: mach-k3: Move TI dummy keys out of board folder

This file is used to emulate customer keys on TI development board
ecosystems, move it out of board/ directory and into mach-k3. And
change the relative paths to absolute paths in the binman paths.

While at it, drop the reference in verdin-binman file which is
redundant.

Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Manorit Chawdhry <m-chawdhry@ti.com>
13 months agoarm: mach-k3: Move K3 degenerate keys out of board folder
Nishanth Menon [Sat, 4 Nov 2023 02:45:10 +0000 (21:45 -0500)]
arm: mach-k3: Move K3 degenerate keys out of board folder

This file is common for all of K3, move it out of board/ directory and
into mach-k3. And change the relative paths to absolute paths in the
binman paths.

While at it, drop the reference in verdin-binman file which is
redundant.

Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Andrew Davis <afd@ti.com>
13 months agoarm: mach-k3: Move sysfw-loader into R5 directory
Andrew Davis [Tue, 14 Nov 2023 15:59:50 +0000 (09:59 -0600)]
arm: mach-k3: Move sysfw-loader into R5 directory

SYSFW is only ever loaded by the R5 core, move the code into that
directory. While here also move the related Kconfig symbols.

Signed-off-by: Andrew Davis <afd@ti.com>
13 months agoarm: mach-k3: Remove incorrect checks for SPL build
Andrew Davis [Tue, 14 Nov 2023 15:59:49 +0000 (09:59 -0600)]
arm: mach-k3: Remove incorrect checks for SPL build

The kconfig option SPL means this build supports SPL but not that
this build is SPL, nor that this build is the SPL running on R5.
For options that are for R5 SPL use CPU_V7R.

Signed-off-by: Andrew Davis <afd@ti.com>
13 months agoarm: mach-k3: Move R5 specific code into new r5/ directory
Andrew Davis [Tue, 14 Nov 2023 15:59:48 +0000 (09:59 -0600)]
arm: mach-k3: Move R5 specific code into new r5/ directory

This makes it clear these are only to be used by the R5 builds of SPL.
And this will be used to later more cleanly split the two builds.

Signed-off-by: Andrew Davis <afd@ti.com>
13 months agoarm: mach-k3: j721s2: Move board selection to mach-k3
Andrew Davis [Wed, 1 Nov 2023 20:35:30 +0000 (15:35 -0500)]
arm: mach-k3: j721s2: Move board selection to mach-k3

Currently each set of board targets from a vendor is selected inside
the board directory for that vendor. This has the problem of multiple
targets, one from each vendor, being selectable at the same time.
For instance you can select both TARGET_AM654_A53_EVM and
TARGET_IOT2050_A53 in the same build.

To fix this we need to move the target board choice to a common location
for each parent SoC selection. Do this in arch/arm/mach-k3.

Signed-off-by: Andrew Davis <afd@ti.com>
13 months agoarm: mach-k3: am62ax: Move board selection to mach-k3
Andrew Davis [Wed, 1 Nov 2023 20:35:29 +0000 (15:35 -0500)]
arm: mach-k3: am62ax: Move board selection to mach-k3

Currently each set of board targets from a vendor is selected inside
the board directory for that vendor. This has the problem of multiple
targets, one from each vendor, being selectable at the same time.
For instance you can select both TARGET_AM654_A53_EVM and
TARGET_IOT2050_A53 in the same build.

To fix this we need to move the target board choice to a common location
for each parent SoC selection. Do this in arch/arm/mach-k3.

Signed-off-by: Andrew Davis <afd@ti.com>
13 months agoarm: mach-k3: am62x: Move board selection to mach-k3
Andrew Davis [Wed, 1 Nov 2023 20:35:28 +0000 (15:35 -0500)]
arm: mach-k3: am62x: Move board selection to mach-k3

Currently each set of board targets from a vendor is selected inside
the board directory for that vendor. This has the problem of multiple
targets, one from each vendor, being selectable at the same time.
For instance you can select both TARGET_AM654_A53_EVM and
TARGET_IOT2050_A53 in the same build.

To fix this we need to move the target board choice to a common location
for each parent SoC selection. Do this in arch/arm/mach-k3.

Signed-off-by: Andrew Davis <afd@ti.com>
13 months agoarm: mach-k3: am64x: Move board selection to mach-k3
Andrew Davis [Wed, 1 Nov 2023 20:35:27 +0000 (15:35 -0500)]
arm: mach-k3: am64x: Move board selection to mach-k3

Currently each set of board targets from a vendor is selected inside
the board directory for that vendor. This has the problem of multiple
targets, one from each vendor, being selectable at the same time.
For instance you can select both TARGET_AM654_A53_EVM and
TARGET_IOT2050_A53 in the same build.

To fix this we need to move the target board choice to a common location
for each parent SoC selection. Do this in arch/arm/mach-k3.

Signed-off-by: Andrew Davis <afd@ti.com>
13 months agoarm: mach-k3: am65x: Move board selection to mach-k3
Andrew Davis [Wed, 1 Nov 2023 20:35:26 +0000 (15:35 -0500)]
arm: mach-k3: am65x: Move board selection to mach-k3

Currently each set of board targets from a vendor is selected inside
the board directory for that vendor. This has the problem of multiple
targets, one from each vendor, being selectable at the same time.
For instance you can select both TARGET_AM654_A53_EVM and
TARGET_IOT2050_A53 in the same build.

To fix this we need to move the target board choice to a common location
for each parent SoC selection. Do this in arch/arm/mach-k3.

Signed-off-by: Andrew Davis <afd@ti.com>
13 months agoarm: mach-k3: j721e: Move board selection to mach-k3
Andrew Davis [Wed, 1 Nov 2023 20:35:25 +0000 (15:35 -0500)]
arm: mach-k3: j721e: Move board selection to mach-k3

Currently each set of board targets from a vendor is selected inside
the board directory for that vendor. This has the problem of multiple
targets, one from each vendor, being selectable at the same time.
For instance you can select both TARGET_AM654_A53_EVM and
TARGET_IOT2050_A53 in the same build.

To fix this we need to move the target board choice to a common location
for each parent SoC selection. Do this in arch/arm/mach-k3.

Signed-off-by: Andrew Davis <afd@ti.com>
13 months agoboard: ti: Add dependency from TARGET selection to SOC
Andrew Davis [Wed, 1 Nov 2023 20:35:24 +0000 (15:35 -0500)]
board: ti: Add dependency from TARGET selection to SOC

Currently the K3 selection for TARGET boards does not depend on the SoC
for which it is based. This leds to the odd ability to select for instance
both SOC_K3_AM625 and TARGET_J721E_A72_EVM.

To fix this the target choice should depend on the matching SOC config.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
13 months agoMerge tag 'tpm-next-22112023' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Wed, 22 Nov 2023 13:26:46 +0000 (08:26 -0500)]
Merge tag 'tpm-next-22112023' of https://source.denx.de/u-boot/custodians/u-boot-tpm into next

tpm_tis_send-cleanup

13 months agotpm: remove superfluous check in tpm_tis_send()
Heinrich Schuchardt [Sat, 11 Nov 2023 00:35:30 +0000 (01:35 +0100)]
tpm: remove superfluous check in tpm_tis_send()

Checking if variable chip is NULL after dereferencing it makes no sense.
As discribed in [1] it is not expected that the variable can ever be NULL.

[1] Re: [PATCH] tpm: avoid NULL pointer dereference in tpm_tis_send()
    https://lore.kernel.org/u-boot/YaFwDtKKYRr7qzWc@apalos.home/

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
13 months agoMerge tag 'v2024.01-rc3' into next
Tom Rini [Mon, 20 Nov 2023 14:19:50 +0000 (09:19 -0500)]
Merge tag 'v2024.01-rc3' into next

Prepare v2024.01-rc3

13 months agoPrepare v2024.01-rc3
Tom Rini [Mon, 20 Nov 2023 13:43:46 +0000 (08:43 -0500)]
Prepare v2024.01-rc3

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agoconfigs: Resync with savedefconfig
Tom Rini [Mon, 20 Nov 2023 13:37:27 +0000 (08:37 -0500)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agoscsi: set dma direction to NONE for TEST UNIT READY
Nikita Yushchenko [Mon, 13 Nov 2023 05:51:02 +0000 (11:51 +0600)]
scsi: set dma direction to NONE for TEST UNIT READY

SCSI device scan code was executing TEST UNIT READY command without
explicitly setting dma direction in struct scsi_cmd to NONE, so command
was passed to driver with dma direction set to DMA_FROM_DEVICE,
inherited from older usage.

With WDC SDINDDH6-64G ufs device, that caused TEST UNIT READY to
return error.

Fix that, by explicitly setting dma direction to NONE for
TEST UNIT READY, and restoring it back DMA_FROM_DEVICE for the
following READ CAPACITY.

Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Reviewed-by: Marek Vasut <marex@denx.de>
13 months agoMerge tag 'efi-next-18112023' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Sat, 18 Nov 2023 20:52:53 +0000 (15:52 -0500)]
Merge tag 'efi-next-18112023' of https://source.denx.de/u-boot/custodians/u-boot-tpm into next

EFI HTTP Boot is currently supported by using a combination of
wget, blkmap and bootefi commands. The user has to download the
image, mount it using blkmap and then execute the efi installer
using bootefi.
This series simplifies the user experience. Instead of doing all the
steps manually, users can now enable a new Kconfig (EFI_HTTP_BOOT)
which will select wget, blkmap and dns options. They can then use
efidebug command to add a boot option for the EFI Bootmanager using
=> efidebug boot add -u 3 netinst http://<path>
=> efidebug boot order 3
=> bootefi bootmgr

The boot manager will automatically download and mount the image.
Once it's mounted it will locate and launch the installer.

It's worth noting that this rarely fails, but the reason is irrelevant
to the current patchset. More information can be found here
https://lore.kernel.org/u-boot/CAOMZO5CoduEgwgdQiybmoKh6qQZOezUtRRQO4ecaGdZBBz5dDw@mail.gmail.c
om/
The tl;dr is that wget sometimes fails to download the file correctly
or set the size env variables. We expect all these to be solved once
LWIP is stable and pulled

13 months agoMerge branch 'master-mmc-clock' of https://source.denx.de/u-boot/custodians/u-boot-sh
Tom Rini [Sat, 18 Nov 2023 15:25:48 +0000 (10:25 -0500)]
Merge branch 'master-mmc-clock' of https://source.denx.de/u-boot/custodians/u-boot-sh

13 months agodoc: uefi: add HTTP Boot support
Masahisa Kojima [Fri, 10 Nov 2023 04:25:42 +0000 (13:25 +0900)]
doc: uefi: add HTTP Boot support

This adds the description about HTTP Boot.

[Ilias add the new EFI_HTTP_BOOT option in docs]
Lore: https://lore.kernel.org/u-boot/20231110042542.3797301-1-masahisa.kojima@linaro.org/T/#m36acf922a888cc14f74e823ec57bacd9f977194e
Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
13 months agocmd: efidebug: add uri device path
Masahisa Kojima [Fri, 10 Nov 2023 04:25:41 +0000 (13:25 +0900)]
cmd: efidebug: add uri device path

This adds the URI device path option for 'boot add' subcommand.
User can add the URI load option for downloading ISO image file
or EFI application through network. Currently HTTP is only supported.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
13 months agoefi_loader: support boot from URI device path
Masahisa Kojima [Fri, 10 Nov 2023 04:25:40 +0000 (13:25 +0900)]
efi_loader: support boot from URI device path

This supports to boot from the URI device path.
When user selects the URI device path, bootmgr downloads
the file using wget into the address specified by loadaddr
env variable.
If the file is .iso or .img file, mount the image with blkmap
then try to boot with the default file(e.g. EFI/BOOT/BOOTAA64.EFI).
Since boot option indicating the default file is automatically
created when new disk is detected, system can boot by selecting
the automatically created blkmap boot option.
If the file is PE-COFF file, load and start the downloaded file.

The buffer used to download the ISO image file must be
reserved to avoid the unintended access to the image and
expose the ramdisk to the OS.
For PE-COFF file case, this memory reservation is done
in LoadImage Boot Service.

[Ilias fix a few memory leaks by replacing returns with gotos]
Lore: https://lore.kernel.org/u-boot/20231110042542.3797301-1-masahisa.kojima@linaro.org/T/#mbac31da301ff465b60894b38f3a587b2868cf817
Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
13 months agoefi_loader: add return to efibootmgr event group
Masahisa Kojima [Fri, 10 Nov 2023 04:25:39 +0000 (13:25 +0900)]
efi_loader: add return to efibootmgr event group

When the image loaded by efibootmgr returns, efibootmgr
needs to clean the resources. Adding the event of returning
to efibootmgr is useful to simplify the implementation.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
13 months agoefi_loader: add missing const classifier for event service
Masahisa Kojima [Fri, 10 Nov 2023 04:25:38 +0000 (13:25 +0900)]
efi_loader: add missing const classifier for event service

const classifier is missing in EventGroup parameter of
CreateEventEx(). Fix it to remove the compiler warning.

NotifyContext parameter of CreateEventEx() is also defined
with const in UEFI specification, but NotifyContext parameter
of CreateEvent() is defined without const.
Since current implementation calls the common efi_create_event()
function from both CreateEventEx() and CreateEvent() services,
NotifyContext parameter leaves as is.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
13 months agoefi_loader: Boot var automatic management
Raymond Mao [Fri, 10 Nov 2023 04:25:37 +0000 (13:25 +0900)]
efi_loader: Boot var automatic management

Changes for complying to EFI spec Â§3.5.1.1
'Removable Media Boot Behavior'.
Boot variables can be automatically generated during a removable
media is probed. At the same time, unused boot variables will be
detected and removed.

Please note that currently the function 'efi_disk_remove' has no
ability to distinguish below two scenarios
a) Unplugging of a removable media under U-Boot
b) U-Boot exiting and booting an OS
Thus currently the boot variables management is not added into
'efi_disk_remove' to avoid boot options being added/erased
repeatedly under scenario b) during power cycles
See TODO comments under function 'efi_disk_remove' for more details

The original efi_secboot tests expect that BootOrder EFI variable
is not defined. With this commit, the BootOrder EFI variable is
automatically added when the disk is detected. The original
efi_secboot tests end up with unexpected failure.
The efi_secboot tests need to be modified to explicitly set
the BootOrder EFI variable.

squashfs and erofs ls tests are also affected by this modification,
need to clear the previous state before squashfs ls test starts.

Co-developed-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
13 months agoblk: blkmap: add ramdisk creation utility function
Masahisa Kojima [Fri, 10 Nov 2023 04:25:36 +0000 (13:25 +0900)]
blk: blkmap: add ramdisk creation utility function

User needs to call several functions to create the ramdisk
with blkmap.
This adds the utility function to create blkmap device and
mount the ramdisk.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
13 months agonet: wget: add wget with dns utility function
Masahisa Kojima [Fri, 10 Nov 2023 04:25:35 +0000 (13:25 +0900)]
net: wget: add wget with dns utility function

Current wget takes the target uri in this format:
 "<http server ip>:<file path>"  e.g.) 192.168.1.1:/bar
The http server ip address must be resolved before
calling wget.

This commit adds the utility function runs wget with dhs.
User can call wget with the uri like "http://foo/bar".

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
13 months agonet: wget: prevent overwriting reserved memory
Masahisa Kojima [Fri, 10 Nov 2023 04:25:34 +0000 (13:25 +0900)]
net: wget: prevent overwriting reserved memory

This introduces the valid range check to store the received
blocks using lmb. The same logic is implemented in tftp.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
13 months agoMerge branch '2023-11-17-assorted-important-fixes'
Tom Rini [Fri, 17 Nov 2023 18:15:33 +0000 (13:15 -0500)]
Merge branch '2023-11-17-assorted-important-fixes'

- Revert HAFDBS changes, correct spl_imx_romapi for eMMC, fix the virtio
  rng in one case, fix bootstd in one case, and correct a Kconfig
  description.

13 months agoRevert "arm64: Use FEAT_HAFDBS to track dirty pages when available"
Chris Packham [Fri, 27 Oct 2023 00:23:54 +0000 (13:23 +1300)]
Revert "arm64: Use FEAT_HAFDBS to track dirty pages when available"

This reverts commit 6cdf6b7a340db4ddd008516181de7e08e3f8c213. This is
part of a series trying to make use of the arm64 hardware features for
tracking dirty pages. Unfortunately this series causes problems for the
AC5/AC5X SoCs. Having exhausted other options the consensus seems to be
reverting this series is the best course of action.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
13 months agoRevert "arm64: Use level-2 for largest block mappings when FEAT_HAFDBS is present"
Chris Packham [Fri, 27 Oct 2023 00:23:53 +0000 (13:23 +1300)]
Revert "arm64: Use level-2 for largest block mappings when FEAT_HAFDBS is present"

This reverts commit 836b8d4b205d2175b57cb9ef271e638b0c116e89. This is
part of a series trying to make use of the arm64 hardware features for
tracking dirty pages. Unfortunately this series causes problems for the
AC5/AC5X SoCs. Having exhausted other options the consensus seems to be
reverting this series is the best course of action.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
13 months agoRevert "armv8: enable HAFDBS for other ELx when FEAT_HAFDBS is present"
Chris Packham [Fri, 27 Oct 2023 00:23:52 +0000 (13:23 +1300)]
Revert "armv8: enable HAFDBS for other ELx when FEAT_HAFDBS is present"

This reverts commit c1da6fdb5c239b432440721772d993e63cfdeb20. This is
part of a series trying to make use of the arm64 hardware features for
tracking dirty pages. Unfortunately this series causes problems for the
AC5/AC5X SoCs. Having exhausted other options the consensus seems to be
reverting this series is the best course of action.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
13 months agoimx: spl_imx_romapi: fix emmc fast boot mode case
Marcel Ziswiler [Thu, 26 Oct 2023 07:32:20 +0000 (09:32 +0200)]
imx: spl_imx_romapi: fix emmc fast boot mode case

This fixes a regression in the eMMC fast boot mode case where the buffer
was missing 464 bytes.

The code figures out how many bytes must at least be fetched to honor
the current read, rounds that up to the ss->pagesize [which is a no-op
in the USB download case because that has ->pagesize==1], fetches that
many bytes, but then recorded the original upper bound as the new end of
the valid data. However, this did not take into account the rounding up
to the ss->pagesize. Fix this by recording the actual bytes downloaded.

Fixes: 4b4472438f5a ("imx: spl_imx_romapi: avoid tricky use of spl_load_simple_fit() to get full FIT size")
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
13 months agoimx: spl_imx_romapi: fix comment about stream(usb) download failure
Marcel Ziswiler [Thu, 26 Oct 2023 07:32:19 +0000 (09:32 +0200)]
imx: spl_imx_romapi: fix comment about stream(usb) download failure

Fix comment about Stream(USB) download failure.

Fixes: 1cbebc786276 ("imx: add rom api support")
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
13 months agospl: fix TPL_SYS_MALLOC_F description
John Keeping [Tue, 14 Nov 2023 11:30:17 +0000 (11:30 +0000)]
spl: fix TPL_SYS_MALLOC_F description

This config option enables the malloc() pool in TPL not the SPL.  Fix
the description to accurately reflect this.

Fixes: fd8497dae54 (spl: Create proper symbols for enabling the malloc() pool)
Signed-off-by: John Keeping <jkeeping@inmusicbrands.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agovirtio: rng: gracefully handle 0 byte returns
Andre Przywara [Tue, 7 Nov 2023 16:09:00 +0000 (16:09 +0000)]
virtio: rng: gracefully handle 0 byte returns

According to the virtio v1.x "entropy device" specification, a virtio-rng
device is supposed to always return at least one byte of entropy.
However the virtio v0.9 spec does not mention such a requirement.

The Arm Fixed Virtual Platform (FVP) implementation of virtio-rng always
returns 8 bytes less of entropy than requested. If 8 bytes or less are
requested, it will return 0 bytes.
This behaviour makes U-Boot's virtio_rng_read() implementation go into an
endless loop, hanging the system.

Work around this problem by always requesting 8 bytes more than needed,
but only if a previous call to virtqueue_get_buf() returned 0 bytes.

This should never trigger on a v1.x spec compliant implementation, but
fixes the hang on the Arm FVP.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reported-by: Peter Hoyes <peter.hoyes@arm.com>
13 months agobootstd: Avoid freeing a non-allocated buffer
Simon Glass [Thu, 16 Nov 2023 01:35:23 +0000 (18:35 -0700)]
bootstd: Avoid freeing a non-allocated buffer

EFI applications can be very large and thus used to cause boot failures
when malloc() space was exhausted.

A recent changed fixed this by using the kernel_addr_r environment var
as the address of the buffer. However, it still frees the buffer when
the bootflow is discarded.

Fix this by introducing a flag to indicate whether the buffer was
allocated, or not.

Note that kernel_addr_r is not the last word here. It might be better
to use lmb to place images. But there is a lot of refactoring to do
before we can remove the environment variables. The distro scripts rely
on them so it is safe for bootstd to do so too.

Fixes: 6a8c2f9781c bootstd: Avoid allocating memory for the EFI file
Signed-off-by: Simon Glass <sjg@chromium.org>
Reported by: Simon Glass <sjg@chromium.org>
Reported by: Shantur Rathore <i@shantur.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Tested-by: Shantur Rathore <i@shantur.com>
13 months agoMerge branch '2023-11-16-assorted-updates' into next
Tom Rini [Fri, 17 Nov 2023 13:38:05 +0000 (08:38 -0500)]
Merge branch '2023-11-16-assorted-updates' into next

- squashfs improvements, remove common.h in some places, assorted code
  fixes, fix a few CONFIG symbol names in Kconfig files, bring in
  linux's <linux/time.h> conversion functions, poplar updates, bcb
  improvements.

13 months agoblk: Drop reference to DM_SPL
Simon Glass [Sun, 12 Nov 2023 20:03:47 +0000 (13:03 -0700)]
blk: Drop reference to DM_SPL

The intent here is to only allow SPL_LEGACY_BLK if !SPL_DM - i.e. that
when driver model is enabled in SPL, legacy block cannot be used.

However this combination is used by about 240 boards, so we cannot
disallow it, at least not yet.

So just drop the condition.

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agodm: core: Correct reference to DM_SPL in SPL_DM_STATS
Simon Glass [Sun, 12 Nov 2023 20:03:46 +0000 (13:03 -0700)]
dm: core: Correct reference to DM_SPL in SPL_DM_STATS

This does not existing anymore. Update SPL_DM_STATS to use the correct
Kconfig option, which is SPL_DM

Signed-off-by: Simon Glass <sjg@chromium.org>
13 months agofs: btrfs: fix reading when length specified
Sam Edwards [Sat, 11 Nov 2023 15:19:04 +0000 (08:19 -0700)]
fs: btrfs: fix reading when length specified

The btrfs read function limits the read length to ensure that it
and the read offset do not together exceed the size of the file.
However, this size was only being queried if the read length was
passed a value of zero (meaning "whole file"), and the size is
defaulted to 0 otherwise. This means the clamp will just zero out
the length if one is specified, preventing reading of the file.

Fix this by checking the file size unconditionally, and unifying
the default length and clamping logic as a single range check instead.

This bug was discovered when trying to boot Linux with initrd= via
'bootefi' from a btrfs partition. The EFI stub entered an infinite
loop of zero-length reads while trying to read the initrd, and the
boot process stalled indefinitely.

Signed-off-by: Sam Edwards <CFSworks@gmail.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
13 months agocmd: bcb: extend BCB C API to allow read/write the fields
Dmitrii Merkurev [Fri, 10 Nov 2023 05:59:55 +0000 (05:59 +0000)]
cmd: bcb: extend BCB C API to allow read/write the fields

Currently BCB C API only allows to modify 'command' BCB field.
Extend it so that we can also read and modify all the available
BCB fields (command, status, recovery, stage).

Co-developed-by: Cody Schuffelen <schuffelen@google.com>
Signed-off-by: Cody Schuffelen <schuffelen@google.com>
Signed-off-by: Dmitrii Merkurev <dimorinny@google.com>
Cc: Eugeniu Rosca <erosca@de.adit-jv.com>
Cc: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Cc: Sean Anderson <sean.anderson@seco.com>
Cc: Cody Schuffelen <schuffelen@google.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # on vim3
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
13 months agocmd: bcb: support various block device interfaces for BCB command
Dmitrii Merkurev [Fri, 10 Nov 2023 05:59:54 +0000 (05:59 +0000)]
cmd: bcb: support various block device interfaces for BCB command

Currently BCB command-line, C APIs and implementation only
support MMC interface. Extend it to allow various block
device interfaces.

Signed-off-by: Dmitrii Merkurev <dimorinny@google.com>
Cc: Eugeniu Rosca <erosca@de.adit-jv.com>
Cc: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Cc: Sean Anderson <sean.anderson@seco.com>
Cc: Cody Schuffelen <schuffelen@google.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # on vim3
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
13 months agopoplar: provide more space for kernel image
Igor Opaniuk [Thu, 9 Nov 2023 22:34:35 +0000 (23:34 +0100)]
poplar: provide more space for kernel image

Adjust mem layout, providing more space for linux kernel image.

This fixes the problem:
ERROR: FDT image overlaps OS image (OS=0x30000000..0x32580000)

Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
13 months agopoplar: use random mac address
Igor Opaniuk [Thu, 9 Nov 2023 22:34:34 +0000 (23:34 +0100)]
poplar: use random mac address

Set CONFIG_NET_RANDOM_ETHADDR=y, which sets random eth address in
case there is no configuration provided neither in CONFIG_ETHADDR
nor in "ethaddr" env variable.

This fixes the problem:
poplar# dhcp
Error: ethernet@9841000 address not set.

Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
13 months agotreewide: use linux/time.h for time conversion defines
Igor Prusov [Thu, 9 Nov 2023 17:10:04 +0000 (20:10 +0300)]
treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
13 months agospi: meson_spifc_a1: Use define for time interval
Igor Prusov [Thu, 9 Nov 2023 17:10:03 +0000 (20:10 +0300)]
spi: meson_spifc_a1: Use define for time interval

Use USEC_PER_MSEC define for timeout to sync code with Linux version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
13 months agolinux/time.h: Add Linux time conversion defines
Igor Prusov [Thu, 9 Nov 2023 17:10:02 +0000 (20:10 +0300)]
linux/time.h: Add Linux time conversion defines

Currently there are no defines for time conversion in time.h, which
leads to drivers declaring those locally or not using defines at all, so
add them from Linux.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agofs: ext4: Remove unused parameter from ext4_mount
Sean Anderson [Wed, 8 Nov 2023 17:51:09 +0000 (12:51 -0500)]
fs: ext4: Remove unused parameter from ext4_mount

The part_length parameter is not used. Remove it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
13 months agosysreset: Fix unsupported request return values
Paul Barker [Wed, 8 Nov 2023 08:51:10 +0000 (08:51 +0000)]
sysreset: Fix unsupported request return values

The description of the sysreset request method in <sysreset.h> says that
the return value should be -EPROTONOSUPPORT if the requested reset type
is not supported by this device.

Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agoboard: cssi: Remove usage of common.h
Christophe Leroy [Mon, 6 Nov 2023 18:12:05 +0000 (19:12 +0100)]
board: cssi: Remove usage of common.h

Remove inclusion of common.h and add relevant
includes when necessary.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
13 months agopowerpc: mpc8xx: Remove usage of common.h
Christophe Leroy [Mon, 6 Nov 2023 18:12:04 +0000 (19:12 +0100)]
powerpc: mpc8xx: Remove usage of common.h

Remove inclusion of common.h and add relevant
includes when necessary.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
13 months agofs/squashfs: enable LZ4 compression support
David Oberhollenzer [Mon, 6 Nov 2023 10:14:03 +0000 (11:14 +0100)]
fs/squashfs: enable LZ4 compression support

The structure is identical to the existing compressor implementations,
trivially adding lz4 decompression to sqfs_decompress.

The changes were tested using a sandbox build. An LZ4 compressed
squashfs image was bound as a host block device.

Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
13 months agofs/squashfs: remove unused declarations
David Oberhollenzer [Mon, 6 Nov 2023 10:03:20 +0000 (11:03 +0100)]
fs/squashfs: remove unused declarations

This patch removes a number of struct and macro declaration that
were found through `git-grep` to be unused. Most of those are
related to compressor options and super block flags.

For reading a SquashFS image, we do not need the compressor options
or the flags. Those only encode settings used for packing the image,
mksquashfs uses them when appending data to an existing image. The
kernel implementation does not touch those, and we don't need them
either.

Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
13 months agotest: eth: Don't crash if env_get returns NULL
Sean Anderson [Sat, 28 Oct 2023 22:57:27 +0000 (18:57 -0400)]
test: eth: Don't crash if env_get returns NULL

env_get can return NULL if it fails to find the variable. Check its result
before using it.

Fixes: 6d9764c2a87 ("dm: test: Add a new test case against dm eth codes for NULL pointer access")
Fixes: df33fd28897 ("test: eth: Add test for ethernet addresses")
Signed-off-by: Sean Anderson <seanga2@gmail.com>
13 months agobootm: Enable legacy VxWorks booting from FITs
Sean Anderson [Fri, 27 Oct 2023 20:07:40 +0000 (16:07 -0400)]
bootm: Enable legacy VxWorks booting from FITs

This works without issue, so don't fail.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
13 months agoMerge patch series "spl: Use common function for loading/parsing images"
Tom Rini [Thu, 16 Nov 2023 17:55:48 +0000 (12:55 -0500)]
Merge patch series "spl: Use common function for loading/parsing images"

To quote the author:

This series adds support for loading all image types (Legacy (with and without
LZMA), FIT (with and without LOAD_FIT_FULL), and i.MX) to the MMC, SPI, NOR,
NET, FAT, EXT, NVMe, and semihosting load methods. It does this by introducing a
helper function which handles the minutiae of invoking the proper parsing
function, and reading the rest of the image.

Hopefully, this will make it easier for load methods to support all image types
that U-Boot supports, without having undocumented unsupported image types. I
applied this to several loaders which were invoking spl_load_simple_fit and/or
spl_parse_image_header, but I did not use it with others (e.g. DFU/RAM) which
had complications in the mix.

This series is organized roughly into two parts. Patches up to "spl: Add generic
spl_load function" are all setup or size-reduction oriented. Later patches
generally convert various load functions to spl_load.

bloat-o-meter results (for CONFIG_SPL only) at [1]. Size growth has been the
bigegst challenge to preparing this series. I have used every trick I can think
of to reduce bloat. Some SAMA boards no longer fit, but I have a plan to fix
them [2].

This is bar far the largest and most-difficult revision of this series to-date.
There are probably still things which can reduce the size, but I have been
working on this series for the better part of two months and I think it is a
good idea to get some feedback. Because of the SAMA bloat, this series will not
pass CI, so I expect to do a v7 before this is ready to apply. Feel free,
however, to apply patches in the first half (especially the fixes).

This version of the series is better-tested than ever before, thanks to some new
unit tests. However, things like the i.MX ROMAPI are untested. NAND should also
be tested more-widely, for reasons listed in the commit message. I encourage you
try this series out on your favorite board.

[1] https://gist.github.com/Forty-Bot/5bfe88676dd3c2aec6ebc23abb08e06f
    This includes some changes to am335x_evm_spiboot and am65x_evm_r5_usbdfu
    which have since been undone. This was ran for v6.
[2] https://lore.kernel.org/u-boot/20231105022742.632175-1-seanga2@gmail.com/

13 months agospl: fat: Add option to disable DMA alignment
Sean Anderson [Wed, 8 Nov 2023 16:48:58 +0000 (11:48 -0500)]
spl: fat: Add option to disable DMA alignment

If we don't DMA-align buffers we pass to FAT, it will align them itself.
This behaviour likely should be deprecated in favor of
CONFIG_BOUNCE_BUFFER, but that's a task for another series. For the
meantime, don't bother aligning the buffer unless we had been doing so in
the past.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agospl: spi: Consolidate spi_load_image_os into spl_spi_load_image
Sean Anderson [Wed, 8 Nov 2023 16:48:57 +0000 (11:48 -0500)]
spl: spi: Consolidate spi_load_image_os into spl_spi_load_image

spi_load_image_os performs almost the same steps as the non-falcon-boot
path of spl_spi_load_image. The load address is different, and it also
loads a device tree, but that's it. Refactor the boot process so that
they can both use the same load function.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>