net: stmmac: Add RK3572 support
Subsystems (6)
v5 cover net: stmmac: Add RK3572 support
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, with MAC RGMII delays disabled.
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:
- Both Ethernet ports obtain IPv4 addresses and pass bidirectional file transfers.
Stability:
- Ethernet error and drop counters do not increase during bidirectional network tests.
AI assistance:
- Codex / DeepSeek V4.1 Flash were used for:
- Reviewing and adjusting code style to follow community conventions
- Automating tests
- Collecting data
---
Changes in v5:
- Rebase onto the latest net-next/main and resolve conflicts.
- Use skip_rgmii_delay_props to control tx_delay and rx_delay parsing.
- Link to v4:
https://patch.msgid.link/[email protected]
Changes in v4:
- Skip legacy delay properties and disable MAC RGMII delays on RK3572.
- Link to v3:
https://patch.msgid.link/[email protected]
Changes in v3:
- Deprecate tx_delay and rx_delay and disallow them for RK3572.
- Link to v2:
https://patch.msgid.link/[email protected]
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/[email protected]
---
Raw dmesg: see the v1 cover letter.
To: Andrew Lunn <[email protected]>
To: "David S. Miller" <[email protected]>
To: Eric Dumazet <[email protected]>
To: Jakub Kicinski <[email protected]>
To: Paolo Abeni <[email protected]>
To: Rob Herring <[email protected]>
To: Krzysztof Kozlowski <[email protected]>
To: Conor Dooley <[email protected]>
To: Heiko Stuebner <[email protected]>
To: David Wu <[email protected]>
To: Alexandre Torgue <[email protected]>
To: Giuseppe Cavallaro <[email protected]>
To: Jose Abreu <[email protected]>
To: Maxime Chevallier <[email protected]>
To: Maxime Coquelin <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
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 | 75 ++++++++++++++++++++-- 3 files changed, 87 insertions(+), 4 deletions(-)
---
base-commit: eb6d6c80d35449c27471b1874f13066c09a8964d
change-id: 20261111-add-board-ok3572-c-net-4d45887c575f
Best regards,
Signature · 1 line
Cunhao Lu <[email protected]>
PATCH v5 1/2 dt-bindings: net: rockchip-dwmac: Add RK3572
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.
---
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(+)
Documentation/devicetree/bindings/net/rockchip-dwmac.yaml +15 -0
@@ -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:
Documentation/devicetree/bindings/net/snps,dwmac.yaml +1 -0
@@ -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
Signature · 1 line
2.34.1
PATCH v5 2/2 net: stmmac: dwmac-rk: Add RK3572 support
In reply to Cunhao LuThe 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. Skip parsing the deprecated tx_delay and rx_delay properties for RK3572.
---
Changes in v5:
- Use skip_rgmii_delay_props to control tx_delay and rx_delay parsing.
Changes in v4:
- Skip legacy delay properties and disable MAC RGMII delays on RK3572.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 75 ++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +71 -4
@@ -66,6 +66,9 @@ struct rk_gmac_ops {bool supports_rgmii;bool supports_rmii;bool supports_sgmii; +/* Skip parsing legacy tx_delay and rx_delay properties on new SoCs. */ +bool skip_rgmii_delay_props; +bool php_grf_required;bool regs_valid;u32 regs[];
@@ -900,6 +903,67 @@ 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 __always_unused tx_delay, +int __always_unused rx_delay) +{ +u32 val =GRF_CLR_BIT (15 ) |GRF_CLR_BIT (7 ); + +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, + .skip_rgmii_delay_props = true, + + .php_grf_required = true, + .regs_valid = true, + .regs = { +0x29d20000 ,/* gmac0 */ +0x2a040000 ,/* gmac1 */ +0x0 ,/* sentinel */ + }, +}; +/* VCCIO0_1_3_IOC */ #define RK3576_VCCIO0_1_3_IOC_CON2 0X6408#define RK3576_VCCIO0_1_3_IOC_CON3 0X640c
@@ -1341,8 +1405,9 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev,* provide (see rk_gmac_powerup()), so only the delay values for * those directions are needed. */ -if (bsp_priv->phy_iface ==PHY_INTERFACE_MODE_RGMII || - bsp_priv->phy_iface ==PHY_INTERFACE_MODE_RGMII_RXID ) { +if (!ops->skip_rgmii_delay_props && + (bsp_priv->phy_iface ==PHY_INTERFACE_MODE_RGMII || + bsp_priv->phy_iface ==PHY_INTERFACE_MODE_RGMII_RXID )) { ret =of_property_read_u32 (dev->of_node,"tx_delay" , &value);if (ret) { bsp_priv->tx_delay =0x30 ;
@@ -1355,8 +1420,9 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev, } } -if (bsp_priv->phy_iface ==PHY_INTERFACE_MODE_RGMII || - bsp_priv->phy_iface ==PHY_INTERFACE_MODE_RGMII_TXID ) { +if (!ops->skip_rgmii_delay_props && + (bsp_priv->phy_iface ==PHY_INTERFACE_MODE_RGMII || + bsp_priv->phy_iface ==PHY_INTERFACE_MODE_RGMII_TXID )) { ret =of_property_read_u32 (dev->of_node,"rx_delay" , &value);if (ret) { bsp_priv->rx_delay =0x10 ;
@@ -1736,6 +1802,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 },
Signature · 1 line
2.34.1
Re: [PATCH net-next v5 2/2] net: stmmac: dwmac-rk: Add RK3572 support
Quoted 6 lines · On 11/23/26 04:07, Cunhao Lu via B4 Relay wrote:
From: Cunhao Lu <[email protected]>
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.
Quoted 6 lines
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. Skip parsing the deprecated
tx_delayandrx_delayproperties for RK3572.Signed-off-by Cunhao Lu <[email protected]>
I think the RGMII handling is good now,
Maxime
Quoted 125 lines
---
Changes in v5:
- Useskip_rgmii_delay_propsto controltx_delayandrx_delayparsing.Changes in v4:
- Skip legacy delay properties and disable MAC RGMII delays on RK3572.--- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 75 ++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 4 deletions(-)drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +71
-4@@ -66,6 +66,9 @@ struct rk_gmac_ops {bool supports_rgmii;bool supports_rmii;bool supports_sgmii; +/* Skip parsing legacy tx_delay and rx_delay properties on new SoCs. */ +bool skip_rgmii_delay_props; +bool php_grf_required;bool regs_valid;u32 regs[];@@ -900,6 +903,67 @@ 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 __always_unused tx_delay, +int __always_unused rx_delay) +{ +u32 val =GRF_CLR_BIT (15 ) |GRF_CLR_BIT (7 ); + +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, + .skip_rgmii_delay_props = true, + + .php_grf_required = true, + .regs_valid = true, + .regs = { +0x29d20000 ,/* gmac0 */ +0x2a040000 ,/* gmac1 */ +0x0 ,/* sentinel */ + }, +}; +/* VCCIO0_1_3_IOC */ #define RK3576_VCCIO0_1_3_IOC_CON2 0X6408#define RK3576_VCCIO0_1_3_IOC_CON3 0X640c@@ -1341,8 +1405,9 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev,* provide (see rk_gmac_powerup()), so only the delay values for * those directions are needed. */ -if (bsp_priv->phy_iface ==PHY_INTERFACE_MODE_RGMII || - bsp_priv->phy_iface ==PHY_INTERFACE_MODE_RGMII_RXID ) { +if (!ops->skip_rgmii_delay_props && + (bsp_priv->phy_iface ==PHY_INTERFACE_MODE_RGMII || + bsp_priv->phy_iface ==PHY_INTERFACE_MODE_RGMII_RXID )) { ret =of_property_read_u32 (dev->of_node,"tx_delay" , &value);if (ret) { bsp_priv->tx_delay =0x30 ;@@ -1355,8 +1420,9 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev, } } -if (bsp_priv->phy_iface ==PHY_INTERFACE_MODE_RGMII || - bsp_priv->phy_iface ==PHY_INTERFACE_MODE_RGMII_TXID ) { +if (!ops->skip_rgmii_delay_props && + (bsp_priv->phy_iface ==PHY_INTERFACE_MODE_RGMII || + bsp_priv->phy_iface ==PHY_INTERFACE_MODE_RGMII_TXID )) { ret =of_property_read_u32 (dev->of_node,"rx_delay" , &value);if (ret) { bsp_priv->rx_delay =0x10 ;@@ -1736,6 +1802,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 },
This series was applied to netdev/net-next.git (main) by Willem de Bruijn <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Willem de Bruijn <[email protected]>:
Quoted 6 lines · On Mon, 23 Nov 2026 11:07:26 +0800 you 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, with MAC RGMII delays disabled.
Quoted 6 lines
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.
[...]
Here is the summary with links:
- [net-next,v5,1/2] dt-bindings: net: rockchip-dwmac: Add RK3572
https://git.kernel.org/netdev/net-next/c/1c901175bc48 - [net-next,v5,2/2] net: stmmac: dwmac-rk: Add RK3572 support https://git.kernel.org/netdev/net-next/c/026158755435
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html