U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yao Zi <ziyao@disroot.org>
To: Rick Chen <rick@andestech.com>, Leo <ycliang@andestech.com>,
	Tom Rini <trini@konsulko.com>, Bin Meng <bmeng.cn@gmail.com>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Anup Patel <anup@brainfault.org>,
	Atish Patra <atishp@atishpatra.org>,
	Green Wan <green.wan@sifive.com>,
	Minda Chen <minda.chen@starfivetech.com>,
	Simon Glass <sjg@chromium.org>,
	Angelo Dureghello <angelo@kernel-space.org>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: u-boot@lists.denx.de, Yao Zi <ziyao@disroot.org>
Subject: [PATCH v2 0/4] Simplify retrieving FDT from SBI in S-Mode
Date: Fri,  7 Mar 2025 13:13:40 +0000	[thread overview]
Message-ID: <20250307131344.43762-1-ziyao@disroot.org> (raw)

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.

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

Changed from v1
- make the default implementation bail out in XPL stage
- correct commit message of sifive platform chagnes
- don't enable OF_HAS_PRIOR_STAGE by default on all SBI-capable RISC-V
  platforms, as it may break the binman configuration
- Link to v1: https://lore.kernel.org/u-boot/20250227144734.61458-1-ziyao@disroot.org/

Yao Zi (4):
  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 dead board_fdt_blob_setup

 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 ----------
 6 files changed, 20 insertions(+), 39 deletions(-)
 create mode 100644 arch/riscv/lib/board.c

-- 
2.48.1


             reply	other threads:[~2025-03-07 13:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-07 13:13 Yao Zi [this message]
2025-03-07 13:13 ` [PATCH v2 1/4] riscv: lib: Add a default implementation of board_fdt_blob_setup Yao Zi
2025-03-25  3:43   ` Leo Liang
2025-03-25 10:08   ` Leo Liang
2025-04-25  8:19   ` Leo Liang
2025-03-07 13:13 ` [PATCH v2 2/4] board: qemu: riscv: Remove duplicated board_fdt_blob_setup Yao Zi
2025-03-07 13:13 ` [PATCH v2 3/4] board: starfive: " Yao Zi
2025-03-07 13:13 ` [PATCH v2 4/4] board: sifive: Remove dead board_fdt_blob_setup Yao Zi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250307131344.43762-1-ziyao@disroot.org \
    --to=ziyao@disroot.org \
    --cc=angelo@kernel-space.org \
    --cc=anup@brainfault.org \
    --cc=atishp@atishpatra.org \
    --cc=bmeng.cn@gmail.com \
    --cc=green.wan@sifive.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=minda.chen@starfivetech.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=rick@andestech.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    --cc=ycliang@andestech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox