* [PATCH net-next v4 1/2] dt-bindings: net: rockchip-dwmac: Add RK3572
2026-11-17 9:04 [PATCH net-next v4 0/2] net: stmmac: Add RK3572 support Cunhao Lu via B4 Relay
@ 2026-11-17 9:04 ` Cunhao Lu via B4 Relay
2026-11-18 9:04 ` sashiko-bot
2026-11-17 9:04 ` [PATCH net-next v4 2/2] net: stmmac: dwmac-rk: Add RK3572 support Cunhao Lu via B4 Relay
1 sibling, 1 reply; 4+ messages in thread
From: Cunhao Lu via B4 Relay @ 2026-11-17 9:04 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, Andrew Lunn
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>
---
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] 4+ messages in thread* [PATCH net-next v4 2/2] net: stmmac: dwmac-rk: Add RK3572 support
2026-11-17 9:04 [PATCH net-next v4 0/2] net: stmmac: Add RK3572 support Cunhao Lu via B4 Relay
2026-11-17 9:04 ` [PATCH net-next v4 1/2] dt-bindings: net: rockchip-dwmac: Add RK3572 Cunhao Lu via B4 Relay
@ 2026-11-17 9:04 ` Cunhao Lu via B4 Relay
1 sibling, 0 replies; 4+ messages in thread
From: Cunhao Lu via B4 Relay @ 2026-11-17 9:04 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. Skip parsing the
deprecated tx_delay and rx_delay properties for RK3572.
Signed-off-by: Cunhao Lu <1579567540@qq.com>
---
Changes in v4:
- Skip legacy delay properties and disable MAC RGMII delays on RK3572.
---
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 94 ++++++++++++++++++++------
1 file changed, 75 insertions(+), 19 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
index a37df5767d84..95889cbc4c39 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 __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,
+ .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
@@ -1331,26 +1383,29 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev,
bsp_priv->clock_input = false;
}
- 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);
- } else {
- dev_info(dev, "TX delay(0x%x).\n", value);
- bsp_priv->tx_delay = value;
- }
+ /* Skip parsing legacy tx_delay and rx_delay properties on new SoCs. */
+ if (ops != &rk3572_ops) {
+ 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);
+ } else {
+ dev_info(dev, "TX delay(0x%x).\n", value);
+ bsp_priv->tx_delay = value;
+ }
- 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.");
- dev_err(dev, "set rx_delay to 0x%x\n",
- bsp_priv->rx_delay);
- } else {
- dev_info(dev, "RX delay(0x%x).\n", value);
- bsp_priv->rx_delay = value;
+ 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.");
+ dev_err(dev, "set rx_delay to 0x%x\n",
+ bsp_priv->rx_delay);
+ } else {
+ dev_info(dev, "RX delay(0x%x).\n", value);
+ bsp_priv->rx_delay = value;
+ }
}
bsp_priv->grf = syscon_regmap_lookup_by_phandle(dev->of_node,
@@ -1720,6 +1775,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] 4+ messages in thread