platform/kernel/u-boot.git
2 years agoconfigs: sunxi: licheepi_nano: enable D-Cache
Icenowy Zheng [Thu, 13 Oct 2022 13:26:45 +0000 (21:26 +0800)]
configs: sunxi: licheepi_nano: enable D-Cache

As the compile error when D-Cache is enabled is gone, we can have
D-Cache enabled now.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agosunxi: fix SUNIV build when enabling D-Cache
Icenowy Zheng [Thu, 13 Oct 2022 13:26:44 +0000 (21:26 +0800)]
sunxi: fix SUNIV build when enabling D-Cache

The enable_caches function in architecture-specific board code is only
necessary for V7A CPUs, code for both V8A and ARM926 have already
declared this function.

Only provide our implementation of enable_caches() for V7A CPUs.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agosunxi: defconfig: Add X96 Mate TV box
Andre Przywara [Sat, 10 Sep 2022 23:06:19 +0000 (00:06 +0100)]
sunxi: defconfig: Add X96 Mate TV box

The X96 Mate TV box is a TV box with the Allwinner H616 SoC. It is
available with up to 4GB of DRAM and 64GB eMMC.
The DRAM chips require a different configuration when compared to the
OrangePi Zero2, we must not use read/write training and write leveling.

Add a defconfig for the box, so that we can easily build U-Boot for it.
We synced the .dts file already from the kernel tree.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
2 years agosunxi: OrangePi Zero 2: Enable SPI booting
Andre Przywara [Sun, 4 Jul 2021 21:15:01 +0000 (22:15 +0100)]
sunxi: OrangePi Zero 2: Enable SPI booting

The OrangePi Zero 2 board comes with 2MB of SPI flash, from which the
BROM is able to boot from. Please note that the fuse setup requires
PC5 (BOOT_SEL3) to be pulled to GND for that to actually work.

Enable the SPL code responsible for finding and loading U-Boot proper and
friends, so that u-boot-sunxi-with-spl.bin can be written into the flash.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Tested-by: Ivan Shishkin <s45rus@gmail.com>
2 years agosunxi: SPL SPI: Add SPI boot support for the Allwinner H616 SoC
Andre Przywara [Sun, 13 Dec 2020 20:19:43 +0000 (20:19 +0000)]
sunxi: SPL SPI: Add SPI boot support for the Allwinner H616 SoC

The H616 SoC uses the same SPI IP as the H6, also shares the same clocks
and reset bits.
The only real difference is a slight change in the pin assignment: the
H6 uses PC5, the H616 PC4 instead. This makes for a small change in
our spi0_pinmux_setup() routine.

Apart from that, just extend the H6 #ifdef guards to also cover the H616,
using the shared CONFIG_SUN50I_GEN_H6 symbol.
Also use this symbol for the Kconfig dependency.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Tested-by: Ivan Shishkin <s45rus@gmail.com>
2 years agosunxi: defconfig: drop redundant definitions
Andre Przywara [Tue, 13 Sep 2022 00:26:36 +0000 (01:26 +0100)]
sunxi: defconfig: drop redundant definitions

When some configuration symbols were converted from header files to
Kconfig, their values were placed into *every* defconfig file.
Since we now have sensible per-SoC defaults defined in Kconfig, those
values are now redundant, and can just be removed.
This affects CONFIG_SPL_STACK, CONFIG_SYS_PBSIZE, CONFIG_SPL_MAX_SIZE,
and CONFIG_SYS_BOOTM_LEN.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agosunxi: Kconfig: use SoC-wide values for some symbols
Andre Przywara [Tue, 13 Sep 2022 00:23:58 +0000 (01:23 +0100)]
sunxi: Kconfig: use SoC-wide values for some symbols

Some configuration symbols formerly defined in header files were
recently converted to Kconfig symbols. This moved their value definition
into *every* defconfig file, even though those values are hardly board
choices.
Use the new Kconfig option to define per-SoC default values, in just one
place, which makes the definition in each defconfig file redundant.

We refrain from setting a sunxi specific value for CONFIG_SYS_BOOTM_LEN,
so this defaults to a much better 64MB for uncompressed arm64 kernels.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agosunxi: dts: arm: update devicetree files
Andre Przywara [Mon, 12 Sep 2022 23:52:52 +0000 (00:52 +0100)]
sunxi: dts: arm: update devicetree files

Update the devicetree files from the Linux kernel, version v6.0-rc4.
This is covering the 32-bit SoCs, from arch/arm/boot/dts/.

This avoids the not backwards-compatible r_intc binding change, to allow
older kernels to boot, but the other nodes are updated.

Not much change here, the vast majority is actually cosmetic: node names
and using symbolic names for the the RTC clocks.
The R40 boards gain DVFS support.
Some A23/A33 tablet DTs are unified into a single file.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
2 years agosunxi: dts: arm64: update devicetree files
Andre Przywara [Sat, 10 Sep 2022 23:04:41 +0000 (00:04 +0100)]
sunxi: dts: arm64: update devicetree files

Update the devicetree files from the Linux kernel, version v6.0-rc4.
This is covering the 64-bit SoCs, from arch/arm64/boot/dts/allwinner.

This avoids the not backwards-compatible r_intc binding change, to allow
older kernels to boot, but the other nodes are updated.

Not much change here, the vast majority is actually cosmetic: node names
and using symbolic names for the the RTC clocks.
Some A64 boards gain some audio nodes.
The H616 DTs are now switched to the version finally merged into the
kernel, which brings some changes, but none affecting U-Boot.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
2 years agoMerge tag 'efi-2023-01-rc1-3' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Mon, 17 Oct 2022 00:23:47 +0000 (20:23 -0400)]
Merge tag 'efi-2023-01-rc1-3' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2023-01-rc1-3

UEFI:
* replace EFI_CALL() by internal functions
* delete loadfile2 handle by uninstalling all protocols

Other:

* Provide spi_set_speed() needed for implementation of
  EFI SPI I/O protocol

2 years agoefi_loader: remove efi_delete_handle on loadfile2
Ilias Apalodimas [Sun, 16 Oct 2022 08:36:32 +0000 (11:36 +0300)]
efi_loader: remove efi_delete_handle on loadfile2

Loadfile2 code is installing two protocols on it's own handle
and uses efi_delete_handle() to clean it up on failure(s). However
commit 05c4c9e21ae6 ("efi_loader: define internal implementations of
install/uninstallmultiple") prepares the ground for us to clean up
efi_delete_handle() used in favor of Install/UninstallMultipleProtocol.

While at it clean up the non needed void casts to (void *) on the
protolcol installation.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agocmd: simplify efidebug
Heinrich Schuchardt [Sat, 15 Oct 2022 11:21:01 +0000 (13:21 +0200)]
cmd: simplify efidebug

* don't use EFI_CALL() for variable services
* don't use runtime pointer to access exported function

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi_loader: avoid EFI_CALL() when draining console
Heinrich Schuchardt [Sat, 15 Oct 2022 10:22:37 +0000 (12:22 +0200)]
efi_loader: avoid EFI_CALL() when draining console

Use internal function.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi_loader: avoid EFI_CALL() for clearing screen
Heinrich Schuchardt [Sat, 15 Oct 2022 09:13:59 +0000 (11:13 +0200)]
efi_loader: avoid EFI_CALL() for clearing screen

Carve out function efi_clear_screen.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agospi: Implement spi_set_speed
Paul Barker [Wed, 5 Oct 2022 12:18:34 +0000 (13:18 +0100)]
spi: Implement spi_set_speed

This function is already defined in spi.h but no implementation of it
currently exists in the tree. The implementation is based on the static
function spi_set_speed_mode(). The function prototype is modified so
that an success or error condition can be returned to the caller.

Signed-off-by: Paul Barker <paul.barker@sancloud.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agoMerge branch '2022-10-12-additional-fixes'
Tom Rini [Wed, 12 Oct 2022 19:12:42 +0000 (15:12 -0400)]
Merge branch '2022-10-12-additional-fixes'

- Add "ubi list", Nokia RX51 fixes, other assorted fixes

2 years agoNokia RX-51: Fix double space key press
Pali Rohár [Sun, 9 Oct 2022 19:38:25 +0000 (21:38 +0200)]
Nokia RX-51: Fix double space key press

Space key is indicated by two different bits. Some HW models indicate press
of space key only by the first bit. Qemu indicates it by both bits at the
same time, which is currently interpreted by u-boot as double key press.

Fix this issue by setting first bit when only second is set (to support HW
models which indicate press only by second bit) and always clearing second
bit before processing to not report double space key press.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoNokia RX-51: Remove CONFIG_UBI_SIZE
Pali Rohár [Sun, 9 Oct 2022 13:12:09 +0000 (15:12 +0200)]
Nokia RX-51: Remove CONFIG_UBI_SIZE

CONFIG_UBI_SIZE option is not used, so remove it.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoFix typo in CONFIG_USBNET_DEVADDR
Ignacio Zamora [Sat, 8 Oct 2022 14:50:56 +0000 (09:50 -0500)]
Fix typo in CONFIG_USBNET_DEVADDR

Fix typo that was caused by the same feature being split in to 2 different
configuration options. Replace CONFIG_USBNET_DEVADDR with
CONFIG_USBNET_DEV_ADDR

Signed-off-by: Ignacio Zamora <nachopitt@gmail.com>
2 years agotools: k3_gen_x509_cert: Do not print SWRV on build
Andrew Davis [Fri, 7 Oct 2022 20:35:31 +0000 (15:35 -0500)]
tools: k3_gen_x509_cert: Do not print SWRV on build

This matches the others here.

Signed-off-by: Andrew Davis <afd@ti.com>
2 years agosmem: msm: add missing <linux/sizes.h>
Robert Marko [Fri, 7 Oct 2022 09:52:44 +0000 (11:52 +0200)]
smem: msm: add missing <linux/sizes.h>

MSM SMEM driver is currently missing <linux/sizes.h> header and throws
the following compile error:

drivers/smem/msm_smem.c: In function ‘qcom_smem_get_ptable’:
drivers/smem/msm_smem.c:635:71: error: ‘SZ_4K’ undeclared (first use in this function)
  635 |         ptable = smem->regions[0].virt_base + smem->regions[0].size - SZ_4K;

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Cc: luka.perkov@sartura.hr
2 years agotest: run setexpr test only on sandbox
Heinrich Schuchardt [Sat, 1 Oct 2022 19:42:35 +0000 (21:42 +0200)]
test: run setexpr test only on sandbox

The test relies on memory being available at 0x0. This in not valid for
many boards.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agofirmware: scmi: fix the multi channel support with CCF
Patrick Delaunay [Fri, 30 Sep 2022 07:36:38 +0000 (09:36 +0200)]
firmware: scmi: fix the multi channel support with CCF

When the CCF is activated, the dev->parent is not necessary
the reference to SCMI transport and the function devm_scmi_of_get_channel
failed for the registered SCMI clock, child for protocol@14,
the channel is null and the SCMI clock driver crash for any operations.

This patch changes the first parameter of the ops of_get_channel(),
aligned with other process_msg() to pass directly the good reference,
i.e. parent result of find_scmi_transport_device(dev)
which return the reference of the scmi transport device.

Fixes: 8e96801aa6a ("firmware: scmi: add multi-channel support")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agocmd: ubi: Add 'ubi list' command for printing list of all UBI volumes
Pali Rohár [Mon, 12 Sep 2022 09:38:55 +0000 (11:38 +0200)]
cmd: ubi: Add 'ubi list' command for printing list of all UBI volumes

To allow easily iterate over all UBI volumes, add a new command which
either print all user UBI volumes on output or set them into env variable.

As UBI volumes can have arbitrary name/label, in most cases it is useful to
iterate them by their numbers. This can be achieved by -numeric flag.

This functionality is similar to already existing 'part list' command which
prints partitions on formatted block device.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoMerge branch '2022-10-11-assorted-fixes-and-updates'
Tom Rini [Tue, 11 Oct 2022 21:35:42 +0000 (17:35 -0400)]
Merge branch '2022-10-11-assorted-fixes-and-updates'

- Assorted code cleanups and fixes, along with two new commands.

2 years agotest: cmd: add test for temperature command
Robert Marko [Tue, 6 Sep 2022 11:30:36 +0000 (13:30 +0200)]
test: cmd: add test for temperature command

Add simple test for the temperature command.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agothermal: add sandbox driver
Robert Marko [Tue, 6 Sep 2022 11:30:35 +0000 (13:30 +0200)]
thermal: add sandbox driver

Provide a simple sandbox driver for the thermal uclass.
It simply registers and returns 100 degrees C if requested.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agodoc: cmd: temperature: add documentation
Robert Marko [Tue, 6 Sep 2022 11:30:34 +0000 (13:30 +0200)]
doc: cmd: temperature: add documentation

Add documentation for the temperature command.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agocmd: add temperature command
Robert Marko [Tue, 6 Sep 2022 11:30:33 +0000 (13:30 +0200)]
cmd: add temperature command

Currently, there is no way for users to check the readings from thermal
sensors from U-boot console, only some boards print it during boot.

So, lets add a simple "temperature" command that allows listing thermal
uclass devices and getting their value.

Note that the thermal devices are intenionally probed if list is used as
almost always they will not get probed otherwise and there is no way for
users to manually call probe on a certain device from console.

Assumption is made that temperature is returned in degrees C and not
milidegrees like in Linux as this is what most drivers seem to return.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agocmd: xxd: add new command
Roger Knecht [Sat, 3 Sep 2022 13:15:04 +0000 (13:15 +0000)]
cmd: xxd: add new command

Add xxd command to print file content as hexdump to standard out

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Roger Knecht <rknecht@pm.me>
2 years agocmd: cat: add new command
Roger Knecht [Sat, 3 Sep 2022 11:34:53 +0000 (11:34 +0000)]
cmd: cat: add new command

Add cat command to print file content to standard out

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Roger Knecht <rknecht@pm.me>
2 years agopinctrl: fix buffer size for pinctrl_generic_set_state_prefix()
John Keeping [Wed, 7 Sep 2022 11:11:42 +0000 (12:11 +0100)]
pinctrl: fix buffer size for pinctrl_generic_set_state_prefix()

This buffer has the concatenated prefix and name written into it, so it
must be large enough to cover both strings plus the terminating NUL.

Fixes: 92c4a95ec7 ("pinctrl: Add new function pinctrl_generic_set_state_prefix()")
Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agopinctrl: nuvoton: fix set persist error
Jim Liu [Tue, 13 Sep 2022 06:23:15 +0000 (14:23 +0800)]
pinctrl: nuvoton: fix set persist error

CA9C is cortex A9 watchdog reset control bit.
if device set persist mode, it shouldn't set this bit.

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
2 years agoboot: image-pre-load: Check environment for location of signature info
Steven Lawrance [Wed, 14 Sep 2022 18:57:28 +0000 (20:57 +0200)]
boot: image-pre-load: Check environment for location of signature info

Setting an alternative signature info node in "pre_load_sig_info_path"
allows verification of an image using the bootm pre-load mechanism with
a different key, e.g.: setenv pre_load_sig_info_path "/alt/sig" ; bootm
preload [addr]

Signed-off-by: Steven Lawrance <steven.lawrance@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoimage-pre-load: Move macros/definitions to image.h
Steven Lawrance [Wed, 14 Sep 2022 18:57:27 +0000 (20:57 +0200)]
image-pre-load: Move macros/definitions to image.h

Putting these definitions in a header will allow signatures to be
validated independently of bootm.

Signed-off-by: Steven Lawrance <steven.lawrance@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobootcount: pmic: Correct misleading comment
Philip Oberfichtner [Mon, 19 Sep 2022 08:11:00 +0000 (10:11 +0200)]
bootcount: pmic: Correct misleading comment

Fix a copy-paste error I did when inserting the comment.

Signed-off-by: Philip Oberfichtner <pro@denx.de>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agolib: crypt: fix selecting a non-existent option
Oleksandr Suvorov [Mon, 19 Sep 2022 09:14:49 +0000 (12:14 +0300)]
lib: crypt: fix selecting a non-existent option

The option SHA256_ALGO does not exist. Remove selecting it.

Fixes: 26dd9936574 ("lib: add crypt subsystem")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
2 years agocmd: pxe: add alias devicetree-overlay for fdtoverlays
Edoardo Tomelleri [Wed, 21 Sep 2022 13:26:33 +0000 (15:26 +0200)]
cmd: pxe: add alias devicetree-overlay for fdtoverlays

This adds keyword devicetree-overlay as an alias for fdtoverlays in
extlinux (sysboot) and pxe to better follow the Boot Loader Specification
[1], improves documentation around them by adding an example for both
fdtoverlays and devicetree-overlay and the environment variable required
for this feature. The link for the spec is updated to the current one.

[1] https://systemd.io/BOOT_LOADER_SPECIFICATION/

Signed-off-by: Edoardo Tomelleri <e.tomell@gmail.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agoMerge tag 'xilinx-for-v2023.01-rc1-v3' of https://source.denx.de/u-boot/custodians...
Tom Rini [Tue, 11 Oct 2022 13:57:08 +0000 (09:57 -0400)]
Merge tag 'xilinx-for-v2023.01-rc1-v3' of https://source.denx.de/u-boot/custodians/u-boot-microblaze

Xilinx changes for v2023.01-rc1 (round 3)

fpga:
- Create new uclass
- Get rid of FPGA_DEBUG and use logging infrastructure

zynq:
- Enable early EEPROM decoding
- Some DT updates

zynqmp:
- Use OCM_BANK_0 to check config loading permission
- Change config object loading in SPL
- Some DT updates

net:
- emaclite: Enable driver for RISC-V

xilinx:
- Fix static checker warnings
- Fix GCC12 warning

sdhci:
- Read PD id from DT

2 years agoMerge branch '2022-10-10-LLVM-related-improvements'
Tom Rini [Tue, 11 Oct 2022 13:55:56 +0000 (09:55 -0400)]
Merge branch '2022-10-10-LLVM-related-improvements'

- A few patches to make building with LLVM/LLD easier

2 years agospl: atf: Fix clang -Wasm-operand-widths warning
Alistair Delva [Mon, 26 Sep 2022 20:47:55 +0000 (20:47 +0000)]
spl: atf: Fix clang -Wasm-operand-widths warning

common/spl/spl_atf.c:187:51: warning: value size does not match register
  size specified by the constraint and modifier [-Wasm-operand-widths]
    __asm__ __volatile__("msr DAIF, %0\n\t" : : "r" (daif) : "memory");
                                                     ^
common/spl/spl_atf.c:187:34: note: use constraint modifier "w"
    __asm__ __volatile__("msr DAIF, %0\n\t" : : "r" (daif) : "memory");
                                    ^~
                                    %w0

Use %x0 to match what Linux does in <asm/sysreg.h> write_sysreg().

Signed-off-by: Alistair Delva <adelva@google.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Michael Walle <michael@walle.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>
2 years agoMakefile: apply dynamic relocations for LLD
Nick Desaulniers [Mon, 26 Sep 2022 20:47:40 +0000 (20:47 +0000)]
Makefile: apply dynamic relocations for LLD

It seems that for aarch64, unless we apply dynamic relocations to the
location being relocated, we fail to boot.

As Fangrui notes:
  For dynamic relocations using the RELA format (readelf -Wr), GNU ld
  sets the initial content to r_addend; ld.lld doesn't do that by
  default (needs --apply-dynamic-relocs).

Otherwise .rodata appears to be full of NUL-bytes before relocation,
causing crashes when trying to invoke the function pointers in
init_sequence_f from initcall_run_list().

Link: https://reviews.llvm.org/D42797
Suggested-by: Fangrui Song <maskray@google.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Alistair Delva <adelva@google.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>
2 years agoexamples: standalone: Fix build with LLVM toolchain
Alistair Delva [Mon, 26 Sep 2022 20:47:10 +0000 (20:47 +0000)]
examples: standalone: Fix build with LLVM toolchain

When building the standalone example with llvm, the link step fails:

examples/standalone/libstubs.o: In function `dummy':
include/_exports.h:10: undefined reference to `jt'
include/_exports.h:11: undefined reference to `jt'
include/_exports.h:12: undefined reference to `jt'
include/_exports.h:13: undefined reference to `jt'
include/_exports.h:14: undefined reference to `jt'
examples/standalone/libstubs.o:include/_exports.h:15:
  more undefined references to `jt' follow

Indeed, the standalone libstubs.o does use the jt symbol, but it was
marked 'static' in stubs.c. It's strange how gcc builds are working.

Signed-off-by: Alistair Delva <adelva@google.com>
Cc: Rick Chen <rick@andestech.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>
2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Mon, 10 Oct 2022 19:38:14 +0000 (15:38 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-usb

2 years agoMerge tag 'efi-2023-01-rc1-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Mon, 10 Oct 2022 16:14:51 +0000 (12:14 -0400)]
Merge tag 'efi-2023-01-rc1-2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2023-01-rc1-2

Documentation:

* man-page for cls command
* update build requirements

UEFI

* Fix bugs in the Stop() function of the EFi Driver Binding protocol
  for block devices
* Avoid EFI_CALL() when invoking CloseProtocol()

2 years agousb: gadget: fastboot: detach usb on reboot commands
Mattijs Korpershoek [Fri, 7 Oct 2022 09:38:22 +0000 (11:38 +0200)]
usb: gadget: fastboot: detach usb on reboot commands

When host issues "fastboot reboot fastboot", it's expected that the
board drops the USB connection before resetting.

On some boards, such as Khadas VIM3L and SEI610, this is not the case.

We observe the following error:
$ fastboot reboot fastboot
Rebooting into fastboot                            OKAY [  0.004s]
fastboot: error: Failed to boot into userspace fastboot; one or more components might be unbootable.

This does not happen when we use the RST button on the board.
It can be reproduced in linux with:
  # echo b > /proc/sysrq-trigger

In this case, we hit a undefined hardware behavior, where D+ and D-
are in an unknown state. Therefore the host can't detect usb
disconnection.

Make sure we always call usb_gadget_release() when a "fastboot reboot"
command is issued.

Note: usb_gadget_release() should be called before g_dnl_unregister()
because g_dnl_unregister() triggers a complete() call on each
endpoint (thus calling do_reset()).

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2 years agousb: ehci: Remove unused ehci_{setup,shutdown}_phy() helpers
Patrice Chotard [Tue, 6 Sep 2022 06:15:29 +0000 (08:15 +0200)]
usb: ehci: Remove unused ehci_{setup,shutdown}_phy() helpers

Remove unused ehci_{setup,shutdown}_phy() helpers now replaced by
generic_{setup,shutdown}_phy().

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
2 years agousb: ehci: Make usage of generic_{setup,shutdown}_phy() helpers
Patrice Chotard [Tue, 6 Sep 2022 06:15:28 +0000 (08:15 +0200)]
usb: ehci: Make usage of generic_{setup,shutdown}_phy() helpers

Replace ehci_setup_phy() and ehci_shutdown_phy () by respectively
generic_setup_phy() and generic_shutdown_phy().

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
2 years agousb: ohci: Make usage of generic_{setup,shutdown}_phy() helpers
Patrice Chotard [Tue, 6 Sep 2022 06:15:27 +0000 (08:15 +0200)]
usb: ohci: Make usage of generic_{setup,shutdown}_phy() helpers

Replace ohci_setup_phy() and ohci_shutdown_phy () by respectively
generic_setup_phy() and generic_shutdown_phy().

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
2 years agophy: Add generic_{setup,shutdown}_phy() helpers
Patrice Chotard [Tue, 6 Sep 2022 06:15:26 +0000 (08:15 +0200)]
phy: Add generic_{setup,shutdown}_phy() helpers

In drivers usb/host/{ehci,ohci}-generic.c, {ehci,ohci}_setup_phy() and
{ehci,ohci}_shutdown_phy() shares 95% of common code.
Factorize this code in new generic_{setup,shudown}_phy() functions.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
2 years agousb: gadget: Clean up Makefile ifdeffery
Marek Vasut [Tue, 23 Aug 2022 17:06:51 +0000 (19:06 +0200)]
usb: gadget: Clean up Makefile ifdeffery

Take the USB_ETHER ifdef block apart and make use of obj-$(VAR) instead
to include the source files in build. The duplicate CI_UDC entry is now
removed, the USB_DEVICE ifdef is now reduced to core.o ep.o addition,
the ether.o can be conditionally compiled in using USB_ETHER.

No functional change.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agousb: Add missing guard around env_get() in usb_hub
Marek Vasut [Mon, 19 Sep 2022 19:19:23 +0000 (21:19 +0200)]
usb: Add missing guard around env_get() in usb_hub

The env_get() might be undefined in case ENV_SUPPORT is disabled,
which may happen e.g. in SPL. Add missing ifdef guard around the
env_get() to prevent build failure.

Signed-off-by: Marek Vasut <marex@denx.de>
Tested-by: Fabio Estevam <festevam@denx.de>
2 years agoefi_loader: reformat efi_disk_add_dev()
Heinrich Schuchardt [Fri, 7 Oct 2022 09:03:01 +0000 (11:03 +0200)]
efi_loader: reformat efi_disk_add_dev()

Make it clearer why InstallMultipleProtocolInterfaces is invoked with two
NULLs:

* rename guid to esp_guid
* put protocol GUIDs and the related interfaces on same lines
* add comment

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agoefi_loader: simplify efi_set_load_options()
Heinrich Schuchardt [Fri, 7 Oct 2022 14:21:28 +0000 (16:21 +0200)]
efi_loader: simplify efi_set_load_options()

* Replace the OpenProtocol() call by efi_search_protocol().
* Remove the CloseProtocol() call.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agoefi_driver: use efi_close_protocol
Heinrich Schuchardt [Fri, 7 Oct 2022 14:12:54 +0000 (16:12 +0200)]
efi_driver: use efi_close_protocol

Avoid EFI_CALL() by using efi_close_protocol().

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agoefi_loader: internal CloseProtocol
Heinrich Schuchardt [Fri, 7 Oct 2022 13:18:15 +0000 (15:18 +0200)]
efi_loader: internal CloseProtocol

Allow avoiding using EFI_CALL() when closing a protocol by providing an
internal function.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agoefi_loader: CloseProtocol in efi_fmp_find
Heinrich Schuchardt [Fri, 7 Oct 2022 13:29:52 +0000 (15:29 +0200)]
efi_loader: CloseProtocol in efi_fmp_find

The CloseProtocol() boot service requires a handle as first argument.
Passing the protocol interface is incorrect.

CloseProtocol() only has an effect if called with a non-zero value for
agent_handle. HandleProtocol() uses an opaque agent_handle when invoking
OpenProtocol() (currently NULL). Therefore HandleProtocol() should be
avoided.

* Replace the LocateHandle() call by efi_search_protocol().
* Remove the CloseProtocol() call.

Fixes: 8d99026f0697 ("efi_loader: capsule: support firmware update")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi_loader: CloseProtocol in tcg2_measure_gpt_data
Heinrich Schuchardt [Fri, 7 Oct 2022 12:28:18 +0000 (14:28 +0200)]
efi_loader: CloseProtocol in tcg2_measure_gpt_data

The CloseProtocol() boot service requires a handle as first argument.
Passing the protocol interface is incorrect.

CloseProtocol() only has an effect if called with a non-zero value for
agent_handle. HandleProtocol() uses an opaque agent_handle when invoking
OpenProtocol() (currently NULL). Therefore HandleProtocol() should be
avoided.

* Replace the LocateHandle() call by efi_search_protocol().
* Remove the CloseProtocol() call.
* Remove a superfluous goto.

Fixes: ce3dbc5d080d ("efi_loader: add UEFI GPT measurement")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agoefi_driver: fix efi_uc_stop()
Heinrich Schuchardt [Fri, 7 Oct 2022 21:53:38 +0000 (23:53 +0200)]
efi_driver: fix efi_uc_stop()

We must always call EFI_EXIT() when returning from an EFIAPI function.

Fixes: 05ef48a2484b ("efi_driver: EFI block driver")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agoefi_loader: don't export efi_remove_all_protocols
Heinrich Schuchardt [Fri, 7 Oct 2022 14:55:29 +0000 (16:55 +0200)]
efi_loader: don't export efi_remove_all_protocols

This function is only used inside efi_boottime.c and is not safe to use
outside of this context.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agoefi_loader: printf code in efi_disk_get_device_name()
Heinrich Schuchardt [Fri, 7 Oct 2022 10:55:16 +0000 (12:55 +0200)]
efi_loader: printf code in efi_disk_get_device_name()

part is unsigned. So it must be printed with %u.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agodoc: describe usage of virt-make-fs for testing
Heinrich Schuchardt [Fri, 7 Oct 2022 23:19:22 +0000 (01:19 +0200)]
doc: describe usage of virt-make-fs for testing

We want tests to avoid the usage of sudo. Describe that virt-make-fs can
generate disk images without being root.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agodoc: add python3-filelock python3-pytest-xdist
Heinrich Schuchardt [Fri, 7 Oct 2022 22:46:35 +0000 (00:46 +0200)]
doc: add python3-filelock python3-pytest-xdist

Packages python3-filelock python3-pytest-xdist as required to run
'make tests'. Add them to the required packages list in the documentation.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agodoc: man-page for cls
Heinrich Schuchardt [Fri, 7 Oct 2022 18:51:35 +0000 (20:51 +0200)]
doc: man-page for cls

Provide a man-page for the cls command.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agocmd: CMD_CLS should not depend on video
Heinrich Schuchardt [Fri, 7 Oct 2022 18:36:12 +0000 (20:36 +0200)]
cmd: CMD_CLS should not depend on video

The cls command works fine on the serial console. There is no reason to
let it depend on the availability of video.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoMerge tag 'u-boot-nand-20221009' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Mon, 10 Oct 2022 12:17:08 +0000 (08:17 -0400)]
Merge tag 'u-boot-nand-20221009' of https://source.denx.de/u-boot/custodians/u-boot-nand-flash

- mtd: Update the function name to 'rfree'
- Support NAND ONFI EDO mode for imx8mn architecture
- dm: clk: add missing stub when CONFIG_CLK is deactivated

2 years agofpga: virtex2: Use logging feature instead of FPGA_DEBUG
Alexander Dahl [Fri, 7 Oct 2022 12:20:03 +0000 (14:20 +0200)]
fpga: virtex2: Use logging feature instead of FPGA_DEBUG

Instead of using DEBUG or LOG_DEBUG the driver still had its own
definition for debug output.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20221007122003.11239-11-ada@thorsis.com
2 years agofpga: spartan3: Use logging feature instead of FPGA_DEBUG
Alexander Dahl [Fri, 7 Oct 2022 12:20:02 +0000 (14:20 +0200)]
fpga: spartan3: Use logging feature instead of FPGA_DEBUG

Instead of using DEBUG or LOG_DEBUG the driver still had its own
definition for debug output.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20221007122003.11239-10-ada@thorsis.com
2 years agofpga: spartan2: Use logging feature instead of FPGA_DEBUG
Alexander Dahl [Fri, 7 Oct 2022 12:20:01 +0000 (14:20 +0200)]
fpga: spartan2: Use logging feature instead of FPGA_DEBUG

Instead of using DEBUG or LOG_DEBUG the driver still had its own
definition for debug output.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20221007122003.11239-9-ada@thorsis.com
2 years agofpga: ACEX1K: Use logging feature instead of FPGA_DEBUG
Alexander Dahl [Fri, 7 Oct 2022 12:20:00 +0000 (14:20 +0200)]
fpga: ACEX1K: Use logging feature instead of FPGA_DEBUG

Instead of using DEBUG or LOG_DEBUG the driver still had its own
definition for debug output.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20221007122003.11239-8-ada@thorsis.com
2 years agofpga: cyclon2: Use logging feature instead of FPGA_DEBUG
Alexander Dahl [Fri, 7 Oct 2022 12:19:59 +0000 (14:19 +0200)]
fpga: cyclon2: Use logging feature instead of FPGA_DEBUG

Instead of using DEBUG or LOG_DEBUG the driver still had its own
definition for debug output.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20221007122003.11239-7-ada@thorsis.com
2 years agofpga: altera: Use logging feature instead of FPGA_DEBUG
Alexander Dahl [Fri, 7 Oct 2022 12:19:58 +0000 (14:19 +0200)]
fpga: altera: Use logging feature instead of FPGA_DEBUG

Instead of using DEBUG or LOG_DEBUG the driver still had its own
definition for debug output.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20221007122003.11239-6-ada@thorsis.com
2 years agofpga: virtex2: Fix printf format string warnings
Alexander Dahl [Fri, 7 Oct 2022 12:19:57 +0000 (14:19 +0200)]
fpga: virtex2: Fix printf format string warnings

Warning appears if built with FPGA_DEBUG defined:

  CC      drivers/fpga/virtex2.o
/mnt/data/adahl/src/u-boot/drivers/fpga/virtex2.c: In function ‘virtex2_ssm_load’:
/mnt/data/adahl/src/u-boot/drivers/fpga/virtex2.c:333:11: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
    PRINTF("%s:%d:done went active early, bytecount = %d\n",
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           __func__, __LINE__, bytecount);
                               ~~~~~~~~~
/mnt/data/adahl/src/u-boot/drivers/fpga/virtex2.c:25:37: note: in definition of macro ‘PRINTF’
 #define PRINTF(fmt, args...) printf(fmt, ##args)
                                     ^~~
/mnt/data/adahl/src/u-boot/drivers/fpga/virtex2.c: In function ‘virtex2_ss_load’:
/mnt/data/adahl/src/u-boot/drivers/fpga/virtex2.c:468:12: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
     PRINTF("%s:%d:done went active early, bytecount = %d\n",
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            __func__, __LINE__, bytecount);
                                ~~~~~~~~~
/mnt/data/adahl/src/u-boot/drivers/fpga/virtex2.c:25:37: note: in definition of macro ‘PRINTF’
 #define PRINTF(fmt, args...) printf(fmt, ##args)
                                     ^~~

Signed-off-by: Alexander Dahl <ada@thorsis.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20221007122003.11239-5-ada@thorsis.com
2 years agofpga: spartan3: Fix printf arguments warning
Alexander Dahl [Fri, 7 Oct 2022 12:19:56 +0000 (14:19 +0200)]
fpga: spartan3: Fix printf arguments warning

The additional comma messes up the arguments.
Warning appears if built with FPGA_DEBUG defined:

      CC      drivers/fpga/spartan3.o
    /mnt/data/adahl/src/u-boot/drivers/fpga/spartan3.c: In function ‘spartan3_sp_load’:
    /mnt/data/adahl/src/u-boot/drivers/fpga/spartan3.c:118:11: warning: too many arguments for format [-Wformat-extra-args]
       PRINTF ("%s: Function Table:\n"
               ^~~~~~~~~~~~~~~~~~~~~~~
    /mnt/data/adahl/src/u-boot/drivers/fpga/spartan3.c:18:37: note: in definition of macro ‘PRINTF’
     #define PRINTF(fmt,args...) printf (fmt ,##args)
                                         ^~~

Fixes: 875c78934ee2 ("Add Xilinx Spartan3 family FPGA support Patch by Kurt Stremerch, 14 February 2005")
Signed-off-by: Alexander Dahl <ada@thorsis.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20221007122003.11239-4-ada@thorsis.com
2 years agofpga: spartan2: Fix printf arguments warning
Alexander Dahl [Fri, 7 Oct 2022 12:19:55 +0000 (14:19 +0200)]
fpga: spartan2: Fix printf arguments warning

That extra comma messes up format arguments.
Warning appears if built with FPGA_DEBUG defined:

      CC      drivers/fpga/spartan2.o
    /mnt/data/adahl/src/u-boot/drivers/fpga/spartan2.c: In function ‘spartan2_sp_load’:
    /mnt/data/adahl/src/u-boot/drivers/fpga/spartan2.c:112:11: warning: too many arguments for format [-Wformat-extra-args]
       PRINTF ("%s: Function Table:\n"
               ^~~~~~~~~~~~~~~~~~~~~~~
    /mnt/data/adahl/src/u-boot/drivers/fpga/spartan2.c:12:37: note: in definition of macro ‘PRINTF’
     #define PRINTF(fmt,args...) printf (fmt ,##args)
                                         ^~~
      CC      drivers/fpga/spartan3.o
    /mnt/data/adahl/src/u-boot/drivers/fpga/spartan3.c: In function ‘spartan3_sp_load’:
    /mnt/data/adahl/src/u-boot/drivers/fpga/spartan3.c:117:11: warning: too many arguments for format [-Wformat-extra-args]
       PRINTF ("%s: Function Table:\n"
               ^~~~~~~~~~~~~~~~~~~~~~~
    /mnt/data/adahl/src/u-boot/drivers/fpga/spartan3.c:17:37: note: in definition of macro ‘PRINTF’
     #define PRINTF(fmt,args...) printf (fmt ,##args)
                                         ^~~

Fixes: e221174377d7 ("Initial revision")
Signed-off-by: Alexander Dahl <ada@thorsis.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20221007122003.11239-3-ada@thorsis.com
2 years agofpga: Add missing Kconfig symbols for old FPGA drivers
Alexander Dahl [Fri, 7 Oct 2022 12:19:54 +0000 (14:19 +0200)]
fpga: Add missing Kconfig symbols for old FPGA drivers

Those drivers could not be built anymore without those options present.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20221007122003.11239-2-ada@thorsis.com
2 years agoclk: versal: Mark versal_clock_setup() as static
Venkatesh Yadav Abbarapu [Fri, 7 Oct 2022 10:55:35 +0000 (16:25 +0530)]
clk: versal: Mark versal_clock_setup() as static

Fix the following sparse and compile time warning
triggered with W=1:

drivers/clk/clk_versal.c:605:5:
warning: no previous prototype for 'versal_clock_setup'
[-Wmissing-prototypes]
605 | int versal_clock_setup(void)

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20221007105535.31902-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
2 years agoxilinx: zynqmp: Load pmufw configuration before checking access
Michal Simek [Wed, 5 Oct 2022 09:39:27 +0000 (11:39 +0200)]
xilinx: zynqmp: Load pmufw configuration before checking access

Before this patch you could see in the log:
U-Boot SPL 2022.10-rc5 (Sep 29 2022 - 15:29:27 +0200)
PMUFW: v1.1
Loading new PMUFW cfg obj (32 bytes)
PMUFW:  No permission to change config object
Loading new PMUFW cfg obj (2032 bytes)

where it is visible that permission is check before sending PMUFW
configuration (big size).

When this patch is applied it is visible that order is correct.
U-Boot SPL 2022.10-rc5 (Sep 29 2022 - 15:47:08 +0200)
Loading new PMUFW cfg obj (2032 bytes)
PMUFW: v1.1
Loading new PMUFW cfg obj (32 bytes)

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/a0bf4f46d670023da4f848790eece6fff22090c2.1664962765.git.michal.simek@amd.com
2 years agoxilinx: common: fix board_late_init_xilinx()
Heinrich Schuchardt [Sat, 8 Oct 2022 09:13:17 +0000 (11:13 +0200)]
xilinx: common: fix board_late_init_xilinx()

Compiling with GCC-12 leads to an error:

    +board/xilinx/common/board.c:479:37: error: the comparison will always
     evaluate as 'true' for the address of 'mac_addr' will never be NULL
     [-Werror=address]
    +  479 |                                 if (!desc->mac_addr[i])
    +      |                                     ^

Remove the redundant check.

Fixes: a03b594738f8 ("xilinx: board: Add support for additional card detection")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Link: https://lore.kernel.org/r/20221008091317.52838-1-heinrich.schuchardt@canonical.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
2 years agoxilinx: zynqmp: change the type of multiboot variable
Venkatesh Yadav Abbarapu [Tue, 4 Oct 2022 05:52:54 +0000 (11:22 +0530)]
xilinx: zynqmp: change the type of multiboot variable

In function ‘set_dfu_alt_info’ a comparison of a u8 value against
0 is done. Since it is always false, change the signature of this
function to use an `int` instead, which match the type used in caller:
`multi_boot()`.

Fix the following warning triggered with W=1:

board/xilinx/zynqmp/zynqmp.c:651:23:
warning: comparison is always false due to limited range of data type
[-Wtype-limits]
651 |         if (multiboot < 0)

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20221004055254.26246-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
2 years agosoc: xilinx: zynqmp: Mark soc_xilinx_zynqmp_get_machine() as static
Venkatesh Yadav Abbarapu [Tue, 4 Oct 2022 05:52:01 +0000 (11:22 +0530)]
soc: xilinx: zynqmp: Mark soc_xilinx_zynqmp_get_machine() as static

Fix the following sparse and compile time warning triggered with W=1:

drivers/soc/soc_xilinx_zynqmp.c:288:5:
warning: no previous prototype for 'soc_xilinx_zynqmp_get_machine'
[-Wmissing-prototypes]

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20221004055201.26146-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
2 years agoxilinx: common: Add print_cpuinfo() declaration
Venkatesh Yadav Abbarapu [Tue, 4 Oct 2022 05:50:53 +0000 (11:20 +0530)]
xilinx: common: Add print_cpuinfo() declaration

cpu-info.c defines print_cpuinfo(), but neglected to
include its declaration, causing the following sparse and
compile time warnings:

board/xilinx/common/cpu-info.c:10:5:
warning: no previous prototype for 'print_cpuinfo'
[-Wmissing-prototypes]

Include init.h, which includes the missing declaration.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20221004055053.26047-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
2 years agomtd: Update the function name to 'rfree'
Fabio Estevam [Fri, 7 Oct 2022 14:35:53 +0000 (11:35 -0300)]
mtd: Update the function name to 'rfree'

Since commit 8d38a8459b0d ("mtd: Rename free() to rfree()")
the function has been renamed to rfree(), so update the description
inside the mtd_oob_region structure as well.

Fixes: 8d38a8459b0d ("mtd: Rename free() to rfree()")
Reported-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Signed-off-by: Fabio Estevam <festevam@denx.de>
Acked-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
2 years agomtd: mxs_nand: Support EDO mode for imx8mn architecture
Michael Trimarchi [Tue, 30 Aug 2022 14:48:47 +0000 (16:48 +0200)]
mtd: mxs_nand: Support EDO mode for imx8mn architecture

Add support for imx8mn architecture in order to run the NAND
in fast edo mode.

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
2 years agomtd: mxs_nand: get the clock with the right name
Dario Binacchi [Tue, 27 Sep 2022 09:56:33 +0000 (11:56 +0200)]
mtd: mxs_nand: get the clock with the right name

Rename the gpmi_apb_bch clock name to gpmi_bch_apb, as you can find in
the device tree.

Fixes: commit a59691280daca ("MXS_NAND: Add clock support for iMX8")
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
2 years agomtd: mxs_nand: don't get the gpmi_apbh_dma clock
Dario Binacchi [Tue, 27 Sep 2022 09:47:29 +0000 (11:47 +0200)]
mtd: mxs_nand: don't get the gpmi_apbh_dma clock

This clock name is not present in any U-boot and Linux kernel device
tree.

Fixes: commit a59691280daca ("MXS_NAND: Add clock support for iMX8")
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
2 years agoimx: gpmi: Add register needed to control nand bus timing
Michael Trimarchi [Tue, 30 Aug 2022 14:47:51 +0000 (16:47 +0200)]
imx: gpmi: Add register needed to control nand bus timing

It is used as delay for gpmi write strobe.

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
2 years agoclk: imx: clk-imx8mn add gpmi nand clocks
Michael Trimarchi [Tue, 30 Aug 2022 14:45:20 +0000 (16:45 +0200)]
clk: imx: clk-imx8mn add gpmi nand clocks

Add gpmi nand clock. Those clock can be used in mxs nand driver
to run nand to EDO mode 5, 4, ...

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
2 years agoclk: imx: gate2 support shared counter and relative clock functions
Michael Trimarchi [Tue, 30 Aug 2022 14:41:38 +0000 (16:41 +0200)]
clk: imx: gate2 support shared counter and relative clock functions

Add shared counter in order to avoid to swich off clock that
are already used.

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
2 years agodm: clk: add missing stub when CONFIG_CLK is deactivated
Dario Binacchi [Tue, 27 Sep 2022 17:18:19 +0000 (19:18 +0200)]
dm: clk: add missing stub when CONFIG_CLK is deactivated

Add missing stub for functions [devm_]clk_...() when CONFIG_CLK is
deactivated.

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
2 years agomtd: nand: Fix SPL build after migration of CONFIG_SYS_NAND_SELF_INIT to Kconfig
Roger Quadros [Wed, 28 Sep 2022 11:42:35 +0000 (14:42 +0300)]
mtd: nand: Fix SPL build after migration of CONFIG_SYS_NAND_SELF_INIT to Kconfig

This fixes the below build error if nand.c is included in
an SPL build.

/work/u-boot/drivers/mtd/nand/raw/nand.c: In function ‘nand_init_chip’:
/work/u-boot/drivers/mtd/nand/raw/nand.c:82:28: error: ‘nand_chip’ undeclared (first use in this function)
   82 |  struct nand_chip *nand = &nand_chip[i];
      |                            ^~~~~~~~~
/work/u-boot/drivers/mtd/nand/raw/nand.c:82:28: note: each undeclared identifier is reported only once for each function it appears in
/work/u-boot/drivers/mtd/nand/raw/nand.c:84:20: error: ‘base_address’ undeclared (first use in this function); did you mean ‘base_addr’?
   84 |  ulong base_addr = base_address[i];
      |                    ^~~~~~~~~~~~
      |                    base_addr

Fixes: 068c41f1cc77 ("Finish conversion CONFIG_SYS_NAND_SELF_INIT to Kconfig")
Signed-off-by: Roger Quadros <rogerq@kernel.org>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
2 years agoMerge tag 'efi-2023-01-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Fri, 7 Oct 2022 15:51:05 +0000 (11:51 -0400)]
Merge tag 'efi-2023-01-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2023-01-rc1

UEFI:

* Provide driver binding protocol to registered events for block devices
* Code simplification and refactoring
* Fix pylint errors in test_efi_secboot

Other:

* Improve checks for register ranges

2 years agoMerge branch '2022-10-07-riscv-toolchain-update'
Tom Rini [Fri, 7 Oct 2022 15:25:05 +0000 (11:25 -0400)]
Merge branch '2022-10-07-riscv-toolchain-update'

- Update RISC-V to use 32bit or 64bit toolchains, depending on if we're
  building for 32bit or 64bit CPUs. This requires updating the Docker
  container as well to have the 32bit toolchain.

2 years agoMerge branch '2022-10-06-assorted-platform-and-board-updates'
Tom Rini [Fri, 7 Oct 2022 15:23:19 +0000 (11:23 -0400)]
Merge branch '2022-10-06-assorted-platform-and-board-updates'

- Assorted platform updates for developerbox, armv8 platforms in
  general, TI K3 and AM65 platforms, nuvoton NPCM845 SoC and then clock
  driver, ftgpio010 support, and common/board_f cleanups.

2 years agoriscv: Fix build against binutils 2.38
Alexandre Ghiti [Mon, 3 Oct 2022 16:07:54 +0000 (18:07 +0200)]
riscv: Fix build against binutils 2.38

The following description is copied from the equivalent patch for the
Linux Kernel proposed by Aurelien Jarno:

>From version 2.38, binutils default to ISA spec version 20191213. This
means that the csr read/write (csrr*/csrw*) instructions and fence.i
instruction has separated from the `I` extension, become two standalone
extensions: Zicsr and Zifencei. As the kernel uses those instruction,
this causes the following build failure:

arch/riscv/cpu/mtrap.S: Assembler messages:
arch/riscv/cpu/mtrap.S:65: Error: unrecognized opcode `csrr a0,scause'
arch/riscv/cpu/mtrap.S:66: Error: unrecognized opcode `csrr a1,sepc'
arch/riscv/cpu/mtrap.S:67: Error: unrecognized opcode `csrr a2,stval'
arch/riscv/cpu/mtrap.S:70: Error: unrecognized opcode `csrw sepc,a0'

Signed-off-by: Alexandre Ghiti <alexandre.ghiti@canonical.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Christian Stewart <christian@paral.in>
Reviewed-by: Rick Chen <rick@andestech.com>
2 years agobuildman: differentiate between riscv32, riscv64
Heinrich Schuchardt [Mon, 3 Oct 2022 16:07:53 +0000 (18:07 +0200)]
buildman: differentiate between riscv32, riscv64

riscv32 needs a different toolchain than riscv64

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>
2 years agodocker: install riscv32 toolchain
Heinrich Schuchardt [Mon, 3 Oct 2022 16:07:52 +0000 (18:07 +0200)]
docker: install riscv32 toolchain

For building riscv32 targets we should use the riscv32 toolchain.
Add it to the Docker image.

Drop the riscv toolchain-alias as we do not need it in future.

While in here, update to the latest "jammy" tag.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>
[trini: Update to latest jammy tag]
Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agospi: zynqmp_qspi: Mark zynqmp_qspi_set_tapdelay() as static
Venkatesh Yadav Abbarapu [Tue, 4 Oct 2022 05:37:30 +0000 (11:07 +0530)]
spi: zynqmp_qspi: Mark zynqmp_qspi_set_tapdelay() as static

Fix the following sparse and compile time warning triggered with W=1:

drivers/spi/zynqmp_gqspi.c:286:6:
warning: no previous prototype for 'zynqmp_qspi_set_tapdelay'
[-Wmissing-prototypes]

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20221004053730.25602-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
2 years agoarm64: zynqmp: Fix compiler warnings in mp.c
Venkatesh Yadav Abbarapu [Tue, 4 Oct 2022 05:34:54 +0000 (11:04 +0530)]
arm64: zynqmp: Fix compiler warnings in mp.c

make W=1 generates the following warning in cpu_disable, cpu_status and
cpu_release functions.

arch/arm/mach-zynqmp/mp.c:166:16: warning: comparison of unsigned expression
in '>= 0' is always true [-Wtype-limits]
166 |         if (nr >= ZYNQMP_CORE_APU0 && nr <= ZYNQMP_CORE_APU3) {
    |                ^~

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20221004053454.25470-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
2 years agoclk: nuvoton: Add support for NPCM845
Jim Liu [Tue, 27 Sep 2022 08:45:16 +0000 (16:45 +0800)]
clk: nuvoton: Add support for NPCM845

Add clock controller driver for NPCM845

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
Acked-by: Sean Anderson <seanga2@gmail.com>