riscv: dts: sophgo: Add Milk-V Duo 256M board support
Subsystems (3)
v4 cover riscv: dts: sophgo: Add Milk-V Duo 256M board support
The Milk-V Duo 256M is a small form factor development board based on the Sophgo SG2002 SoC.
This series adds the board binding, the PWR_GPIO controller node for the CV180x/CV181x family, and the board device tree with support for the UART console, SD/MMC, USB host and the onboard blue status LED.
Tested on actual Milk-V Duo 256M hardware: verified boot to shell, SD card rootfs mount, USB host (root hub detected) and the heartbeat LED, both via the default heartbeat trigger and manual sysfs control.
Changes since v3:
- Move the pwr_gpio node in cv180x.dtsi to follow unit-address ordering, placing it between usb@4340000 and rtc@5025000 (Inochi Amaoto)
Changes since v2:
- Add the PWR_GPIO (porte) controller node to cv180x.dtsi as a new patch, instead of dropping the LED node (Inochi Amaoto)
- Restore the gpio-leds node for the onboard blue status LED
- Add my copyright to the new board dts
- Drop the unrelated Makefile trailing-newline change
Changes since v1:
- Removed the leds node because &porte was not supported in cv180x.dtsi (reworked in v3)
- Retained the &usb node because it is already defined in cv180x.dtsi
Chen-Yu Yeh (3):
dt-bindings: soc: sophgo: add Milk-V Duo 256M board
riscv: dts: sophgo: cv180x: Add PWR_GPIO controller
riscv: dts: sophgo: Add Milk-V Duo 256M board support
.../bindings/soc/sophgo/sophgo.yaml | 4 + arch/riscv/boot/dts/sophgo/Makefile | 1 + arch/riscv/boot/dts/sophgo/cv180x.dtsi | 18 +++ .../boot/dts/sophgo/sg2002-milkv-duo256m.dts | 121 ++++++++++++++++++ 4 files changed, 144 insertions(+) create mode 100644 arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts
base-commit: 980ab36ae5972c83f683b939e50c469c4947229e
Signature · 1 line
2.43.0
PATCH v4 1/3 dt-bindings: soc: sophgo: add Milk-V Duo 256M board
Add compatible string for the Milk-V Duo 256M board.
--- Documentation/devicetree/bindings/soc/sophgo/sophgo.yaml | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/soc/sophgo/sophgo.yaml +4 -0
@@ -35,6 +35,10 @@ properties: - enum: - milkv,duo-s - const: sophgo,sg2000 + - items: + - enum: + - milkv,duo256m + - const: sophgo,sg2002 - items: - enum: - sipeed,licheerv-nano-b
Signature · 1 line
2.43.0
PATCH v4 2/3 riscv: dts: sophgo: cv180x: Add PWR_GPIO controller
In reply to Chen-Yu YehThe CV180x/CV181x family has an additional DesignWare APB GPIO controller (PWR_GPIO) located in the always-on power domain at 0x5021000. Add the node so that boards can reference GPIOs in this bank, such as status LEDs.
---
Changes since v3:
- Move the pwr_gpio node to follow unit-address ordering (Inochi Amaoto)
arch/riscv/boot/dts/sophgo/cv180x.dtsi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
arch/riscv/boot/dts/sophgo/cv180x.dtsi +18 -0
@@ -448,6 +448,24 @@ usb: usb@4340000 { status = "disabled"; }; + gpio4: gpio@5021000 { + compatible = "snps,dw-apb-gpio"; + reg = <0x5021000 0x1000>; + #address-cells = <1>; + #size-cells = <0>; + + porte: gpio-controller@0 { + compatible = "snps,dw-apb-gpio-port"; + gpio-controller; + #gpio-cells = <2>; + ngpios = <32>; + reg = <0>; + interrupt-controller; + #interrupt-cells = <2>; + interrupts = <SOC_PERIPHERAL_IRQ(54) IRQ_TYPE_LEVEL_HIGH>; + }; + }; + rtc@5025000 { compatible = "sophgo,cv1800b-rtc", "syscon"; reg = <0x5025000 0x2000>;
Signature · 1 line
2.43.0
PATCH v4 3/3 riscv: dts: sophgo: Add Milk-V Duo 256M board support
In reply to Chen-Yu YehThe Milk-V Duo 256M is a small form factor development board based on the Sophgo SG2002 SoC.
This patch adds basic device tree support for the board, including:
- UART console
- SD/MMC controller
- USB host
- Onboard blue status LED (connected to PWR_GPIO[2] / porte 2)
Tested on actual Milk-V Duo 256M hardware, verified boot to shell and heartbeat LED functionality.
--- arch/riscv/boot/dts/sophgo/Makefile | 1 + .../boot/dts/sophgo/sg2002-milkv-duo256m.dts | 121 ++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts
arch/riscv/boot/dts/sophgo/Makefile +1 -0
@@ -2,6 +2,7 @@ dtb-$(CONFIG_ARCH_SOPHGO) += cv1800b-milkv-duo.dtb dtb-$(CONFIG_ARCH_SOPHGO) += cv1812h-huashan-pi.dtb dtb-$(CONFIG_ARCH_SOPHGO) += sg2002-licheerv-nano-b.dtb +dtb-$(CONFIG_ARCH_SOPHGO) += sg2002-milkv-duo256m.dtb dtb-$(CONFIG_ARCH_SOPHGO) += sg2042-milkv-pioneer.dtb dtb-$(CONFIG_ARCH_SOPHGO) += sg2042-evb-v1.dtb dtb-$(CONFIG_ARCH_SOPHGO) += sg2042-evb-v2.dtb
arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts new file +121 -0
121 lines not on this page · raw message
Signature · 1 line
2.43.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Potentially incorrect coprocessor RTOS memory region address causing memory fragmentation and…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Potentially incorrect coprocessor RTOS memory region address causing memory fragmentation and risking memory corruption. --
--- Patch [3]: [PATCH v4 3/3] riscv: dts: sophgo: Add Milk-V Duo 256M board support --- commit 0fb7e443f556963d48319d1228e77903653e11bc
Author: Chen-Yu Yeh <[email protected]>
riscv: dts: sophgo: Add Milk-V Duo 256M board support
This commit adds basic device tree support for the Milk-V Duo 256M board based on the Sophgo SG2002 SoC. It includes configurations for UART, SD/MMC, USB host, and the onboard status LED.
Quoted 5 lines
arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts new file +0
-0
[ ... ]
arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts line 48
Quoted 9 lines
arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts new file +9
-0+ reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + coprocessor_rtos: region@83f40000 { + reg = <0x83f40000 0xc0000>; + no-map; + };
[Severity: Medium]
Is this reserved memory address correct for the 256M board?
This address (0x83f40000) is at the top of the 64MB boundary, which matches the 64MB Milk-V Duo. Since the Milk-V Duo 256M has 256MB of RAM, would the RTOS usually be placed near the top of the 256MB space instead?
If the bootloader places the RTOS at the top of memory but the device tree reserves this lower address, could Linux inadvertently overwrite the actual RTOS memory during allocation? This might also artificially fragment the contiguous Linux memory pool around the 64MB mark.
Quoted 2 lines
arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts new file +2
-0+ }; +};
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
Confirmed, this was a real bug. The address was carried over from the 64M Duo. The 256M board's firmware reserves the top 2MB instead -- the vendor device tree declares memory as <0x80000000 0x0fe00000> -- so the region is 0x8fe00000/0x200000, matching cv1812h-huashan-pi. Fixed in v5.
Chen-Yu
<[email protected]> 於 2026年7月22日週三 上午7:45寫道:
Quoted 50 lines
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Potentially incorrect coprocessor RTOS memory region address causing memory fragmentation and risking memory corruption. ----- Patch [3]: [PATCH v4 3/3] riscv: dts: sophgo: Add Milk-V Duo 256M board support --- commit
0fb7e443f556963d48319d1228e77903653e11bc
Author: Chen-Yu Yeh <[email protected]>riscv: dts: sophgo: Add Milk-V Duo 256M board support
This commit adds basic device tree support for the Milk-V Duo 256M board based on the Sophgo SG2002 SoC. It includes configurations for UART, SD/MMC, USB host, and the onboard status LED.
Quoted 5 lines
arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts new file +0
-0[ ... ]
arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts line 48
Quoted 9 lines
arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts new file +9
-0+ reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + coprocessor_rtos: region@83f40000 { + reg = <0x83f40000 0xc0000>; + no-map; + };[Severity: Medium]
Is this reserved memory address correct for the 256M board?This address (
0x83f40000) is at the top of the 64MB boundary, which matches the 64MB Milk-V Duo. Since the Milk-V Duo 256M has 256MB of RAM, would the RTOS usually be placed near the top of the 256MB space instead?If the bootloader places the RTOS at the top of memory but the device tree reserves this lower address, could Linux inadvertently overwrite the actual RTOS memory during allocation? This might also artificially fragment the contiguous Linux memory pool around the 64MB mark.
arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts
Quoted 2 lines
arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts new file +2
-0+ }; +};--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3