platform/kernel/u-boot.git
15 months agoefi_loader: fix efi_add_known_memory()
Heinrich Schuchardt [Mon, 14 Aug 2023 05:50:53 +0000 (07:50 +0200)]
efi_loader: fix efi_add_known_memory()

In efi_add_known_memory() we currently call board_get_usable_ram_top() with
an incorrect value 0 of parameter total_size. This leads to an incorrect
value for ram_top depending on the code in board_get_usable_ram_top().

Use the value of gd->ram_top instead which is set before relocation by
calling board_get_usable_ram_top().

Fixes: 7b78d6438a2b ("efi_loader: Reserve unaccessible memory")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
15 months agobootmeth: efi: Make distro_efi_boot() static
Bin Meng [Thu, 3 Aug 2023 09:30:05 +0000 (17:30 +0800)]
bootmeth: efi: Make distro_efi_boot() static

As it is only called in bootmeth_efi.c

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
15 months agodoc: add partition API to HTML documentation
Heinrich Schuchardt [Tue, 15 Aug 2023 10:30:19 +0000 (12:30 +0200)]
doc: add partition API to HTML documentation

* Convert comments in part.h to Sphinx style.
* Create documentation page for the partition API.
* Add the partition API page to the API index page.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agodoc: description of board_get_usable_ram_top()
Heinrich Schuchardt [Mon, 14 Aug 2023 06:44:26 +0000 (08:44 +0200)]
doc: description of board_get_usable_ram_top()

Improve the description of function board_get_usable_ram_top().

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agolmb: description lmb_is_reserved, lmb_is_reserved_flags
Heinrich Schuchardt [Sat, 12 Aug 2023 17:09:32 +0000 (19:09 +0200)]
lmb: description lmb_is_reserved, lmb_is_reserved_flags

* provide a description for function lmb_is_reserved()
* improve the description of funciton lmb_is_reserved_flags()

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
15 months agodoc/sphinx/requirements.txt: Bump certifi up
Tom Rini [Tue, 1 Aug 2023 18:53:30 +0000 (14:53 -0400)]
doc/sphinx/requirements.txt: Bump certifi up

Upgrade certifi to the latest version, to remove e-Tugra from the root
store.

Link: https://groups.google.com/a/mozilla.org/g/dev-security-policy/c/C-HrP1SEq1A?pli=1
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
15 months agoMerge tag 'u-boot-rockchip-20230814' of https://source.denx.de/u-boot/custodians...
Tom Rini [Mon, 14 Aug 2023 13:11:09 +0000 (09:11 -0400)]
Merge tag 'u-boot-rockchip-20230814' of https://source.denx.de/u-boot/custodians/u-boot-rockchip

- Add board: rk3568 EmbedFire Lubancat 2
- Fixes for rk3568 clock and pinctrl;
- Fixes for rk3308 clock and uart;
- rk3328 rock64 updates;
- Video fix on veyron board;

15 months agoMerge tag 'video-20230814' of https://source.denx.de/u-boot/custodians/u-boot-video
Tom Rini [Mon, 14 Aug 2023 13:09:23 +0000 (09:09 -0400)]
Merge tag 'video-20230814' of https://source.denx.de/u-boot/custodians/u-boot-video

 - fix NULL dereference in vidconsole_measure()
 - fix simplefb format for raspberrypi-4b
 - fix typo in Kconfig

15 months agopinctrl: rockchip: Fix drive and input schmitt on RK3568
Jonas Karlman [Mon, 14 Aug 2023 00:28:26 +0000 (00:28 +0000)]
pinctrl: rockchip: Fix drive and input schmitt on RK3568

On RK3568 most pins have a configurable drive strength of level 0-5 and
some pins level 0-11. When rk3568_set_drive is called with a strength
value above 7 the drv value written to reg may overflow into the write
enable bits, resulting in a bad configuration.

This cause e.g. ethernet PHY on Radxa CM3-IO board not to work after
drive is configured according to the device tree.

  Could not get PHY for ethernet@fe010000: addr 0

Level 6-11 can be configured using a second reg for some pins, however
the drv value is reused resulting in lower 6 bits being written to reg.

Input schmitt is configured in 2-bit fields on RK3568 compared to
earlier generation and 2'b10 should be used to enable input schmitt.

Change to use regmap_update_bits with a rmask to fix the overflow issue
and closer match the linux driver. Bit shift the drv value used for the
second reg to configure drive strength level 6-11. Also write correct
values for input schmitt setting.

Fixes: 1977d746aa54 ("rockchip: rk3568: add rk3568 pinctrl driver")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agorpi: set the correct parameter for simple framebuffer node
Meng Li [Wed, 26 Jul 2023 02:42:35 +0000 (10:42 +0800)]
rpi: set the correct parameter for simple framebuffer node

When raspberrpi-4b platform  boots up, there are 2 sets of same bootup
log displayed on HDMI monitor screen, it looks like the screen is split
into 2 parts. The root cause is that video format of u-boot is different
from kernel. The fixing "a8r8g8b8" video format is used in u-boot, but
"r5g6b5" video format from framebuffer node is used in kernel image. In
order to avoid weird display status on screen, it needs to set the correct
parameter for simple framebuffer node even if it has existed.

Signed-off-by: Meng Li <Meng.Li@windriver.com>
15 months agobcm2835: Add simiple-framebuffer for use with fkms
Jason Wessel [Wed, 26 Jul 2023 02:42:34 +0000 (10:42 +0800)]
bcm2835: Add simiple-framebuffer for use with fkms

When the fkms dtb overlay is used only the simple-framebuffer is
presented as a usable video display. So, add "simple-framebuffer"
compatible to enable video driver bcm2835.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Meng Li <Meng.Li@windriver.com>
15 months agovideo: kconfig: Fix a typo in SPL_VIDEO_REMOVE
Bin Meng [Thu, 3 Aug 2023 10:40:08 +0000 (18:40 +0800)]
video: kconfig: Fix a typo in SPL_VIDEO_REMOVE

Add one space between 'before' and 'loading'.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agovideo: vidconsole: Fix null dereference of ops->measure
Bin Meng [Thu, 3 Aug 2023 09:32:41 +0000 (17:32 +0800)]
video: vidconsole: Fix null dereference of ops->measure

At present vidconsole_measure() tests ops->select_font before calling
ops->measure, which would result in a null dereference when the console
driver provides no ops for measure.

Fixes: b828ed7d7929 ("console: Allow measuring the bounding box of text")
Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agorockchip: MAINTAINERS: fix board name for Radxa ROCK 4C+
FUKAUMI Naoki [Thu, 3 Aug 2023 08:04:32 +0000 (17:04 +0900)]
rockchip: MAINTAINERS: fix board name for Radxa ROCK 4C+

align with other ROCK series.

Fixes: 2b506407c8 ("rockchip: Add MAINTAINERS entry for Radxa Rock 4C+")
Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agodts: rockchip: rk3308: Avoid warning for serial probe on prereloc
Massimo Pegorer [Thu, 3 Aug 2023 11:08:13 +0000 (13:08 +0200)]
dts: rockchip: rk3308: Avoid warning for serial probe on prereloc

Make device tree complete and consistent for pre relocation phase. Some
nodes are missing, causing warnings to be issued on serial port probing
during pre relocation phase (uclass_get_device_by_phandle_id fails when
called by pinctrl_select_state_full: none of these failures is fatal
nor causing issues). Add to *-u-boot.dtsi all required nodes with the
'bootph-some-ram' attribute.

Signed-off-by: Massimo Pegorer <massimo.pegorer+oss@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agoclk: rockchip: rk3308: Support reading UART rate and clock registers
Massimo Pegorer [Thu, 3 Aug 2023 11:08:12 +0000 (13:08 +0200)]
clk: rockchip: rk3308: Support reading UART rate and clock registers

Add support to read RK3308 registers used to configure UART clocks, and
thus to get UART rate and baudrate. This fixes clock_get_rate returning
error on serial device probing. Moreover, there is no need anymore to
use 'clock-frequency' property for UART nodes in *-u-boot.dtsi files
for all cases where UART is not inited by U-Boot proper or by SPL o by
TPL code but by a preliminary external boot phase (for Rock PI S, UART
is inited by external TPL).

Signed-off-by: Massimo Pegorer <massimo.pegorer+oss@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agoclk: rockchip: rk3308: Fix ordering between masking and shifting
Massimo Pegorer [Thu, 3 Aug 2023 11:08:11 +0000 (13:08 +0200)]
clk: rockchip: rk3308: Fix ordering between masking and shifting

As per definitions of masks and shift offsets in cru_rk3308.h, values
read from registers must be first masked and then shifted. By the way,
this fix is binary invariant, because in all of fixed cases the shift
offset is zero.

Signed-off-by: Massimo Pegorer <massimo.pegorer+oss@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agorockchip: spl: Drop out of scope debug message related to uart init
Massimo Pegorer [Wed, 2 Aug 2023 17:05:24 +0000 (19:05 +0200)]
rockchip: spl: Drop out of scope debug message related to uart init

Debug uart is no more inited in board_init_f function: remove this
debug message from board_init_f. If an earliest-as-possible message
after debug uart initialization is needed, enable DEBUG_UART_ANNOUNCE
Kconfig option, instead.

Signed-off-by: Massimo Pegorer <massimo.pegorer+oss@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agorockchip: spl: Drop useless call to debug_uart_init
Massimo Pegorer [Wed, 2 Aug 2023 17:05:23 +0000 (19:05 +0200)]
rockchip: spl: Drop useless call to debug_uart_init

Since commit 0dba45864b2a ("arm: Init the debug UART") function
debug_uart_init is called in crt files _main before calling
board_init_f. Therefore, there is no need to call it again
inside board_init_f implementation in arm/mach-rockchip/spl.c.

Signed-off-by: Massimo Pegorer <massimo.pegorer+oss@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agorockchip: rk356x-u-boot: Set max-frequency prop in sdhci node
Jonas Karlman [Fri, 4 Aug 2023 09:34:01 +0000 (09:34 +0000)]
rockchip: rk356x-u-boot: Set max-frequency prop in sdhci node

Most board device trees for RK356x set max-frequency = <200000000> in
the sdhci node, some boards like Quartz64 do not. This result in an
error message due to sdhci driver trying to set a clock rate of 0
instead of the max-frequency value.

  rockchip_sdhci_probe clk set rate fail!

Fix this by setting a common max-frequency in rk356x-u-boot.dtsi. A
patch to set default max-frequency of sdhci node in linux is planned.

Also remove the forced status = "okay" for the sdhci and sdmmc0 nodes,
boards already set correct state for these nodes.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agoclk: rockchip: rk3568: Add dummy support for GMAC speed clocks
Jonas Karlman [Fri, 4 Aug 2023 09:34:00 +0000 (09:34 +0000)]
clk: rockchip: rk3568: Add dummy support for GMAC speed clocks

Pine64 Quartz64 boards DT reference SCLK_GMAC1_RGMII_SPEED in the
assigned-clocks property of the gmac1 node. This result in a ENOENT
error when driver core tries to set a parent for this clock.

The clock speed in rgmii/rmii mode is changed using clk_set_rate of the
tx_rx clock and not using clk_set_parent of the speed clock.

Add dummy support for SCLK_GMAC1_RGMII_SPEED and similar clocks to clk
driver to allow a driver for gmac node to probe.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agoclk: rockchip: rk3568: Include UART clocks in SPL
Jonas Karlman [Fri, 4 Aug 2023 09:33:59 +0000 (09:33 +0000)]
clk: rockchip: rk3568: Include UART clocks in SPL

The clock driver for RK3568 does not include support for UART clocks in
SPL. This result in the following message with high enough loglevel.

  ns16550_serial serial@fe660000: pinctrl_select_state_full: uclass_get_device_by_phandle_id: err=-19

Fix this by including support for UART clocks in SPL.

Fixes: 4a262feba3a5 ("rockchip: rk3568: add clock driver")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agoclk: rockchip: rk3568: Fix mask for clk_cpll_div_25m_div
Jonas Karlman [Fri, 4 Aug 2023 09:33:59 +0000 (09:33 +0000)]
clk: rockchip: rk3568: Fix mask for clk_cpll_div_25m_div

The field for clk_cpll_div_25m_div in CRU_CLKSEL_CON81 is 6 bits wide,
not 5 bits wide as currently defined in CPLL_25M_DIV_MASK.

Fix this and the assert so that CPLL_25M can be assigned a 25 MHz rate.

Fixes: 4a262feba3a5 ("rockchip: rk3568: add clock driver")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agoclk: rockchip: rk3568: Fix clk selection in rk3568_pwm_get_clk
Damon Ding [Fri, 4 Aug 2023 09:33:57 +0000 (09:33 +0000)]
clk: rockchip: rk3568: Fix clk selection in rk3568_pwm_get_clk

Fix use of wrong clk selection for CLK_PWM1 on RK3568.

Fixes: 4a262feba3a5 ("rockchip: rk3568: add clock driver")
Signed-off-by: Damon Ding <damon.ding@rock-chips.com>
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agorockchip: cru: Enable cpu info support for rk3568
Anton [Mon, 7 Aug 2023 07:04:46 +0000 (10:04 +0300)]
rockchip: cru: Enable cpu info support for rk3568

Add cru structure definition in head file to support cpu_info driver.

Series-version: 2
Series-changes: 2
Format the patch header, add commit message and signature.

Signed-off-by: Anton <vao@asu-vei.ru>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
15 months agovideo: avoid build failure on veyron board
Alvaro Fernando García [Fri, 4 Aug 2023 00:35:38 +0000 (21:35 -0300)]
video: avoid build failure on veyron board

533ad9dc avoided an overflow but causes compilation
failure on 32bit boards (eg. veyron speedy)

this commit uses div_u64 which has a fallback codepath
for 32bit platforms

Signed-off-by: Alvaro Fernando García <alvarofernandogarcia@gmail.com>
Tested-by: Simon Glass <sjg@chromium.org> # chromebook_jerry
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agorockchip: rk3568: Add EmbedFire Lubancat 2 support
Andy Yan [Sat, 5 Aug 2023 12:00:11 +0000 (20:00 +0800)]
rockchip: rk3568: Add EmbedFire Lubancat 2 support

LubanCat2 is a rk3568 based SBC from EmbedFire.

Specification:
- Rockchip rk3568
- LPDDR4/4X 1/2/4/8 GB
- TF scard slot
- eMMC 8/32/64/128 GB
- Gigabit ethernet x 2
- HDMI out
- USB 2.0 Host x 1
- USB 2.0 Type-C OTG x 1
- USB 3.0 Host x 1
- Mini PCIE interface for WIFI/BT module
- M.2 key for 2280 NVME
- 40 pin header

The dts file is sync from linux mainline.

Signed-off-by: Andy Yan <andyshrk@163.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agorockchip: rv1126: Enable fdtoverlay support
Jagan Teki [Sat, 29 Jul 2023 13:41:42 +0000 (19:11 +0530)]
rockchip: rv1126: Enable fdtoverlay support

Add fdtoverlay_addr_r and enable OF_LIBFDT_OVERLAY for the
use of DT overlay in RV1126.

Signed-off-by: Jagan Teki <jagan@edgeble.ai>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agorockchip: dts: rk3328: rock64: Align spi flash entry
Peter Robinson [Wed, 14 Jun 2023 12:43:14 +0000 (13:43 +0100)]
rockchip: dts: rk3328: rock64: Align spi flash entry

Align the SPI flash entry with upstream. There's no need
to diverge here.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agorockchip: dts: rk3328: Add rng details to u-boot.dtsi
Peter Robinson [Wed, 14 Jun 2023 12:43:13 +0000 (13:43 +0100)]
rockchip: dts: rk3328: Add rng details to u-boot.dtsi

Add the rk3328 rng details to the u-boot.dtsi and
enable the RNG on the Rock64 to be able to provide
a random seed via UEFI.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
(Fix typo message)
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
15 months agoconfig: rock64: enable efuse for stable mac addr
Peter Robinson [Wed, 14 Jun 2023 12:43:12 +0000 (13:43 +0100)]
config: rock64: enable efuse for stable mac addr

Enable the rockchip efuse driver on the Rock64 to
provide a stable ethernet address on the device.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agopci: rockchip: Release resources on failing probe
Jonas Karlman [Tue, 11 Jul 2023 23:13:56 +0000 (23:13 +0000)]
pci: rockchip: Release resources on failing probe

The PCIe driver for RK3399 is affected by a similar issue that was fixed
for RK35xx in the commit e04b67a7f4c1 ("pci: pcie_dw_rockchip: release
resources on failing probe").

Resources are not released on failing probe, e.g. regulators may be left
enabled and the ep-gpio may be left in a requested state.

Change to use regulator_set_enable_if_allowed and disable regulators
after failure to keep regulator enable count balanced, ep-gpio is also
released on regulator failure.

Also add support for the vpcie12v-supply, remove unused include and
check return value from dev_read_addr_name.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
15 months agorockchip: rk3399: remove duplicate call to regulators_enable_boot_on
Quentin Schulz [Fri, 22 Jul 2022 10:09:08 +0000 (12:09 +0200)]
rockchip: rk3399: remove duplicate call to regulators_enable_boot_on

An earlier commit makes the common SPL code call
regulators_enable_boot_on and regulators_enable_boot_off before
iterating over possible boot media for U-Boot proper. There is therefore
no need to do this in the rk3399-specific code, so let's remove it.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Tested-by: Xavier Drudis Ferran <xdrudis@tinet.cat>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
15 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-watchdog
Tom Rini [Thu, 10 Aug 2023 15:40:09 +0000 (11:40 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-watchdog

- cmd: cyclic: Remove duplicate command name in help text (Alexander)
- ftwdt010: need to reset watchdog in ftwdt010_wdt_start() (Sergei)

15 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Thu, 10 Aug 2023 14:36:43 +0000 (10:36 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-riscv

+ Add USB host support on VisionFive2 board
+ Enable SPI flash support on VisionFive2 board
+ Enable Random Number Generator in RISC-V QEMU board
+ Display new SBI extension
+ Add SPL_ZERO_MEM_BEFORE_USE Kconfig for jh7110 L2 LIM
  (Loosely-Integrated Memory)

15 months agowatchdog: ftwdt010: need to reset watchdog in ftwdt010_wdt_start()
Sergei Antonov [Sun, 30 Jul 2023 17:14:16 +0000 (20:14 +0300)]
watchdog: ftwdt010: need to reset watchdog in ftwdt010_wdt_start()

ftwdt010_wdt_start() has to call ftwdt010_wdt_reset() after setting-up
the timeout in the same fashion ftwdt010_wdt_expire_now() does it.

Without this patch the "wdt start <ms>" command does not actually start
the watchdog timer until the "wdt reset" command is executed.

Signed-off-by: Sergei Antonov <saproj@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
15 months agocmd: cyclic: Remove duplicate command name in help text
Alexander Dahl [Fri, 4 Aug 2023 15:53:23 +0000 (17:53 +0200)]
cmd: cyclic: Remove duplicate command name in help text

Function 'cmd_usage()' already prints one command in usage before
printing out the help text given to the U_BOOT_CMD_WITH_SUBCMDS macro.

Wrong previous output:

    Usage:
    cyclic cyclic demo <cycletime_ms> <delay_us> - register cyclic demo function
    cyclic list - list cyclic functions

Signed-off-by: Alexander Dahl <ada@thorsis.com>
Reviewed-by: Stefan Roese <sr@denx.de>
15 months agoriscv: cpu: jh7110: Select SPL_ZERO_MEM_BEFORE_USE
Shengyu Qu [Wed, 9 Aug 2023 13:11:33 +0000 (21:11 +0800)]
riscv: cpu: jh7110: Select SPL_ZERO_MEM_BEFORE_USE

Add Kconfig item for Starfive JH7110 to select SPL_ZERO_MEM_BEFORE_USE.

Signed-off-by: Bo Gan <ganboing@gmail.com>
Signed-off-by: Shengyu Qu <wiagn233@outlook.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
15 months agoriscv: Add SPL_ZERO_MEM_BEFORE_USE implementation
Shengyu Qu [Wed, 9 Aug 2023 13:11:32 +0000 (21:11 +0800)]
riscv: Add SPL_ZERO_MEM_BEFORE_USE implementation

Add the actual support code for SPL_ZERO_MEM_BEFORE_USE and remove
existing Starfive JH7110's L2 LIM clean code, since existing code has
following issues:
 1. Each hart (in the middle of a function call) overwriting its own
    stack and other harts' stacks.
    (data-race and data-corruption)
 2. Lottery winner hart can be doing "board_init_f_init_reserve",
    while other harts are in the middle of zeroing L2 LIM.
    (data-race)

Signed-off-by: Bo Gan <ganboing@gmail.com>
Signed-off-by: Shengyu Qu <wiagn233@outlook.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
15 months agoriscv: Kconfig: Add SPL_ZERO_MEM_BEFORE_USE
Shengyu Qu [Wed, 9 Aug 2023 13:11:31 +0000 (21:11 +0800)]
riscv: Kconfig: Add SPL_ZERO_MEM_BEFORE_USE

Add a Kconfig item to allow SPL to clear stack/GD/malloc area before
using them.

Signed-off-by: Bo Gan <ganboing@gmail.com>
Signed-off-by: Shengyu Qu <wiagn233@outlook.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
15 months agoconfigs: starfive: Enable environment in SPI flash support
Shengyu Qu [Tue, 8 Aug 2023 13:14:36 +0000 (21:14 +0800)]
configs: starfive: Enable environment in SPI flash support

On Starfive Visionfive 2, the u-boot environment settings are saved to
on-board SPI flash. Enable relative configs by default and set offset
and size according to upstream linux dts.

Signed-off-by: Shengyu Qu <wiagn233@outlook.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
15 months agoconfigs: riscv: starfive: Add VF2 PCIe USB3 XHCI support
Minda Chen [Mon, 7 Aug 2023 08:53:38 +0000 (16:53 +0800)]
configs: riscv: starfive: Add VF2 PCIe USB3 XHCI support

Add XHCI_PCI to enable usb3-host functions.
Also add usb command and keyboard config.

Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
15 months agoriscv: starfive: Add SYS_CACHE_SHIFT_6 to enable SYS_CACHELINE_SIZE
Minda Chen [Mon, 7 Aug 2023 08:53:37 +0000 (16:53 +0800)]
riscv: starfive: Add SYS_CACHE_SHIFT_6 to enable SYS_CACHELINE_SIZE

Some device driver need SYS_CACHELINE_SIZE macro. Add StarFive
SYS_CACHE_SHIFT_6 to enable it.

Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
15 months agoriscv: dts: starfive: Enable pcie0 dts node
Minda Chen [Mon, 7 Aug 2023 08:53:36 +0000 (16:53 +0800)]
riscv: dts: starfive: Enable pcie0 dts node

In StarFive VF2 board. pcie0 connect to VTI usb controller.
Enable it to support usb host.

Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
15 months agopci: plda: Get correct ECAM offset in multiple PCIe RC case
Minda Chen [Mon, 7 Aug 2023 08:53:35 +0000 (16:53 +0800)]
pci: plda: Get correct ECAM offset in multiple PCIe RC case

Get the correct ECAM offset and record the secondary bus
number in Multiple RC case.

Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
15 months agocmd/sbi: display new extensions
Heinrich Schuchardt [Wed, 2 Aug 2023 20:39:46 +0000 (22:39 +0200)]
cmd/sbi: display new extensions

The SBI specification v2.0-rc2 defines new extensions:

* Nested Acceleration Extension (NACL)
* Steal Time Accounting (STA)

Allow the sbi command to display these.

Add missing implementation IDs.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
15 months agoriscv: qemu: imply CONFIG_DM_RNG
Heinrich Schuchardt [Fri, 28 Jul 2023 13:54:15 +0000 (15:54 +0200)]
riscv: qemu: imply CONFIG_DM_RNG

The EFI_RNG_PROTOCOL is needed for Linux' KASLR.

QEMU can provide a virtio-rng device to emulate a hardware random number
generator which is supported by our virtio_rng driver.

Enabling CONFIG_DM_RNG will enable CONFIG_VIRTIO_RNG and
CONFIG_EFI_RNG_PROTOCOL by default too.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agoMerge tag 'x86-pull-20230809' of https://source.denx.de/u-boot/custodians/u-boot-x86
Tom Rini [Wed, 9 Aug 2023 17:17:34 +0000 (13:17 -0400)]
Merge tag 'x86-pull-20230809' of https://source.denx.de/u-boot/custodians/u-boot-x86

- x86: Fixes for distro booting
- x86: Move some boards to text environment

15 months agox86: qemu-x86: Convert to text environment
Simon Glass [Mon, 31 Jul 2023 03:02:05 +0000 (21:02 -0600)]
x86: qemu-x86: Convert to text environment

Use the common include.

Drop everything from the config.h file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> # Intel Edison
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: qemu: Add required linux/sizes.h include
Simon Glass [Mon, 31 Jul 2023 03:02:04 +0000 (21:02 -0600)]
x86: qemu: Add required linux/sizes.h include

These files rely on the config.h file provided this include. Add it
explictily so we can move to a text environment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> # Intel Edison
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: efi-x86_payload: Convert to text environment
Simon Glass [Mon, 31 Jul 2023 03:02:03 +0000 (21:02 -0600)]
x86: efi-x86_payload: Convert to text environment

Use the common include.

Drop everything from the config.h file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> # Intel Edison
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: efi-x86_app: Convert to text environment
Simon Glass [Mon, 31 Jul 2023 03:02:02 +0000 (21:02 -0600)]
x86: efi-x86_app: Convert to text environment

Use the common include. Drop the unnecessary changes, since missing
stdio drivers will be ignored.

Drop everything from the config.h file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> # Intel Edison
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: slimbootloader: Convert to text environment
Simon Glass [Mon, 31 Jul 2023 03:02:01 +0000 (21:02 -0600)]
x86: slimbootloader: Convert to text environment

Use the common include along with some additions.

Drop everything from the config.h file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> # Intel Edison
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[Drop common env from slimbootloader.env]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: minnowmax: Convert to text environment
Simon Glass [Mon, 31 Jul 2023 03:02:00 +0000 (21:02 -0600)]
x86: minnowmax: Convert to text environment

Use the common include along with some additions.

Drop everything from the config.h file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> # Intel Edison
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: cougarcanyon2: Convert to text environment
Simon Glass [Mon, 31 Jul 2023 03:01:59 +0000 (21:01 -0600)]
x86: cougarcanyon2: Convert to text environment

Use the common include. The existing environment includes "vga" but that
is not valid anymore, so let it use vidconsole

Drop everything from the config.h file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> # Intel Edison
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: cherryhill: Convert to text environment
Simon Glass [Mon, 31 Jul 2023 03:01:58 +0000 (21:01 -0600)]
x86: cherryhill: Convert to text environment

Use the common include.

Drop everything from the config.h file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> # Intel Edison
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: edison: Convert to text environment
Simon Glass [Mon, 31 Jul 2023 03:01:57 +0000 (21:01 -0600)]
x86: edison: Convert to text environment

Don't use the common include since Edison's environment is empty.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> # Intel Edison
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: galileo: Convert to text environment
Simon Glass [Mon, 31 Jul 2023 03:01:56 +0000 (21:01 -0600)]
x86: galileo: Convert to text environment

Use the common include.

Drop everything from the config.h file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> # Intel Edison
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: bayleybay: Convert to text environment
Simon Glass [Mon, 31 Jul 2023 03:01:55 +0000 (21:01 -0600)]
x86: bayleybay: Convert to text environment

Use the common include.

Drop everything from the config.h file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> # Intel Edison
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: crownbay: Convert to text environment
Simon Glass [Mon, 31 Jul 2023 03:01:54 +0000 (21:01 -0600)]
x86: crownbay: Convert to text environment

Use the common include.

Drop everything from the config.h file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> # Intel Edison
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: coreboot: Convert to text environment
Simon Glass [Mon, 31 Jul 2023 03:01:53 +0000 (21:01 -0600)]
x86: coreboot: Convert to text environment

Use the common include and add some options specific to this board.

Drop everything from the config.h file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> # Intel Edison
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: Add a common include for environment settings
Simon Glass [Mon, 31 Jul 2023 03:01:52 +0000 (21:01 -0600)]
x86: Add a common include for environment settings

Create a text-file version of x86-common.h which can be used by x86
boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> # Intel Edison
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: Drop unused distro settings
Simon Glass [Mon, 31 Jul 2023 03:01:51 +0000 (21:01 -0600)]
x86: Drop unused distro settings

No x86 board uses distro boot, so drop these settings.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> # Intel Edison
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: Drop inclusion of ibmpc.h
Simon Glass [Mon, 31 Jul 2023 03:01:50 +0000 (21:01 -0600)]
x86: Drop inclusion of ibmpc.h

This is not needed in this file anymore. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> # Intel Edison
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: edison: Drop inclusion of ibmpc.h
Simon Glass [Mon, 31 Jul 2023 03:01:49 +0000 (21:01 -0600)]
x86: edison: Drop inclusion of ibmpc.h

This should be included by files that need it, not the config.h file.
Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> # Intel Edison
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: i8254: Include required ibmpc.h header
Simon Glass [Mon, 31 Jul 2023 03:01:48 +0000 (21:01 -0600)]
x86: i8254: Include required ibmpc.h header

This is needed for this file, so include it here explicitly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> # Intel Edison
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: Drop CFG_SYS_STACK_SIZE
Simon Glass [Mon, 31 Jul 2023 03:01:47 +0000 (21:01 -0600)]
x86: Drop CFG_SYS_STACK_SIZE

This is only used in one file and the value is the same for both boards
which define it. Use the fixed value of 32KB and drop the CFG. This will
allow removal of the config.h files.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> # Intel Edison
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agoenv: Explain how to use #include files in text environment
Simon Glass [Mon, 31 Jul 2023 03:01:46 +0000 (21:01 -0600)]
env: Explain how to use #include files in text environment

Provide documentation on how to share common settings among boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> # Intel Edison
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agoenv: Use include/env for text-environment includes
Simon Glass [Mon, 31 Jul 2023 03:01:45 +0000 (21:01 -0600)]
env: Use include/env for text-environment includes

The 'environment' word is too long. We mostly use 'env' in U-Boot, so use
that as the name of the include directory too.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> # Intel Edison
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agodoc: Explain how to avoid the distro-boot scripts
Simon Glass [Mon, 31 Jul 2023 03:01:44 +0000 (21:01 -0600)]
doc: Explain how to avoid the distro-boot scripts

Now that standard boot is available, mention this in the environment
documentation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> # Intel Edison
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: Update qemu documentation
Simon Glass [Sun, 30 Jul 2023 17:16:07 +0000 (11:16 -0600)]
x86: Update qemu documentation

Add some hints and observations related to booting distros on QEMU on x86.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: Enable useful options for qemu-86
Simon Glass [Sun, 30 Jul 2023 17:16:06 +0000 (11:16 -0600)]
x86: Enable useful options for qemu-86

This build can be used to boot 32-bit standard-distro builds. Enable some
more options, so that all possible EFI UUIDs are decoded, we can search
memory for tables, support the full set of standard-boot features, have
full logging along with debug UART and can boot from CDROM media.

This mirrors a similar patch for qemu-x86_64

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[Drop the unknown option from defconfig]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
15 months agovideo: Add a Kconfig option for SPL video handoff
Simon Glass [Sun, 30 Jul 2023 17:16:05 +0000 (11:16 -0600)]
video: Add a Kconfig option for SPL video handoff

At present this feature is enabled in SPL if a bloblist is available.
Some platforms may not want to use this, so add an option to allow the
feature to be disabled.

Note that the feature unfortunately only fills in part of the
video-handoff information, so causes failures on x86 platforms. For now,
disable it there.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> # qemu-x86_64
15 months agox86: Correct copying of BIOS mode information
Simon Glass [Sun, 30 Jul 2023 17:16:04 +0000 (11:16 -0600)]
x86: Correct copying of BIOS mode information

This is copying beyond the end of the destination buffer. Correct the code
by using the size of the  vesa_mode_info struct. We don't need to copy the
rest of the bytes in the buffer.

This long-standing bug prevents virtio bootdevs working correctly on
qemu-x86 at present.

Fixes: 0ca2426beae ("x86: Add support for running option ROMs natively")
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> # qemu-x86_64
15 months agoRevert "x86: Switch QEMU over to use the bochs driver"
Simon Glass [Sun, 30 Jul 2023 17:16:02 +0000 (11:16 -0600)]
Revert "x86: Switch QEMU over to use the bochs driver"

Unfortunately the bochs driver does not currently work with distros.
It causes a hang between grub menu selection and the OS displaying
something.

Preliminary investigation shows that GRUB does not jump to the kernel
at all.

This reproduces reliably.

This reverts commit b8956425d525c3c25fd218f252f89a5e44df6a9f.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> # qemu-x86_64
[Slightly modify the commit message about preliminary investigation]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: Run QEMU machine setup in SPL
Simon Glass [Sun, 30 Jul 2023 17:16:01 +0000 (11:16 -0600)]
x86: Run QEMU machine setup in SPL

Call the hardware-init function from QEMU from SPL. This allows the
video BIOS to operate correctly.

Create an x86-wide qemu.h header to avoid having to #ifdef the header
in spl.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> # qemu-x86_64
15 months agovideo: Tidy up Makefile rule for video
Simon Glass [Sun, 30 Jul 2023 17:16:00 +0000 (11:16 -0600)]
video: Tidy up Makefile rule for video

Drop the duplication and add a single rule which can handle SPL as well.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: spl: Drop unwanted debug()
Simon Glass [Sun, 30 Jul 2023 17:15:59 +0000 (11:15 -0600)]
x86: spl: Drop unwanted debug()

This was left over from some previous debugging. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: coreboot: Update doc for CBFS access
Simon Glass [Sun, 30 Jul 2023 17:15:19 +0000 (11:15 -0600)]
x86: coreboot: Update doc for CBFS access

Add an example to show how cbfs is used.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[Removed CONFIG_CMD_CBFS from defconfig files]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
15 months agobootstd: Add some more debugging in the bootdev uclass
Simon Glass [Sun, 30 Jul 2023 17:15:16 +0000 (11:15 -0600)]
bootstd: Add some more debugging in the bootdev uclass

Add some more output to make it easier to see what is going wrong when
a bootdev hunter fails.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agobootstd: Correct creating of bootdev sibling
Simon Glass [Sun, 30 Jul 2023 17:15:15 +0000 (11:15 -0600)]
bootstd: Correct creating of bootdev sibling

Use the correct function here, since there may be multiple IDE devices
available.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
15 months agobootstd: Rename bootdev_setup_sibling_blk()
Simon Glass [Sun, 30 Jul 2023 17:15:14 +0000 (11:15 -0600)]
bootstd: Rename bootdev_setup_sibling_blk()

This name is a little confusing since it suggests that it sets up the
sibling block device. In fact it sets up a bootdev for it. Rename the
function to make this clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
15 months agolib: Suppress E when writing error-string output
Simon Glass [Sun, 30 Jul 2023 17:15:13 +0000 (11:15 -0600)]
lib: Suppress E when writing error-string output

When CONFIG_ERRNO_STR is not enabled this shows a spurious 'E' from the
format string. Fix this.

Fixes: 7f331941321 ("lib: Support printing an error string")
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agousb: Return -ENOENT when no devices are found
Simon Glass [Sun, 30 Jul 2023 17:15:12 +0000 (11:15 -0600)]
usb: Return -ENOENT when no devices are found

When USB finds no devices it currently returns -EPERM which bootstd does
not understand. This causes other bootdevs of the same priority to be
skipped.

Fix this by returning the correct error code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agoMerge tag 'doc-2023-10-rc3' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Wed, 9 Aug 2023 12:28:50 +0000 (08:28 -0400)]
Merge tag 'doc-2023-10-rc3' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for doc-2023-10-rc3

Documentation:

* Update examples for imx8mp_evk
* OpenOCD debugging guide for TI K3 boards
* Explain using gadget devices on TI boards
* Describe best practices for board ports

15 months agoMerge tag 'fsl-qoriq-2023-8-9' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Wed, 9 Aug 2023 12:28:27 +0000 (08:28 -0400)]
Merge tag 'fsl-qoriq-2023-8-9' of https://source.denx.de/u-boot/custodians/u-boot-fsl-qoriq

- Drop one unused function for layerscape

15 months agoarm64: fsl: layerscape: Remove unused functions
Shenlin Liang [Fri, 28 Jul 2023 06:57:44 +0000 (14:57 +0800)]
arm64: fsl: layerscape: Remove unused functions

Function board_switch_core_volt has not been used since it was
defined

Signed-off-by: Shenlin Liang <liangshenlin@eswincomputing.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
15 months agodoc: Begin adding a best practices document for board ports
Tom Rini [Tue, 8 Aug 2023 20:36:16 +0000 (16:36 -0400)]
doc: Begin adding a best practices document for board ports

To help guide developers down the right path, begin a document that
lists some best practices to follow when creating a new board port.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agodoc: imx8mp_evk: Use in-tree build in the example
Fabio Estevam [Mon, 7 Aug 2023 13:42:47 +0000 (10:42 -0300)]
doc: imx8mp_evk: Use in-tree build in the example

To make it consistent with the instructions from other NXP imx8m boards,
such as imx8mm-evk and imx8mn-evk, use U-Boot in-tree build in the
examples.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
15 months agodoc: imx8mp_evk: Remove unneeded export ATF_LOAD_ADDR line
Fabio Estevam [Mon, 7 Aug 2023 13:42:46 +0000 (10:42 -0300)]
doc: imx8mp_evk: Remove unneeded export ATF_LOAD_ADDR line

Originally, exporting the ATF_LOAD_ADDR was required, but since binman has
been used to generate the flash.bin, it is no longer needed to do
such manual export.

The ATF address is now passed via binman in imx8mp-u-boot.dtsi:

atf {
description = "ARM Trusted Firmware";
type = "firmware";
arch = "arm64";
compression = "none";
load = <0x970000>;
entry = <0x970000>;

atf_blob: atf-blob {
filename = "bl31.bin";
type = "atf-bl31";
};
};

Remove the  unneeded export ATF_LOAD_ADDR line.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
15 months agodoc: ti: Explain how the various gadget devices can be used
Miquel Raynal [Mon, 7 Aug 2023 06:42:41 +0000 (08:42 +0200)]
doc: ti: Explain how the various gadget devices can be used

Describe the current situation wrt the handling of USB devices on AM33xx
based boards, taking the example of a common board (the Beagle Bone
Black) and explaining how the different USB gadgets can be used.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
15 months agodoc: board: toradex: fix verdin module output
Marcel Ziswiler [Sun, 6 Aug 2023 23:44:46 +0000 (01:44 +0200)]
doc: board: toradex: fix verdin module output

Fix the Verdin module output which was missing white space for correct
rendering.

While at it also leave product links, add section author also for the
Verdin iMX8M Mini and Plus, and add a missing CROSS_COMPILE export for
the Verdin iMX8M Mini.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Nishanth Menon <nm@ti.com> #verdin-am62
Reviewed-by: Tom Rini <trini@konsulko.com>
15 months agodoc: Add the link for the documentation of the .its
Jit Loon Lim [Fri, 4 Aug 2023 02:28:39 +0000 (10:28 +0800)]
doc: Add the link for the documentation of the .its

Provide the link for the .its related documentation for Arria10.

Signed-off-by: Jit Loon Lim <jit.loon.lim@intel.com>
15 months agodoc: board: ti: k3: Add a guide to debugging with OpenOCD
Jason Kacines [Thu, 3 Aug 2023 06:29:22 +0000 (01:29 -0500)]
doc: board: ti: k3: Add a guide to debugging with OpenOCD

Bootloader debug usually tends to be a bit dicey prior to DDR and
serial port getting active in the system. JTAG typically remains the
only practical debug option during the initial bringup.

OpenOCD is one of the most popular environment for providing debug
capability via a GDB compatible interface for developers to work with.

Debugging U-Boot and bootloaders on K3 platform does have a bit of
tribal knowledge that is better documented in our common platform
documentation.

Signed-off-by: Jason Kacines <j-kacines@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
15 months agoMerge branch '2023-08-08-introuce-Arm-FF-A-support'
Tom Rini [Tue, 8 Aug 2023 19:23:16 +0000 (15:23 -0400)]
Merge branch '2023-08-08-introuce-Arm-FF-A-support'

To quote the author:
Adding support for Arm FF-A v1.0 (Arm Firmware Framework for Armv8-A) [A].

FF-A specifies interfaces that enable a pair of software execution
environments aka partitions to communicate with each other. A partition
could be a VM in the Normal or Secure world, an application in S-EL0, or
a Trusted OS in S-EL1.

FF-A is a discoverable bus and similar to architecture features.
FF-A bus is discovered using ARM_SMCCC_FEATURES mechanism performed by
the PSCI driver.

   => dm tree

    Class     Index  Probed  Driver                Name
   -----------------------------------------------------------
   ...
    firmware      0  [ + ]   psci                      |-- psci
    ffa                   0  [   ]   arm_ffa               |   `-- arm_ffa
   ...

Clients are able to probe then use the FF-A bus by calling the DM class
searching APIs (e.g: uclass_first_device).

This implementation of the specification provides support for Aarch64.

The FF-A driver uses the SMC ABIs defined by the FF-A specification to:

    - Discover the presence of secure partitions (SPs) of interest
    - Access an SP's service through communication protocols
      (e.g: EFI MM communication protocol)

The FF-A support provides the following features:

    - Being generic by design and can be used by any Arm 64-bit platform
    - FF-A support can be compiled and used without EFI
    - Support for SMCCCv1.2 x0-x17 registers
    - Support for SMC32 calling convention
    - Support for 32-bit and 64-bit FF-A direct messaging
    - Support for FF-A MM communication (compatible with EFI boot time)
    - Enabling FF-A and MM communication in Corstone1000 platform as a use case
    - A Uclass driver providing generic FF-A methods.
    - An Arm FF-A device driver providing Arm-specific methods and reusing the Uclass methods.
    - A sandbox emulator for Arm FF-A, emulates the FF-A side of the Secure World and provides
      FF-A ABIs inspection methods.
    - An FF-A sandbox device driver for FF-A communication with the emulated Secure World.
      The driver leverages the FF-A Uclass to establish FF-A communication.
    - Sandbox FF-A test cases.
    - A new command called armffa is provided as an example of how to access the
      FF-A bus

For more details about the FF-A support please refer to [B] and refer to [C] for
how to use the armffa command.

Please find at [D] an example of the expected boot logs when enabling
FF-A support for a platform. In this example the platform is
Corstone1000. But it can be any Arm 64-bit platform.

More details:

[A]: https://developer.arm.com/documentation/den0077/latest/
[B]: doc/arch/arm64.ffa.rst
[C]: doc/usage/cmd/armffa.rst
[D]: example of boot logs when enabling FF-A

15 months agoarm_ffa: efi: corstone1000: enable MM communication
Abdellatif El Khlifi [Fri, 4 Aug 2023 13:33:45 +0000 (14:33 +0100)]
arm_ffa: efi: corstone1000: enable MM communication

turn on EFI MM communication

On Corstone-1000 platform MM communication between u-boot
and the secure world (Optee) is done using the FF-A bus.

Changes made are generated using savedefconfig.

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jens Wiklander <jens.wiklander@linaro.org>
15 months agoarm_ffa: efi: introduce FF-A MM communication
Abdellatif El Khlifi [Fri, 4 Aug 2023 13:33:44 +0000 (14:33 +0100)]
arm_ffa: efi: introduce FF-A MM communication

Add MM communication support using FF-A transport

This feature allows accessing MM partitions services through
EFI MM communication protocol. MM partitions such as StandAlonneMM
or smm-gateway secure partitions which reside in secure world.

An MM shared buffer and a door bell event are used to exchange
the data.

The data is used by EFI services such as GetVariable()/SetVariable()
and copied from the communication buffer to the MM shared buffer.

The secure partition is notified about availability of data in the
MM shared buffer by an FF-A message (door bell).

On such event, MM SP can read the data and updates the MM shared
buffer with the response data.

The response data is copied back to the communication buffer and
consumed by the EFI subsystem.

MM communication protocol supports FF-A 64-bit direct messaging.

We tested the FF-A MM communication on the Corstone-1000 platform.

We ran the UEFI SCT test suite containing EFI setVariable, getVariable and
getNextVariable tests which involve FF-A MM communication and all tests
are passing with the current changes.

We made the SCT test reports (part of the ACS results) public following the
latest Corstone-1000 platform software release. Please find the test
reports at [1].

[1]: https://gitlab.arm.com/arm-reference-solutions/arm-reference-solutions-test-report/-/tree/master/embedded-a/corstone1000/CORSTONE1000-2023.06/acs_results_fpga.zip

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Tested-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
15 months agoarm_ffa: introduce armffa command
Abdellatif El Khlifi [Fri, 4 Aug 2023 13:33:43 +0000 (14:33 +0100)]
arm_ffa: introduce armffa command

Provide armffa command showcasing the use of the U-Boot FF-A support

armffa is a command showcasing how to invoke FF-A operations.
This provides a guidance to the client developers on how to
call the FF-A bus interfaces. The command also allows to gather secure
partitions information and ping these  partitions. The command is also
helpful in testing the communication with secure partitions.

For more details please refer to the command documentation [1].

A Sandbox test is provided for the armffa command.

[1]: doc/usage/cmd/armffa.rst

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jens Wiklander <jens.wiklander@linaro.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
15 months agoarm_ffa: introduce sandbox test cases for UCLASS_FFA
Abdellatif El Khlifi [Fri, 4 Aug 2023 13:33:42 +0000 (14:33 +0100)]
arm_ffa: introduce sandbox test cases for UCLASS_FFA

Add functional test cases for the FF-A support

These tests rely on the FF-A sandbox emulator and FF-A
sandbox driver which help in inspecting the FF-A communication.

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jens Wiklander <jens.wiklander@linaro.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
15 months agoarm_ffa: introduce sandbox FF-A support
Abdellatif El Khlifi [Fri, 4 Aug 2023 13:33:41 +0000 (14:33 +0100)]
arm_ffa: introduce sandbox FF-A support

Emulate Secure World's FF-A ABIs and allow testing U-Boot FF-A support

Features of the sandbox FF-A support:

- Introduce an FF-A emulator
- Introduce an FF-A device driver for FF-A comms with emulated Secure World
- Provides test methods allowing to read the status of the inspected ABIs

The sandbox FF-A emulator supports only 64-bit direct messaging.

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jens Wiklander <jens.wiklander@linaro.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>