Switch Milk-V Duo to the upstream CV1800B devicetree by enabling
CONFIG_OF_UPSTREAM and selecting sophgo/cv1800b-milkv-duo.

The upstream devicetree keeps the Ethernet MAC disabled and does not
describe the CV1800B SPIF controller. Add U-Boot overrides to preserve
the existing networking and SPI NOR support.

Reviewed-by: Leo Yu-Chi Liang <[email protected]>
Signed-off-by: Zhuxu Ran <[email protected]>
---
 arch/riscv/dts/cv1800b-milkv-duo-u-boot.dtsi | 35 ++++++++++++++++++++++++++++
 board/sophgo/milkv_duo/MAINTAINERS           |  3 ++-
 configs/milkv_duo_defconfig                  |  3 ++-
 3 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/arch/riscv/dts/cv1800b-milkv-duo-u-boot.dtsi 
b/arch/riscv/dts/cv1800b-milkv-duo-u-boot.dtsi
new file mode 100644
index 00000000000..3a1d01e8940
--- /dev/null
+++ b/arch/riscv/dts/cv1800b-milkv-duo-u-boot.dtsi
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2023 Jisheng Zhang <[email protected]>
+ * Copyright (C) 2023 Inochi Amaoto <[email protected]>
+ * Copyright (C) 2026 Zhuxu Ran <[email protected]>
+ */
+
+/*
+ * The Ethernet signals are routed to the RJ45 connector on the optional
+ * IO Board. Keep Ethernet available in U-Boot when the IO Board is attached.
+ */
+&gmac0 {
+       status = "okay";
+};
+
+&{/soc} {
+       spif: spi@10000000 {
+               compatible = "sophgo,cv1800b-spif";
+               reg = <0x10000000 0x10000000>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clocks = <&clk CLK_AHB_SF>;
+               interrupts = <95 IRQ_TYPE_LEVEL_HIGH>;
+               status = "okay";
+
+               flash@0 {
+                       compatible = "jedec,spi-nor";
+                       reg = <0>;
+                       spi-max-frequency = <75000000>;
+                       spi-tx-bus-width = <4>;
+                       spi-rx-bus-width = <4>;
+                       m25p,fast-read;
+               };
+       };
+};
diff --git a/board/sophgo/milkv_duo/MAINTAINERS 
b/board/sophgo/milkv_duo/MAINTAINERS
index 6941dc5b376..8ca551426ae 100644
--- a/board/sophgo/milkv_duo/MAINTAINERS
+++ b/board/sophgo/milkv_duo/MAINTAINERS
@@ -1,7 +1,8 @@
 Milk-V Duo
 M:     Kongyang Liu <[email protected]>
 S:     Maintained
-F:     board/sophgo/milkv_duo/
+F:     arch/riscv/dts/cv1800b-milkv-duo-u-boot.dtsi
 F:     board/sophgo/common/
+F:     board/sophgo/milkv_duo/
 F:     configs/milkv_duo_defconfig
 F:     doc/board/sophgo/milkv_duo.rst
diff --git a/configs/milkv_duo_defconfig b/configs/milkv_duo_defconfig
index f1f3930564b..9d6b80362d5 100644
--- a/configs/milkv_duo_defconfig
+++ b/configs/milkv_duo_defconfig
@@ -4,7 +4,8 @@ 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="cv1800b-milkv-duo"
+CONFIG_DEFAULT_DEVICE_TREE="sophgo/cv1800b-milkv-duo"
+CONFIG_OF_UPSTREAM=y
 CONFIG_SYS_LOAD_ADDR=0x80080000
 CONFIG_IDENT_STRING="milkv_duo"
 CONFIG_TARGET_MILKV_DUO=y

-- 
2.55.0

Reply via email to