riscv: dts: sophgo: Add Milk-V Duo 256M board support
Subsystems (3)
v3 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 v2:
- Add the PWR_GPIO (porte) controller node to cv180x.dtsi as a new patch, instead of dropping the LED node (suggested by 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, see above)
- Retained the &usb node because it is already defined in cv180x.dtsi
- Cleaned up the trailing blank line in the Makefile
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: acb7500801e98639f6d8c2d796ed9f64cba83d3a
Signature · 1 line
2.43.0
PATCH v3 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
@@ -31,6 +31,10 @@ properties: - milkv,duo-module-01-evb - const: milkv,duo-module-01 - const: sophgo,sg2000 + - items: + - enum: + - milkv,duo256m + - const: sophgo,sg2002 - items: - enum: - sipeed,licheerv-nano-b
Signature · 1 line
2.43.0
PATCH v3 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.
---
The base address and interrupt number match the vendor SDK device tree (cv181x_base_riscv.dtsi: gpio@05021000, PLIC interrupt 70, i.e. SOC_PERIPHERAL_IRQ(54)). Verified on Milk-V Duo 256M hardware via the onboard status LED on porte 2.
arch/riscv/boot/dts/sophgo/cv180x.dtsi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
arch/riscv/boot/dts/sophgo/cv180x.dtsi +18 -0
@@ -160,6 +160,24 @@ portd: gpio-controller@0 { }; }; + 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>; + }; + }; + saradc: adc@30f0000 { compatible = "sophgo,cv1800b-saradc"; reg = <0x030f0000 0x1000>;
Signature · 1 line
2.43.0
PATCH v3 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 reviewRe: [PATCH v3 2/3] riscv: dts: sophgo: cv180x: Add PWR_GPIO controller
In reply to Chen-Yu YehThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] The newly added `gpio@5021000` node is inserted out of numerical order with respect to its…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The newly added gpio@5021000 node is inserted out of numerical order with respect to its unit-address. --
--- Patch [2]: [PATCH v3 2/3] riscv: dts: sophgo: cv180x: Add PWR_GPIO controller --- commit 141d632bdcf67218645f5def2ac6d6cba75ba5ef
Author: Chen-Yu Yeh <[email protected]>
riscv: dts: sophgo: cv180x: Add PWR_GPIO controller
This commit adds the PWR_GPIO controller node to the CV180x/CV181x device tree. The controller is an additional DesignWare APB GPIO controller located in the always-on power domain.
arch/riscv/boot/dts/sophgo/cv180x.dtsi portd: gpio-controller@0 { · line 163
Quoted 9 lines
arch/riscv/boot/dts/sophgo/cv180x.dtsi +1
-0@@ -160,6 +160,24 @@ portd: gpio-controller@0 { }; }; + gpio4: gpio@5021000 {
[Severity: Low]
This isn't a bug, but should this node be sorted by its unit address?
It appears that gpio@5021000 is placed right before adc@30f0000, which breaks the standard convention of sorting device tree nodes numerically by their unit address.
Quoted 2 lines
arch/riscv/boot/dts/sophgo/cv180x.dtsi +2
-0+ compatible = "snps,dw-apb-gpio"; + reg = <0x5021000 0x1000>;
[ ... ]
Quoted 3 lines
arch/riscv/boot/dts/sophgo/cv180x.dtsi +2
-0+ }; + saradc: adc@30f0000 {
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Low] Missing explicit pinctrl configuration for the status LED. - [Low] Device tree node ordering…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] Missing explicit pinctrl configuration for the status LED.
- [Low] Device tree node ordering violation for gpio4.
--
--- Patch [3]: [PATCH v3 3/3] riscv: dts: sophgo: Add Milk-V Duo 256M board support --- commit 40bbbb1b4ad92a0f96cf454940bcf6e5942c12cb
Author: Chen-Yu Yeh <[email protected]>
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 patch adds basic device tree support for the board, including UART, SD/MMC, USB host, and a status LED.
arch/riscv/boot/dts/sophgo/cv180x.dtsi portd: gpio-controller@0 { · line 165
Quoted 11 lines
arch/riscv/boot/dts/sophgo/cv180x.dtsi +3
-0@@ -160,6 +160,24 @@ portd: gpio-controller@0 { }; }; + gpio4: gpio@5021000 { + compatible = "snps,dw-apb-gpio"; + reg = <0x5021000 0x1000>;
[Severity: Low]
This isn't a bug, but are these device tree nodes ordered correctly?
The node gpio4: gpio@5021000 is placed immediately after gpio3: gpio@3023000 but before saradc: adc@30f0000. Device tree nodes within a bus or SoC node are typically sorted ascendingly by their unit-address. Since 0x5021000 is greater than 0x030f0000, this node appears to be structurally out of order.
Quoted 2 lines
arch/riscv/boot/dts/sophgo/cv180x.dtsi +2
-0+ #address-cells = <1>; + #size-cells = <0>;
[ ... ]
Quoted 6 lines
arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts new file +0
-0@@ -0,0 +1,121 @@
[ ... ]
arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts line 34
Quoted 6 lines
arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts new file +6
-0+ leds { + compatible = "gpio-leds"; + + led-0 { + gpios = <&porte 2 GPIO_ACTIVE_HIGH>; + color = <LED_COLOR_ID_BLUE>;
[Severity: Low]
Is it intentional to omit the explicit pinctrl configuration for the status LED?
Without a pinctrl-0 or pinctrl-names reference, the led-0 node relies entirely on the bootloader's default pinmux configuration to remain in GPIO mode. If the board is booted with firmware that does not pre-configure this pin, the LED functionality could fail.
Quoted 4 lines
arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts new file +4
-0+ function = LED_FUNCTION_STATUS; + linux,default-trigger = "heartbeat"; + }; + };
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
Re: [PATCH v3 1/3] dt-bindings: soc: sophgo: add Milk-V Duo 256M board
In reply to Chen-Yu Yehpw-bot: not-applicable
Inochi Amaoto
maintainerRe: [PATCH v3 2/3] riscv: dts: sophgo: cv180x: Add PWR_GPIO controller
In reply to Chen-Yu YehQuoted 31 lines · Chen-Yu Yeh
The CV180x/CV181x family has an additional DesignWare APB GPIO controller (
PWR_GPIO) located in the always-on power domain at0x5021000. Add the node so that boards can reference GPIOs in this bank, such as status LEDs.Signed-off-by Chen-Yu Yeh <[email protected]>---
The base address and interrupt number match the vendor SDK device tree (cv181x_base_riscv.dtsi: gpio@05021000, PLIC interrupt 70, i.e.SOC_PERIPHERAL_IRQ(54)). Verified on Milk-V Duo 256M hardware via the onboard status LED on porte 2.arch/riscv/boot/dts/sophgo/cv180x.dtsi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)arch/riscv/boot/dts/sophgo/cv180x.dtsi +8
-0@@ -160,6 +160,24 @@ portd: gpio-controller@0 { }; }; + 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";
arch/riscv/boot/dts/sophgo/cv180x.dtsi portd: gpio-controller@0 { · line 180
Quoted 10 lines
arch/riscv/boot/dts/sophgo/cv180x.dtsi +10
-0+ gpio-controller; + #gpio-cells = <2>; + ngpios = <32>; + reg = <0>; + interrupt-controller; + #interrupt-cells = <2>; + interrupts = <SOC_PERIPHERAL_IRQ(54) IRQ_TYPE_LEVEL_HIGH>; + }; + }; +
You should follow the device address order. not by the device name.
Quoted 6 lines
arch/riscv/boot/dts/sophgo/cv180x.dtsi +0
-0saradc: adc@30f0000 { compatible = "sophgo,cv1800b-saradc"; reg = <0x030f0000 0x1000>;Signature · 1 line
2.43.0
Re: [PATCH v3 2/3] riscv: dts: sophgo: cv180x: Add PWR_GPIO controller
Quoted 1 line
You should follow the device address order. not by the device name.
Right, I placed it next to the other GPIO nodes by type. Will move it to the correct position by unit address in v4.
Inochi Amaoto <[email protected]> 於 2026年7月13日週一 上午8:57寫道:
Quoted 52 lines · Chen-Yu Yeh
Quoted 31 lines
The CV180x/CV181x family has an additional DesignWare APB GPIO controller (
PWR_GPIO) located in the always-on power domain at0x5021000. Add the node so that boards can reference GPIOs in this bank, such as status LEDs.Signed-off-by Chen-Yu Yeh <[email protected]>---
The base address and interrupt number match the vendor SDK device tree (cv181x_base_riscv.dtsi: gpio@05021000, PLIC interrupt 70, i.e.SOC_PERIPHERAL_IRQ(54)). Verified on Milk-V Duo 256M hardware via the onboard status LED on porte 2.arch/riscv/boot/dts/sophgo/cv180x.dtsi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)arch/riscv/boot/dts/sophgo/cv180x.dtsi +8
-0@@ -160,6 +160,24 @@ portd: gpio-controller@0 { }; }; + 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";arch/riscv/boot/dts/sophgo/cv180x.dtsi portd: gpio-controller@0 { · line 180
Quoted 10 lines
arch/riscv/boot/dts/sophgo/cv180x.dtsi +10
-0+ gpio-controller; + #gpio-cells = <2>; + ngpios = <32>; + reg = <0>; + interrupt-controller; + #interrupt-cells = <2>; + interrupts = <SOC_PERIPHERAL_IRQ(54) IRQ_TYPE_LEVEL_HIGH>; + }; + }; +You should follow the device address order. not by the device name.
Quoted 6 lines
arch/riscv/boot/dts/sophgo/cv180x.dtsi +0
-1saradc: adc@30f0000 { compatible = "sophgo,cv1800b-saradc"; reg = <0x030f0000 0x1000>; --2.43.0