.../bindings/net/allwinner,sun8i-a83t-emac.yaml | 142 ++++++++++++++-- drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c | 184 +++++++++++++++++---- 2 files changed, 276 insertions(+), 50 deletions(-)
The A733 GMAC210 is a DesignWare MAC 5.20 with an Allwinner glue close to
the A523 GMAC200 already supported by dwmac-sun55i, but with a few
significant differences:
* The glue configuration registers are a dedicated MMIO region of the
controller instead of a syscon register.
* That region is in the AHB reset domain, so the AHB reset must be
released before the configuration is written. The configuration
is sampled by the dwmac when the other reset is deasserted.
* The DMA channels have their own interrupt lines.
* A PTP reference clock and an AHB reset are needed.
* The controllers do not require a power domain (AFAIK).
* The TX clock delay value is 5 bits wide instead of 3, split over 2
register fields, and both TX and RX delays use a 180ps step.
The DT changes for the A733 and the Cubie A7A board are not part of this
series and will be sent separately through the sunxi tree.
Tested on a Cubie A7A, RGMII with a MAXIO external PHY on GMAC0.
Problems found while testing (none impacting this driver directly):
* Unstable EEE/LPI: If the device stays in LPI mode long enough, the
link sometimes (but not always) goes down, coming back up when the
device exits LPI mode. This is apparently due to the PHY; the vendor
driver disables this feature. The solution is to use genphy with the
eee-broken-* DT properties or wait for the upcoming mainline driver:
https://lore.kernel.org/all/MN0PR19MB609154F210DF84DCB29D3696ACC62@MN0PR19MB6091.namprd19.prod.outlook.com
* Tx-delay: The vendor kernel ships with a Tx delay of 2.16ns. It may seem
to work at first but breaks under heavy load. The vendor kernel is
configured for an external RGMII clock, which cannot work on the A7A:
the 125MHz input and 25MHz reference output are not wired to the PHY.
It was most likely not tested on this board. A 1.62ns Tx delay works
well.
DT example is available here (gated on CCU and pinctrl mainline support
currently):
https://github.com/jbrun3t/linux/commit/aa6f3a5ce4cd6e09ff9be1828915bfe8e87c57df
Maxime, I've tried adding a new init callback as you suggested but it
did not work out. The config needs to be written before the 'stmmaceth'
reset is deasserted to be properly sampled, but it can only be written
once the 'ahb' reset is deasserted. A new callback would not help.
However, tweaking the stmmac platform data as I did in v2 is not
necessary since the reset is shared. I've corrected that.
Changes in v3:
- Split the driver changes into preparatory patches and the A733 addition
- Use a 180ps TX and RX delay step on the A733, allowing up to 5580ps
- Release the shared AHB reset before writing the glue registers instead of
taking over the stmmaceth reset from the stmmac core
- Link to v2: https://patch.msgid.link/20260910-allwinner-a733-gmac-support-v2-0-4f4a1e520c23@baylibre.com
Changes in v2:
- No driver change since RFC, just more tests.
- Rebase on net-next/main - proper prefix added
- Link to v1: https://patch.msgid.link/20260731-allwinner-a733-gmac-support-v1-0-d0a8732bfa82@baylibre.com
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
Jerome Brunet (5):
dt-bindings: net: sun8i-emac: Add A733 GMAC210 compatible
net: stmmac: sun55i: Add per-compatible match data
net: stmmac: sun55i: Make the delay step configurable
net: stmmac: sun55i: Support TX delay extension bits
net: stmmac: sun55i: Add support for Allwinner A733 GMAC210
.../bindings/net/allwinner,sun8i-a83t-emac.yaml | 142 ++++++++++++++--
drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c | 184 +++++++++++++++++----
2 files changed, 276 insertions(+), 50 deletions(-)
---
base-commit: 944ae66642b726bd6b25ae71b1e9ff88a0e0bdb0
change-id: 20260731-allwinner-a733-gmac-support-163bde10c152
Best regards,
--
Jerome
> * Tx-delay: The vendor kernel ships with a Tx delay of 2.16ns. It may seem
> to work at first but breaks under heavy load. The vendor kernel is
> configured for an external RGMII clock, which cannot work on the A7A:
> the 125MHz input and 25MHz reference output are not wired to the PHY.
> It was most likely not tested on this board. A 1.62ns Tx delay works
> well.
>
> DT example is available here (gated on CCU and pinctrl mainline support
> currently):
> https://github.com/jbrun3t/linux/commit/aa6f3a5ce4cd6e09ff9be1828915bfe8e87c57df
&gmac0 {
phy-mode = "rgmii-id";
phy-handle = <&ext_rgmii0_phy>;
phy-supply = <®_swout1>;
pinctrl-names = "default";
pinctrl-0 = <&gmac0_pins>;
tx-internal-delay-ps = <1620>;
rx-internal-delay-ps = <1800>;
Something does not seem correct here. rgmii-id means the PHY is adding
2ns of delay. The MAC is adding an additional 1.6 to 1.8 ns. The total
is way too big when the standard says 2ns.
Is the PHY adding 2ns?
Andrew
> * Unstable EEE/LPI: If the device stays in LPI mode long enough, the
> link sometimes (but not always) goes down, coming back up when the
> device exits LPI mode. This is apparently due to the PHY; the vendor
> driver disables this feature. The solution is to use genphy with the
> eee-broken-* DT properties or wait for the upcoming mainline driver:
> https://lore.kernel.org/all/MN0PR19MB609154F210DF84DCB29D3696ACC62@MN0PR19MB6091.namprd19.prod.outlook.com
Looking at this code, it totally ignores the interface mode. So you
have no idea what RGMII delays it is adding. When this driver gets
fixed before being merged, your DT fragment will likely break.
Andrew
On jeu. 24 sept. 2026 at 00:19, Andrew Lunn <andrew@lunn.ch> wrote: >> * Unstable EEE/LPI: If the device stays in LPI mode long enough, the >> link sometimes (but not always) goes down, coming back up when the >> device exits LPI mode. This is apparently due to the PHY; the vendor >> driver disables this feature. The solution is to use genphy with the >> eee-broken-* DT properties or wait for the upcoming mainline driver: >> https://lore.kernel.org/all/MN0PR19MB609154F210DF84DCB29D3696ACC62@MN0PR19MB6091.namprd19.prod.outlook.com > > Looking at this code, it totally ignores the interface mode. So you > have no idea what RGMII delays it is adding. When this driver gets > fixed before being merged, your DT fragment will likely break. Thanks for pointing this out Andrew. I've changed the phy-mode to plain rgmii which seems more in line with what the PHY actually does. > > Andrew -- Jerome
> I've changed the phy-mode to plain rgmii which seems more in line with
> what the PHY actually does.
No, it is much messier than that.
https://elixir.bootlin.com/linux/v6.15/source/Documentation/devicetree/bindings/net/ethernet-controller.yaml#L287
rgmii-id is very likely to be correct, if you were using a sane PHY.
But this PHY is going to cause you lots of problems.
Andrew
© 2016 - 2026 Red Hat, Inc.