public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH 0/5] Simplifiy retrieving FDT from SBI in S-Mode
@ 2025-02-27 14:47 Yao Zi
  2025-02-27 14:47 ` [PATCH 1/5] riscv: lib: Add a default implementation of board_fdt_blob_setup Yao Zi
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Yao Zi @ 2025-02-27 14:47 UTC (permalink / raw)
  To: Rick Chen, Leo, Tom Rini, Bin Meng, Paul Walmsley, Palmer Dabbelt,
	Anup Patel, Atish Patra, Green Wan, Minda Chen, Simon Glass,
	Angelo Dureghello, Ilias Apalodimas, Heinrich Schuchardt
  Cc: u-boot, Yao Zi

A typical bootflow of S-Mode RISC-V U-Boot looks like,

  -------    -------    ----------
  | SPL | -> | SBI | -> | U-Boot |
  -------    -------    ----------
                |
     M-Mode     |       S-Mode
                |

Both the most popular SBI implementation, OpenSBI, and U-Boot require a
FDT to function. The common solution is to pick an appropriate
devicetree at SPL stage and pass it to OpenSBI, which is also capable of
passing its (possibly modified) devicetree to the next stage (proper
U-Boot here) program.

The problem is although we retrieve the FDT passed by SBI in RISC-V's
start.S, a custom board_fdt_blob_setup is still required to make use of
it, resulting in duplicated similar functions in board-level code.

This series provides a weak version of board_fdt_blob_setup to setup the
SBI-passed FDT, serving as fallback on RISC-V platforms to eliminate the
duplication. We also select OF_HAS_PRIOR_STAGE by default on RISC-V
platforms if SBI is enabled, which is the usual configuration.

Tested on
 - Milk-V Duo (milkv_duo_defconfig)
 - Starfive VisionFive 2 (starfive_visionfive2_defconfig)
 - QEMU VM (qemu-riscv64_smode_defconfig).

Yao Zi (5):
  riscv: lib: Add a default implementation of board_fdt_blob_setup
  board: qemu: riscv: Remove duplicated board_fdt_blob_setup
  board: starfive: Remove duplicated board_fdt_blob_setup
  board: sifive: Remove duplicated board_fdt_blob_setup
  riscv: select OF_HAS_PRIOR_STAGE by default if SBI is enabled

 arch/riscv/Kconfig                            |  1 +
 arch/riscv/lib/Makefile                       |  1 +
 arch/riscv/lib/board.c                        | 19 +++++++++++++++++++
 board/emulation/qemu-riscv/qemu-riscv.c       |  8 --------
 board/sifive/unleashed/unleashed.c            | 11 -----------
 board/sifive/unmatched/unmatched.c            | 10 ----------
 .../visionfive2/starfive_visionfive2.c        | 10 ----------
 7 files changed, 21 insertions(+), 39 deletions(-)
 create mode 100644 arch/riscv/lib/board.c

-- 
2.48.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2025-03-07 11:15 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-27 14:47 [PATCH 0/5] Simplifiy retrieving FDT from SBI in S-Mode Yao Zi
2025-02-27 14:47 ` [PATCH 1/5] riscv: lib: Add a default implementation of board_fdt_blob_setup Yao Zi
2025-03-06  4:05   ` Leo Liang
2025-02-27 14:47 ` [PATCH 2/5] board: qemu: riscv: Remove duplicated board_fdt_blob_setup Yao Zi
2025-03-06  4:05   ` Leo Liang
2025-02-27 14:47 ` [PATCH 3/5] board: starfive: " Yao Zi
2025-03-06  4:08   ` Leo Liang
2025-02-27 14:47 ` [PATCH 4/5] board: sifive: " Yao Zi
2025-03-06  4:09   ` Leo Liang
2025-02-27 14:47 ` [PATCH 5/5] riscv: select OF_HAS_PRIOR_STAGE by default if SBI is enabled Yao Zi
2025-03-06  4:10   ` Leo Liang
2025-03-06 11:09   ` Leo Liang
2025-03-06 12:40     ` Yao Zi
2025-03-07 11:15     ` Yao Zi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox