All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/9] riscv: sophgo: add SPL support for the Milk-V Duo
@ 2026-12-01 14:25 Hiago De Franco
  2026-12-01 14:25 ` [PATCH v2 1/9] binman: add Sophgo CV18xx FIP entry type Hiago De Franco
                   ` (9 more replies)
  0 siblings, 10 replies; 15+ messages in thread
From: Hiago De Franco @ 2026-12-01 14:25 UTC (permalink / raw)
  To: u-boot, Yao Zi
  Cc: Tom Rini, Leo Liang, Tim Ouyang, Kongyang Liu, Simon Glass,
	Alper Nebi Yasak, Lukasz Majewski, Zhuxu Ran, Andrei Lalaev,
	João Paulo Gonçalves

This series adds SPL support for the Milk-V Duo (Sophgo CV1800B, 64 MiB
DDR2), so the board no longer needs the vendor FSBL to bring up DDR,
configure the PLLs and hand off to OpenSBI and U-Boot proper.

Currently this board only builds a bare u-boot.bin that depends on the
vendor FSBL (and the vendor fiptool) to do all of the early hardware
bring-up before U-Boot starts. With this series:

- The SPL is loaded directly by the BootROM from fip.bin, built by a new
  binman entry type that reproduces the fiptool image layout (param1
  header + BL2 header) without depending on the vendor tool.
- SPL enables the C906 caches and T-HEAD ISA extensions and brings up and
  trains the DDR2 controller/PHY, ported from the Sophgo FSBL sources [1]
  (plat/cv180x).
- The PLLs and their derived dividers are programmed by the CV1800B clock
  driver from U-Boot proper, and the RTC power domain configuration for
  shutdown, warm reset, power-cycle and watchdog reset is handled by the
  RTC driver using the upstream devicetree node and regmap, matching what
  the vendor FSBL used to configure.
- SPL then loads the FIT image (OpenSBI, U-Boot and the DT) placed at
  offset 0x40000 of fip.bin via the BootROM ROMAPI, and hands off to
  OpenSBI, which starts U-Boot in S-mode.
- Board documentation is updated.

Tested by booting a Milk-V Duo board from an SD card (fip.bin on the FAT
partition) built with this series (SPL -> OpenSBI -> U-Boot -> Linux).

This series used the help of Claude Opus 5.5 to read the FSBL and turn
it into U-Boot SPL.

This series depends on the U-Boot dts/upstream sync that includes the
Linux commits 6645398c4621 ("riscv: dts: sophgo: cv1800b-milkv-duo:
drop reserved memory node") and 60e4cafd3090 ("riscv: dts: sophgo:
sg2002-milkv-duo256m: drop reserved memory node"). Without them, U-Boot
relocates into the coprocessor reserved-memory region and fails to boot
Linux.

[1] https://github.com/sophgo/fsbl.git

Signed-off-by: Hiago De Franco <hfranco@baylibre.com>
---
Changes in v2:
- Move the T-HEAD cache operations from arch/riscv/cpu/th1520/cache.c to
  lib/thead_cache.c, build them only for T-HEAD SoCs, and reuse them in
  the CV1800B SPL. Set both cache enable bits in a single CSR update, as
  required by the C906.
- Move the PLL and divider setup out of the SPL and into the CV1800B clock
  driver, running from U-Boot proper, and poll the PLL lock bits.
- Move the RTC power and reset setup out of the SPL and into the CV1800B
  RTC driver probe, using the register map from the upstream RTC
  devicetree node.
- Use CFG_SYS_NS16550_CLK instead of clock-frequency for the 8250 UART.
- Keep the default OpenSBI scratch options so the boot banner stays off.
- Rebase onto the upstream CV18xx devicetree conversion.
- Document the SoC boot flow.
- Link to v1: https://patch.msgid.link/20261021-milkv-duo-spl-v1-0-ee7618860237@baylibre.com

---
Hiago De Franco (9):
      binman: add Sophgo CV18xx FIP entry type
      riscv: move T-HEAD cache operations to lib
      riscv: cv1800b: add SPL support
      ram: sophgo: add CV180x DDR2 driver
      board: sophgo: milkv_duo: add SPL support
      clk: sophgo: cv1800b: initialize PLLs
      rtc: cv1800b: configure RTC power and reset in probe
      doc: board: sophgo: milkv_duo: update documentation
      doc: board: sophgo: milkv_duo: document the SPL boot flow

 MAINTAINERS                                        |   1 +
 arch/riscv/Kconfig                                 |   6 +
 arch/riscv/cpu/cv1800b/Kconfig                     |   3 +
 arch/riscv/cpu/cv1800b/Makefile                    |   4 +
 arch/riscv/cpu/cv1800b/spl.c                       |  29 +
 arch/riscv/cpu/th1520/Kconfig                      |   1 +
 arch/riscv/cpu/th1520/Makefile                     |   1 -
 arch/riscv/dts/cv1800b-milkv-duo-u-boot.dtsi       |  85 +++
 arch/riscv/include/asm/arch-cv1800b/rom_api.h      |  36 ++
 arch/riscv/include/asm/cache.h                     |   1 +
 board/sophgo/milkv_duo/Kconfig                     |   5 +
 board/sophgo/milkv_duo/MAINTAINERS                 |   3 +
 board/sophgo/milkv_duo/Makefile                    |   1 +
 board/sophgo/milkv_duo/board.c                     |  19 +
 board/sophgo/milkv_duo/spl.c                       |  75 +++
 configs/milkv_duo_defconfig                        |  17 +
 doc/board/sophgo/milkv_duo.rst                     |  91 +--
 drivers/clk/sophgo/clk-cv1800b.c                   | 127 +++++
 drivers/ram/Kconfig                                |   1 +
 drivers/ram/Makefile                               |   1 +
 drivers/ram/sophgo/Kconfig                         |   6 +
 drivers/ram/sophgo/Makefile                        |   6 +
 drivers/ram/sophgo/cv180x_ddr.c                    | 140 +++++
 drivers/ram/sophgo/cvx16_pinmux.c                  |  54 ++
 drivers/ram/sophgo/ddr_patch_regs.c                |  39 ++
 drivers/ram/sophgo/ddr_pkg_info.c                  | 110 ++++
 drivers/ram/sophgo/ddr_sys.c                       | 635 +++++++++++++++++++++
 drivers/ram/sophgo/ddr_sys.h                       | 108 ++++
 drivers/ram/sophgo/ddrc_init.c                     | 476 +++++++++++++++
 drivers/ram/sophgo/phy_init.c                      | 193 +++++++
 drivers/rtc/cv1800b.c                              |  67 ++-
 include/clk/sophgo-cv1800b.h                       |  11 +
 include/configs/milkv_duo.h                        |   2 +
 lib/Makefile                                       |   1 +
 arch/riscv/cpu/th1520/cache.c => lib/thead_cache.c |  17 +-
 tools/binman/etype/sophgo_cv18xx_fip.py            |  89 +++
 tools/binman/ftest.py                              |  54 ++
 tools/binman/test/vendor/sophgo_cv18xx_fip.dts     |  18 +
 .../test/vendor/sophgo_cv18xx_fip_bad_offset.dts   |  16 +
 .../test/vendor/sophgo_cv18xx_fip_collection.dts   |  19 +
 40 files changed, 2530 insertions(+), 38 deletions(-)
---
base-commit: 42680af8d15bb49201b298ab5f62058051c13083
change-id: 20261017-milkv-duo-spl-2e2fae6858f1

Best regards,
-- 
Hiago


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

end of thread, other threads:[~2026-12-02 13:30 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 14:25 [PATCH v2 0/9] riscv: sophgo: add SPL support for the Milk-V Duo Hiago De Franco
2026-12-01 14:25 ` [PATCH v2 1/9] binman: add Sophgo CV18xx FIP entry type Hiago De Franco
2026-12-01 23:03   ` David Lechner
2026-12-01 14:25 ` [PATCH v2 2/9] riscv: move T-HEAD cache operations to lib Hiago De Franco
2026-12-01 23:03   ` David Lechner
2026-12-01 14:25 ` [PATCH v2 3/9] riscv: cv1800b: add SPL support Hiago De Franco
2026-12-01 14:25 ` [PATCH v2 4/9] ram: sophgo: add CV180x DDR2 driver Hiago De Franco
2026-12-01 14:25 ` [PATCH v2 5/9] board: sophgo: milkv_duo: add SPL support Hiago De Franco
2026-12-01 23:03   ` David Lechner
2026-12-01 14:25 ` [PATCH v2 6/9] clk: sophgo: cv1800b: initialize PLLs Hiago De Franco
2026-12-01 14:25 ` [PATCH v2 7/9] rtc: cv1800b: configure RTC power and reset in probe Hiago De Franco
2026-12-01 14:25 ` [PATCH v2 8/9] doc: board: sophgo: milkv_duo: update documentation Hiago De Franco
2026-12-01 17:34   ` E Shattow
2026-12-01 14:25 ` [PATCH v2 9/9] doc: board: sophgo: milkv_duo: document the SPL boot flow Hiago De Franco
2026-12-02 12:22 ` [PATCH v2 0/9] riscv: sophgo: add SPL support for the Milk-V Duo Zhuxu Ran

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.