riscv: dts: sophgo: Milk-V Duo 256M ethernet support
Subsystems (3)
v2 cover riscv: dts: sophgo: Milk-V Duo 256M ethernet support
The Milk-V Duo 256M has no Ethernet connector of its own; the SG2002's internal PHY is only usable through the optional USB & Ethernet IO board. This series adds an overlay for that board and fixes the name of the internal PHY node it exposes.
Changes in v2:
- Enable Ethernet through an overlay instead of in the board devicetree, since without the IO board the pins may be used as GPIO (Inochi)
- Send both patches in one thread (Inochi)
- Test link-up and traffic on the IO board, which v1 could not
- Collect Inochi's Reviewed-by on the PHY node name fix
The overlay has the same shape as Hiago's for the Milk-V Duo [1], so the two boards stay consistent. The PHY node name fix is in cv180x.dtsi and so covers that board as well.
Testing, with a kernel built from this branch:
- sg2002-milkv-duo256m-eth.dtb: eth0 comes up at 100Mbps/Full, gets an address via DHCP and passes traffic
- sg2002-milkv-duo256m.dtb: no eth0 is created, and the gmac node reads back as disabled
Kernel log with sg2002-milkv-duo256m-eth.dtb:
[ 1.426499] stmmaceth 4070000.ethernet: User ID: 0x10, Synopsys ID: 0x37 [ 1.426536] stmmaceth 4070000.ethernet: DWMAC1000 [ 6.052829] stmmaceth 4070000.ethernet eth0: PHY [mdio_mux-0.0:01] driver [Generic PHY] (irq=POLL) [ 8.138131] stmmaceth 4070000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
# ip addr show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
inet 192.168.0.47/24 brd 192.168.0.255 scope global dynamic noprefixroute eth0With the base sg2002-milkv-duo256m.dtb:
# ip addr show eth0 ip: can't find device 'eth0' # cat /proc/device-tree/soc/ethernet@4070000/status disabled
iperf3 against a desktop on the same switch gives 94 Mbit/s with the board sending and 70-74 Mbit/s with it receiving, with no retransmissions either way. The receive side being slower is not a CPU limit on the board; I have not looked into it further yet.
v1: https://lore.kernel.org/sophgo/[email protected]/
https://lore.kernel.org/sophgo/[email protected]/
[1] https://lore.kernel.org/sophgo/[email protected]/
Chen-Yu Yeh (2):
riscv: dts: sophgo: add Milk-V Duo 256M ethernet support overlay
riscv: dts: sophgo: cv180x: Fix internal ephy node name
arch/riscv/boot/dts/sophgo/Makefile | 3 +++ arch/riscv/boot/dts/sophgo/cv180x.dtsi | 2 +- .../dts/sophgo/sg2002-milkv-duo256m-eth.dtso | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m-eth.dtso
Signature · 1 line
2.43.0
PATCH v2 1/2 riscv: dts: sophgo: add Milk-V Duo 256M ethernet support overlay
The SG2002 has an internal 10/100 Ethernet PHY, but on the Milk-V Duo 256M the Ethernet signals only reach the RJ45 connector on the optional USB & Ethernet IO board. The MAC (gmac0) and the MDIO multiplexer used to reach the internal PHY are already described in cv180x.dtsi but are disabled, and they cannot be enabled in the board devicetree because without the IO board the same pins may be used as GPIO.
Add an overlay that enables them.
Tested on Milk-V Duo 256M with the USB & Ethernet IO board: the link comes up at 100Mbps/Full, the interface gets an address via DHCP and passes traffic in both directions. Without the overlay, eth0 does not appear.
--- arch/riscv/boot/dts/sophgo/Makefile | 3 +++ .../dts/sophgo/sg2002-milkv-duo256m-eth.dtso | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m-eth.dtso
arch/riscv/boot/dts/sophgo/Makefile +3 -0
@@ -4,6 +4,9 @@ dtb-$(CONFIG_ARCH_SOPHGO) += cv1812h-huashan-pi.dtb dtb-$(CONFIG_ARCH_SOPHGO) += sg2000-milkv-duo-s.dtb dtb-$(CONFIG_ARCH_SOPHGO) += sg2002-licheerv-nano-b.dtb dtb-$(CONFIG_ARCH_SOPHGO) += sg2002-milkv-duo256m.dtb +sg2002-milkv-duo256m-eth-dtbs := sg2002-milkv-duo256m.dtb sg2002-milkv-duo256m-eth.dtbo +dtb-$(CONFIG_ARCH_SOPHGO) += sg2002-milkv-duo256m-eth.dtb +dtb-$(CONFIG_ARCH_SOPHGO) += sg2002-milkv-duo256m-eth.dtbo 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-eth.dtso new file +17 -0
@@ -0,0 +1,17 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Enable ethernet on Milk-V Duo 256M with the USB & Ethernet IO board. + * + * Copyright (c) 2026, Chen-Yu Yeh <[email protected]> + */ + +/dts-v1/; +/plugin/; + +&gmac0 { + status = "okay"; +}; + +&mdio { + status = "okay"; +};
Signature · 1 line
2.43.0
PATCH v2 2/2 riscv: dts: sophgo: cv180x: Fix internal ephy node name
In reply to Chen-Yu YehThe internal EPHY node is named "phy@0" while its reg property is <1>. The unit-address should match the first entry of the reg property, but this is not checked by dtc for MDIO buses. The kernel confirms the PHY is indeed at address 1:
eth0: PHY [mdio_mux-0.0:01] driver [Generic PHY]
Rename the node to ethernet-phy@1, which also follows the common naming convention for ethernet PHY nodes.
--- arch/riscv/boot/dts/sophgo/cv180x.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/boot/dts/sophgo/cv180x.dtsi +1 -1
@@ -71,7 +71,7 @@ internal_mdio: mdio@0 { #size-cells = <0>; reg = <0>; - internal_ephy: phy@0 { + internal_ephy: phy@1 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <1>; };
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH v2 2/2] riscv: dts: sophgo: cv180x: Fix internal ephy node name
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] dts: mismatch between commit message and actual node rename --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] dts: mismatch between commit message and actual node rename
--
commit ff7773f0965119de993db57ef5ec58df5146e727
Author: Chen-Yu Yeh <[email protected]>
riscv: dts: sophgo: cv180x: Fix internal ephy node name
This commit updates the internal EPHY node name in cv180x.dtsi to match its reg property. It aims to rename the node to follow the common ethernet PHY naming convention.
arch/riscv/boot/dts/sophgo/cv180x.dtsi internal_mdio: mdio@0 { · line 74
Quoted 10 lines
arch/riscv/boot/dts/sophgo/cv180x.dtsi +1
-1@@ -71,7 +71,7 @@ internal_mdio: mdio@0 { #size-cells = <0>; reg = <0>; - internal_ephy: phy@0 { + internal_ephy: phy@1 {
[Severity: Medium]
Does this node rename mismatch the commit message and skip generic Ethernet PHY schema validation?
The commit message states "Rename the node to ethernet-phy@1", but the code only changes the unit address from "phy@0" to "phy@1", omitting the "ethernet-" prefix. This mismatch causes the node to silently skip the standard validation in ethernet-phy.yaml, which expects the node name to match the pattern ^ethernet-phy(@[a-f0-9]+)?$.
Quoted 3 lines
arch/riscv/boot/dts/sophgo/cv180x.dtsi +0
-0compatible = "ethernet-phy-ieee802.3-c22"; reg = <1>; };
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Re: [PATCH v2 2/2] riscv: dts: sophgo: cv180x: Fix internal ephy node name
Quoted 3 lines · On Sat, Oct 03, 2026 at 08:51:17AM +0000, [email protected] wrote:
The commit message states "Rename the node to ethernet-phy@1", but the code only changes the unit address from "phy@0" to "phy@1", omitting the "ethernet-" prefix.
Right, the description and the change disagree, and ethernet-phy@1 is the intended name: it is the generic node name for an Ethernet PHY, and it also brings the node under ethernet-phy.yaml, which phy@1 skips.
I will rename it to ethernet-phy@1 in v3. The internal_ephy label is unchanged, so the phy-handle reference in gmac0 is unaffected.
Inochi: the only change to this patch is the node name, so I intend to keep your Reviewed-by for v3 -- let me know if you would rather look at it again.
Thanks,
Chen-Yu
Re: [PATCH v2 2/2] riscv: dts: sophgo: cv180x: Fix internal ephy node name
In reply to Chen-Yu YehHi Chen-Yu,
Quoted 11 lines · Chen-Yu Yeh
The internal EPHY node is named "phy@0" while its reg property is <1>. The unit-address should match the first entry of the reg property, but this is not checked by dtc for MDIO buses. The kernel confirms the PHY is indeed at address 1:
eth0: PHY [mdio_mux-0.0:01] driver [Generic PHY]
Rename the node to ethernet-phy@1, which also follows the common naming convention for ethernet PHY nodes.
Fixes ba1abacc57cb ("riscv: dts: sophgo: Add mdio multiplexer device for cv18xx")
My only comment here is that I belive you should remove the newline between "Fixes" and the "Reviewed-by".
Quoted 23 lines
Reviewed-by Inochi Amaoto <[email protected]>Signed-off-by Chen-Yu Yeh <[email protected]>--- arch/riscv/boot/dts/sophgo/cv180x.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/riscv/boot/dts/sophgo/cv180x.dtsi +1
-1@@ -71,7 +71,7 @@ internal_mdio: mdio@0 { #size-cells = <0>; reg = <0>; - internal_ephy: phy@0 { + internal_ephy: phy@1 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <1>; };Signature · 1 line
2.43.0
Best regards,
Signature · 1 line
Hiago
Quoted 47 lines · Chen-Yu Yeh
The Milk-V Duo 256M has no Ethernet connector of its own; the SG2002's internal PHY is only usable through the optional USB & Ethernet IO board. This series adds an overlay for that board and fixes the name of the internal PHY node it exposes.
Changes in v2:
- Enable Ethernet through an overlay instead of in the board devicetree, since without the IO board the pins may be used as GPIO (Inochi)
- Send both patches in one thread (Inochi)
- Test link-up and traffic on the IO board, which v1 could not
- Collect Inochi's Reviewed-by on the PHY node name fixThe overlay has the same shape as Hiago's for the Milk-V Duo [1], so the two boards stay consistent. The PHY node name fix is in
cv180x.dtsiand so covers that board as well.Testing, with a kernel built from this branch:
- sg2002-milkv-duo256m-eth.dtb: eth0 comes up at 100Mbps/Full, gets an address via DHCP and passes traffic
- sg2002-milkv-duo256m.dtb: no eth0 is created, and the gmac node reads back as disabledKernel log with sg2002-milkv-duo256m-eth.dtb:
[ 1.426499] stmmaceth 4070000.ethernet: User ID: 0x10, Synopsys ID: 0x37 [ 1.426536] stmmaceth 4070000.ethernet: DWMAC1000 [ 6.052829] stmmaceth 4070000.ethernet eth0: PHY [mdio_mux-0.0:01] driver [Generic PHY] (irq=POLL) [ 8.138131] stmmaceth 4070000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx# ip addr show eth0 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000 inet 192.168.0.47/24 brd 192.168.0.255 scope global dynamic noprefixroute eth0With the base sg2002-milkv-duo256m.dtb:
# ip addr show eth0 ip: can't find device 'eth0' # cat /proc/device-tree/soc/ethernet@4070000/status disablediperf3 against a desktop on the same switch gives 94 Mbit/s with the board sending and 70-74 Mbit/s with it receiving, with no retransmissions either way. The receive side being slower is not a CPU limit on the board; I have not looked into it further yet.
Quoted 4 lines
v1: https://lore.kernel.org/sophgo/[email protected]/
https://lore.kernel.org/sophgo/[email protected]/
for the series,
Quoted 5 lines
Chen-Yu Yeh (2):
riscv: dts: sophgo: add Milk-V Duo 256M ethernet support overlay
riscv: dts: sophgo: cv180x: Fix internal ephy node name
Quoted 9 lines
arch/riscv/boot/dts/sophgo/Makefile | 3 +++ arch/riscv/boot/dts/sophgo/cv180x.dtsi | 2 +- .../dts/sophgo/sg2002-milkv-duo256m-eth.dtso | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m-eth.dtsoSignature · 1 line
2.43.0
Best regards,
Signature · 1 line
Hiago