* [PATCH 1/4] riscv64: dts: sophgo: add SG2000 dtsi
2026-10-16 19:52 [PATCH 0/4] board: sophgo: Add support for Milk-V Duo S João Paulo Gonçalves
@ 2026-10-16 19:52 ` João Paulo Gonçalves
2026-10-16 19:52 ` [PATCH 2/4] riscv64: dts: sophgo: add initial Milk-V Duo S board support João Paulo Gonçalves
` (3 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: João Paulo Gonçalves @ 2026-10-16 19:52 UTC (permalink / raw)
To: u-boot, Yao Zi
Cc: Tom Rini, Sumit Garg, Gui-Dong Han, Joshua Milas, Chen Wang,
Inochi Amaoto, Lukasz Majewski, Peng Fan,
João Paulo Gonçalves, Tim Ouyang, Leo Liang,
Hiago De Franco, Raymond Mao, Michal Simek, Yixun Lan,
Andrei Lalaev, E Shattow
From: Joshua Milas <josh.milas@gmail.com>
Adds sg2000.dtsi on the RISCV side.
Signed-off-by: Joshua Milas <josh.milas@gmail.com>
Tested-by: Gui-Dong Han <hanguidong02@gmail.com>
Reviewed-by: Gui-Dong Han <hanguidong02@gmail.com>
Link: https://patch.msgid.link/20260615120324.1527881-3-josh.milas@gmail.com
Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
Signed-off-by: Chen Wang <chen.wang@linux.dev>
[ upstream commit: 418bd91075ccee25828db79390848da1ab3ef0a7 ]
(cherry picked from commit 48900d9aad54bcbd48db3e906e17526ee682354f)
---
dts/upstream/src/riscv/sophgo/sg2000.dtsi | 53 +++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
diff --git a/dts/upstream/src/riscv/sophgo/sg2000.dtsi b/dts/upstream/src/riscv/sophgo/sg2000.dtsi
new file mode 100644
index 000000000000..38462769574f
--- /dev/null
+++ b/dts/upstream/src/riscv/sophgo/sg2000.dtsi
@@ -0,0 +1,53 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+
+#define SOC_PERIPHERAL_IRQ(nr) ((nr) + 16)
+
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/pinctrl/pinctrl-sg2000.h>
+#include "cv180x-cpus.dtsi"
+#include "cv180x.dtsi"
+#include "cv181x.dtsi"
+
+/ {
+ compatible = "sophgo,sg2000";
+
+ memory@80000000 {
+ device_type = "memory";
+ reg = <0x80000000 0x20000000>;
+ };
+
+ soc {
+ interrupt-parent = <&plic>;
+ dma-noncoherent;
+
+ pinctrl: pinctrl@3001000 {
+ compatible = "sophgo,sg2000-pinctrl";
+ reg = <0x03001000 0x1000>,
+ <0x05027000 0x1000>;
+ reg-names = "sys", "rtc";
+ };
+
+ clk: clock-controller@3002000 {
+ compatible = "sophgo,sg2000-clk";
+ reg = <0x03002000 0x1000>;
+ clocks = <&osc>;
+ #clock-cells = <1>;
+ };
+
+ plic: interrupt-controller@70000000 {
+ compatible = "sophgo,sg2000-plic", "thead,c900-plic";
+ reg = <0x70000000 0x4000000>;
+ interrupts-extended = <&cpu0_intc 11>, <&cpu0_intc 9>;
+ interrupt-controller;
+ #address-cells = <0>;
+ #interrupt-cells = <2>;
+ riscv,ndev = <101>;
+ };
+
+ clint: timer@74000000 {
+ compatible = "sophgo,sg2000-clint", "thead,c900-clint";
+ reg = <0x74000000 0x10000>;
+ interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>;
+ };
+ };
+};
--
2.53.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 2/4] riscv64: dts: sophgo: add initial Milk-V Duo S board support
2026-10-16 19:52 [PATCH 0/4] board: sophgo: Add support for Milk-V Duo S João Paulo Gonçalves
2026-10-16 19:52 ` [PATCH 1/4] riscv64: dts: sophgo: add SG2000 dtsi João Paulo Gonçalves
@ 2026-10-16 19:52 ` João Paulo Gonçalves
2026-10-16 19:52 ` [PATCH 3/4] clk: sophgo: cv1800b: Add SG2000 compatible string João Paulo Gonçalves
` (2 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: João Paulo Gonçalves @ 2026-10-16 19:52 UTC (permalink / raw)
To: u-boot, Yao Zi
Cc: Tom Rini, Sumit Garg, Gui-Dong Han, Joshua Milas, Chen Wang,
Inochi Amaoto, Lukasz Majewski, Peng Fan,
João Paulo Gonçalves, Tim Ouyang, Leo Liang,
Hiago De Franco, Raymond Mao, Michal Simek, Yixun Lan,
Andrei Lalaev, E Shattow
From: Joshua Milas <josh.milas@gmail.com>
This adds initial riscv support for the Milk-V Duo S board
[1] making it possible to boot Linux to the command line.
Link: https://milkv.io/duo-s [1]
Signed-off-by: Joshua Milas <josh.milas@gmail.com>
Link: https://milkv.io/duo-s [1]
Link: https://patch.msgid.link/20260615120324.1527881-4-josh.milas@gmail.com
Signed-off-by: Inochi Amaoto <inochiama@gmail.com> # Trim empty line
Signed-off-by: Chen Wang <chen.wang@linux.dev>
[ upstream commit: 66153532fb18474c83f9bcbb27b039c7788e664f ]
(cherry picked from commit 2b4cd02ed6873160a2c8be4cdaa0d63e92b52830)
---
.../src/riscv/sophgo/sg2000-milkv-duo-s.dts | 244 +++++++++++++++++++++
1 file changed, 244 insertions(+)
diff --git a/dts/upstream/src/riscv/sophgo/sg2000-milkv-duo-s.dts b/dts/upstream/src/riscv/sophgo/sg2000-milkv-duo-s.dts
new file mode 100644
index 000000000000..78a257839f6f
--- /dev/null
+++ b/dts/upstream/src/riscv/sophgo/sg2000-milkv-duo-s.dts
@@ -0,0 +1,244 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+
+/dts-v1/;
+
+#include <dt-bindings/pinctrl/pinctrl-sg2000.h>
+#include "sg2000.dtsi"
+
+/ {
+ model = "Milk-V Duo S";
+ compatible = "milkv,duo-s", "sophgo,sg2000";
+
+ aliases {
+ i2c4 = &i2c4;
+ mmc0 = &sdhci0;
+ mmc1 = &emmc;
+ mmc2 = &sdhci1;
+ serial0 = &uart0;
+ serial4 = &uart4;
+ };
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+
+ wifi_pwrseq: wifi-pwrseq {
+ compatible = "mmc-pwrseq-simple";
+ reset-gpios = <&porta 15 GPIO_ACTIVE_LOW>;
+ power-off-delay-us = <50000>;
+ post-power-on-delay-ms = <200>;
+ };
+};
+
+&osc {
+ clock-frequency = <25000000>;
+};
+
+&pinctrl {
+ emmc_cfg: emmc-cfg {
+ emmc-rstn-pins {
+ pinmux = <PINMUX(PIN_EMMC_RSTN, 0)>;
+ bias-pull-up;
+ drive-strength-microamp = <10800>;
+ power-source = <1800>;
+ };
+
+ emmc-clk-pins {
+ pinmux = <PINMUX(PIN_EMMC_CLK, 0)>;
+ bias-pull-up;
+ drive-strength-microamp = <10800>;
+ power-source = <1800>;
+ };
+
+ emmc-cmd-pins {
+ pinmux = <PINMUX(PIN_EMMC_CMD, 0)>;
+ bias-pull-up;
+ drive-strength-microamp = <10800>;
+ power-source = <1800>;
+ };
+
+ emmc-data-pins {
+ pinmux = <PINMUX(PIN_EMMC_DAT0, 0)>,
+ <PINMUX(PIN_EMMC_DAT1, 0)>,
+ <PINMUX(PIN_EMMC_DAT2, 0)>,
+ <PINMUX(PIN_EMMC_DAT3, 0)>;
+ bias-pull-up;
+ drive-strength-microamp = <10800>;
+ power-source = <1800>;
+ };
+ };
+
+ i2c4_cfg: i2c4-cfg {
+ i2c4-pins {
+ pinmux = <PINMUX(PIN_VIVO_D1, 7)>,
+ <PINMUX(PIN_VIVO_D0, 7)>;
+ bias-pull-up;
+ drive-strength-microamp = <4000>;
+ power-source = <1800>;
+ };
+ };
+
+ sdhci0_cfg: sdhci0-cfg {
+ sdhci0-cd-pins {
+ pinmux = <PINMUX(PIN_SD0_CD, 0)>;
+ bias-pull-up;
+ drive-strength-microamp = <10800>;
+ power-source = <3300>;
+ };
+
+ sdhci0-clk-pins {
+ pinmux = <PINMUX(PIN_SD0_CLK, 0)>;
+ bias-pull-up;
+ drive-strength-microamp = <16100>;
+ power-source = <3300>;
+ };
+
+ sdhci0-cmd-pins {
+ pinmux = <PINMUX(PIN_SD0_CMD, 0)>;
+ bias-pull-up;
+ drive-strength-microamp = <10800>;
+ power-source = <3300>;
+ };
+
+ sdhci0-data-pins {
+ pinmux = <PINMUX(PIN_SD0_D0, 0)>,
+ <PINMUX(PIN_SD0_D1, 0)>,
+ <PINMUX(PIN_SD0_D2, 0)>,
+ <PINMUX(PIN_SD0_D3, 0)>;
+ bias-pull-up;
+ drive-strength-microamp = <10800>;
+ power-source = <3300>;
+ };
+ };
+
+ sdhci1_cfg: sdhci1-cfg {
+ sdhci1-clk-pins {
+ pinmux = <PINMUX(PIN_MIPI_TXM4, 1)>;
+ bias-pull-up;
+ drive-strength-microamp = <10800>;
+ power-source = <1800>;
+ };
+
+ sdhci1-cmd-pins {
+ pinmux = <PINMUX(PIN_MIPI_TXP4, 1)>;
+ bias-pull-up;
+ drive-strength-microamp = <10800>;
+ power-source = <1800>;
+ };
+
+ sdhci1-data-pins {
+ pinmux = <PINMUX(PIN_MIPI_TXM3, 1)>,
+ <PINMUX(PIN_MIPI_TXP3, 1)>,
+ <PINMUX(PIN_MIPI_TXM2, 7)>,
+ <PINMUX(PIN_MIPI_TXP2, 7)>;
+ bias-pull-up;
+ drive-strength-microamp = <10800>;
+ power-source = <1800>;
+ };
+ };
+
+ uart0_cfg: uart0-cfg {
+ uart0-pins {
+ pinmux = <PINMUX(PIN_UART0_TX, 0)>,
+ <PINMUX(PIN_UART0_RX, 0)>;
+ bias-pull-up;
+ drive-strength-microamp = <10800>;
+ power-source = <3300>;
+ };
+ };
+
+ uart4_cfg: uart4-cfg {
+ uart4-data-pins {
+ pinmux = <PINMUX(PIN_UART2_TX, 5)>,
+ <PINMUX(PIN_UART2_RX, 5)>;
+ drive-strength-microamp = <10800>;
+ power-source = <3300>;
+ };
+
+ uart4-control-pins {
+ pinmux = <PINMUX(PIN_UART2_CTS, 5)>,
+ <PINMUX(PIN_UART2_RTS, 5)>;
+ bias-pull-up;
+ drive-strength-microamp = <10800>;
+ power-source = <3300>;
+ };
+ };
+};
+
+&dmac {
+ status = "okay";
+};
+
+&emmc {
+ bus-width = <4>;
+ no-1-8-v;
+ cap-mmc-hw-reset;
+ no-sd;
+ no-sdio;
+ non-removable;
+ pinctrl-0 = <&emmc_cfg>;
+ pinctrl-names = "default";
+ status = "okay";
+};
+
+&gmac0 {
+ status = "okay";
+};
+
+&i2c4 {
+ pinctrl-0 = <&i2c4_cfg>;
+ pinctrl-names = "default";
+ status = "okay";
+};
+
+&mdio {
+ status = "okay";
+};
+
+&saradc {
+ status = "okay";
+};
+
+&sdhci0 {
+ bus-width = <4>;
+ disable-wp;
+ no-1-8-v;
+ pinctrl-0 = <&sdhci0_cfg>;
+ pinctrl-names = "default";
+ status = "okay";
+};
+
+&sdhci1 {
+ bus-width = <4>;
+ cap-sdio-irq;
+ cap-sd-highspeed;
+ keep-power-in-suspend;
+ no-mmc;
+ no-sd;
+ non-removable;
+ max-frequency = <150000000>;
+ mmc-pwrseq = <&wifi_pwrseq>;
+ pinctrl-0 = <&sdhci1_cfg>;
+ pinctrl-names = "default";
+ sd-uhs-sdr50;
+ sd-uhs-sdr104;
+ status = "okay";
+};
+
+&uart0 {
+ pinctrl-0 = <&uart0_cfg>;
+ pinctrl-names = "default";
+ status = "okay";
+};
+
+&uart4 {
+ pinctrl-0 = <&uart4_cfg>;
+ pinctrl-names = "default";
+ uart-has-rtscts;
+ status = "okay";
+};
+
+&usb {
+ dr_mode = "host";
+ status = "okay";
+};
--
2.53.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 3/4] clk: sophgo: cv1800b: Add SG2000 compatible string
2026-10-16 19:52 [PATCH 0/4] board: sophgo: Add support for Milk-V Duo S João Paulo Gonçalves
2026-10-16 19:52 ` [PATCH 1/4] riscv64: dts: sophgo: add SG2000 dtsi João Paulo Gonçalves
2026-10-16 19:52 ` [PATCH 2/4] riscv64: dts: sophgo: add initial Milk-V Duo S board support João Paulo Gonçalves
@ 2026-10-16 19:52 ` João Paulo Gonçalves
2026-10-16 23:52 ` E Shattow
2026-10-16 19:52 ` [PATCH 4/4] board: sophgo: Add support for Milk-V Duo S João Paulo Gonçalves
2026-10-16 21:54 ` [PATCH 0/4] " Hiago De Franco
4 siblings, 1 reply; 10+ messages in thread
From: João Paulo Gonçalves @ 2026-10-16 19:52 UTC (permalink / raw)
To: u-boot, Yao Zi
Cc: Tom Rini, Sumit Garg, Gui-Dong Han, Joshua Milas, Chen Wang,
Inochi Amaoto, Lukasz Majewski, Peng Fan,
João Paulo Gonçalves, Tim Ouyang, Leo Liang,
Hiago De Franco, Raymond Mao, Michal Simek, Yixun Lan,
Andrei Lalaev, E Shattow
The upstream SG2000 devicetree (sg2000.dtsi) uses "sophgo,sg2000-clk" as
the clock controller compatible string. The clocks needed by U-Boot are
the same as on the CV1800, so the existing driver can be reused.
Add "sophgo,sg2000-clk" to the driver match table.
Signed-off-by: João Paulo Gonçalves <jpaulo.silvagoncalves@gmail.com>
---
drivers/clk/sophgo/clk-cv1800b.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/clk/sophgo/clk-cv1800b.c b/drivers/clk/sophgo/clk-cv1800b.c
index 248a69321fc1..93d71ad1c314 100644
--- a/drivers/clk/sophgo/clk-cv1800b.c
+++ b/drivers/clk/sophgo/clk-cv1800b.c
@@ -744,6 +744,7 @@ const struct clk_ops cv1800b_clk_ops = {
static const struct udevice_id cv1800b_clk_of_match[] = {
{ .compatible = "sophgo,cv1800-clk" },
+ { .compatible = "sophgo,sg2000-clk" },
{ },
};
--
2.53.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH 3/4] clk: sophgo: cv1800b: Add SG2000 compatible string
2026-10-16 19:52 ` [PATCH 3/4] clk: sophgo: cv1800b: Add SG2000 compatible string João Paulo Gonçalves
@ 2026-10-16 23:52 ` E Shattow
0 siblings, 0 replies; 10+ messages in thread
From: E Shattow @ 2026-10-16 23:52 UTC (permalink / raw)
To: João Paulo Gonçalves, u-boot, Yao Zi
Cc: Tom Rini, Sumit Garg, Gui-Dong Han, Joshua Milas, Chen Wang,
Inochi Amaoto, Lukasz Majewski, Peng Fan, Tim Ouyang, Leo Liang,
Hiago De Franco, Raymond Mao, Michal Simek, Yixun Lan,
Andrei Lalaev
On 10/16/26 12:52, João Paulo Gonçalves wrote:
> The upstream SG2000 devicetree (sg2000.dtsi) uses "sophgo,sg2000-clk" as
> the clock controller compatible string. The clocks needed by U-Boot are
> the same as on the CV1800, so the existing driver can be reused.
>
> Add "sophgo,sg2000-clk" to the driver match table.
>
> Signed-off-by: João Paulo Gonçalves <jpaulo.silvagoncalves@gmail.com>
> ---
> drivers/clk/sophgo/clk-cv1800b.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/clk/sophgo/clk-cv1800b.c b/drivers/clk/sophgo/clk-cv1800b.c
> index 248a69321fc1..93d71ad1c314 100644
> --- a/drivers/clk/sophgo/clk-cv1800b.c
> +++ b/drivers/clk/sophgo/clk-cv1800b.c
> @@ -744,6 +744,7 @@ const struct clk_ops cv1800b_clk_ops = {
>
> static const struct udevice_id cv1800b_clk_of_match[] = {
> { .compatible = "sophgo,cv1800-clk" },
> + { .compatible = "sophgo,sg2000-clk" },
> { },
> };
>
>
Reviewed-by: E Shattow <e@freeshell.de>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 4/4] board: sophgo: Add support for Milk-V Duo S
2026-10-16 19:52 [PATCH 0/4] board: sophgo: Add support for Milk-V Duo S João Paulo Gonçalves
` (2 preceding siblings ...)
2026-10-16 19:52 ` [PATCH 3/4] clk: sophgo: cv1800b: Add SG2000 compatible string João Paulo Gonçalves
@ 2026-10-16 19:52 ` João Paulo Gonçalves
2026-10-16 23:51 ` E Shattow
2026-10-16 21:54 ` [PATCH 0/4] " Hiago De Franco
4 siblings, 1 reply; 10+ messages in thread
From: João Paulo Gonçalves @ 2026-10-16 19:52 UTC (permalink / raw)
To: u-boot, Yao Zi
Cc: Tom Rini, Sumit Garg, Gui-Dong Han, Joshua Milas, Chen Wang,
Inochi Amaoto, Lukasz Majewski, Peng Fan,
João Paulo Gonçalves, Tim Ouyang, Leo Liang,
Hiago De Franco, Raymond Mao, Michal Simek, Yixun Lan,
Andrei Lalaev, E Shattow
Add support for the Milk-V Duo S, a development board based on the
Sophgo SG2000 SoC with 512 MiB of RAM.
The SG2000 differs from the CV1800B used on the Milk-V Duo 64M and the
SG2002 used on the Milk-V Duo 256M, but these SoCs share most of their
IP blocks, including the CPU core, so the existing CV1800B support can
be reused.
Add a separate board directory, target and defconfig for the Duo S,
based on the Milk-V Duo 256M ones. Like the Duo 256M, it reuses the
common Milk-V Duo board code. The defconfig uses the upstream devicetree
via OF_UPSTREAM.
Link: https://milkv.io/docs/duo/getting-started/duos
Signed-off-by: João Paulo Gonçalves <jpaulo.silvagoncalves@gmail.com>
Acked-by: Andrei Lalaev <andrey.lalaev@gmail.com>
Acked-by: Hiago De Franco <hfranco@baylibre.com>
---
arch/riscv/Kconfig | 4 ++
board/sophgo/milkv_duo_s/Kconfig | 30 +++++++++++
board/sophgo/milkv_duo_s/MAINTAINERS | 8 +++
board/sophgo/milkv_duo_s/Makefile | 6 +++
board/sophgo/milkv_duo_s/milkv_duo_s.env | 8 +++
configs/milkv_duo_s_defconfig | 43 ++++++++++++++++
doc/board/sophgo/index.rst | 1 +
doc/board/sophgo/milkv_duo_s.rst | 86 ++++++++++++++++++++++++++++++++
include/configs/milkv_duo_s.h | 12 +++++
9 files changed, 198 insertions(+)
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 386241efd4a0..df10354e9aef 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -32,6 +32,9 @@ config TARGET_MILKV_DUO
config TARGET_MILKV_DUO_256M
bool "Support Milk-V Duo 256M Board"
+config TARGET_MILKV_DUO_S
+ bool "Support Milk-V Duo S Board"
+
config TARGET_OPENPITON_RISCV64
bool "Support RISC-V cores on OpenPiton SoC"
@@ -125,6 +128,7 @@ source "board/sifive/unmatched/Kconfig"
source "board/sipeed/maix/Kconfig"
source "board/sophgo/milkv_duo/Kconfig"
source "board/sophgo/milkv_duo_256m/Kconfig"
+source "board/sophgo/milkv_duo_s/Kconfig"
source "board/sophgo/licheerv_nano/Kconfig"
source "board/spacemit/k1/Kconfig"
source "board/spacemit/k3/Kconfig"
diff --git a/board/sophgo/milkv_duo_s/Kconfig b/board/sophgo/milkv_duo_s/Kconfig
new file mode 100644
index 000000000000..6ec6bd65d938
--- /dev/null
+++ b/board/sophgo/milkv_duo_s/Kconfig
@@ -0,0 +1,30 @@
+if TARGET_MILKV_DUO_S
+
+config SYS_BOARD
+ default "milkv_duo_s"
+
+config SYS_VENDOR
+ default "sophgo"
+
+config SYS_CPU
+ default "cv1800b"
+
+config SYS_CONFIG_NAME
+ default "milkv_duo_s"
+
+# The vendor FIP tool prepends a 32-byte loader header to u-boot.bin and loads
+# the result at 0x80200000, so the U-Boot code runs 0x20 bytes above that.
+config TEXT_BASE
+ default 0x80200020
+
+config ENV_SIZE
+ default 0x20000
+
+config ENV_SECT_SIZE
+ default 0x40000
+
+config BOARD_SPECIFIC_OPTIONS
+ def_bool y
+ select SOPHGO_CV1800B
+
+endif
diff --git a/board/sophgo/milkv_duo_s/MAINTAINERS b/board/sophgo/milkv_duo_s/MAINTAINERS
new file mode 100644
index 000000000000..86533c03fd9a
--- /dev/null
+++ b/board/sophgo/milkv_duo_s/MAINTAINERS
@@ -0,0 +1,8 @@
+Milk-V Duo S
+M: Andrei Lalaev <andrey.lalaev@gmail.com>
+M: Hiago De Franco <hfranco@baylibre.com>
+S: Maintained
+F: board/sophgo/milkv_duo_s/
+F: configs/milkv_duo_s_defconfig
+F: doc/board/sophgo/milkv_duo_s.rst
+F: include/configs/milkv_duo_s.h
diff --git a/board/sophgo/milkv_duo_s/Makefile b/board/sophgo/milkv_duo_s/Makefile
new file mode 100644
index 000000000000..a1b6aaee1489
--- /dev/null
+++ b/board/sophgo/milkv_duo_s/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (c) 2026, João Paulo Gonçalves <jpaulo.silvagoncalves@gmail.com>
+
+obj-y += ../milkv_duo/board.o
+obj-$(CONFIG_NET_LEGACY) += ../common/ethernet.o
diff --git a/board/sophgo/milkv_duo_s/milkv_duo_s.env b/board/sophgo/milkv_duo_s/milkv_duo_s.env
new file mode 100644
index 000000000000..4c9f53d08118
--- /dev/null
+++ b/board/sophgo/milkv_duo_s/milkv_duo_s.env
@@ -0,0 +1,8 @@
+fdt_addr_r=0x84000000
+fdtfile=DEFAULT_DEVICE_TREE.dtb
+kernel_addr_r=0x80200000
+kernel_comp_addr_r=0x88000000
+kernel_comp_size=0x4000000
+pxefile_addr_r=0x84300000
+ramdisk_addr_r=0x84400000
+scriptaddr=0x84200000
diff --git a/configs/milkv_duo_s_defconfig b/configs/milkv_duo_s_defconfig
new file mode 100644
index 000000000000..41a31c4ad46c
--- /dev/null
+++ b/configs/milkv_duo_s_defconfig
@@ -0,0 +1,43 @@
+CONFIG_RISCV=y
+CONFIG_SYS_MALLOC_LEN=0x820000
+CONFIG_SYS_MALLOC_F_LEN=0x8000
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x82300000
+CONFIG_DEFAULT_DEVICE_TREE="sophgo/sg2000-milkv-duo-s"
+CONFIG_SYS_LOAD_ADDR=0x80080000
+CONFIG_IDENT_STRING=" milkv_duo_s"
+CONFIG_TARGET_MILKV_DUO_S=y
+CONFIG_ARCH_RV64I=y
+CONFIG_RISCV_SMODE=y
+CONFIG_FIT=y
+CONFIG_BOOTSTD_FULL=y
+# CONFIG_BOOTMETH_EFI_BOOTMGR is not set
+CONFIG_SD_BOOT=y
+CONFIG_SYS_CBSIZE=512
+CONFIG_SYS_PBSIZE=544
+CONFIG_SYS_PROMPT="milkv_duo_s# "
+# CONFIG_CMD_BOOTDEV is not set
+CONFIG_CMD_MBR=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_POWEROFF=y
+# CONFIG_CMD_MII is not set
+CONFIG_CMD_EXT4_WRITE=y
+# CONFIG_ISO_PARTITION is not set
+# CONFIG_EFI_PARTITION is not set
+CONFIG_OF_UPSTREAM=y
+CONFIG_ENV_OVERWRITE=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_CLK_SOPHGO_CV1800B=y
+CONFIG_MMC=y
+CONFIG_MMC_IO_VOLTAGE=y
+CONFIG_MMC_UHS_SUPPORT=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_ADMA=y
+CONFIG_MMC_SDHCI_CV1800B=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_SYS_NS16550=y
+CONFIG_SYS_NS16550_MEM32=y
+CONFIG_SPI=y
+CONFIG_SYSRESET=y
+CONFIG_SYSRESET_CV1800B=y
diff --git a/doc/board/sophgo/index.rst b/doc/board/sophgo/index.rst
index 19c9a19b1d4b..61aceafceea3 100644
--- a/doc/board/sophgo/index.rst
+++ b/doc/board/sophgo/index.rst
@@ -7,4 +7,5 @@ Sophgo
milkv_duo
milkv_duo_256m
+ milkv_duo_s
licheerv_nano
diff --git a/doc/board/sophgo/milkv_duo_s.rst b/doc/board/sophgo/milkv_duo_s.rst
new file mode 100644
index 000000000000..2ae749a08215
--- /dev/null
+++ b/doc/board/sophgo/milkv_duo_s.rst
@@ -0,0 +1,86 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Milk-V Duo S
+============
+
+SG2000 RISC-V SoC
+-----------------
+The SG2000 is a high-performance, low-power 64-bit RISC-V/ARM SoC from Sophgo.
+
+Mainline support
+----------------
+Support for the following drivers is already enabled:
+
+1. ns16550 UART Driver.
+2. Synopsys Designware MSHC Driver.
+3. Synopsys Designware Ethernet Controller.
+
+Building
+~~~~~~~~
+1. Add the RISC-V toolchain to your PATH.
+2. Setup ARCH & cross compilation environment variable:
+
+.. code-block:: console
+
+ export CROSS_COMPILE=<riscv64 toolchain prefix>
+ cd <U-Boot-dir>
+ make milkv_duo_s_defconfig
+ make
+
+This will generate u-boot.bin
+
+Booting
+~~~~~~~
+Currently, we rely on vendor FSBL (First Stage Boot Loader) to initialize the
+clock and load OpenSBI and the u-boot image, then bootup from it.
+
+To run u-boot.bin on top of FSBL, follow these steps:
+
+1. Generate a compatible u-boot.bin using U-Boot with the Milk-V Duo S
+ default configuration.
+
+2. Use mainline OpenSBI with a newer version than 1.5 to generate fw_dynamic.
+ Use FW_FDT_PATH to point to sg2000-milkv-duo-s.dtb device tree file while
+ compiling fw_dynamic. Example:
+
+.. code-block:: console
+
+ cd open-sbi
+ PLATFORM=generic FW_FDT_PATH=../u-boot/dts/upstream/src/riscv/sophgo/sg2000-milkv-duo-s.dtb make
+
+This will generate build/platform/generic/firmware/fw_dynamic.bin.
+
+3. Use the vendor-provided tool [1] to create a unified fip.bin file containing
+ FSBL, OpenSBI, and U-Boot.
+ Note that you will have to use the file cv181x.bin as the FSBL.
+
+4. Place the generated fip.bin file into the FAT partition of the SD card.
+
+5. Set the board's boot core selection switch to RISC-V.
+
+6. Insert the SD card into the board and power it on.
+
+The board will automatically execute the FSBL from the fip.bin file.
+Subsequently, it will transition to OpenSBI, and finally, OpenSBI will invoke
+U-Boot.
+
+[1]: https://github.com/sophgo/fiptool
+
+Sample boot log from Milk-V Duo S board
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.. code-block:: none
+
+ U-Boot 2026.10-g3c39950264fd (Oct 16 2026 - 19:45:23 +0000) milkv_duo_s
+
+ DRAM: 512 MiB
+ Core: 28 devices, 13 uclasses, devicetree: separate
+ MMC: mmc@4310000: 0, mmc@4320000: 2, mmc@4300000: 1
+ Loading Environment from nowhere... OK
+ In: serial@4140000
+ Out: serial@4140000
+ Err: serial@4140000
+ Net:
+ Warning: ethernet@4070000 (eth0) using random MAC address - de:19:4d:5d:74:41
+ eth0: ethernet@4070000
+ Hit any key to stop autoboot: 0
+ milkv_duo_s#
diff --git a/include/configs/milkv_duo_s.h b/include/configs/milkv_duo_s.h
new file mode 100644
index 000000000000..f60aa23fc181
--- /dev/null
+++ b/include/configs/milkv_duo_s.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (c) 2026, João Paulo Gonçalves <jpaulo.silvagoncalves@gmail.com>
+ *
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#define CFG_SYS_SDRAM_BASE 0x80000000
+
+#endif /* __CONFIG_H */
--
2.53.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH 4/4] board: sophgo: Add support for Milk-V Duo S
2026-10-16 19:52 ` [PATCH 4/4] board: sophgo: Add support for Milk-V Duo S João Paulo Gonçalves
@ 2026-10-16 23:51 ` E Shattow
2026-10-17 4:07 ` Yao Zi
2026-10-17 20:05 ` Hiago De Franco
0 siblings, 2 replies; 10+ messages in thread
From: E Shattow @ 2026-10-16 23:51 UTC (permalink / raw)
To: João Paulo Gonçalves, u-boot, Yao Zi
Cc: Tom Rini, Sumit Garg, Gui-Dong Han, Joshua Milas, Chen Wang,
Inochi Amaoto, Lukasz Majewski, Peng Fan, Tim Ouyang, Leo Liang,
Hiago De Franco, Raymond Mao, Michal Simek, Yixun Lan,
Andrei Lalaev
Hi João Paulo,
On 10/16/26 12:52, João Paulo Gonçalves wrote:
> Add support for the Milk-V Duo S, a development board based on the
> Sophgo SG2000 SoC with 512 MiB of RAM.
>
> The SG2000 differs from the CV1800B used on the Milk-V Duo 64M and the
> SG2002 used on the Milk-V Duo 256M, but these SoCs share most of their
> IP blocks, including the CPU core, so the existing CV1800B support can
> be reused.
>
> Add a separate board directory, target and defconfig for the Duo S,
> based on the Milk-V Duo 256M ones. Like the Duo 256M, it reuses the
> common Milk-V Duo board code. The defconfig uses the upstream devicetree
> via OF_UPSTREAM.
>
> Link: https://milkv.io/docs/duo/getting-started/duos
> Signed-off-by: João Paulo Gonçalves <jpaulo.silvagoncalves@gmail.com>
> Acked-by: Andrei Lalaev <andrey.lalaev@gmail.com>
> Acked-by: Hiago De Franco <hfranco@baylibre.com>
> ---
> arch/riscv/Kconfig | 4 ++
> board/sophgo/milkv_duo_s/Kconfig | 30 +++++++++++
> board/sophgo/milkv_duo_s/MAINTAINERS | 8 +++
> board/sophgo/milkv_duo_s/Makefile | 6 +++
> board/sophgo/milkv_duo_s/milkv_duo_s.env | 8 +++
> configs/milkv_duo_s_defconfig | 43 ++++++++++++++++
> doc/board/sophgo/index.rst | 1 +
> doc/board/sophgo/milkv_duo_s.rst | 86 ++++++++++++++++++++++++++++++++
> include/configs/milkv_duo_s.h | 12 +++++
> 9 files changed, 198 insertions(+)
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 386241efd4a0..df10354e9aef 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -32,6 +32,9 @@ config TARGET_MILKV_DUO
> config TARGET_MILKV_DUO_256M
> bool "Support Milk-V Duo 256M Board"
>
> +config TARGET_MILKV_DUO_S
> + bool "Support Milk-V Duo S Board"
> +
> config TARGET_OPENPITON_RISCV64
> bool "Support RISC-V cores on OpenPiton SoC"
>
> @@ -125,6 +128,7 @@ source "board/sifive/unmatched/Kconfig"
> source "board/sipeed/maix/Kconfig"
> source "board/sophgo/milkv_duo/Kconfig"
> source "board/sophgo/milkv_duo_256m/Kconfig"
> +source "board/sophgo/milkv_duo_s/Kconfig"
> source "board/sophgo/licheerv_nano/Kconfig"
> source "board/spacemit/k1/Kconfig"
> source "board/spacemit/k3/Kconfig"
> diff --git a/board/sophgo/milkv_duo_s/Kconfig b/board/sophgo/milkv_duo_s/Kconfig
> new file mode 100644
> index 000000000000..6ec6bd65d938
> --- /dev/null
> +++ b/board/sophgo/milkv_duo_s/Kconfig
> @@ -0,0 +1,30 @@
> +if TARGET_MILKV_DUO_S
> +
> +config SYS_BOARD
> + default "milkv_duo_s"
> +
> +config SYS_VENDOR
> + default "sophgo"
> +
> +config SYS_CPU
> + default "cv1800b"
> +
> +config SYS_CONFIG_NAME
> + default "milkv_duo_s"
> +
> +# The vendor FIP tool prepends a 32-byte loader header to u-boot.bin and loads
> +# the result at 0x80200000, so the U-Boot code runs 0x20 bytes above that.
> +config TEXT_BASE
> + default 0x80200020
> +
> +config ENV_SIZE
> + default 0x20000
> +
> +config ENV_SECT_SIZE
> + default 0x40000
> +
> +config BOARD_SPECIFIC_OPTIONS
> + def_bool y
> + select SOPHGO_CV1800B
> +
> +endif
> diff --git a/board/sophgo/milkv_duo_s/MAINTAINERS b/board/sophgo/milkv_duo_s/MAINTAINERS
> new file mode 100644
> index 000000000000..86533c03fd9a
> --- /dev/null
> +++ b/board/sophgo/milkv_duo_s/MAINTAINERS
> @@ -0,0 +1,8 @@
> +Milk-V Duo S
> +M: Andrei Lalaev <andrey.lalaev@gmail.com>
> +M: Hiago De Franco <hfranco@baylibre.com>
> +S: Maintained
> +F: board/sophgo/milkv_duo_s/
> +F: configs/milkv_duo_s_defconfig
> +F: doc/board/sophgo/milkv_duo_s.rst
> +F: include/configs/milkv_duo_s.h
> diff --git a/board/sophgo/milkv_duo_s/Makefile b/board/sophgo/milkv_duo_s/Makefile
> new file mode 100644
> index 000000000000..a1b6aaee1489
> --- /dev/null
> +++ b/board/sophgo/milkv_duo_s/Makefile
> @@ -0,0 +1,6 @@
> +# SPDX-License-Identifier: GPL-2.0+
> +#
> +# Copyright (c) 2026, João Paulo Gonçalves <jpaulo.silvagoncalves@gmail.com>
> +
> +obj-y += ../milkv_duo/board.o
> +obj-$(CONFIG_NET_LEGACY) += ../common/ethernet.o
> diff --git a/board/sophgo/milkv_duo_s/milkv_duo_s.env b/board/sophgo/milkv_duo_s/milkv_duo_s.env
> new file mode 100644
> index 000000000000..4c9f53d08118
> --- /dev/null
> +++ b/board/sophgo/milkv_duo_s/milkv_duo_s.env
> @@ -0,0 +1,8 @@
> +fdt_addr_r=0x84000000
> +fdtfile=DEFAULT_DEVICE_TREE.dtb
Sorry I do not understand, what is "DEFAULT_DEVICE_TREE.dtb" where is
this file actually?
> +kernel_addr_r=0x80200000
> +kernel_comp_addr_r=0x88000000
> +kernel_comp_size=0x4000000
> +pxefile_addr_r=0x84300000
> +ramdisk_addr_r=0x84400000
> +scriptaddr=0x84200000
> diff --git a/configs/milkv_duo_s_defconfig b/configs/milkv_duo_s_defconfig
> new file mode 100644
> index 000000000000..41a31c4ad46c
> --- /dev/null
> +++ b/configs/milkv_duo_s_defconfig
> @@ -0,0 +1,43 @@
> +CONFIG_RISCV=y
> +CONFIG_SYS_MALLOC_LEN=0x820000
> +CONFIG_SYS_MALLOC_F_LEN=0x8000
> +CONFIG_NR_DRAM_BANKS=1
> +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
> +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x82300000
> +CONFIG_DEFAULT_DEVICE_TREE="sophgo/sg2000-milkv-duo-s"
> +CONFIG_SYS_LOAD_ADDR=0x80080000
> +CONFIG_IDENT_STRING=" milkv_duo_s"
> +CONFIG_TARGET_MILKV_DUO_S=y
> +CONFIG_ARCH_RV64I=y
> +CONFIG_RISCV_SMODE=y
> +CONFIG_FIT=y
> +CONFIG_BOOTSTD_FULL=y
> +# CONFIG_BOOTMETH_EFI_BOOTMGR is not set
> +CONFIG_SD_BOOT=y
> +CONFIG_SYS_CBSIZE=512
> +CONFIG_SYS_PBSIZE=544
> +CONFIG_SYS_PROMPT="milkv_duo_s# "
Delete CONFIG_SYS_PROMPT there is no purpose for non-default here
> +# CONFIG_CMD_BOOTDEV is not set
> +CONFIG_CMD_MBR=y
> +CONFIG_CMD_MMC=y
> +CONFIG_CMD_POWEROFF=y
> +# CONFIG_CMD_MII is not set
> +CONFIG_CMD_EXT4_WRITE=y
> +# CONFIG_ISO_PARTITION is not set
> +# CONFIG_EFI_PARTITION is not set
> +CONFIG_OF_UPSTREAM=y
> +CONFIG_ENV_OVERWRITE=y
> +CONFIG_NET_RANDOM_ETHADDR=y
> +CONFIG_CLK_SOPHGO_CV1800B=y
> +CONFIG_MMC=y
> +CONFIG_MMC_IO_VOLTAGE=y
> +CONFIG_MMC_UHS_SUPPORT=y
> +CONFIG_MMC_SDHCI=y
> +CONFIG_MMC_SDHCI_ADMA=y
> +CONFIG_MMC_SDHCI_CV1800B=y
> +CONFIG_ETH_DESIGNWARE=y
> +CONFIG_SYS_NS16550=y
> +CONFIG_SYS_NS16550_MEM32=y
> +CONFIG_SPI=y
> +CONFIG_SYSRESET=y
> +CONFIG_SYSRESET_CV1800B=y
> diff --git a/doc/board/sophgo/index.rst b/doc/board/sophgo/index.rst
> index 19c9a19b1d4b..61aceafceea3 100644
> --- a/doc/board/sophgo/index.rst
> +++ b/doc/board/sophgo/index.rst
> @@ -7,4 +7,5 @@ Sophgo
>
> milkv_duo
> milkv_duo_256m
> + milkv_duo_s
> licheerv_nano
> diff --git a/doc/board/sophgo/milkv_duo_s.rst b/doc/board/sophgo/milkv_duo_s.rst
> new file mode 100644
> index 000000000000..2ae749a08215
> --- /dev/null
> +++ b/doc/board/sophgo/milkv_duo_s.rst
> @@ -0,0 +1,86 @@
> +.. SPDX-License-Identifier: GPL-2.0+
> +
> +Milk-V Duo S
> +============
> +
> +SG2000 RISC-V SoC
> +-----------------
> +The SG2000 is a high-performance, low-power 64-bit RISC-V/ARM SoC from Sophgo.
> +
> +Mainline support
> +----------------
> +Support for the following drivers is already enabled:
> +
> +1. ns16550 UART Driver.
> +2. Synopsys Designware MSHC Driver.
> +3. Synopsys Designware Ethernet Controller.
> +
> +Building
> +~~~~~~~~
> +1. Add the RISC-V toolchain to your PATH.
> +2. Setup ARCH & cross compilation environment variable:
> +
> +.. code-block:: console
> +
> + export CROSS_COMPILE=<riscv64 toolchain prefix>
> + cd <U-Boot-dir>> + make milkv_duo_s_defconfig
> + make
Consider this variation:
export CROSS_COMPILE=<riscv64 toolchain prefix>
make -C u-boot.git O=../u-boot milkv_duo_s_defconfig
make -C u-boot.git O=../u-boot
> +
> +This will generate u-boot.bin
> +
> +Booting
> +~~~~~~~
> +Currently, we rely on vendor FSBL (First Stage Boot Loader) to initialize the
> +clock and load OpenSBI and the u-boot image, then bootup from it.
> +
> +To run u-boot.bin on top of FSBL, follow these steps:
> +
> +1. Generate a compatible u-boot.bin using U-Boot with the Milk-V Duo S
> + default configuration.
> +
> +2. Use mainline OpenSBI with a newer version than 1.5 to generate fw_dynamic.
Suspicious statement, I think it is wrong here.
Is this in regard to mainline OpenSBI commit f7a92f6b ("lib: utils/fdt:
Add support for parsing riscv,isa-extensions") ? If so, a short
statement e.g. "Use OpenSBI for generic platform with support for
parsing riscv,isa-extensions, introduced in mainline OpenSBI v1.6
release" or simply "Use mainline OpenSBI v1.6+" because you don't tell
us anyways why it is important that the needed change happens between
v1.5 and v1.6 OpenSBI version.
> + Use FW_FDT_PATH to point to sg2000-milkv-duo-s.dtb device tree file while
> + compiling fw_dynamic. Example:
> +
> +.. code-block:: console
> +
> + cd open-sbi
> + PLATFORM=generic FW_FDT_PATH=../u-boot/dts/upstream/src/riscv/sophgo/sg2000-milkv-duo-s.dtb make
See above comment about setting the O= make variable. Consider this again:
make -C opensbi.git O=../opensbi clean
make -C opensbi.git O=../opensbi PLATFORM=generic
FW_FDT_PATH=../u-boot/dts/upstream/src/riscv/sophgo/sg2000-milkv-duo-s.dtb
An explicit invocation of clean target before generic platform build
should be listed because of a well-known OpenSBI build problem:
https://lore.kernel.org/opensbi/0d6bf7c7-7605-4ad6-a35c-54efc5230fb8@sifive.com/
> +
> +This will generate build/platform/generic/firmware/fw_dynamic.bin.
> +
> +3. Use the vendor-provided tool [1] to create a unified fip.bin file containing
I think this description is correct but it just sounds strange to me
with the word "unified" for a mix of libre open source software into
third-party proprietary tools and proprietary executable code blob.
Consider "Use the vendor-provided fiptool [1] to prepare FSBL containing..."
> + FSBL, OpenSBI, and U-Boot.
"SPL, OpenSBI with initial device tree and U-Boot payload"
> + Note that you will have to use the file cv181x.bin as the FSBL.
Naming what we would want from U-Boot SPL to be known as "SPL" and then
wrapped with mkimage action to become "FSBL" is more easily
understandable. We do not have this yet, but think about a future where
there is U-Boot SPL and mkimage support here, how would you describe
this? Use that and apply it to the third party vendor workflow now.
If cv181x.bin is ready-to-go rename as "fip.bin" and SoC BootROM loader
functionality accepts this (no fiptool) then yes it is also true to
describe as "FSBL".
In fact the terminology FSBL and SPL may be equivalent but we can make
this arbitrary distinction in documentation to make it clearer what is
the compiled executable code SPL and what is the SPL image formed with
additional preparation.
> +
> +4. Place the generated fip.bin file into the FAT partition of the SD card.
Consider "Place the prepared fip.bin file" or better "Copy the prepared
FSBL as fip.bin file into the FAT partition of the SD card."
I like "prepared" word to describe wrapping up one or many data sources
in a header expected by the SoC BootROM loader functionality.
> +
> +5. Set the board's boot core selection switch to RISC-V.
> +
> +6. Insert the SD card into the board and power it on.
> +
> +The board will automatically execute the FSBL from the fip.bin file.
> +Subsequently, it will transition to OpenSBI, and finally, OpenSBI will invoke
> +U-Boot.
"The board will automatically load the FSBL from file fip.bin on the "
and name here the circumstances, is it the first FAT partition of msdos
label on SD Card? Is GPT GUID parition valid? It must be FAT16 or FAT32?
What exactly are the conditions for this?
"Subsequently, it will execute the SPL, and transition to OpenSBI with
U-Boot main app as the OpenSBI payload."
> +
> +[1]: https://github.com/sophgo/fiptool
> +
> +Sample boot log from Milk-V Duo S board
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +.. code-block:: none
> +
> + U-Boot 2026.10-g3c39950264fd (Oct 16 2026 - 19:45:23 +0000) milkv_duo_s
> +
> + DRAM: 512 MiB
> + Core: 28 devices, 13 uclasses, devicetree: separate
> + MMC: mmc@4310000: 0, mmc@4320000: 2, mmc@4300000: 1
> + Loading Environment from nowhere... OK
> + In: serial@4140000
> + Out: serial@4140000
> + Err: serial@4140000
> + Net:
> + Warning: ethernet@4070000 (eth0) using random MAC address - de:19:4d:5d:74:41
> + eth0: ethernet@4070000
> + Hit any key to stop autoboot: 0
> + milkv_duo_s#
> diff --git a/include/configs/milkv_duo_s.h b/include/configs/milkv_duo_s.h
> new file mode 100644
> index 000000000000..f60aa23fc181
> --- /dev/null
> +++ b/include/configs/milkv_duo_s.h
> @@ -0,0 +1,12 @@
> +/* SPDX-License-Identifier: GPL-2.0+ */
> +/*
> + * Copyright (c) 2026, João Paulo Gonçalves <jpaulo.silvagoncalves@gmail.com>
> + *
> + */
> +
> +#ifndef __CONFIG_H
> +#define __CONFIG_H
> +
> +#define CFG_SYS_SDRAM_BASE 0x80000000
> +
> +#endif /* __CONFIG_H */
>
If able, please reverse-engineer / port support for the Milk-V Duo S
FSBL image format to U-Boot mkimage tool. Also look more closely at
fully-relocatable OpenSBI fw_dynamic.bin support.
-E Shattow
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 4/4] board: sophgo: Add support for Milk-V Duo S
2026-10-16 23:51 ` E Shattow
@ 2026-10-17 4:07 ` Yao Zi
2026-10-17 20:05 ` Hiago De Franco
1 sibling, 0 replies; 10+ messages in thread
From: Yao Zi @ 2026-10-17 4:07 UTC (permalink / raw)
To: E Shattow, João Paulo Gonçalves, u-boot, Yao Zi
Cc: Tom Rini, Sumit Garg, Gui-Dong Han, Joshua Milas, Chen Wang,
Inochi Amaoto, Lukasz Majewski, Peng Fan, Tim Ouyang, Leo Liang,
Hiago De Franco, Raymond Mao, Michal Simek, Yixun Lan,
Andrei Lalaev
On Fri, Oct 16, 2026 at 04:51:34PM -0700, E Shattow wrote:
> Hi João Paulo,
>
> On 10/16/26 12:52, João Paulo Gonçalves wrote:
> > Add support for the Milk-V Duo S, a development board based on the
> > Sophgo SG2000 SoC with 512 MiB of RAM.
> >
> > The SG2000 differs from the CV1800B used on the Milk-V Duo 64M and the
> > SG2002 used on the Milk-V Duo 256M, but these SoCs share most of their
> > IP blocks, including the CPU core, so the existing CV1800B support can
> > be reused.
> >
> > Add a separate board directory, target and defconfig for the Duo S,
> > based on the Milk-V Duo 256M ones. Like the Duo 256M, it reuses the
> > common Milk-V Duo board code. The defconfig uses the upstream devicetree
> > via OF_UPSTREAM.
> >
> > Link: https://milkv.io/docs/duo/getting-started/duos
> > Signed-off-by: João Paulo Gonçalves <jpaulo.silvagoncalves@gmail.com>
> > Acked-by: Andrei Lalaev <andrey.lalaev@gmail.com>
> > Acked-by: Hiago De Franco <hfranco@baylibre.com>
> > ---
> > arch/riscv/Kconfig | 4 ++
> > board/sophgo/milkv_duo_s/Kconfig | 30 +++++++++++
> > board/sophgo/milkv_duo_s/MAINTAINERS | 8 +++
> > board/sophgo/milkv_duo_s/Makefile | 6 +++
> > board/sophgo/milkv_duo_s/milkv_duo_s.env | 8 +++
> > configs/milkv_duo_s_defconfig | 43 ++++++++++++++++
> > doc/board/sophgo/index.rst | 1 +
> > doc/board/sophgo/milkv_duo_s.rst | 86 ++++++++++++++++++++++++++++++++
> > include/configs/milkv_duo_s.h | 12 +++++
> > 9 files changed, 198 insertions(+)
...
> > diff --git a/board/sophgo/milkv_duo_s/milkv_duo_s.env b/board/sophgo/milkv_duo_s/milkv_duo_s.env
> > new file mode 100644
> > index 000000000000..4c9f53d08118
> > --- /dev/null
> > +++ b/board/sophgo/milkv_duo_s/milkv_duo_s.env
> > @@ -0,0 +1,8 @@
> > +fdt_addr_r=0x84000000
> > +fdtfile=DEFAULT_DEVICE_TREE.dtb
>
> Sorry I do not understand, what is "DEFAULT_DEVICE_TREE.dtb" where is
> this file actually?
It would be expanded to the value of CONFIG_DEFAULT_DEVICE_TREE, with
quotes stripped. See usage/environment.rst, and Makefile:2166.
...
> > diff --git a/doc/board/sophgo/milkv_duo_s.rst b/doc/board/sophgo/milkv_duo_s.rst
> > new file mode 100644
> > index 000000000000..2ae749a08215
> > --- /dev/null
> > +++ b/doc/board/sophgo/milkv_duo_s.rst
> > @@ -0,0 +1,86 @@
> > +.. SPDX-License-Identifier: GPL-2.0+
> > +
> > +Milk-V Duo S
> > +============
> > +
> > +SG2000 RISC-V SoC
> > +-----------------
> > +The SG2000 is a high-performance, low-power 64-bit RISC-V/ARM SoC from Sophgo.
> > +
> > +Mainline support
> > +----------------
> > +Support for the following drivers is already enabled:
> > +
> > +1. ns16550 UART Driver.
> > +2. Synopsys Designware MSHC Driver.
> > +3. Synopsys Designware Ethernet Controller.
> > +
> > +Building
> > +~~~~~~~~
> > +1. Add the RISC-V toolchain to your PATH.
> > +2. Setup ARCH & cross compilation environment variable:
> > +
> > +.. code-block:: console
> > +
> > + export CROSS_COMPILE=<riscv64 toolchain prefix>
> > + cd <U-Boot-dir>> + make milkv_duo_s_defconfig
> > + make
>
> Consider this variation:
>
> export CROSS_COMPILE=<riscv64 toolchain prefix>
> make -C u-boot.git O=../u-boot milkv_duo_s_defconfig
> make -C u-boot.git O=../u-boot
I don't think this improves things much, let's stop being nitpicking
here.
> > +
> > +This will generate u-boot.bin
> > +
> > +Booting
> > +~~~~~~~
> > +Currently, we rely on vendor FSBL (First Stage Boot Loader) to initialize the
> > +clock and load OpenSBI and the u-boot image, then bootup from it.
> > +
> > +To run u-boot.bin on top of FSBL, follow these steps:
> > +
> > +1. Generate a compatible u-boot.bin using U-Boot with the Milk-V Duo S
> > + default configuration.
> > +
> > +2. Use mainline OpenSBI with a newer version than 1.5 to generate fw_dynamic.
>
> Suspicious statement, I think it is wrong here.
>
> Is this in regard to mainline OpenSBI commit f7a92f6b ("lib: utils/fdt:
> Add support for parsing riscv,isa-extensions") ? If so, a short
> statement e.g. "Use OpenSBI for generic platform with support for
> parsing riscv,isa-extensions, introduced in mainline OpenSBI v1.6
> release" or simply "Use mainline OpenSBI v1.6+" because you don't tell
> us anyways why it is important that the needed change happens between
> v1.5 and v1.6 OpenSBI version.
I think it's likely related to 2bed4c1c57a7 ("platform: generic: thead:
add Sophgo CV18XX/SG200X series"), which applies a PMU-related quirk to
SG2002. But anyway, yes, an explanation of the version requirement would
be helpful, though I doubt it's SoC-specific instead of board-specific,
thus better put in a separate file.
> > + Use FW_FDT_PATH to point to sg2000-milkv-duo-s.dtb device tree file while
> > + compiling fw_dynamic. Example:
> > +
> > +.. code-block:: console
> > +
> > + cd open-sbi
> > + PLATFORM=generic FW_FDT_PATH=../u-boot/dts/upstream/src/riscv/sophgo/sg2000-milkv-duo-s.dtb make
>
> See above comment about setting the O= make variable. Consider this again:
>
> make -C opensbi.git O=../opensbi clean
> make -C opensbi.git O=../opensbi PLATFORM=generic
> FW_FDT_PATH=../u-boot/dts/upstream/src/riscv/sophgo/sg2000-milkv-duo-s.dtb
>
> An explicit invocation of clean target before generic platform build
> should be listed because of a well-known OpenSBI build problem:
>
> https://lore.kernel.org/opensbi/0d6bf7c7-7605-4ad6-a35c-54efc5230fb8@sifive.com/
This sounds like an OpenSBI bug, and I'm not sure whether we should pay
for it to maintain it in the documentation.
Furthermore, anyone building OpenSBI would be affected by the issue,
which makes it sound more unnatural to emphasize this in a board-level
documentation (e.g., should we modify all other RISC-V ports to mention
this?).
To me, the board/SoC-level documentation is only responsible for
describing the board/SoC-specific stuff. It's necessary to mention how
to build related firmware, but I don't think we should get too deep
here.
> > +
> > +This will generate build/platform/generic/firmware/fw_dynamic.bin.
> > +
> > +3. Use the vendor-provided tool [1] to create a unified fip.bin file containing
>
> I think this description is correct but it just sounds strange to me
> with the word "unified" for a mix of libre open source software into
> third-party proprietary tools and proprietary executable code blob.
Sophgo FSBL had been source-available for a long time, and Sophgo has
recently explicitly licensed it. Thus it doesn't sound correct to call
them "proprietary" and "blob".
> Consider "Use the vendor-provided fiptool [1] to prepare FSBL containing..."
This is incorrect. In the context of CV18xx/SG200x bootflow, FSBL refers
to the bootloader preceeding U-Boot (whether it's the vendor one or not),
and fip.bin is combined from FSBL, OpenSBI, and U-Boot.
> > + FSBL, OpenSBI, and U-Boot.
>
> "SPL, OpenSBI with initial device tree and U-Boot payload"
>
> > + Note that you will have to use the file cv181x.bin as the FSBL.
>
> Naming what we would want from U-Boot SPL to be known as "SPL" and then
> wrapped with mkimage action to become "FSBL" is more easily
> understandable. We do not have this yet, but think about a future where
> there is U-Boot SPL and mkimage support here, how would you describe
> this? Use that and apply it to the third party vendor workflow now.
Sorry for not getting you points, but I couldn't understand what
cannot be described...
> If cv181x.bin is ready-to-go rename as "fip.bin" and SoC BootROM loader
> functionality accepts this (no fiptool) then yes it is also true to
> describe as "FSBL".
>
> In fact the terminology FSBL and SPL may be equivalent but we can make
> this arbitrary distinction in documentation to make it clearer what is
> the compiled executable code SPL and what is the SPL image formed with
> additional preparation.
This sounds reasonable. However, I don't think it should belong to this
series adding support for another board.
In case that you don't know, CV1800B, SG2000, and SG2002 have the same
bootflow, and we already have CV1800B (milkv_duo) and SG2002
(milkv_duo_256m) support available in mainline U-Boot, without
explaining these terms. So I don't think we should put such burden on
one adding a new board.
It'll be nice if Joao could add some related documentation, but I don't
think it's a blocker for merging this series.
> > +
> > +4. Place the generated fip.bin file into the FAT partition of the SD card.
>
> Consider "Place the prepared fip.bin file" or better "Copy the prepared
> FSBL as fip.bin file into the FAT partition of the SD card."
>
> I like "prepared" word to describe wrapping up one or many data sources
> in a header expected by the SoC BootROM loader functionality.
I think this is a little too nitpicking. This is probably copied from
documentation of other CV18xx/SG200x boards, and I don't think there's a
strong difference among the three versions...
...
> > diff --git a/include/configs/milkv_duo_s.h b/include/configs/milkv_duo_s.h
> > new file mode 100644
> > index 000000000000..f60aa23fc181
> > --- /dev/null
> > +++ b/include/configs/milkv_duo_s.h
> > @@ -0,0 +1,12 @@
> > +/* SPDX-License-Identifier: GPL-2.0+ */
> > +/*
> > + * Copyright (c) 2026, João Paulo Gonçalves <jpaulo.silvagoncalves@gmail.com>
> > + *
> > + */
> > +
> > +#ifndef __CONFIG_H
> > +#define __CONFIG_H
> > +
> > +#define CFG_SYS_SDRAM_BASE 0x80000000
> > +
> > +#endif /* __CONFIG_H */
> >
>
> If able, please reverse-engineer / port support for the Milk-V Duo S
> FSBL image format to U-Boot mkimage tool. Also look more closely at
> fully-relocatable OpenSBI fw_dynamic.bin support.
Nice point, but this won't be a blocker for the series, either :)
> -E Shattow
Best regards,
Yao Zi
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 4/4] board: sophgo: Add support for Milk-V Duo S
2026-10-16 23:51 ` E Shattow
2026-10-17 4:07 ` Yao Zi
@ 2026-10-17 20:05 ` Hiago De Franco
1 sibling, 0 replies; 10+ messages in thread
From: Hiago De Franco @ 2026-10-17 20:05 UTC (permalink / raw)
To: E Shattow
Cc: João Paulo Gonçalves, u-boot, Yao Zi, Tom Rini,
Sumit Garg, Gui-Dong Han, Joshua Milas, Chen Wang, Inochi Amaoto,
Lukasz Majewski, Peng Fan, Tim Ouyang, Leo Liang, Raymond Mao,
Michal Simek, Yixun Lan, Andrei Lalaev
On Fri, Oct 16, 2026 at 04:51:34PM -0700, E Shattow wrote:
> Hi João Paulo,
>
> On 10/16/26 12:52, João Paulo Gonçalves wrote:
> > Add support for the Milk-V Duo S, a development board based on the
> > Sophgo SG2000 SoC with 512 MiB of RAM.
> >
> > The SG2000 differs from the CV1800B used on the Milk-V Duo 64M and the
> > SG2002 used on the Milk-V Duo 256M, but these SoCs share most of their
> > IP blocks, including the CPU core, so the existing CV1800B support can
> > be reused.
> >
> > Add a separate board directory, target and defconfig for the Duo S,
> > based on the Milk-V Duo 256M ones. Like the Duo 256M, it reuses the
> > common Milk-V Duo board code. The defconfig uses the upstream devicetree
> > via OF_UPSTREAM.
> >
> > Link: https://milkv.io/docs/duo/getting-started/duos
> > Signed-off-by: João Paulo Gonçalves <jpaulo.silvagoncalves@gmail.com>
> > Acked-by: Andrei Lalaev <andrey.lalaev@gmail.com>
> > Acked-by: Hiago De Franco <hfranco@baylibre.com>
> > ---
> > arch/riscv/Kconfig | 4 ++
> > board/sophgo/milkv_duo_s/Kconfig | 30 +++++++++++
> > board/sophgo/milkv_duo_s/MAINTAINERS | 8 +++
> > board/sophgo/milkv_duo_s/Makefile | 6 +++
> > board/sophgo/milkv_duo_s/milkv_duo_s.env | 8 +++
> > configs/milkv_duo_s_defconfig | 43 ++++++++++++++++
> > doc/board/sophgo/index.rst | 1 +
> > doc/board/sophgo/milkv_duo_s.rst | 86 ++++++++++++++++++++++++++++++++
> > include/configs/milkv_duo_s.h | 12 +++++
> > 9 files changed, 198 insertions(+)
> >
...
> > diff --git a/configs/milkv_duo_s_defconfig b/configs/milkv_duo_s_defconfig
> > new file mode 100644
> > index 000000000000..41a31c4ad46c
> > --- /dev/null
> > +++ b/configs/milkv_duo_s_defconfig
> > @@ -0,0 +1,43 @@
> > +CONFIG_RISCV=y
> > +CONFIG_SYS_MALLOC_LEN=0x820000
> > +CONFIG_SYS_MALLOC_F_LEN=0x8000
> > +CONFIG_NR_DRAM_BANKS=1
> > +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
> > +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x82300000
> > +CONFIG_DEFAULT_DEVICE_TREE="sophgo/sg2000-milkv-duo-s"
> > +CONFIG_SYS_LOAD_ADDR=0x80080000
> > +CONFIG_IDENT_STRING=" milkv_duo_s"
> > +CONFIG_TARGET_MILKV_DUO_S=y
> > +CONFIG_ARCH_RV64I=y
> > +CONFIG_RISCV_SMODE=y
> > +CONFIG_FIT=y
> > +CONFIG_BOOTSTD_FULL=y
> > +# CONFIG_BOOTMETH_EFI_BOOTMGR is not set
> > +CONFIG_SD_BOOT=y
> > +CONFIG_SYS_CBSIZE=512
> > +CONFIG_SYS_PBSIZE=544
> > +CONFIG_SYS_PROMPT="milkv_duo_s# "
>
> Delete CONFIG_SYS_PROMPT there is no purpose for non-default here
This is the same for the other Milk-V Duo boards (CV1800B and SG2002). I
like the idea to have this with the board name and I do not see this as
a blocker for the series. If this needs to be removed, I would remove
the other boards as well, which I prefer not to do.
>
> > +# CONFIG_CMD_BOOTDEV is not set
> > +CONFIG_CMD_MBR=y
> > +CONFIG_CMD_MMC=y
> > +CONFIG_CMD_POWEROFF=y
> > +# CONFIG_CMD_MII is not set
> > +CONFIG_CMD_EXT4_WRITE=y
> > +# CONFIG_ISO_PARTITION is not set
> > +# CONFIG_EFI_PARTITION is not set
> > +CONFIG_OF_UPSTREAM=y
> > +CONFIG_ENV_OVERWRITE=y
> > +CONFIG_NET_RANDOM_ETHADDR=y
> > +CONFIG_CLK_SOPHGO_CV1800B=y
> > +CONFIG_MMC=y
> > +CONFIG_MMC_IO_VOLTAGE=y
> > +CONFIG_MMC_UHS_SUPPORT=y
> > +CONFIG_MMC_SDHCI=y
> > +CONFIG_MMC_SDHCI_ADMA=y
> > +CONFIG_MMC_SDHCI_CV1800B=y
> > +CONFIG_ETH_DESIGNWARE=y
> > +CONFIG_SYS_NS16550=y
> > +CONFIG_SYS_NS16550_MEM32=y
> > +CONFIG_SPI=y
> > +CONFIG_SYSRESET=y
> > +CONFIG_SYSRESET_CV1800B=y
...
Best regards,
--
Hiago
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/4] board: sophgo: Add support for Milk-V Duo S
2026-10-16 19:52 [PATCH 0/4] board: sophgo: Add support for Milk-V Duo S João Paulo Gonçalves
` (3 preceding siblings ...)
2026-10-16 19:52 ` [PATCH 4/4] board: sophgo: Add support for Milk-V Duo S João Paulo Gonçalves
@ 2026-10-16 21:54 ` Hiago De Franco
4 siblings, 0 replies; 10+ messages in thread
From: Hiago De Franco @ 2026-10-16 21:54 UTC (permalink / raw)
To: João Paulo Gonçalves
Cc: u-boot, Yao Zi, Tom Rini, Sumit Garg, Gui-Dong Han, Joshua Milas,
Chen Wang, Inochi Amaoto, Lukasz Majewski, Peng Fan, Tim Ouyang,
Leo Liang, Raymond Mao, Michal Simek, Yixun Lan, Andrei Lalaev,
E Shattow, Zhuxu Ran
Hi João,
On Fri, Oct 16, 2026 at 04:52:30PM -0300, João Paulo Gonçalves wrote:
> This series adds support for the Milk-V Duo S, a development board based
> on the Sophgo SG2000 SoC with 512 MiB of RAM. The board uses the
> upstream Linux devicetree via OF_UPSTREAM.
>
> The first two patches cherry-pick the SG2000 dtsi and the Duo S
> devicetree from upstream v7.3-rc1.
>
> The Duo S gets its own board directory, based on the Milk-V Duo 256M
> one. Apart from the devicetree, the two boards share almost all of their
> configuration. However, they use different SoCs (SG2000 vs. SG2002), so
> the Duo S is not treated as a variant of the Duo 256M.
>
> Hiago and Andrei reviewed these patches internally before submission,
> hence their Acked-by tags. Since they already work with these boards,
> they have agreed to maintain the Duo S support.
>
> Tested on a Milk-V Duo S.
Thanks for the series. As I reviewed earlier, it looks good to me.
I will add Zhuxu Ran to CC since maybe he is interested as well.
+CC: Zhuxu Ran <zhuxu_ran@zohomail.com>
Link: https://lore.kernel.org/u-boot/20261016-upstream-v1-milk-duo-s-v1-0-e4bf386eea2d@gmail.com/
>
> ---
> Joshua Milas (2):
> riscv64: dts: sophgo: add SG2000 dtsi
> riscv64: dts: sophgo: add initial Milk-V Duo S board support
>
> João Paulo Gonçalves (2):
> clk: sophgo: cv1800b: Add SG2000 compatible string
> board: sophgo: Add support for Milk-V Duo S
>
> arch/riscv/Kconfig | 4 +
> board/sophgo/milkv_duo_s/Kconfig | 30 +++
> board/sophgo/milkv_duo_s/MAINTAINERS | 8 +
> board/sophgo/milkv_duo_s/Makefile | 6 +
> board/sophgo/milkv_duo_s/milkv_duo_s.env | 8 +
> configs/milkv_duo_s_defconfig | 43 ++++
> doc/board/sophgo/index.rst | 1 +
> doc/board/sophgo/milkv_duo_s.rst | 86 ++++++++
> drivers/clk/sophgo/clk-cv1800b.c | 1 +
> .../src/riscv/sophgo/sg2000-milkv-duo-s.dts | 244 +++++++++++++++++++++
> dts/upstream/src/riscv/sophgo/sg2000.dtsi | 53 +++++
> include/configs/milkv_duo_s.h | 12 +
> 12 files changed, 496 insertions(+)
> ---
> base-commit: 8d534cec0cc0109a37c0ded8854da03f1526dc0e
> change-id: 20261014-upstream-v1-milk-duo-s-c4d2935c4298
>
> Best regards,
> --
> João Paulo Gonçalves <jpaulo.silvagoncalves@gmail.com>
>
Best regards,
--
Hiago
^ permalink raw reply [flat|nested] 10+ messages in thread