Skip to contentSkip to conversation

riscv: dts: sophgo: Milk-V Duo 256M ethernet support

PATCH Applied Chen-Yu Yeh 3 participants 5 messages Oct 5 – Nov 1

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 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 v3:
- Rename the PHY node to ethernet-phy@1, as the commit message already said; v2 only changed the unit address (sashiko-bot). dtbs_check now validates the node against ethernet-phy.yaml, with no new warnings.
- Drop the blank line in the trailer block of 2/2 (Hiago)
- Collect Hiago's Reviewed-by
- Keep Inochi's Reviewed-by on 2/2, since the only change is the node name

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 eth0

With 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]/

v2: 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
#1 lore raw

PATCH v3 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
index d5c80d4ff005..49639cb0888b 100644
@@ -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
new file mode 100644
index 000000000000..cc93746d932c
@@ -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
#2 lore raw

PATCH v3 2/2 riscv: dts: sophgo: cv180x: Fix internal ephy node name

In reply to 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")
---
 arch/riscv/boot/dts/sophgo/cv180x.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/boot/dts/sophgo/cv180x.dtsi +1 -1
index ec3bf305274a..d2ec70fd515e 100644
@@ -71,7 +71,7 @@ internal_mdio: mdio@0 {
 				#size-cells = <0>;
 				reg = <0>;
 
-				internal_ephy: phy@0 {
+				internal_ephy: ethernet-phy@1 {
 					compatible = "ethernet-phy-ieee802.3-c22";
 					reg = <1>;
 				};
Signature · 1 line
2.43.0
maintainer Applied
#3 lore raw
In reply to Chen-Yu Yeh
Quoted 14 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 v3:
- Rename the PHY node to ethernet-phy@1, as the commit message already said; v2 only changed the unit address (sashiko-bot). dtbs_check now validates the node against ethernet-phy.yaml, with no new warnings.
- Drop the blank line in the trailer block of 2/2 (Hiago)
- Collect Hiago's Reviewed-by
- Keep Inochi's Reviewed-by on 2/2, since the only change is the node name

Quoted 1 line

[...]

Applied to for-next, thanks!

[1/2] riscv: dts: sophgo: add Milk-V Duo 256M ethernet support overlay

      https://github.com/sophgo/linux/commit/627e4e43e555ba252f93784eafff74ed82234c63
[2/2] riscv: dts: sophgo: cv180x: Fix internal ephy node name
      https://github.com/sophgo/linux/commit/673f8e66d5edf424eaf599c8051e0f6962605861

Thanks,
Inochi

#4 lore raw
In reply to Chen-Yu Yeh
This series was applied to riscv/linux.git (fixes) by Inochi Amaoto <[email protected]>:

Hello:

This series was applied to riscv/linux.git (fixes) by Inochi Amaoto <[email protected]>:

Quoted 14 lines · On Mon, 5 Oct 2026 17:37:47 +0800 you wrote:

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 v3:
- Rename the PHY node to ethernet-phy@1, as the commit message already said; v2 only changed the unit address (sashiko-bot). dtbs_check now validates the node against ethernet-phy.yaml, with no new warnings.
- Drop the blank line in the trailer block of 2/2 (Hiago)
- Collect Hiago's Reviewed-by
- Keep Inochi's Reviewed-by on 2/2, since the only change is the node name

Quoted 1 line

[...]

Here is the summary with links:
- [v3,1/2] riscv: dts: sophgo: add Milk-V Duo 256M ethernet support overlay

    https://git.kernel.org/riscv/c/627e4e43e555
  - [v3,2/2] riscv: dts: sophgo: cv180x: Fix internal ephy node name
    https://git.kernel.org/riscv/c/673f8e66d5ed

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html