Re: [PATCH 5/5] arm64: dts: allwinner: sun60i-a733-orangepi-4-pro: Enable GMAC0 Ethernet
From: Alastair D'Silva
Date: Wed Nov 25 2026 - 16:13:50 EST
Hi Andrew,
Thank you for the review on this series (and for the nitpick on patch 3,
which I will fix in v2).
On Wed, Nov 25, 2026 at 06:30:24PM +0100, Andrew Lunn wrote:
> https://elixir.bootlin.com/linux/v6.15/source/Documentation/devicetree/bindings/net/ethernet-controller.yaml#L287
>
> phy-mode describes the PCB. If the PCB has no delays, rgmii-id should
> be used.
>
> The MAC/PHY pair need to decide which of the two add the delays. This
> is not decided by phy-mode.
>
> 3780 ps is also huge, much greater than the 2ns required by the
> standard. It suggests something else is going on, maybe a clock is
> inverted? Please investigate.
Your suspicion about an inverted RX clock was spot-on.
Checking Allwinner's BSP glue header, BIT(4) of the GMAC210 glue
register (0x04508000) is ERXIE (RX clock invert, ~4 ns / 180 degrees
at 125 MHz) and BIT(3) is ETXIE (TX clock invert). Testing on the
Orange Pi 4 Pro confirmed:
- With phy-mode = "rgmii" (0 PHY delays) and ERXIE = 0, RX works
across ERXDC = 12..24 (2160..4320 ps, where 3780 ps sat).
- With phy-mode = "rgmii" and ERXIE = 1, RX works at ERXDC = 0..6
(0..1080 ps), confirming the ~4 ns RX clock inversion.
- With phy-mode = "rgmii-id" (YT8531 PHY adding ~1950 ps TX and RX):
- TX works with 0 ps MAC delay (tx-internal-delay-ps omitted).
- RX with ERXIE = 0 works across ERXDC = 8..16 (1440..2880 ps,
centered at 2160 ps), giving 936 Mbits/sec TCP RX and 723 Mbits/sec
TCP TX in iperf3.
- RX with ERXIE = 1 fails across ERXDC = 0..24 because 4 ns (ERXIE)
+ 1.95 ns (PHY) overshoots the valid window.
For v2, I will switch the board DTS to phy-mode = "rgmii-id" and drop
tx-internal-delay-ps so the YT8531 PHY provides the standard ~2 ns
delays, while keeping ERXIE = 0 and setting rx-internal-delay-ps = <2160>
to compensate for the RX clock phase (matching existing dwmac-sun55i
boards).
Thanks,
Alastair