platform/kernel/u-boot.git
2 years agorockchip: puma-rk3399: use gpio-hog instead of fixed-regulator for enabling eMMC...
Quentin Schulz [Thu, 15 Sep 2022 09:14:22 +0000 (11:14 +0200)]
rockchip: puma-rk3399: use gpio-hog instead of fixed-regulator for enabling eMMC/SPI-NOR

On Haikou devkit, it is possible to disable eMMC and SPI-NOR to force
booting from SD card or USB via rkdeveloptool by toggling a switch. This
switch needs to be overridden in software to be able to access eMMC and
SPI-NOR once the device has booted from SD Card. Puma SoM can override
this pin via gpio3_d5.

Until now, fixed regulator device was abused to model this, but since
there's now support for GPIO hogs, let's use it.

Since we want to be able to boot the SPL from SD Card but give it the
ability to load U-Boot proper from a fallback medium such as eMMC and
SPI-NOR, SPL support for GPIO hogs needs to be enabled too. Support for
other kinds of regulators are not needed anymore, so let's disable them.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: puma-rk3399: fix boot_targets swap depending on U-Boot proper load medium
Quentin Schulz [Thu, 15 Sep 2022 09:14:21 +0000 (11:14 +0200)]
rockchip: puma-rk3399: fix boot_targets swap depending on U-Boot proper load medium

distroboot should try first on the same MMC medium as the one the SPL
loaded U-Boot proper from. This was the case when the introducing commit
was merged because the default order was eMMC first and then SD card.
The check was therefore made only on whether we booted from SD card,
because otherwise the order was the expected one.
However, in commit b212ad24a604 ("rockchip: Fix MMC boot order"), the
order was swapped. Meaning our simple check is now useless.

Let's fix that by accounting for all scenarii: default boot_targets has
mmc0 first but booting from SD Card, mmc1 first but booting from eMMC.

Fixes: b212ad24a604 ("rockchip: Fix MMC boot order")
Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: rk3399: Add EAIDK-610 support
Andy Yan [Sun, 18 Sep 2022 11:30:02 +0000 (19:30 +0800)]
rockchip: rk3399: Add EAIDK-610 support

Specification
- Rockchip RK3399
- LPDDR3 4GB
- TF sd scard slot
- eMMC
- AP6255 for WiFi + BT
- Gigabit ethernet
- HDMI out
- 40 pin header
- USB 2.0 x 2
- USB 3.0 x 1
- USB 3.0 Type-C x 1 work in otg mode
- 12V DC Power supply

The dts file is sync from linux-next[0].

[0]:https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/arch/arm64/boot/dts/rockchip/rk3399-eaidk-610.dts

Signed-off-by: Andy Yan <andyshrk@163.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: puma-rk3399: remove dead code
Quentin Schulz [Thu, 15 Sep 2022 16:25:32 +0000 (18:25 +0200)]
rockchip: puma-rk3399: remove dead code

CONFIG_SERIAL_TAG is not selectable for ARM64 machines. While
get_board_serial is weakly defined if ENV_VARS_UBOOT_RUNTIME_CONFIG is
defined, it is only called when CONFIG_SUPPORT_PASSING_ATAGS is defined,
which also is not selectable for ARM64 machines. Therefore this is dead
code so let's remove it.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoram: rockchip: fix typo in KConfig option label
Quentin Schulz [Thu, 15 Sep 2022 10:17:10 +0000 (12:17 +0200)]
ram: rockchip: fix typo in KConfig option label

RAM_PX30_DDR4 is for DDR4 support and not DDR3 so let's fix the typo.

Fixes: 2db36c64bd5a ("ram: rockchip: px30: add a config-based ddr selection")
Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: px30: support debug uart on UART0
Quentin Schulz [Thu, 15 Sep 2022 10:12:47 +0000 (12:12 +0200)]
rockchip: px30: support debug uart on UART0

UART0 can obviously also be used for debug uart in U-Boot, so let's add
its support.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: rk3399: fix incorrect ifdef check on SPL_GPIO
Quentin Schulz [Fri, 22 Jul 2022 09:30:14 +0000 (11:30 +0200)]
rockchip: rk3399: fix incorrect ifdef check on SPL_GPIO

The check to perform is on CONFIG_SPL_GPIO and not SPL_GPIO.
Because this was never compiled in, it missed an include of cru.h that
was not detected before. Let's include it too.

Also switch to IS_ENABLED in-code check as it is the preferred
inclusion/exclusion mechanism.

Fixes: 07586ee4322a ("rockchip: rk3399: Support common spl_board_init")
Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: rk3399: fix incorrect ifdef check on SPL_DM_REGULATOR
Quentin Schulz [Fri, 22 Jul 2022 09:30:13 +0000 (11:30 +0200)]
rockchip: rk3399: fix incorrect ifdef check on SPL_DM_REGULATOR

The check to perform is on CONFIG_SPL_DM_REGULATOR and not
SPL_DM_REGULATOR. Also switch to in-code check instead of ifdefs.

Fixes: 07586ee4322a ("rockchip: rk3399: Support common spl_board_init")
Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Peter Robinson <pbrobinson@gmail.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com> # Rock960
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoarm: rockchip: rk3399: Program PLL clock for DDR at 50 MHz in documented range
Xavier Drudis Ferran [Sat, 16 Jul 2022 10:31:45 +0000 (12:31 +0200)]
arm: rockchip: rk3399: Program PLL clock for DDR at 50 MHz in documented range

The original code set up the DDR clock to 48 MHz, not 50MHz as
requested, and did it in a way that didn't satisfy the Application
Notes in RK3399 TRM [1]. 2.9.2.B says:

   PLL frequency range requirement
   [...]
   FOUTVCO: 800MHz to 3.2GHz

2.9.2.A :
   PLL output frequency configuration
   [...]
   FOUTVCO = FREF / REFDIV * FBDIV
   FOUTPOSTDIV = FOUTVCO / POSTDIV1 / POSTDIV2

FREF = 24 MHz

The original code gives FOUTVCO: 24MHz/1 * 12 = 288MHz < 800MHz
And the resulting FOUTPOSTDIV is 288MHz / 3 / 2 = 48MHz
but the requested frequency was 50MHz

Note:
2.7.2 Detail Register Description
PMUCRU_PPLL_CON0 says

   fbdiv
   Feedback Divide Value
   Valid divider settings are:
   [16, 3200] in integer mode

So .fbdiv = 12 wouldn't be right. But 2.9.2.C says:

   PLL setting consideration
   [...]
   The following settings are valid for FBDIV:
   DSMPD=1 (Integer Mode):
   12,13,14,16-4095 (practical value is limited to 3200, 2400, or 1600
   (FVCOMAX / FREFMIN))
   [...]

So .fbdiv = 12 would be right.

In any case FOUTVCO is still wrong. I thank YouMin Chen for
confirmation and explanation.

Despite documentation, I don't seem to be able to reproduce a
practical problem with the wrong FOUTVCO. When I initially found it I
thought some problems with detecting the RAM capacity in my Rock Pi 4B
could be related to it and my patch seemed to help. But since I'm no
longer able to reproduce the issue, it works with or without this
patch. And meanwhile a patch[2] by Lee Jones and YouMin Chen addresses
this issue. Btw, shouldn't that be commited?

So this patches solves no visible problem.  Yet, to prevent future
problems, I think it'd be best to stick to spec.

An alternative to this patch could be

    {.refdiv = 1, .fbdiv = 75, .postdiv1 = 6, .postdiv2 = 6};

This would theoretically consume more power and yield less jitter,
according to 2.9.2.C :

   PLL setting consideration
   [...]
   For lowest power operation, the minimum VCO and FREF frequencies
   should be used. For minimum jitter operation, the highest VCO and
   FREF frequencies should be used.
   [...]

But I haven't tried it because I don't think it matters much. 50MHz
for DDR is only shortly used by TPL at RAM init. Normal operation is
at 800MHz.  Maybe it's better to use less power until later when more
complex software can control batteries or charging or whatever ?

Cc: Simon Glass <sjg@chromium.org>
Cc: Philipp Tomsich <philipp.tomsich@vrull.eu>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Sean Anderson <seanga2@gmail.com>
Link: [1] https://opensource.rock-chips.com/images/e/ee/Rockchip_RK3399TRM_V1.4_Part1-20170408.pdf
Link: [2] https://patchwork.ozlabs.org/project/uboot/list/?series=305766

Signed-off-by: Xavier Drudis Ferran <xdrudis@tinet.cat>
Tested-by: Michal Suchánek <msuchanek@suse.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoarm: dts: rockchip: rk3288: partial sync from Linux
Johan Jonker [Wed, 28 Sep 2022 14:24:28 +0000 (16:24 +0200)]
arm: dts: rockchip: rk3288: partial sync from Linux

Partial sync of rk3288.dtsi from Linux version 5.18

Changed:
  only properties and functions that are not yet included
  swap some clocks positions
  fix some irq numbers
  style and sort nodes

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoarm: dts: rockchip: update cpu and gpu nodes
Johan Jonker [Wed, 28 Sep 2022 14:24:14 +0000 (16:24 +0200)]
arm: dts: rockchip: update cpu and gpu nodes

In order to better compare the Linux rk3288.dtsi version
with the u-boot version update the cpu and gpu nodes.

Changed:
  use operating-points-v2
  update thermal for all cpus
  add labels to all cpus
  change gpu compatible
  change gpu interrupt names

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoarm: dts: rockchip: rk3288: move thermal sub nodes to dtsi
Johan Jonker [Wed, 28 Sep 2022 14:24:06 +0000 (16:24 +0200)]
arm: dts: rockchip: rk3288: move thermal sub nodes to dtsi

In order to better compare the Linux rk3288.dtsi version
with the u-boot version move thermal sub nodes to the dtsi
file and remove rk3288-thermal.dtsi

Changed:
  replace underscore in nodename
  remove comments about sensor and ID
  use gpu phandle
  add #cooling-cells to gpu node
  lower critical temparature
  remove linux,hwmon property

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agophycore-rk3288: Avoid enabling partition support in SPL
Simon Glass [Fri, 11 Mar 2022 19:10:04 +0000 (12:10 -0700)]
phycore-rk3288: Avoid enabling partition support in SPL

This is not needed or used, and adds code size. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: phycore_rk3288: remove phycore_init() function
Johan Jonker [Tue, 18 Oct 2022 11:25:00 +0000 (13:25 +0200)]
rockchip: phycore_rk3288: remove phycore_init() function

The phycore_rk3288 board has a SPL size problem,
so remove phycore_init() function to stay within the limits.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Wadim Egorov <w.egorov@phytec.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.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>