Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next v3 0/2] net: stmmac: Add RK3572 support
@ 2026-11-16  7:39 Cunhao Lu via B4 Relay
  2026-11-16  7:39 ` [PATCH net-next v3 1/2] dt-bindings: net: rockchip-dwmac: Add RK3572 Cunhao Lu via B4 Relay
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Cunhao Lu via B4 Relay @ 2026-11-16  7:39 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Heiko Stuebner, David Wu, Alexandre Torgue, Giuseppe Cavallaro,
	Jose Abreu, Maxime Chevallier, Maxime Coquelin
  Cc: Cunhao Lu, netdev, devicetree, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-stm32

This is one of the subsystem submissions for RK3572 support.

This series adds the RK3572 GMAC bindings and support for both Ethernet
controllers in the Rockchip stmmac glue driver. It provides RGMII and
RMII mode and clock control, together with RGMII delay configuration.

The RK3572 SoC has eight CPU cores: two Cortex-A73 cores and six
Cortex-A53 cores. It also integrates an Arm Mali-G310V2 MC1 GPU.
The OK3572-C board provides two Gigabit Ethernet ports, three USB3 Type-A
ports, a Type-C dual-role port, eMMC, microSD, and UART.

Testing was performed with Debian 13 minimal and Linux 7.3 on the
OK3572-C with the FET3572-C module.

Passed functionality:

- SD and eMMC complete the firmware, kernel, and root filesystem
  boot chain.
- UART console works at 1500000 baud.
- SD read/write and data persistence checks pass.
- All eight CPUs start; CPU frequency scaling and hotplug checks pass.
- Both Ethernet ports obtain IPv4 addresses and pass bidirectional file
  transfers.
- All three Type-A ports pass USB2 and USB3 enumeration, data transfers,
  and reconnect persistence checks.
- Type-C host and device modes pass in both plug orientations. Physical
  reconnects correctly select the expected device, host, and device roles
  in sequence.

Stability:

- Repeated cold and software reboots complete on SD and eMMC without data
  integrity failures.
- A combined CPU, memory, network, SD, and USB3 stress test completes
  without a crash, lockup, CPU offline event, or thermal shutdown.
- Ethernet error and drop counters do not increase during bidirectional
  network tests.

Build and checks:

- The kernel, modules, and board DTB build successfully.
- The series passes checkpatch with --strict.

Untested hardware and paths:

- NPU
- PCIe
- GPU, video output, and audio
- Other low-speed external interfaces

Some files in this series are derived from the Forlinx OK3572-C BSP
Alpha1. Thanks to Forlinx for their support.

AI assistance:

- Codex / DeepSeek V4.1 Flash were used for:
  - Reviewing and adjusting code style to follow community conventions
  - Automating tests
  - Collecting data

Signed-off-by: Cunhao Lu <1579567540@qq.com>
---
Changes in v3:
- Deprecate tx_delay and rx_delay and disallow them for RK3572.
- Link to v2:
  https://patch.msgid.link/20261111-add-board-ok3572-c-net-v2-0-304466394970@qq.com

Changes in v2:
- Split the original RK3572 support series by subsystem.
- Add rockchip,rk3572-gmac to the shared Synopsys compatible list in
  snps,dwmac.yaml.
- Link to v1:
  https://patch.msgid.link/20261022-add-board-ok3572-c-v1-0-0b0fd85a31ee@qq.com

---
Raw dmesg: see the v1 cover letter.

To: Andrew Lunn <andrew+netdev@lunn.ch>
To: "David S. Miller" <davem@davemloft.net>
To: Eric Dumazet <edumazet@kernel.org>
To: Jakub Kicinski <kuba@kernel.org>
To: Paolo Abeni <pabeni@redhat.com>
To: Rob Herring <robh@kernel.org>
To: Krzysztof Kozlowski <krzk+dt@kernel.org>
To: Conor Dooley <conor+dt@kernel.org>
To: Heiko Stuebner <heiko@sntech.de>
To: David Wu <david.wu@rock-chips.com>
To: Alexandre Torgue <alexandre.torgue@foss.st.com>
To: Giuseppe Cavallaro <peppe.cavallaro@st.com>
To: Jose Abreu <joabreu@synopsys.com>
To: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: netdev@vger.kernel.org
Cc: devicetree@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-rockchip@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-stm32@st-md-mailman.stormreply.com

---
Cunhao Lu (2):
      dt-bindings: net: rockchip-dwmac: Add RK3572
      net: stmmac: dwmac-rk: Add RK3572 support

 .../devicetree/bindings/net/rockchip-dwmac.yaml    | 15 ++++++
 .../devicetree/bindings/net/snps,dwmac.yaml        |  1 +
 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c     | 53 ++++++++++++++++++++++
 3 files changed, 69 insertions(+)
---
base-commit: 067c5c24cef23d913b67eaaf71ae67e7169a6620
change-id: 20261111-add-board-ok3572-c-net-4d45887c575f

Best regards,
--  
Cunhao Lu <1579567540@qq.com>



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH net-next v3 1/2] dt-bindings: net: rockchip-dwmac: Add RK3572
  2026-11-16  7:39 [PATCH net-next v3 0/2] net: stmmac: Add RK3572 support Cunhao Lu via B4 Relay
@ 2026-11-16  7:39 ` Cunhao Lu via B4 Relay
  2026-11-16 13:44   ` Andrew Lunn
  2026-11-18 10:41   ` netdev-bot+sashiko
  2026-11-16  7:39 ` [PATCH net-next v3 2/2] net: stmmac: dwmac-rk: Add RK3572 support Cunhao Lu via B4 Relay
  2026-11-16 13:43 ` [PATCH net-next v3 0/2] net: stmmac: " Andrew Lunn
  2 siblings, 2 replies; 10+ messages in thread
From: Cunhao Lu via B4 Relay @ 2026-11-16  7:39 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Heiko Stuebner, David Wu, Alexandre Torgue, Giuseppe Cavallaro,
	Jose Abreu, Maxime Chevallier, Maxime Coquelin
  Cc: Cunhao Lu, netdev, devicetree, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-stm32

From: Cunhao Lu <1579567540@qq.com>

Add the rockchip,rk3572-gmac compatible with the snps,dwmac-4.20a
fallback and require rockchip,php-grf.

Mark tx_delay and rx_delay as deprecated and disallow them for RK3572
so new designs do not use the legacy delay properties.

Signed-off-by: Cunhao Lu <1579567540@qq.com>
---
Changes in v3:
- Deprecate tx_delay and rx_delay and disallow them for RK3572.

Changes in v2:
- Add RK3572 to the shared Synopsys compatible list for consistency.
---
 Documentation/devicetree/bindings/net/rockchip-dwmac.yaml | 15 +++++++++++++++
 Documentation/devicetree/bindings/net/snps,dwmac.yaml     |  1 +
 2 files changed, 16 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/rockchip-dwmac.yaml b/Documentation/devicetree/bindings/net/rockchip-dwmac.yaml
index e8dda1961ab3..d7b7bb008235 100644
--- a/Documentation/devicetree/bindings/net/rockchip-dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/rockchip-dwmac.yaml
@@ -27,6 +27,7 @@ select:
           - rockchip,rk3506-gmac
           - rockchip,rk3528-gmac
           - rockchip,rk3568-gmac
+          - rockchip,rk3572-gmac
           - rockchip,rk3576-gmac
           - rockchip,rk3588-gmac
           - rockchip,rv1108-gmac
@@ -54,6 +55,7 @@ properties:
               - rockchip,rk3506-gmac
               - rockchip,rk3528-gmac
               - rockchip,rk3568-gmac
+              - rockchip,rk3572-gmac
               - rockchip,rk3576-gmac
               - rockchip,rk3588-gmac
               - rockchip,rv1126-gmac
@@ -112,6 +114,7 @@ properties:
     minimum: 0
     maximum: 0x7F
     default: 0x30
+    deprecated: true
 
   rx_delay:
     description: Delay value for RXD timing.
@@ -119,6 +122,7 @@ properties:
     minimum: 0
     maximum: 0x7F
     default: 0x10
+    deprecated: true
 
   pcs-handle:
     description:
@@ -141,11 +145,22 @@ required:
 allOf:
   - $ref: snps,dwmac.yaml#
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: rockchip,rk3572-gmac
+    then:
+      properties:
+        rx_delay: false
+        tx_delay: false
+
   - if:
       properties:
         compatible:
           contains:
             enum:
+              - rockchip,rk3572-gmac
               - rockchip,rk3576-gmac
               - rockchip,rk3588-gmac
     then:
diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index 2c4842404bf6..80d3b43e2889 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -94,6 +94,7 @@ properties:
         - rockchip,rk3506-gmac
         - rockchip,rk3528-gmac
         - rockchip,rk3568-gmac
+        - rockchip,rk3572-gmac
         - rockchip,rk3576-gmac
         - rockchip,rk3588-gmac
         - rockchip,rv1108-gmac

-- 
2.34.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net-next v3 2/2] net: stmmac: dwmac-rk: Add RK3572 support
  2026-11-16  7:39 [PATCH net-next v3 0/2] net: stmmac: Add RK3572 support Cunhao Lu via B4 Relay
  2026-11-16  7:39 ` [PATCH net-next v3 1/2] dt-bindings: net: rockchip-dwmac: Add RK3572 Cunhao Lu via B4 Relay
@ 2026-11-16  7:39 ` Cunhao Lu via B4 Relay
  2026-11-16 13:55   ` Andrew Lunn
  2026-11-18 10:41   ` netdev-bot+sashiko
  2026-11-16 13:43 ` [PATCH net-next v3 0/2] net: stmmac: " Andrew Lunn
  2 siblings, 2 replies; 10+ messages in thread
From: Cunhao Lu via B4 Relay @ 2026-11-16  7:39 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Heiko Stuebner, David Wu, Alexandre Torgue, Giuseppe Cavallaro,
	Jose Abreu, Maxime Chevallier, Maxime Coquelin
  Cc: Cunhao Lu, netdev, devicetree, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-stm32

From: Cunhao Lu <1579567540@qq.com>

The RK3572 has two GMAC controllers with separate mode and clock control
registers in the PHP and NVM0 GRFs. RGMII delay lines are configured
through the IOC.

Add the register layout and delay callback for both controllers so the
Rockchip glue driver can configure their RGMII and RMII interfaces and
select the appropriate clocks for each link speed.

Signed-off-by: Cunhao Lu <1579567540@qq.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 53 ++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
index a37df5767d84..c9d8d8bf51f7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
@@ -900,6 +900,58 @@ static const struct rk_gmac_ops rk3568_ops = {
 	},
 };
 
+#define RK3572_VCCIO0_3_VO_IOC_CON1		0x10608
+#define RK3572_VCCIO1_2_4_VI_IOC_CON1		0x12604
+#define RK3572_VCCIO5_6_IOC_MISC0		0x14630
+#define RK3572_PHP_GRF_GMAC0_CON		0x0070
+#define RK3572_NVM0_GRF_GMAC1_CON		0x0020
+
+static int rk3572_init(struct rk_priv_data *bsp_priv)
+{
+	switch (bsp_priv->id) {
+	case 0:
+		bsp_priv->gmac_grf_reg = RK3572_PHP_GRF_GMAC0_CON;
+		break;
+	case 1:
+		bsp_priv->gmac_grf_reg = RK3572_NVM0_GRF_GMAC1_CON;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	bsp_priv->clock_grf_reg = bsp_priv->gmac_grf_reg;
+	return 0;
+}
+
+static void rk3572_set_to_rgmii(struct rk_priv_data *bsp_priv,
+				int tx_delay, int rx_delay)
+{
+	u32 val = GRF_FIELD(14, 8, rx_delay) | GRF_FIELD(6, 0, tx_delay) |
+		  GRF_FIELD(15, 15, !!rx_delay) | GRF_FIELD(7, 7, !!tx_delay);
+
+	if (bsp_priv->id == 1) {
+		regmap_write(bsp_priv->php_grf, RK3572_VCCIO0_3_VO_IOC_CON1, val);
+		regmap_write(bsp_priv->php_grf, RK3572_VCCIO5_6_IOC_MISC0, val);
+	} else {
+		regmap_write(bsp_priv->php_grf, RK3572_VCCIO1_2_4_VI_IOC_CON1, val);
+	}
+}
+
+static const struct rk_gmac_ops rk3572_ops = {
+	.init = rk3572_init,
+	.set_to_rgmii = rk3572_set_to_rgmii,
+	.gmac_phy_intf_sel_mask = GENMASK_U16(11, 9),
+	.gmac_rmii_mode_mask = BIT_U16(3),
+	.clock.io_clksel_io_mask = BIT_U16(7),
+	.clock.gmii_clk_sel_mask = GENMASK_U16(6, 5),
+	.clock.rmii_clk_sel_mask = BIT_U16(5),
+	.clock.rmii_gate_en_mask = BIT_U16(4),
+	.supports_rmii = true,
+	.php_grf_required = true,
+	.regs_valid = true,
+	.regs = { 0x29d20000, 0x2a040000, 0 },
+};
+
 /* VCCIO0_1_3_IOC */
 #define RK3576_VCCIO0_1_3_IOC_CON2		0X6408
 #define RK3576_VCCIO0_1_3_IOC_CON3		0X640c
@@ -1720,6 +1772,7 @@ static const struct of_device_id rk_gmac_dwmac_match[] = {
 	{ .compatible = "rockchip,rk3506-gmac", .data = &rk3506_ops },
 	{ .compatible = "rockchip,rk3528-gmac", .data = &rk3528_ops },
 	{ .compatible = "rockchip,rk3568-gmac", .data = &rk3568_ops },
+	{ .compatible = "rockchip,rk3572-gmac", .data = &rk3572_ops },
 	{ .compatible = "rockchip,rk3576-gmac", .data = &rk3576_ops },
 	{ .compatible = "rockchip,rk3588-gmac", .data = &rk3588_ops },
 	{ .compatible = "rockchip,rv1108-gmac", .data = &rv1108_ops },

-- 
2.34.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH net-next v3 0/2] net: stmmac: Add RK3572 support
  2026-11-16  7:39 [PATCH net-next v3 0/2] net: stmmac: Add RK3572 support Cunhao Lu via B4 Relay
  2026-11-16  7:39 ` [PATCH net-next v3 1/2] dt-bindings: net: rockchip-dwmac: Add RK3572 Cunhao Lu via B4 Relay
  2026-11-16  7:39 ` [PATCH net-next v3 2/2] net: stmmac: dwmac-rk: Add RK3572 support Cunhao Lu via B4 Relay
@ 2026-11-16 13:43 ` Andrew Lunn
  2 siblings, 0 replies; 10+ messages in thread
From: Andrew Lunn @ 2026-11-16 13:43 UTC (permalink / raw)
  To: 1579567540
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Heiko Stuebner, David Wu, Alexandre Torgue, Giuseppe Cavallaro,
	Jose Abreu, Maxime Chevallier, Maxime Coquelin, netdev,
	devicetree, linux-arm-kernel, linux-rockchip, linux-kernel,
	linux-stm32

On Mon, Nov 16, 2026 at 03:39:13PM +0800, Cunhao Lu via B4 Relay wrote:
> This is one of the subsystem submissions for RK3572 support.
> 
> This series adds the RK3572 GMAC bindings and support for both Ethernet
> controllers in the Rockchip stmmac glue driver. It provides RGMII and
> RMII mode and clock control, together with RGMII delay configuration.


> 
> The RK3572 SoC has eight CPU cores: two Cortex-A73 cores and six
> Cortex-A53 cores. It also integrates an Arm Mali-G310V2 MC1 GPU.
> The OK3572-C board provides two Gigabit Ethernet ports, three USB3 Type-A
> ports, a Type-C dual-role port, eMMC, microSD, and UART.
> 
> Testing was performed with Debian 13 minimal and Linux 7.3 on the
> OK3572-C with the FET3572-C module.
> 
> Passed functionality:
> 
> - SD and eMMC complete the firmware, kernel, and root filesystem
>   boot chain.
> - UART console works at 1500000 baud.
> - SD read/write and data persistence checks pass.
> - All eight CPUs start; CPU frequency scaling and hotplug checks pass.
> - Both Ethernet ports obtain IPv4 addresses and pass bidirectional file
>   transfers.
> - All three Type-A ports pass USB2 and USB3 enumeration, data transfers,
>   and reconnect persistence checks.
> - Type-C host and device modes pass in both plug orientations. Physical
>   reconnects correctly select the expected device, host, and device roles
>   in sequence.
> 
> Stability:
> 
> - Repeated cold and software reboots complete on SD and eMMC without data
>   integrity failures.
> - A combined CPU, memory, network, SD, and USB3 stress test completes
>   without a crash, lockup, CPU offline event, or thermal shutdown.
> - Ethernet error and drop counters do not increase during bidirectional
>   network tests.
> 
> Build and checks:
> 
> - The kernel, modules, and board DTB build successfully.
> - The series passes checkpatch with --strict.
> 
> Untested hardware and paths:
> 
> - NPU
> - PCIe
> - GPU, video output, and audio
> - Other low-speed external interfaces

Most of this is irrelevant for netdev. Please write your merge commit
message for the subsystem doing to merge.

Andrew

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net-next v3 1/2] dt-bindings: net: rockchip-dwmac: Add RK3572
  2026-11-16  7:39 ` [PATCH net-next v3 1/2] dt-bindings: net: rockchip-dwmac: Add RK3572 Cunhao Lu via B4 Relay
@ 2026-11-16 13:44   ` Andrew Lunn
  2026-11-18 10:41   ` netdev-bot+sashiko
  1 sibling, 0 replies; 10+ messages in thread
From: Andrew Lunn @ 2026-11-16 13:44 UTC (permalink / raw)
  To: 1579567540
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Heiko Stuebner, David Wu, Alexandre Torgue, Giuseppe Cavallaro,
	Jose Abreu, Maxime Chevallier, Maxime Coquelin, netdev,
	devicetree, linux-arm-kernel, linux-rockchip, linux-kernel,
	linux-stm32

On Mon, Nov 16, 2026 at 03:39:14PM +0800, Cunhao Lu via B4 Relay wrote:
> From: Cunhao Lu <1579567540@qq.com>
> 
> Add the rockchip,rk3572-gmac compatible with the snps,dwmac-4.20a
> fallback and require rockchip,php-grf.
> 
> Mark tx_delay and rx_delay as deprecated and disallow them for RK3572
> so new designs do not use the legacy delay properties.
> 
> Signed-off-by: Cunhao Lu <1579567540@qq.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net-next v3 2/2] net: stmmac: dwmac-rk: Add RK3572 support
  2026-11-16  7:39 ` [PATCH net-next v3 2/2] net: stmmac: dwmac-rk: Add RK3572 support Cunhao Lu via B4 Relay
@ 2026-11-16 13:55   ` Andrew Lunn
  2026-11-16 15:11     ` Cunhao Lu
  2026-11-18 10:41   ` netdev-bot+sashiko
  1 sibling, 1 reply; 10+ messages in thread
From: Andrew Lunn @ 2026-11-16 13:55 UTC (permalink / raw)
  To: 1579567540
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Heiko Stuebner, David Wu, Alexandre Torgue, Giuseppe Cavallaro,
	Jose Abreu, Maxime Chevallier, Maxime Coquelin, netdev,
	devicetree, linux-arm-kernel, linux-rockchip, linux-kernel,
	linux-stm32

> +static void rk3572_set_to_rgmii(struct rk_priv_data *bsp_priv,
> +				int tx_delay, int rx_delay)
> +{
> +	u32 val = GRF_FIELD(14, 8, rx_delay) | GRF_FIELD(6, 0, tx_delay) |
> +		  GRF_FIELD(15, 15, !!rx_delay) | GRF_FIELD(7, 7, !!tx_delay);
> +
> +	if (bsp_priv->id == 1) {
> +		regmap_write(bsp_priv->php_grf, RK3572_VCCIO0_3_VO_IOC_CON1, val);
> +		regmap_write(bsp_priv->php_grf, RK3572_VCCIO5_6_IOC_MISC0, val);
> +	} else {
> +		regmap_write(bsp_priv->php_grf, RK3572_VCCIO1_2_4_VI_IOC_CON1, val);
> +	}
> +}
> +
> +static const struct rk_gmac_ops rk3572_ops = {
> +	.init = rk3572_init,
> +	.set_to_rgmii = rk3572_set_to_rgmii,
> +	.gmac_phy_intf_sel_mask = GENMASK_U16(11, 9),
> +	.gmac_rmii_mode_mask = BIT_U16(3),
> +	.clock.io_clksel_io_mask = BIT_U16(7),
> +	.clock.gmii_clk_sel_mask = GENMASK_U16(6, 5),
> +	.clock.rmii_clk_sel_mask = BIT_U16(5),
> +	.clock.rmii_gate_en_mask = BIT_U16(4),
> +	.supports_rmii = true,
> +	.php_grf_required = true,
> +	.regs_valid = true,
> +	.regs = { 0x29d20000, 0x2a040000, 0 },
> +};

Just looking at this, it is not obvious that rx_delay and tx_delay are
actually not used.

	 Andrew

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net-next v3 2/2] net: stmmac: dwmac-rk: Add RK3572 support
  2026-11-16 13:55   ` Andrew Lunn
@ 2026-11-16 15:11     ` Cunhao Lu
  2026-11-16 15:58       ` Andrew Lunn
  0 siblings, 1 reply; 10+ messages in thread
From: Cunhao Lu @ 2026-11-16 15:11 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Heiko Stuebner, David Wu, Alexandre Torgue, Giuseppe Cavallaro,
	Jose Abreu, Maxime Chevallier, Maxime Coquelin, netdev,
	devicetree, linux-arm-kernel, linux-rockchip, linux-kernel,
	linux-stm32

Hi,

> [...]
> > + .regs_valid = true,
> > + .regs = { 0x29d20000, 0x2a040000, 0 },
> > +};
>
> Just looking at this, it is not obvious that rx_delay and tx_delay are
> actually not used.

My board currently uses rgmii-id, where both MAC TX and RX delays
are disabled. I kept the delay handling to support rgmii-rxid,
rgmii-txid and rgmii, using the default values for the MAC delays
enabled in those modes. The legacy tx_delay and rx_delay properties
are now disallowed for RK3572 in the binding.

I currently have only one oscilloscope, with a maximum bandwidth of
200 MHz. With this equipment, I cannot accurately determine how the
TX and RX delay register values translate to picoseconds, so I am
not planning to add support for tx-internal-delay-ps and
rx-internal-delay-ps in this series for now.

Would it be acceptable to support only rgmii-id for RGMII in the next
version, and reject rgmii, rgmii-rxid and rgmii-txid? This would let me
stop using tx_delay and rx_delay in the RK3572 driver path as well.

Best regards,
Cunhao Lu

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net-next v3 2/2] net: stmmac: dwmac-rk: Add RK3572 support
  2026-11-16 15:11     ` Cunhao Lu
@ 2026-11-16 15:58       ` Andrew Lunn
  0 siblings, 0 replies; 10+ messages in thread
From: Andrew Lunn @ 2026-11-16 15:58 UTC (permalink / raw)
  To: Cunhao Lu
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Heiko Stuebner, David Wu, Alexandre Torgue, Giuseppe Cavallaro,
	Jose Abreu, Maxime Chevallier, Maxime Coquelin, netdev,
	devicetree, linux-arm-kernel, linux-rockchip, linux-kernel,
	linux-stm32

On Mon, Nov 16, 2026 at 11:11:42PM +0800, Cunhao Lu wrote:
> Hi,
> 
> > [...]
> > > + .regs_valid = true,
> > > + .regs = { 0x29d20000, 0x2a040000, 0 },
> > > +};
> >
> > Just looking at this, it is not obvious that rx_delay and tx_delay are
> > actually not used.
> 
> My board currently uses rgmii-id, where both MAC TX and RX delays
> are disabled. I kept the delay handling to support rgmii-rxid,
> rgmii-txid and rgmii, using the default values for the MAC delays
> enabled in those modes. The legacy tx_delay and rx_delay properties
> are now disallowed for RK3572 in the binding.
> 
> I currently have only one oscilloscope, with a maximum bandwidth of
> 200 MHz. With this equipment, I cannot accurately determine how the
> TX and RX delay register values translate to picoseconds, so I am
> not planning to add support for tx-internal-delay-ps and
> rx-internal-delay-ps in this series for now.
> 
> Would it be acceptable to support only rgmii-id for RGMII in the next
> version, and reject rgmii, rgmii-rxid and rgmii-txid? This would let me
> stop using tx_delay and rx_delay in the RK3572 driver path as well.

No, rgmii, rgmii-rxid and rgmii-txid are valid, it depends on the PCB
design.

https://elixir.bootlin.com/linux/v6.15/source/Documentation/devicetree/bindings/net/ethernet-controller.yaml#L287

What i would prefer is that the C code does not parse the rx_delay and
tx_delay properties. If somebody actually needs them, they need to
implement tx-internal-delay-ps and rx-internal-delay-ps. Since you
don't need them, you don't need to implement them.

      Andrew

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net-next v3 1/2] dt-bindings: net: rockchip-dwmac: Add RK3572
  2026-11-16  7:39 ` [PATCH net-next v3 1/2] dt-bindings: net: rockchip-dwmac: Add RK3572 Cunhao Lu via B4 Relay
  2026-11-16 13:44   ` Andrew Lunn
@ 2026-11-18 10:41   ` netdev-bot+sashiko
  1 sibling, 0 replies; 10+ messages in thread
From: netdev-bot+sashiko @ 2026-11-18 10:41 UTC (permalink / raw)
  To: 1579567540
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, robh, krzk+dt,
	conor+dt, heiko, david.wu, alexandre.torgue, peppe.cavallaro,
	joabreu, maxime.chevallier, mcoquelin.stm32, netdev, devicetree,
	linux-arm-kernel, linux-rockchip, linux-kernel, linux-stm32

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] In rockchip-dwmac.yaml, this patch adds an allOf block that
  sets `rx_delay: false` and `tx_delay: false` for rockchip,rk3572-gmac.
- [Low] Under the subject "Add RK3572", the patch adds `deprecated: true`
  to the top-level tx_delay and rx_delay definitions in rockchip-…

--

dt-bindings: net: rockchip-dwmac: Add RK3572

This adds the rockchip,rk3572-gmac compatible, with snps,dwmac-4.20a as
the fallback, and requires rockchip,php-grf for it. It also marks
tx_delay and rx_delay as deprecated and disallows them for RK3572.

> diff --git a/Documentation/devicetree/bindings/net/rockchip-dwmac.yaml b/Documentation/devicetree/bindings/net/rockchip-dwmac.yaml
> index e8dda1961ab31..d7b7bb0082357 100644
> --- a/Documentation/devicetree/bindings/net/rockchip-dwmac.yaml
> +++ b/Documentation/devicetree/bindings/net/rockchip-dwmac.yaml

[ ... ]

> @@ -112,6 +114,7 @@ properties:
>      minimum: 0
>      maximum: 0x7F
>      default: 0x30
> +    deprecated: true
>  
>    rx_delay:
>      description: Delay value for RXD timing.
> @@ -119,6 +122,7 @@ properties:
>      minimum: 0
>      maximum: 0x7F
>      default: 0x10
> +    deprecated: true

[Severity: Low]
These deprecated: true lines are on the top-level tx_delay and rx_delay
definitions. Doesn't that deprecate them for every Rockchip GMAC compatible
(px30, rk3128 through rk3588, rv1108, rv1126), and not only for RK3572?

The binding doesn't name a replacement. dwmac-rk.c also doesn't read any
standard alternative such as rx-internal-delay-ps or tx-internal-delay-ps.
On the older SoCs, a board that needs MAC-side RGMII delay has no
non-deprecated way to describe it.

If a DT leaves the properties out, rk_gmac_setup() logs errors and falls
back to hidden defaults:

drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c:rk_gmac_setup() {
    ...
	ret = of_property_read_u32(dev->of_node, "tx_delay", &value);
	if (ret) {
		bsp_priv->tx_delay = 0x30;
		dev_err(dev, "Can not read property: tx_delay.");
    ...
}

Could this binding-wide deprecation go in a separate patch with a rationale
and a successor that the driver supports? Alternatively, could it be limited
to compatibles where a replacement exists?

> @@ -141,11 +145,22 @@ required:
>  allOf:
>    - $ref: snps,dwmac.yaml#
>  
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: rockchip,rk3572-gmac
> +    then:
> +      properties:
> +        rx_delay: false
> +        tx_delay: false

[Severity: Medium]
With rx_delay and tx_delay set to false, how does an RK3572 board control
the MAC-side RGMII delay? phy-mode isn't restricted, so "rgmii",
"rgmii-rxid" and "rgmii-txid" still pass validation.

The companion commit "net: stmmac: dwmac-rk: Add RK3572 support" binds
rockchip,rk3572-gmac to rk3572_ops. That uses the shared rk_gmac_setup()
and rk_gmac_powerup() paths. rk_gmac_setup() always reads both properties.
On a valid RK3572 DT they are always missing, so it falls back to 0x30/0x10:

drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c:rk_gmac_setup() {
    ...
	ret = of_property_read_u32(dev->of_node, "tx_delay", &value);
	if (ret) {
		bsp_priv->tx_delay = 0x30;
		dev_err(dev, "Can not read property: tx_delay.");
		dev_err(dev, "set tx_delay to 0x%x\n",
			bsp_priv->tx_delay);
    ...
	ret = of_property_read_u32(dev->of_node, "rx_delay", &value);
	if (ret) {
		bsp_priv->rx_delay = 0x10;
    ...
}

That gives four dev_err() lines on every probe of every RK3572 GMAC,
rgmii-id included.

Then the set_mode switch in rk_gmac_powerup() passes those fallbacks into
ops->set_to_rgmii():

	case PHY_INTERFACE_MODE_RGMII:
		...
			bsp_priv->ops->set_to_rgmii(bsp_priv,
						    bsp_priv->tx_delay,
						    bsp_priv->rx_delay);
	...
	case PHY_INTERFACE_MODE_RGMII_RXID:
		...
						    bsp_priv->tx_delay, 0);
	...
	case PHY_INTERFACE_MODE_RGMII_TXID:
		...
						    0, bsp_priv->rx_delay);

In the companion commit, rk3572_set_to_rgmii() does:

	u32 val = GRF_FIELD(14, 8, rx_delay) | GRF_FIELD(6, 0, tx_delay) |
		  GRF_FIELD(15, 15, !!rx_delay) | GRF_FIELD(7, 7, !!tx_delay);

So the non-zero fallbacks switch on the php_grf IOC delay lines. The delay
values are fixed, and the DT can't tune them or turn them off. Before this
change, tx_delay = <0> was how to turn the delay off, and the schema now
rejects that. Only phy-mode = "rgmii-id" ends up with zero MAC delay.

The commit message says the goal is "so new designs do not use the legacy
delay properties". The schema does that, but the driver still applies
legacy delay values through its hidden defaults.

The standard tx-internal-delay-ps and rx-internal-delay-ps properties
validate through snps,dwmac.yaml and ethernet-controller.yaml. But
dwmac-rk.c never reads them, so setting them does nothing and gives no
error.

Would it make sense to either restrict RK3572 to rgmii-id (with the driver
skipping the reads and dev_err() calls for RK3572), or to add driver
support for tx-internal-delay-ps and rx-internal-delay-ps before banning
the legacy properties?

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116-add-board-ok3572-c-net-v3-0-a957fdcd9c7a%40qq.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net-next v3 2/2] net: stmmac: dwmac-rk: Add RK3572 support
  2026-11-16  7:39 ` [PATCH net-next v3 2/2] net: stmmac: dwmac-rk: Add RK3572 support Cunhao Lu via B4 Relay
  2026-11-16 13:55   ` Andrew Lunn
@ 2026-11-18 10:41   ` netdev-bot+sashiko
  1 sibling, 0 replies; 10+ messages in thread
From: netdev-bot+sashiko @ 2026-11-18 10:41 UTC (permalink / raw)
  To: 1579567540
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, robh, krzk+dt,
	conor+dt, heiko, david.wu, alexandre.torgue, peppe.cavallaro,
	joabreu, maxime.chevallier, mcoquelin.stm32, netdev, devicetree,
	linux-arm-kernel, linux-rockchip, linux-kernel, linux-stm32

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] RK3572 RGMII delay lines get fixed values that the DT is not
  allowed to describe.

--

net: stmmac: dwmac-rk: Add RK3572 support

This patch adds RK3572 support to the Rockchip dwmac glue driver. It
covers the register layout for the two GMAC controllers in the PHP and
NVM0 GRFs, plus a set_to_rgmii callback that programs the RGMII delay
lines through the IOC.

> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> index a37df5767d84e..c9d8d8bf51f7b 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c

[ ... ]

> +static void rk3572_set_to_rgmii(struct rk_priv_data *bsp_priv,
> +				int tx_delay, int rx_delay)
> +{
> +	u32 val = GRF_FIELD(14, 8, rx_delay) | GRF_FIELD(6, 0, tx_delay) |
> +		  GRF_FIELD(15, 15, !!rx_delay) | GRF_FIELD(7, 7, !!tx_delay);
> +
> +	if (bsp_priv->id == 1) {
> +		regmap_write(bsp_priv->php_grf, RK3572_VCCIO0_3_VO_IOC_CON1, val);
> +		regmap_write(bsp_priv->php_grf, RK3572_VCCIO5_6_IOC_MISC0, val);
> +	} else {
> +		regmap_write(bsp_priv->php_grf, RK3572_VCCIO1_2_4_VI_IOC_CON1, val);
> +	}
> +}

[Severity: Medium]
Where are the tx_delay and rx_delay values for RK3572 meant to come from?

The companion binding change in rockchip-dwmac.yaml forbids the legacy
properties for this compatible:

  - if:
      properties:
        compatible:
          contains:
            const: rockchip,rk3572-gmac
    then:
      properties:
        rx_delay: false
        tx_delay: false

That means a schema-valid RK3572 node never has them. rk_gmac_setup() then
falls back to the old defaults and logs an error on every probe:

drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c:rk_gmac_setup() {
    ...
	ret = of_property_read_u32(dev->of_node, "tx_delay", &value);
	if (ret) {
		bsp_priv->tx_delay = 0x30;
		dev_err(dev, "Can not read property: tx_delay.");
    ...
	ret = of_property_read_u32(dev->of_node, "rx_delay", &value);
	if (ret) {
		bsp_priv->rx_delay = 0x10;
		dev_err(dev, "Can not read property: rx_delay.");
    ...
}

rk_gmac_powerup() passes these defaults on for "rgmii" (both delays),
"rgmii-rxid" (tx_delay) and "rgmii-txid" (rx_delay). Since bits 15 and 7
are set from !!rx_delay and !!tx_delay, rk3572_set_to_rgmii() switches on
the IOC delay lines with 0x30/0x10 taps for every RGMII mode except
"rgmii-id".

The 0x30/0x10 defaults come from older Rockchip SoCs. Do they match the
RK3572 tap size?

A board can't override them without failing schema validation. The driver
also doesn't read rx-internal-delay-ps or tx-internal-delay-ps.

Consider a board that uses "rgmii" with PCB delays, or a PHY that adds its
own delay. Could this leave the RX/TX sampling skewed, with no supported
way to fix it in DT?

Would it make sense to either zero the MAC-side delays for RK3572 when the
legacy properties are absent, or take them from the standard
*-internal-delay-ps properties? If not, should the binding keep allowing
tx_delay/rx_delay for now?

> +
> +static const struct rk_gmac_ops rk3572_ops = {
> +	.init = rk3572_init,
> +	.set_to_rgmii = rk3572_set_to_rgmii,

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116-add-board-ok3572-c-net-v3-0-a957fdcd9c7a%40qq.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-11-18 10:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16  7:39 [PATCH net-next v3 0/2] net: stmmac: Add RK3572 support Cunhao Lu via B4 Relay
2026-11-16  7:39 ` [PATCH net-next v3 1/2] dt-bindings: net: rockchip-dwmac: Add RK3572 Cunhao Lu via B4 Relay
2026-11-16 13:44   ` Andrew Lunn
2026-11-18 10:41   ` netdev-bot+sashiko
2026-11-16  7:39 ` [PATCH net-next v3 2/2] net: stmmac: dwmac-rk: Add RK3572 support Cunhao Lu via B4 Relay
2026-11-16 13:55   ` Andrew Lunn
2026-11-16 15:11     ` Cunhao Lu
2026-11-16 15:58       ` Andrew Lunn
2026-11-18 10:41   ` netdev-bot+sashiko
2026-11-16 13:43 ` [PATCH net-next v3 0/2] net: stmmac: " Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox