Skip to contentSkip to conversation

riscv: dts: sophgo: Enable ethernet for Milk-V Duo 256M

PATCH Superseded Chen-Yu Yeh 2 participants 3 messages Aug 3 – Aug 28

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 riscv: dts: sophgo: Enable ethernet for Milk-V Duo 256M

The SG2002 has an internal ethernet PHY, but on the Milk-V Duo 256M the ethernet signals are only routed to the RJ45 connector of the optional IO board.

Enable the GMAC and the MDIO multiplexer so that the interface is usable when such a board is attached.

Tested on actual Milk-V Duo 256M hardware: the GMAC probes, the MDIO multiplexer selects the internal bus and the internal EPHY is detected at address 1:

eth0: PHY [mdio_mux-0.0:01] driver [Generic PHY]

Link-up was not verified for lack of the IO board.

---
 arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts +8 -0
index a2797c0bd767..1462a96a1c12 100644
@@ -49,6 +49,14 @@ coprocessor_rtos: region@8fe00000 {
 	};
 };
 
+&gmac0 {
+	status = "okay";
+};
+
+&mdio {
+	status = "okay";
+};
+
 &osc {
 	clock-frequency = <25000000>;
 };

base-commit: 11881041b745b444e4f6c87a2748f1951cf02742

Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 7 lines · Chen-Yu Yeh

The SG2002 has an internal ethernet PHY, but on the Milk-V Duo 256M the ethernet signals are only routed to the RJ45 connector of the optional IO board.

Enable the GMAC and the MDIO multiplexer so that the interface is usable when such a board is attached.

Quoted 9 lines

Tested on actual Milk-V Duo 256M hardware: the GMAC probes, the MDIO multiplexer selects the internal bus and the internal EPHY is detected at address 1:

eth0: PHY [mdio_mux-0.0:01] driver [Generic PHY]

Link-up was not verified for lack of the IO board.

This is not acceptable, I agree with something like DT overlay for support external IO board to enable this. But you should not enable this by default. As other may want to use this as GPIO.

Regards,
Inochi

Quoted 29 lines
---
 arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts +8 -0
index a2797c0bd767..1462a96a1c12 100644
@@ -49,6 +49,14 @@ coprocessor_rtos: region@8fe00000 {
 	};
 };
 
+&gmac0 {
+	status = "okay";
+};
+
+&mdio {
+	status = "okay";
+};
+
 &osc {
 	clock-frequency = <25000000>;
 };

base-commit: 11881041b745b444e4f6c87a2748f1951cf02742

Signature · 1 line
2.43.0
author
#2 lore raw
Quoted 3 lines · Inochi Amaoto

This is not acceptable, I agree with something like DT overlay for support external IO board to enable this. But you should not enable this by default. As other may want to use this as GPIO.

You are right, and I should have caught this myself -- the signals only go to the RJ45 on the optional IO board, so enabling them in the board DTS takes the pins away from anyone who wants them as GPIO. Thanks for stopping it.

I will rework this as a DT overlay for v2: the board DTS keeps the GMAC and MDIO mux disabled, and a separate .dtso enables them for the USB & Ethernet IO board [1].

One thing before I send it: I do not have the IO board yet, which is why v1 said link-up was unverified. I have ordered one, so v2 will come with an actual link-up and iperf3 result rather than just "the PHY is detected". I would rather send it tested than send it soon.

[1] https://milkv.io/docs/duo/io-board/usb-ethernet-iob

Chen-Yu

Inochi Amaoto <[email protected]> 於 2026年8月22日週六 上午10:13寫道:

Quoted 55 lines · Chen-Yu Yeh
Quoted 7 lines

The SG2002 has an internal ethernet PHY, but on the Milk-V Duo 256M the ethernet signals are only routed to the RJ45 connector of the optional IO board.

Enable the GMAC and the MDIO multiplexer so that the interface is usable when such a board is attached.

Quoted 9 lines

Tested on actual Milk-V Duo 256M hardware: the GMAC probes, the MDIO multiplexer selects the internal bus and the internal EPHY is detected at address 1:

eth0: PHY [mdio_mux-0.0:01] driver [Generic PHY]

Link-up was not verified for lack of the IO board.

This is not acceptable, I agree with something like DT overlay for support external IO board to enable this. But you should not enable this by default. As other may want to use this as GPIO.

Regards,
Inochi

Quoted 29 lines
---
 arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/riscv/boot/dts/sophgo/sg2002-milkv-duo256m.dts +8 -0
index a2797c0bd767..1462a96a1c12 100644
@@ -49,6 +49,14 @@ coprocessor_rtos: region@8fe00000 {
      };
 };
 
+&gmac0 {
+     status = "okay";
+};
+
+&mdio {
+     status = "okay";
+};
+
 &osc {
      clock-frequency = <25000000>;
 };

base-commit: 11881041b745b444e4f6c87a2748f1951cf02742 --
2.43.0