Solved support for rgmii-id

I've noticed that fdt definitions for network phy's are moving to phy-mode="rgmii-id" instead of using tx/rx delays generated by the MAC.
A quick scan in /usr/src/sys/contrib/device-tree show almost 300 dts files that mention rgmii-id
But there is not much support for rgmii-id in the phy drivers.

Even worse, the aw_if_dwc driver breaks with non accurate error when confronted with rgmii-id defined phy-interface:
dwc0: Can't reset DWC.
What actually happens - it falls back to mii mode and then fails the reset.

This patch will - at least - connect in rgmii mode.
But you are still left with a disfunctional dwc - hardly good enough to satisfy dhcpclient - extreme packet loss.
--- sys/arm/allwinner/    2022-06-10 10:37:03.613795000 +0000
+++ sys/arm/allwinner/aw_if_dwc.c    2022-06-09 09:47:44.000000000 +0000
@@ -79,7 +79,7 @@
             return (error);
-        if (strcmp(phy_type, "rgmii") == 0)
+        if (strncmp(phy_type, "rgmii", 5) == 0)
             tx_parent_name = "gmac_int_tx";
             tx_parent_name = "mii_phy_tx";

I think real rgmii-id support is needed in the dev/mii driver files.
As it is now it seems that at least the following boards (Allwinner A20) will have a a broken network interface when using their u-boot-master() from ports:
Others might also be affected.

For those interested, I managed to get a working setup on a pcduino3-nano with current u-boot (2022-04) using the attached patch.


  • mii-rgmii-id.patch.txt
    8.2 KB · Views: 25
BananaPi-M1 is fine over here..
U-boot is troublesome for it.
Also my Hummingboards use Mii-RG on iMX6. I think its Atheros AR8035
Both Hummingboard and Hummingboard2 use it.
BananaPi-M1 is fine over here..
U-boot is troublesome for it.
For bananapi the dts changed from rgmii to rgmii-id on Nov 2, 2020 in the linux source tree.
Have not checked specifically for M1 though.
u-boot, which follows linux, probably picked up that change last year.
Point I'm trying to make:

If you install a current u-boot chances are you will loose network connection.
This is due to the current drivers not supporting this mode, AFAIKS.

Because, if phymode is not exactly "rgmii" (strcmp) it uses the wrong clock.
Anyway, whether it actually fails is board dependent.
bananpi might have the wiring to really run in mii mode.
I really don't know much about any of this. It is just terminology I have seen by in code.
There is a hack for BananaPi so things are not right on the FreeBSD 12.x images. So I went GenericSD image.