Skip to contentSkip to conversation

net: stmmac: Add support for Allwinner A523 GMAC200

PATCH In review Chen-Yu Tsai 4 participants 11 messages Sep 25, 2025 – Oct 1, 2025

Subsystems (6)
lore
Share & tools
lore

Chen-Yu Tsai

author maintainer
#0 lore raw

v8 cover net: stmmac: Add support for Allwinner A523 GMAC200

From: Chen-Yu Tsai <[email protected]>

Hi everyone,

This is v8 of my Allwinner A523 GMAC200 support series. This is based on next-20250925.

This version only contains the DT binding and driver patches. The device tree patches are basically the same as the previous version.

Changes since v7:
- Rebased onto next-20250925
- Split out only the patches for net-next
- Link to v7
https://lore.kernel.org/all/[email protected]/

Changes since v6:
- Collected acks for DT binding patch
- Rebased onto next-20250922
- Link to v6
https://lore.kernel.org/all/[email protected]/

Changes since v5:
- Use plat->phy_interface instead of plat->mac_interface (Russell)
- Link to v5
https://lore.kernel.org/all/[email protected]/

Changes since v4:
- Moved clock-names list to main schema in DT binding (Rob)
- Dropped 4 patches that are already merged
- Link to v4
https://lore.kernel.org/all/[email protected]/

Changes since v3:
- driver
- Fixed printf format specifier warning
- Link to v3
https://lore.kernel.org/all/[email protected]/

Changes since v2:
- DT binding
- Added "select" to avoid matching against all dwmac entries
- driver
- Include "ps" unit in "... must be multiple of ..." error message
- Use FIELD_FIT to check if delay value is in range and FIELD_MAX to get the maximum value
- Reword error message for delay value exceeding maximum
- Drop MASK_TO_VAL
- Link to v2:
https://lore.kernel.org/all/[email protected]/

Changes since v1:
- Dropped RFT tag
- Switched to generic (tx|rx)-internal-delay-ps
- dwmac-sun55i driver bits
- Changed dev_err() + return to dev_err_probe()
- Added check of return value from syscon regmap write
- Changed driver name to match file name
- sram driver bits
- Fixed check on return value
- Expanded commit message
- dtsi
- Fixed typo in tx-queues-config
- cubie a5e
- Add PHY regulator delay
- Link to v1:
https://lore.kernel.org/all/[email protected]/

This series adds support for the second Ethernet controller found on the Allwinner A523 SoC family. This controller, dubbed GMAC200, is a DWMAC4 core with an integration layer around it. The integration layer is similar to older Allwinner generations, but with an extra memory bus gate and separate power domain.

Patch 1 adds a new compatible string combo to the existing Allwinner EMAC binding.

Patch 2 adds a new driver for this core and integration combo.

Thanks
ChenYu

Chen-Yu Tsai (2):
dt-bindings: net: sun8i-emac: Add A523 GMAC200 compatible
net: stmmac: Add support for Allwinner A523 GMAC200

 .../net/allwinner,sun8i-a83t-emac.yaml        |  95 ++++++++++-
 drivers/net/ethernet/stmicro/stmmac/Kconfig   |  12 ++
 drivers/net/ethernet/stmicro/stmmac/Makefile  |   1 +
 .../ethernet/stmicro/stmmac/dwmac-sun55i.c    | 159 ++++++++++++++++++
 4 files changed, 265 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c
Signature · 1 line
2.47.3
author maintainer
#1 lore raw

PATCH v8 1/2 dt-bindings: net: sun8i-emac: Add A523 GMAC200 compatible

From: Chen-Yu Tsai <[email protected]>

The Allwinner A523 SoC family has a second Ethernet controller, called the GMAC200 in the BSP and T527 datasheet, and referred to as GMAC1 for numbering. This controller, according to BSP sources, is fully compatible with a slightly newer version of the Synopsys DWMAC core. The glue layer around the controller is the same as found around older DWMAC cores on Allwinner SoCs. The only slight difference is that since this is the second controller on the SoC, the register for the clock delay controls is at a different offset. Last, the integration includes a dedicated clock gate for the memory bus and the whole thing is put in a separately controllable power domain.

Add a compatible string entry for it, and work in the requirements for a second clock and a power domain.

---
Changes since v4:
- Move clock-names list to main schema (Rob) Changes since v2:
- Added "select" to avoid matching against all dwmac entries Changes since v1:
- Switch to generic (tx|rx)-internal-delay-ps properties

---
 .../net/allwinner,sun8i-a83t-emac.yaml        | 95 ++++++++++++++++++-
 1 file changed, 93 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml +93 -2
index 2ac709a4c472..fc62fb2a68ac 100644
@@ -10,6 +10,21 @@ maintainers:
   - Chen-Yu Tsai <[email protected]>
   - Maxime Ripard <[email protected]>
 
+# We need a select here so we don't match all nodes with 'snps,dwmac'
+select:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - allwinner,sun8i-a83t-emac
+          - allwinner,sun8i-h3-emac
+          - allwinner,sun8i-r40-gmac
+          - allwinner,sun8i-v3s-emac
+          - allwinner,sun50i-a64-emac
+          - allwinner,sun55i-a523-gmac200
+  required:
+    - compatible
+
 properties:
   compatible:
     oneOf:
@@ -26,6 +41,9 @@ properties:
               - allwinner,sun50i-h616-emac0
               - allwinner,sun55i-a523-gmac0
           - const: allwinner,sun50i-a64-emac
+      - items:
+          - const: allwinner,sun55i-a523-gmac200
+          - const: snps,dwmac-4.20a
 
   reg:
     maxItems: 1
@@ -37,14 +55,21 @@ properties:
     const: macirq
 
   clocks:
-    maxItems: 1
+    minItems: 1
+    maxItems: 2
 
   clock-names:
-    const: stmmaceth
+    minItems: 1
+    items:
+      - const: stmmaceth
+      - const: mbus
 
   phy-supply:
     description: PHY regulator
 
+  power-domains:
+    maxItems: 1
+
   syscon:
     $ref: /schemas/types.yaml#/definitions/phandle
     description:
@@ -191,6 +216,42 @@ allOf:
             - mdio-parent-bus
             - mdio@1
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: allwinner,sun55i-a523-gmac200
+    then:
+      properties:
+        clocks:
+          minItems: 2
+        clock-names:
+          minItems: 2
+        tx-internal-delay-ps:
+          default: 0
+          minimum: 0
+          maximum: 700
+          multipleOf: 100
+          description:
+            External RGMII PHY TX clock delay chain value in ps.
+        rx-internal-delay-ps:
+          default: 0
+          minimum: 0
+          maximum: 3100
+          multipleOf: 100
+          description:
+            External RGMII PHY TX clock delay chain value in ps.
+      required:
+        - power-domains
+    else:
+      properties:
+        clocks:
+          maxItems: 1
+        clock-names:
+          maxItems: 1
+        power-domains: false
+
+
 unevaluatedProperties: false
 
 examples:
@@ -323,4 +384,34 @@ examples:
         };
     };
 
+  - |
+    ethernet@4510000 {
+        compatible = "allwinner,sun55i-a523-gmac200",
+                     "snps,dwmac-4.20a";
+        reg = <0x04510000 0x10000>;
+        clocks = <&ccu 117>, <&ccu 79>;
+        clock-names = "stmmaceth", "mbus";
+        resets = <&ccu 43>;
+        reset-names = "stmmaceth";
+        interrupts = <0 47 4>;
+        interrupt-names = "macirq";
+        pinctrl-names = "default";
+        pinctrl-0 = <&rgmii1_pins>;
+        power-domains = <&pck600 4>;
+        syscon = <&syscon>;
+        phy-handle = <&ext_rgmii_phy_1>;
+        phy-mode = "rgmii-id";
+        snps,fixed-burst;
+        snps,axi-config = <&gmac1_stmmac_axi_setup>;
+
+        mdio {
+            compatible = "snps,dwmac-mdio";
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            ext_rgmii_phy_1: ethernet-phy@1 {
+                reg = <1>;
+            };
+        };
+    };
 ...
Signature · 1 line
2.47.3
author maintainer
#2 lore raw

PATCH v8 2/2 net: stmmac: Add support for Allwinner A523 GMAC200

In reply to Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

The Allwinner A523 SoC family has a second Ethernet controller, called the GMAC200 in the BSP and T527 datasheet, and referred to as GMAC1 for numbering. This controller, according to BSP sources, is fully compatible with a slightly newer version of the Synopsys DWMAC core. The glue layer around the controller is the same as found around older DWMAC cores on Allwinner SoCs. The only slight difference is that since this is the second controller on the SoC, the register for the clock delay controls is at a different offset. Last, the integration includes a dedicated clock gate for the memory bus and the whole thing is put in a separately controllable power domain.

Add a new driver for this hardware supporting the integration layer.

---
Changes since v5:
- Use plat->phy_interface instead of plat->mac_interface (Russell)

Changes since v3:
- Fixed printf format specifier warning

Changes since v2 (all suggested by Russell King):
- Include "ps" unit in "... must be multiple of ..." error message
- Use FIELD_FIT to check if delay value is in range and FIELD_MAX to get the maximum value
- Reword error message for delay value exceeding maximum
- Drop MASK_TO_VAL

Changes since v1:
- Switch to generic (tx|rx)-internal-delay-ps properties
- Change dev_err() + return to dev_err_probe()
- Check return value from syscon regmap write
- Change driver name to match file name

---
 drivers/net/ethernet/stmicro/stmmac/Kconfig   |  12 ++
 drivers/net/ethernet/stmicro/stmmac/Makefile  |   1 +
 .../ethernet/stmicro/stmmac/dwmac-sun55i.c    | 159 ++++++++++++++++++
 3 files changed, 172 insertions(+)
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c
drivers/net/ethernet/stmicro/stmmac/Kconfig +12 -0
index 91d9a14362bf..9507131875b2 100644
@@ -265,6 +265,18 @@ config DWMAC_SUN8I
 	  stmmac device driver. This driver is used for H3/A83T/A64
 	  EMAC ethernet controller.
 
+config DWMAC_SUN55I
+	tristate "Allwinner sun55i GMAC200 support"
+	default ARCH_SUNXI
+	depends on OF && (ARCH_SUNXI || COMPILE_TEST)
+	select MDIO_BUS_MUX
+	help
+	  Support for Allwinner A523/T527 GMAC200 ethernet controllers.
+
+	  This selects Allwinner SoC glue layer support for the
+	  stmmac device driver. This driver is used for A523/T527
+	  GMAC200 ethernet controller.
+
 config DWMAC_THEAD
 	tristate "T-HEAD dwmac support"
 	depends on OF && (ARCH_THEAD || COMPILE_TEST)
drivers/net/ethernet/stmicro/stmmac/Makefile +1 -0
index b591d93f8503..51e068e26ce4 100644
@@ -31,6 +31,7 @@ obj-$(CONFIG_DWMAC_STI)		+= dwmac-sti.o
 obj-$(CONFIG_DWMAC_STM32)	+= dwmac-stm32.o
 obj-$(CONFIG_DWMAC_SUNXI)	+= dwmac-sunxi.o
 obj-$(CONFIG_DWMAC_SUN8I)	+= dwmac-sun8i.o
+obj-$(CONFIG_DWMAC_SUN55I)	+= dwmac-sun55i.o
 obj-$(CONFIG_DWMAC_THEAD)	+= dwmac-thead.o
 obj-$(CONFIG_DWMAC_DWC_QOS_ETH)	+= dwmac-dwc-qos-eth.o
 obj-$(CONFIG_DWMAC_INTEL_PLAT)	+= dwmac-intel-plat.o
drivers/net/ethernet/stmicro/stmmac/dwmac-sun55i.c new file +159 -0

159 lines not on this page · raw message

Signature · 1 line
2.47.3
maintainer
#3 lore raw
Quoted 10 lines · On Fri, 26 Sep 2025 03:15:59 +0800 Chen-Yu Tsai wrote:

The Allwinner A523 SoC family has a second Ethernet controller, called the GMAC200 in the BSP and T527 datasheet, and referred to as GMAC1 for numbering. This controller, according to BSP sources, is fully compatible with a slightly newer version of the Synopsys DWMAC core. The glue layer around the controller is the same as found around older DWMAC cores on Allwinner SoCs. The only slight difference is that since this is the second controller on the SoC, the register for the clock delay controls is at a different offset. Last, the integration includes a dedicated clock gate for the memory bus and the whole thing is put in a separately controllable power domain.

Hi Andrew, does this look good ?

thread: https://lore.kernel.org/[email protected]

maintainer
#4 lore raw
Quoted 12 lines · On Mon, 29 Sep 2025 18:08:04 -0700 Jakub Kicinski wrote:
Quoted 10 lines · On Fri, 26 Sep 2025 03:15:59 +0800 Chen-Yu Tsai wrote:

The Allwinner A523 SoC family has a second Ethernet controller, called the GMAC200 in the BSP and T527 datasheet, and referred to as GMAC1 for numbering. This controller, according to BSP sources, is fully compatible with a slightly newer version of the Synopsys DWMAC core. The glue layer around the controller is the same as found around older DWMAC cores on Allwinner SoCs. The only slight difference is that since this is the second controller on the SoC, the register for the clock delay controls is at a different offset. Last, the integration includes a dedicated clock gate for the memory bus and the whole thing is put in a separately controllable power domain.

Quoted 3 lines

Hi Andrew, does this look good ?

thread: https://lore.kernel.org/[email protected]

Adding Heiner and Russell, in case Andrew is AFK.

We need an ack from PHY maintainers, the patch seems to be setting delays regardless of the exact RMII mode. I don't know these things..

author maintainer
#5 lore raw
Quoted 14 lines · Jakub Kicinski
Quoted 12 lines · On Mon, 29 Sep 2025 18:08:04 -0700 Jakub Kicinski wrote:
Quoted 10 lines · On Fri, 26 Sep 2025 03:15:59 +0800 Chen-Yu Tsai wrote:

The Allwinner A523 SoC family has a second Ethernet controller, called the GMAC200 in the BSP and T527 datasheet, and referred to as GMAC1 for numbering. This controller, according to BSP sources, is fully compatible with a slightly newer version of the Synopsys DWMAC core. The glue layer around the controller is the same as found around older DWMAC cores on Allwinner SoCs. The only slight difference is that since this is the second controller on the SoC, the register for the clock delay controls is at a different offset. Last, the integration includes a dedicated clock gate for the memory bus and the whole thing is put in a separately controllable power domain.

Quoted 8 lines
Quoted 3 lines

Hi Andrew, does this look good ?

thread: https://lore.kernel.org/[email protected]

Adding Heiner and Russell, in case Andrew is AFK.

We need an ack from PHY maintainers, the patch seems to be setting delays regardless of the exact RMII mode. I don't know these things..

AFAIK the delays only apply to the RGMII signal path, i.e. they are no-op for RMII. Also, the delays are unrelated to the 2ns delay required by RGMII. These delays are more for tweaking minute signal length differences.

ChenYu

maintainer
#6 lore raw
In reply to Jakub Kicinski
Quoted 13 lines · Jakub Kicinski
Quoted 12 lines · On Mon, 29 Sep 2025 18:08:04 -0700 Jakub Kicinski wrote:
Quoted 10 lines · On Fri, 26 Sep 2025 03:15:59 +0800 Chen-Yu Tsai wrote:

The Allwinner A523 SoC family has a second Ethernet controller, called the GMAC200 in the BSP and T527 datasheet, and referred to as GMAC1 for numbering. This controller, according to BSP sources, is fully compatible with a slightly newer version of the Synopsys DWMAC core. The glue layer around the controller is the same as found around older DWMAC cores on Allwinner SoCs. The only slight difference is that since this is the second controller on the SoC, the register for the clock delay controls is at a different offset. Last, the integration includes a dedicated clock gate for the memory bus and the whole thing is put in a separately controllable power domain.

Quoted 8 lines
Quoted 3 lines

Hi Andrew, does this look good ?

thread: https://lore.kernel.org/[email protected]

Adding Heiner and Russell, in case Andrew is AFK.

We need an ack from PHY maintainers, the patch seems to be setting delays regardless of the exact RMII mode. I don't know these things..

The net-next PR is upon us, let's defer even this series to the next cycle.

@Chen-Yu Tsai: please re-post it when net-next will reopen after Oct 12th, thanks!

Paolo

#10 lore raw
In reply to Jakub Kicinski
Quoted 13 lines · Jakub Kicinski
Quoted 12 lines · On Mon, 29 Sep 2025 18:08:04 -0700 Jakub Kicinski wrote:
Quoted 10 lines · On Fri, 26 Sep 2025 03:15:59 +0800 Chen-Yu Tsai wrote:

The Allwinner A523 SoC family has a second Ethernet controller, called the GMAC200 in the BSP and T527 datasheet, and referred to as GMAC1 for numbering. This controller, according to BSP sources, is fully compatible with a slightly newer version of the Synopsys DWMAC core. The glue layer around the controller is the same as found around older DWMAC cores on Allwinner SoCs. The only slight difference is that since this is the second controller on the SoC, the register for the clock delay controls is at a different offset. Last, the integration includes a dedicated clock gate for the memory bus and the whole thing is put in a separately controllable power domain.

Quoted 5 lines
Quoted 3 lines

Hi Andrew, does this look good ?

thread: https://lore.kernel.org/[email protected]

Adding Heiner and Russell, in case Andrew is AFK.

I believe it's fine. Applying the delays irrespective of the RGMII mode is what I think needs to be done to allow the delays to be fine-tuned.

The author hsa confirmed that the delays don't apply to RMII, so that isn't a concern. So,

Thanks!

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
#7 lore raw
In reply to Paolo Abeni
Quoted 16 lines · Paolo Abeni
Quoted 15 lines · Jakub Kicinski
Quoted 14 lines · On Mon, 29 Sep 2025 18:08:04 -0700 Jakub Kicinski wrote:
Quoted 10 lines · On Fri, 26 Sep 2025 03:15:59 +0800 Chen-Yu Tsai wrote:

The Allwinner A523 SoC family has a second Ethernet controller, called the GMAC200 in the BSP and T527 datasheet, and referred to as GMAC1 for numbering. This controller, according to BSP sources, is fully compatible with a slightly newer version of the Synopsys DWMAC core. The glue layer around the controller is the same as found around older DWMAC cores on Allwinner SoCs. The only slight difference is that since this is the second controller on the SoC, the register for the clock delay controls is at a different offset. Last, the integration includes a dedicated clock gate for the memory bus and the whole thing is put in a separately controllable power domain.

Hi Andrew, does this look good ?

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

thread: https://lore.kernel.org/[email protected]

Adding Heiner and Russell, in case Andrew is AFK.

We need an ack from PHY maintainers, the patch seems to be setting delays regardless of the exact RMII mode. I don't know these things..

The net-next PR is upon us, let's defer even this series to the next cycle.

Would've been nice to have been given the opportunity to respond to Jakub's email before that decision was made. Not all of us are in the US timezone. (Jakub's email came in gone 1am my time.)

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
maintainer
#8 lore raw
Quoted 21 lines · Russell King (Oracle)
Quoted 20 lines · Paolo Abeni
Quoted 19 lines · Jakub Kicinski
Quoted 12 lines · On Mon, 29 Sep 2025 18:08:04 -0700 Jakub Kicinski wrote:
Quoted 10 lines · On Fri, 26 Sep 2025 03:15:59 +0800 Chen-Yu Tsai wrote:

The Allwinner A523 SoC family has a second Ethernet controller, called the GMAC200 in the BSP and T527 datasheet, and referred to as GMAC1 for numbering. This controller, according to BSP sources, is fully compatible with a slightly newer version of the Synopsys DWMAC core. The glue layer around the controller is the same as found around older DWMAC cores on Allwinner SoCs. The only slight difference is that since this is the second controller on the SoC, the register for the clock delay controls is at a different offset. Last, the integration includes a dedicated clock gate for the memory bus and the whole thing is put in a separately controllable power domain.

Quoted 3 lines

Hi Andrew, does this look good ?

thread: https://lore.kernel.org/[email protected]

Adding Heiner and Russell, in case Andrew is AFK.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

We need an ack from PHY maintainers, the patch seems to be setting delays regardless of the exact RMII mode. I don't know these things..

The net-next PR is upon us, let's defer even this series to the next cycle.

Would've been nice to have been given the opportunity to respond to Jakub's email before that decision was made. Not all of us are in the US timezone. (Jakub's email came in gone 1am my time.)

I'm sorry, the time constraint is very strict. The PR is already in late. My message's goal was to give you the needed and deserve time for reviewing the series, not to pressure you.

Note that to merge the series at this point I need to undo some of the work already done.

Cheers,

Paolo

maintainer
#9 lore raw
In reply to Paolo Abeni
Quoted 20 lines · Paolo Abeni
Quoted 19 lines · Jakub Kicinski
Quoted 12 lines · On Mon, 29 Sep 2025 18:08:04 -0700 Jakub Kicinski wrote:
Quoted 10 lines · On Fri, 26 Sep 2025 03:15:59 +0800 Chen-Yu Tsai wrote:

The Allwinner A523 SoC family has a second Ethernet controller, called the GMAC200 in the BSP and T527 datasheet, and referred to as GMAC1 for numbering. This controller, according to BSP sources, is fully compatible with a slightly newer version of the Synopsys DWMAC core. The glue layer around the controller is the same as found around older DWMAC cores on Allwinner SoCs. The only slight difference is that since this is the second controller on the SoC, the register for the clock delay controls is at a different offset. Last, the integration includes a dedicated clock gate for the memory bus and the whole thing is put in a separately controllable power domain.

Quoted 3 lines

Hi Andrew, does this look good ?

thread: https://lore.kernel.org/[email protected]

Adding Heiner and Russell, in case Andrew is AFK.

Quoted 7 lines
Quoted 2 lines

We need an ack from PHY maintainers, the patch seems to be setting delays regardless of the exact RMII mode. I don't know these things..

The net-next PR is upon us, let's defer even this series to the next cycle.

@Chen-Yu Tsai: please re-post it when net-next will reopen after Oct 12th, thanks!

To be clear: given Russell's ack I'm applying the series now, no need to repost.

Thanks,

Paolo