platform/kernel/u-boot.git
19 months agovbe: Add fixups for a basic set of OS requests
Simon Glass [Tue, 11 Oct 2022 15:47:18 +0000 (09:47 -0600)]
vbe: Add fixups for a basic set of OS requests

As a starting point, add support for providing random data, if requested
by the OS. Also add ASLR, as a placeholder for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
(fixed up to use uclass_first_device_err() instead)

19 months agotest: Move common FIT code into a separate fit_util file
Simon Glass [Tue, 11 Oct 2022 15:47:17 +0000 (09:47 -0600)]
test: Move common FIT code into a separate fit_util file

To avoid duplicating code, create a new fit_util module which provides
various utility functions for FIT. Move this code out from the existing
test_fit.py and refactor it with addition parameters.

Fix up pylint warnings in the conversion.

This involves no functional change.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agoboot: Tidy up logging and naming in vbe_simple
Simon Glass [Tue, 11 Oct 2022 15:47:16 +0000 (09:47 -0600)]
boot: Tidy up logging and naming in vbe_simple

Make sure the log_msg_ret() values are unique so that the log trace is
unambiguous with LOG_ERROR_RETURN. Also avoid reusing the 'node' variable
for two different nodes in bootmeth_vbe_simple_ft_fixup(), since this is
confusing.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agoboot: Pass the correct FDT to the EVT_FT_FIXUP event
Simon Glass [Tue, 11 Oct 2022 15:47:15 +0000 (09:47 -0600)]
boot: Pass the correct FDT to the EVT_FT_FIXUP event

Now that we support multiple device trees with the ofnode interface, we
can pass the correct FDT to this event. This allows the 'working' FDT to
be fixed up, as expected, so long as OFNODE_MULTI_TREE is enabled.

Also make sure we don't try to do this with livetree, which does not
support fixups yet.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agosandbox: Support FDT fixups
Simon Glass [Tue, 11 Oct 2022 15:47:14 +0000 (09:47 -0600)]
sandbox: Support FDT fixups

Add support for doing device tree fixups in sandbox. This allows us to
test that functionality in CI.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agobootstd: Move VBE setup into a shared function
Simon Glass [Tue, 11 Oct 2022 15:47:13 +0000 (09:47 -0600)]
bootstd: Move VBE setup into a shared function

This information needs to be set up by the bootstd tests as well. Move it
into a common function and ensure it is executed before any bootstd test
is run.

Make sure the 'images' parameter is set correctly for fixups.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agofdt: Show a message when the working FDT changes
Simon Glass [Tue, 11 Oct 2022 15:47:12 +0000 (09:47 -0600)]
fdt: Show a message when the working FDT changes

The working FDT is the one which comes from the OS and is fixed up by
U-Boot. When the bootm command runs, it sets up the working FDT to be the
one it is about to pass to the OS, so that fixups can happen.

This seems like an important step, so add a message indicating that the
working FDT has changed. This is shown during the running of the bootm
command.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agofs: Quieten down the filesystems more
Simon Glass [Tue, 11 Oct 2022 15:47:11 +0000 (09:47 -0600)]
fs: Quieten down the filesystems more

When looking for a filesystem on a partition we should do so quietly. At
present if the filesystem is very small (e.g. 512 bytes) we get a host of
messages.

Update these to only show when debugging.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agoboot: Correct handling of addresses in boot_relocate_fdt()
Simon Glass [Tue, 11 Oct 2022 15:47:10 +0000 (09:47 -0600)]
boot: Correct handling of addresses in boot_relocate_fdt()

This code uses casts between addresses and pointers, so does not work with
sandbox. Update it so we can allow sandbox to do device tree fixups.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agobootm: Drop #ifdef from do_bootm()
Simon Glass [Tue, 11 Oct 2022 15:47:09 +0000 (09:47 -0600)]
bootm: Drop #ifdef from do_bootm()

Drop the #ifdefs from this command by using a variable to hold the states
that should be executed.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agobootm: Avoid returning error codes from command
Simon Glass [Tue, 11 Oct 2022 15:47:08 +0000 (09:47 -0600)]
bootm: Avoid returning error codes from command

Functions which implement commands must return a CMD_RET_... error code.
At present bootm can return a negative errno value in some cases, thus
causing strange behaviour such as trying to exit the shell and printing
usage information.

Fix this by returning the correct value.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agobootm: Change incorrect 'unsupported' error
Simon Glass [Tue, 11 Oct 2022 15:47:07 +0000 (09:47 -0600)]
bootm: Change incorrect 'unsupported' error

At present when bootm fails, it says:

    subcommand not supported

and then prints help for the bootm command. This is not very useful, since
generally the error is related to something else, such as fixups failing.
It is quite confusing to see this in a test run.

Change the error and show the error code.

We could update the OS functions to return -ENOSYS when they do not
support the bootm subcommand. But this involves some thought since this is
arch-specific code and proper errno error codes are not always returned.
Also, with the code as is, all required subcommands are of course
supported - a problem would only come if someone added a new one or
removed support for one from an existing OS. Therefore it seems better to
leave that sort of effort for when our bootm tests are improved.

Note: v1 of this patch generated a discussion[1] about printing error
strings automatically using printf(). That is outside the scope of this
patch but will be dealt with separately.

[1] https://patchwork.ozlabs.org/project/uboot/patch/20220909151801.336551-3-sjg@chromium.org/

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agodm: core: Switch uclass_*_device_err to use uclass_*_device_check
Michal Suchanek [Wed, 12 Oct 2022 19:58:06 +0000 (21:58 +0200)]
dm: core: Switch uclass_*_device_err to use uclass_*_device_check

The _err variant iterators use the simple iterators without suffix as
basis.

However, there is no user that uclass_next_device_err for iteration,
many users of uclass_first_device_err use it to get the first and
(assumed) only device of an uclass, and a couple that use
uclass_next_device_err to get the device following a known device in the
uclass list.

While there are some truly singleton device classes in which more than
one device cannot exist these are quite rare, and most classes can have
multiple devices even if it is not the case on the SoC's EVB.

In a later patch the simple iterators will be updated to not stop on
error and return next device instead. With this in many cases the code
that expects the first device or an error if it fails to probe may get
the next device instead. Use the _check iterators as the basis of _err
iterators to preserve the old behavior.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agodm: core: Switch uclass_foreach_dev_probe to use simple iterator
Michal Suchanek [Wed, 12 Oct 2022 19:58:05 +0000 (21:58 +0200)]
dm: core: Switch uclass_foreach_dev_probe to use simple iterator

The return value is not used for anythig, and in a later patch the
behavior of the _err iterator will change in an incompatible way.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Update pvblock_probe() to avoid using internal var:
Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agompc83xx: gazerbeam: Update sysinfo_get error handling
Michal Suchanek [Wed, 12 Oct 2022 19:58:04 +0000 (21:58 +0200)]
mpc83xx: gazerbeam: Update sysinfo_get error handling

In a later patch sysinfo_get will be changed to return the device in cae
of an error. Set sysinfo to NULL on error to preserve previous behavior.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agonet: eth-uclass: Do not set device on error
Michal Suchanek [Wed, 12 Oct 2022 19:58:02 +0000 (21:58 +0200)]
net: eth-uclass: Do not set device on error

eth_get_dev relies on the broken behavior that returns an error but not
the device on which the error happened which gives the caller no
reasonable way to report or handle the error.

In a later patch uclass_first_device_err will be changed to return the
device on error but eth_get_dev stores the returned device pointer
directly in a global state without checking the return value. Unset the
pointer again in the error case.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agodm: blk: Do not use uclass_next_device_err
Michal Suchanek [Wed, 12 Oct 2022 19:58:01 +0000 (21:58 +0200)]
dm: blk: Do not use uclass_next_device_err

blk_first_device_err/blk_next_device_err uses
uclass_first_device_err/uclass_next_device_err for device iteration.

Although the function names superficially match the return value from
uclass_first_device_err/uclass_next_device_err is never used
meaningfully, and uclass_first_device/uclass_next_device works equally
well for this purpose.

In the following patch the semantic of
uclass_first_device_err/uclass_next_device_err will be changed to be
based on uclass_first_device_check/uclass_next_device_check breaking
this sole user that uses uclass_next_device_err for iteration.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agodm: treewide: Use uclass_next_device_err when accessing second device
Michal Suchanek [Wed, 12 Oct 2022 19:58:00 +0000 (21:58 +0200)]
dm: treewide: Use uclass_next_device_err when accessing second device

There are a couple users of uclass_next_device return value that get the
first device by other means and use uclass_next_device assuming the
following device in the uclass is related to the first one.

Use uclass_next_device_err because the return value from
uclass_next_device will be removed in a later patch.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agodm: treewide: Use uclass_first_device_err when accessing one device
Michal Suchanek [Wed, 12 Oct 2022 19:57:59 +0000 (21:57 +0200)]
dm: treewide: Use uclass_first_device_err when accessing one device

There is a number of users that use uclass_first_device to access the
first and (assumed) only device in uclass.

Some check the return value of uclass_first_device and also that a
device was returned which is exactly what uclass_first_device_err does.

Some are not checking that a device was returned and can potentially
crash if no device exists in the uclass. Finally there is one that
returns NULL on error either way.

Convert all of these to use uclass_first_device_err instead, the return
value will be removed from uclass_first_device in a later patch.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agocmd: List all uclass devices regardless of probe error
Michal Suchanek [Wed, 12 Oct 2022 19:57:58 +0000 (21:57 +0200)]
cmd: List all uclass devices regardless of probe error

There are a few commands that iterate uclass with
uclass_first_device/uclass_next_device or the _err variant.

Use the _check class iterator variant to get devices that fail to probe
as well, and print the status.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agow1: Fix bus counting in w1_get_bus
Michal Suchanek [Wed, 12 Oct 2022 19:57:57 +0000 (21:57 +0200)]
w1: Fix bus counting in w1_get_bus

Use uclass_first_device_check/uclass_next_device_check to correctly
count buses that fail to probe.

Fixes: d3e19cf919 ("w1: Add 1-Wire uclass")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agovideo: ipuv3: Fix error handling when getting the display
Michal Suchanek [Wed, 12 Oct 2022 19:57:56 +0000 (21:57 +0200)]
video: ipuv3: Fix error handling when getting the display

The code checks that uclass_first_device returned a device but the
returned value that is assigned is never used. Use
uclass_first_device_err instead, and move the error return outside of
the if block.

Fixes: f4ec1ae08e ("mxc_ipuv3_fb.c: call display_enable")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agostdio: Fix class iteration in stdio_add_devices()
Michal Suchanek [Wed, 12 Oct 2022 19:57:55 +0000 (21:57 +0200)]
stdio: Fix class iteration in stdio_add_devices()

There is a complaint in the code that iterates keyboards that we don't
have the _check variant of class iterator but we in fact do, use it.

In the code that iterates video devices there is an attempt to print
errors but the simple iterator does not return a device when there is an
error. Use the _check variant of the iterator as well.

Also format error messages consistently.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agousb: ether: Fix error handling in usb_ether_init
Michal Suchanek [Wed, 12 Oct 2022 19:57:54 +0000 (21:57 +0200)]
usb: ether: Fix error handling in usb_ether_init

The code checks the return value from uclass_first_device as well as
that the device exists but it passes on the return value which may be
zero if there are no gadget devices. Just check that a device was
returned and return -ENODEV otherwise.

Also remove the dev variable which is not really used for anything.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agobootstd: Fix listing boot devices
Michal Suchanek [Wed, 12 Oct 2022 19:57:53 +0000 (21:57 +0200)]
bootstd: Fix listing boot devices

bootdev_list() uses uclass_*_device_err() to iterate devices.
However, the only value _err adds is returning an error when the device
pointer is null, and that's checked anyway.

Also there is some intent to report errors, and that's what
uclass_*_device_check() is for, use it.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agodm: pci: Fix device PCI iteration
Michal Suchanek [Wed, 12 Oct 2022 19:57:52 +0000 (21:57 +0200)]
dm: pci: Fix device PCI iteration

When there is no PCI bus uclass_first_device will return no bus and no
error which will result in pci_find_first_device calling
skip_to_next_device with no bus, and the bus is only checked at the end
of the while cycle, not the beginning.

Fixes: 76c3fbcd3d ("dm: pci: Add a way to iterate through all PCI devices")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agodm: treewide: Do not opencode uclass_probe_all()
Michal Suchanek [Wed, 12 Oct 2022 19:57:51 +0000 (21:57 +0200)]
dm: treewide: Do not opencode uclass_probe_all()

We already have a function for probing all devices of a specific class,
use it.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agodm: core: Fix uclass_probe_all to really probe all devices
Michal Suchanek [Wed, 12 Oct 2022 19:57:50 +0000 (21:57 +0200)]
dm: core: Fix uclass_probe_all to really probe all devices

uclass_probe_all uses uclass_first_device/uclass_next_device assigning
the return value.

The interface for getting meaningful error is
uclass_first_device_check/uclass_next_device_check, use it.

Also do not stop iteration when an error is encountered. Probing all
devices includes those that happen to be after a failing device in the
uclass order.

Fixes: a59153dfeb ("dm: core: add function uclass_probe_all() to probe all devices")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agodm: regmap: Disable range checks in SPL
Simon Glass [Sat, 15 Oct 2022 14:08:54 +0000 (08:08 -0600)]
dm: regmap: Disable range checks in SPL

A recent change to regmap breaks building of phycore-rk3288 for me. The
difference is only a few bytes. Somehow CI seems to pass, even though it
fails when I run docker locally. But it prevents me from sending any more
pull requests.

In any case this board is clearly near the limit. We could revert the
offending change, but it is needed for sandbox tests.

Instead, add a way to drop the range checks in SPL, since they end up
doing nothing if everything is working as expected.

This makes phycore-rk3288 build again for me and reduces the size of SPL
slightly for a number of boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 947d4f132b4 ("regmap: fix range checks")

19 months agoCI: Update to jammy-20221003-17Oct2022 tag
Tom Rini [Mon, 17 Oct 2022 15:10:32 +0000 (11:10 -0400)]
CI: Update to jammy-20221003-17Oct2022 tag

This includes python3-pyelftools so we can drop it from one of the tests
directly.

Signed-off-by: Tom Rini <trini@konsulko.com>
19 months agodocker: Install pyelftools for builds
Simon Glass [Thu, 13 Oct 2022 12:25:57 +0000 (06:25 -0600)]
docker: Install pyelftools for builds

Binman needs this module to build sandbox_vpl and it is needed elsewhere
in CI.

Add it to the docker file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xpyron.glpk@gmx.de>
19 months 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

19 months 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>
19 months 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>
19 months 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>
19 months 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>
19 months 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>
19 months 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

20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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
20 months 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>
20 months 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>
20 months 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>
20 months 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.

20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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

20 months 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

20 months 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>
20 months 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>
20 months 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>
20 months 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

20 months 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()

20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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>
20 months 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

20 months 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
20 months 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
20 months 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
20 months 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
20 months 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
20 months 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
20 months 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
20 months 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
20 months 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
20 months 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
20 months 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>
20 months 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