* [PATCH net-next 0/6] net: stmmac: rk: final cleanups part
@ 2026-02-04 9:14 Russell King (Oracle)
2026-02-04 9:14 ` [PATCH net-next 1/6] net: stmmac: rk: introduce flags indicating support for RGMII/RMII Russell King (Oracle)
` (6 more replies)
0 siblings, 7 replies; 20+ messages in thread
From: Russell King (Oracle) @ 2026-02-04 9:14 UTC (permalink / raw)
To: Andrew Lunn
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Heiko Stuebner, Jakub Kicinski, linux-arm-kernel, linux-rockchip,
linux-stm32, netdev, Paolo Abeni
Hi,
This is the last part of my current dwmac-rk cleanups.
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 361 ++++++++++---------------
1 file changed, 150 insertions(+), 211 deletions(-)
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH net-next 1/6] net: stmmac: rk: introduce flags indicating support for RGMII/RMII
2026-02-04 9:14 [PATCH net-next 0/6] net: stmmac: rk: final cleanups part Russell King (Oracle)
@ 2026-02-04 9:14 ` Russell King (Oracle)
2026-02-04 9:39 ` Maxime Chevallier
2026-02-04 19:57 ` Heiko Stübner
2026-02-04 9:14 ` [PATCH net-next 2/6] net: stmmac: rk: replace empty set_to_rmii() with supports_rmii Russell King (Oracle)
` (5 subsequent siblings)
6 siblings, 2 replies; 20+ messages in thread
From: Russell King (Oracle) @ 2026-02-04 9:14 UTC (permalink / raw)
To: Andrew Lunn
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Heiko Stuebner, Jakub Kicinski, linux-arm-kernel, linux-rockchip,
linux-stm32, netdev, Paolo Abeni
Introduce two boolean flags into struct rk_priv_data indicating
whether RGMII and/or RMII is supported for this instance. Use these
to configure the supported_interfaces mask for phylink, validate the
interface mode. Initialise these from equivalent flags in the
rk_gmac_ops or depending on the presence of the ops->set_to_rgmii and
ops->set_to_mii methods. Finally, make ops->set_to_* optional.
This will allow us to get rid of empty set_to_rmii() methods.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
.../net/ethernet/stmicro/stmmac/dwmac-rk.c | 35 +++++++++++++------
1 file changed, 25 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
index c56cc40683a3..73d471844022 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
@@ -53,6 +53,8 @@ struct rk_gmac_ops {
bool gmac_grf_reg_in_php;
bool clock_grf_reg_in_php;
+ bool supports_rgmii;
+ bool supports_rmii;
bool php_grf_required;
bool regs_valid;
u32 regs[];
@@ -86,6 +88,8 @@ struct rk_priv_data {
bool clk_enabled;
bool clock_input;
bool integrated_phy;
+ bool supports_rgmii;
+ bool supports_rmii;
struct clk_bulk_data *clks;
int num_clks;
@@ -1415,6 +1419,9 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev,
bsp_priv->clock_grf_reg = ops->clock_grf_reg;
bsp_priv->clock = ops->clock;
+ bsp_priv->supports_rgmii = ops->supports_rgmii || !!ops->set_to_rgmii;
+ bsp_priv->supports_rmii = ops->supports_rmii || !!ops->set_to_rmii;
+
if (ops->init) {
ret = ops->init(bsp_priv);
if (ret) {
@@ -1434,11 +1441,11 @@ static int rk_gmac_check_ops(struct rk_priv_data *bsp_priv)
case PHY_INTERFACE_MODE_RGMII_ID:
case PHY_INTERFACE_MODE_RGMII_RXID:
case PHY_INTERFACE_MODE_RGMII_TXID:
- if (!bsp_priv->ops->set_to_rgmii)
+ if (!bsp_priv->supports_rgmii)
return -EINVAL;
break;
case PHY_INTERFACE_MODE_RMII:
- if (!bsp_priv->ops->set_to_rmii)
+ if (!bsp_priv->supports_rmii)
return -EINVAL;
break;
default:
@@ -1489,24 +1496,32 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_priv)
switch (bsp_priv->phy_iface) {
case PHY_INTERFACE_MODE_RGMII:
dev_info(dev, "init for RGMII\n");
- bsp_priv->ops->set_to_rgmii(bsp_priv, bsp_priv->tx_delay,
- bsp_priv->rx_delay);
+ if (bsp_priv->ops->set_to_rgmii)
+ bsp_priv->ops->set_to_rgmii(bsp_priv,
+ bsp_priv->tx_delay,
+ bsp_priv->rx_delay);
break;
case PHY_INTERFACE_MODE_RGMII_ID:
dev_info(dev, "init for RGMII_ID\n");
- bsp_priv->ops->set_to_rgmii(bsp_priv, 0, 0);
+ if (bsp_priv->ops->set_to_rgmii)
+ bsp_priv->ops->set_to_rgmii(bsp_priv, 0, 0);
break;
case PHY_INTERFACE_MODE_RGMII_RXID:
dev_info(dev, "init for RGMII_RXID\n");
- bsp_priv->ops->set_to_rgmii(bsp_priv, bsp_priv->tx_delay, 0);
+ if (bsp_priv->ops->set_to_rgmii)
+ bsp_priv->ops->set_to_rgmii(bsp_priv,
+ bsp_priv->tx_delay, 0);
break;
case PHY_INTERFACE_MODE_RGMII_TXID:
dev_info(dev, "init for RGMII_TXID\n");
- bsp_priv->ops->set_to_rgmii(bsp_priv, 0, bsp_priv->rx_delay);
+ if (bsp_priv->ops->set_to_rgmii)
+ bsp_priv->ops->set_to_rgmii(bsp_priv,
+ 0, bsp_priv->rx_delay);
break;
case PHY_INTERFACE_MODE_RMII:
dev_info(dev, "init for RMII\n");
- bsp_priv->ops->set_to_rmii(bsp_priv);
+ if (bsp_priv->ops->set_to_rmii)
+ bsp_priv->ops->set_to_rmii(bsp_priv);
break;
default:
dev_err(dev, "NO interface defined!\n");
@@ -1542,10 +1557,10 @@ static void rk_get_interfaces(struct stmmac_priv *priv, void *bsp_priv,
{
struct rk_priv_data *rk = bsp_priv;
- if (rk->ops->set_to_rgmii)
+ if (rk->supports_rgmii)
phy_interface_set_rgmii(interfaces);
- if (rk->ops->set_to_rmii)
+ if (rk->supports_rmii)
__set_bit(PHY_INTERFACE_MODE_RMII, interfaces);
}
--
2.47.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH net-next 2/6] net: stmmac: rk: replace empty set_to_rmii() with supports_rmii
2026-02-04 9:14 [PATCH net-next 0/6] net: stmmac: rk: final cleanups part Russell King (Oracle)
2026-02-04 9:14 ` [PATCH net-next 1/6] net: stmmac: rk: introduce flags indicating support for RGMII/RMII Russell King (Oracle)
@ 2026-02-04 9:14 ` Russell King (Oracle)
2026-02-04 9:40 ` Maxime Chevallier
2026-02-04 19:58 ` Heiko Stübner
2026-02-04 9:14 ` [PATCH net-next 3/6] net: stmmac: rk: rk3328: gmac2phy only supports RMII Russell King (Oracle)
` (4 subsequent siblings)
6 siblings, 2 replies; 20+ messages in thread
From: Russell King (Oracle) @ 2026-02-04 9:14 UTC (permalink / raw)
To: Andrew Lunn
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Heiko Stuebner, Jakub Kicinski, linux-arm-kernel, linux-rockchip,
linux-stm32, netdev, Paolo Abeni
Rather than providing a now-empty set_to_rmii() method to indicate
that RMII is supported, switch to setting ops->supports_rmii instead.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
.../net/ethernet/stmicro/stmmac/dwmac-rk.c | 86 ++++++-------------
1 file changed, 24 insertions(+), 62 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
index 73d471844022..25ad8600e9e2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
@@ -268,12 +268,7 @@ static void rk_gmac_integrated_fephy_powerdown(struct rk_priv_data *priv,
#define PX30_GRF_GMAC_CON1 0x0904
-static void px30_set_to_rmii(struct rk_priv_data *bsp_priv)
-{
-}
-
static const struct rk_gmac_ops px30_ops = {
- .set_to_rmii = px30_set_to_rmii,
.set_speed = rk_set_clk_mac_speed,
.gmac_grf_reg = PX30_GRF_GMAC_CON1,
@@ -281,6 +276,8 @@ static const struct rk_gmac_ops px30_ops = {
.clock_grf_reg = PX30_GRF_GMAC_CON1,
.clock.mac_speed_mask = BIT_U16(2),
+
+ .supports_rmii = true,
};
#define RK3128_GRF_MAC_CON0 0x0168
@@ -307,13 +304,8 @@ static void rk3128_set_to_rgmii(struct rk_priv_data *bsp_priv,
RK3128_GMAC_CLK_TX_DL_CFG(tx_delay));
}
-static void rk3128_set_to_rmii(struct rk_priv_data *bsp_priv)
-{
-}
-
static const struct rk_gmac_ops rk3128_ops = {
.set_to_rgmii = rk3128_set_to_rgmii,
- .set_to_rmii = rk3128_set_to_rmii,
.gmac_grf_reg = RK3128_GRF_MAC_CON1,
.gmac_phy_intf_sel_mask = GENMASK_U16(8, 6),
@@ -323,6 +315,8 @@ static const struct rk_gmac_ops rk3128_ops = {
.clock.gmii_clk_sel_mask = GENMASK_U16(13, 12),
.clock.rmii_clk_sel_mask = BIT_U16(11),
.clock.mac_speed_mask = BIT_U16(10),
+
+ .supports_rmii = true,
};
#define RK3228_GRF_MAC_CON0 0x0900
@@ -410,13 +404,8 @@ static void rk3288_set_to_rgmii(struct rk_priv_data *bsp_priv,
RK3288_GMAC_CLK_TX_DL_CFG(tx_delay));
}
-static void rk3288_set_to_rmii(struct rk_priv_data *bsp_priv)
-{
-}
-
static const struct rk_gmac_ops rk3288_ops = {
.set_to_rgmii = rk3288_set_to_rgmii,
- .set_to_rmii = rk3288_set_to_rmii,
.gmac_grf_reg = RK3288_GRF_SOC_CON1,
.gmac_phy_intf_sel_mask = GENMASK_U16(8, 6),
@@ -426,6 +415,8 @@ static const struct rk_gmac_ops rk3288_ops = {
.clock.gmii_clk_sel_mask = GENMASK_U16(13, 12),
.clock.rmii_clk_sel_mask = BIT_U16(11),
.clock.mac_speed_mask = BIT_U16(10),
+
+ .supports_rmii = true,
};
#define RK3308_GRF_MAC_CON0 0x04a0
@@ -434,18 +425,14 @@ static const struct rk_gmac_ops rk3288_ops = {
#define RK3308_GMAC_FLOW_CTRL GRF_BIT(3)
#define RK3308_GMAC_FLOW_CTRL_CLR GRF_CLR_BIT(3)
-static void rk3308_set_to_rmii(struct rk_priv_data *bsp_priv)
-{
-}
-
static const struct rk_gmac_ops rk3308_ops = {
- .set_to_rmii = rk3308_set_to_rmii,
-
.gmac_grf_reg = RK3308_GRF_MAC_CON0,
.gmac_phy_intf_sel_mask = GENMASK_U16(4, 2),
.clock_grf_reg = RK3308_GRF_MAC_CON0,
.clock.mac_speed_mask = BIT_U16(0),
+
+ .supports_rmii = true,
};
#define RK3328_GRF_MAC_CON0 0x0900
@@ -497,10 +484,6 @@ static void rk3328_set_to_rgmii(struct rk_priv_data *bsp_priv,
RK3328_GMAC_CLK_TX_DL_CFG(tx_delay));
}
-static void rk3328_set_to_rmii(struct rk_priv_data *bsp_priv)
-{
-}
-
static void rk3328_integrated_phy_powerup(struct rk_priv_data *priv)
{
regmap_write(priv->grf, RK3328_GRF_MACPHY_CON1,
@@ -512,7 +495,6 @@ static void rk3328_integrated_phy_powerup(struct rk_priv_data *priv)
static const struct rk_gmac_ops rk3328_ops = {
.init = rk3328_init,
.set_to_rgmii = rk3328_set_to_rgmii,
- .set_to_rmii = rk3328_set_to_rmii,
.integrated_phy_powerup = rk3328_integrated_phy_powerup,
.integrated_phy_powerdown = rk_gmac_integrated_ephy_powerdown,
@@ -522,6 +504,8 @@ static const struct rk_gmac_ops rk3328_ops = {
.clock.rmii_clk_sel_mask = BIT_U16(7),
.clock.mac_speed_mask = BIT_U16(2),
+ .supports_rmii = true,
+
.regs_valid = true,
.regs = {
0xff540000, /* gmac2io */
@@ -554,13 +538,8 @@ static void rk3366_set_to_rgmii(struct rk_priv_data *bsp_priv,
RK3366_GMAC_CLK_TX_DL_CFG(tx_delay));
}
-static void rk3366_set_to_rmii(struct rk_priv_data *bsp_priv)
-{
-}
-
static const struct rk_gmac_ops rk3366_ops = {
.set_to_rgmii = rk3366_set_to_rgmii,
- .set_to_rmii = rk3366_set_to_rmii,
.gmac_grf_reg = RK3366_GRF_SOC_CON6,
.gmac_phy_intf_sel_mask = GENMASK_U16(11, 9),
@@ -570,6 +549,8 @@ static const struct rk_gmac_ops rk3366_ops = {
.clock.gmii_clk_sel_mask = GENMASK_U16(5, 4),
.clock.rmii_clk_sel_mask = BIT_U16(3),
.clock.mac_speed_mask = BIT_U16(7),
+
+ .supports_rmii = true,
};
#define RK3368_GRF_SOC_CON15 0x043c
@@ -596,13 +577,8 @@ static void rk3368_set_to_rgmii(struct rk_priv_data *bsp_priv,
RK3368_GMAC_CLK_TX_DL_CFG(tx_delay));
}
-static void rk3368_set_to_rmii(struct rk_priv_data *bsp_priv)
-{
-}
-
static const struct rk_gmac_ops rk3368_ops = {
.set_to_rgmii = rk3368_set_to_rgmii,
- .set_to_rmii = rk3368_set_to_rmii,
.gmac_grf_reg = RK3368_GRF_SOC_CON15,
.gmac_phy_intf_sel_mask = GENMASK_U16(11, 9),
@@ -612,6 +588,8 @@ static const struct rk_gmac_ops rk3368_ops = {
.clock.gmii_clk_sel_mask = GENMASK_U16(5, 4),
.clock.rmii_clk_sel_mask = BIT_U16(3),
.clock.mac_speed_mask = BIT_U16(7),
+
+ .supports_rmii = true,
};
#define RK3399_GRF_SOC_CON5 0xc214
@@ -638,13 +616,8 @@ static void rk3399_set_to_rgmii(struct rk_priv_data *bsp_priv,
RK3399_GMAC_CLK_TX_DL_CFG(tx_delay));
}
-static void rk3399_set_to_rmii(struct rk_priv_data *bsp_priv)
-{
-}
-
static const struct rk_gmac_ops rk3399_ops = {
.set_to_rgmii = rk3399_set_to_rgmii,
- .set_to_rmii = rk3399_set_to_rmii,
.gmac_grf_reg = RK3399_GRF_SOC_CON5,
.gmac_phy_intf_sel_mask = GENMASK_U16(11, 9),
@@ -654,6 +627,8 @@ static const struct rk_gmac_ops rk3399_ops = {
.clock.gmii_clk_sel_mask = GENMASK_U16(5, 4),
.clock.rmii_clk_sel_mask = BIT_U16(3),
.clock.mac_speed_mask = BIT_U16(7),
+
+ .supports_rmii = true,
};
#define RK3506_GRF_SOC_CON8 0x0020
@@ -884,18 +859,15 @@ static void rk3568_set_to_rgmii(struct rk_priv_data *bsp_priv,
RK3568_GMAC_TXCLK_DLY_ENABLE);
}
-static void rk3568_set_to_rmii(struct rk_priv_data *bsp_priv)
-{
-}
-
static const struct rk_gmac_ops rk3568_ops = {
.init = rk3568_init,
.set_to_rgmii = rk3568_set_to_rgmii,
- .set_to_rmii = rk3568_set_to_rmii,
.set_speed = rk_set_clk_mac_speed,
.gmac_phy_intf_sel_mask = GENMASK_U16(6, 4),
+ .supports_rmii = true,
+
.regs_valid = true,
.regs = {
0xfe2a0000, /* gmac0 */
@@ -969,10 +941,6 @@ static void rk3576_set_to_rgmii(struct rk_priv_data *bsp_priv,
RK3576_GMAC_CLK_RX_DL_CFG(rx_delay));
}
-static void rk3576_set_to_rmii(struct rk_priv_data *bsp_priv)
-{
-}
-
static void rk3576_set_clock_selection(struct rk_priv_data *bsp_priv, bool input,
bool enable)
{
@@ -992,7 +960,6 @@ static void rk3576_set_clock_selection(struct rk_priv_data *bsp_priv, bool input
static const struct rk_gmac_ops rk3576_ops = {
.init = rk3576_init,
.set_to_rgmii = rk3576_set_to_rgmii,
- .set_to_rmii = rk3576_set_to_rmii,
.set_clock_selection = rk3576_set_clock_selection,
.gmac_rmii_mode_mask = BIT_U16(3),
@@ -1000,6 +967,8 @@ static const struct rk_gmac_ops rk3576_ops = {
.clock.gmii_clk_sel_mask = GENMASK_U16(6, 5),
.clock.rmii_clk_sel_mask = BIT_U16(5),
+ .supports_rmii = true,
+
.php_grf_required = true,
.regs_valid = true,
.regs = {
@@ -1120,19 +1089,15 @@ static const struct rk_gmac_ops rk3588_ops = {
#define RV1108_GMAC_FLOW_CTRL GRF_BIT(3)
#define RV1108_GMAC_FLOW_CTRL_CLR GRF_CLR_BIT(3)
-static void rv1108_set_to_rmii(struct rk_priv_data *bsp_priv)
-{
-}
-
static const struct rk_gmac_ops rv1108_ops = {
- .set_to_rmii = rv1108_set_to_rmii,
-
.gmac_grf_reg = RV1108_GRF_GMAC_CON0,
.gmac_phy_intf_sel_mask = GENMASK_U16(6, 4),
.clock_grf_reg = RV1108_GRF_GMAC_CON0,
.clock.rmii_clk_sel_mask = BIT_U16(7),
.clock.mac_speed_mask = BIT_U16(2),
+
+ .supports_rmii = true,
};
#define RV1126_GRF_GMAC_CON0 0X0070
@@ -1176,17 +1141,14 @@ static void rv1126_set_to_rgmii(struct rk_priv_data *bsp_priv,
RV1126_GMAC_M1_CLK_TX_DL_CFG(tx_delay));
}
-static void rv1126_set_to_rmii(struct rk_priv_data *bsp_priv)
-{
-}
-
static const struct rk_gmac_ops rv1126_ops = {
.set_to_rgmii = rv1126_set_to_rgmii,
- .set_to_rmii = rv1126_set_to_rmii,
.set_speed = rk_set_clk_mac_speed,
.gmac_grf_reg = RV1126_GRF_GMAC_CON0,
.gmac_phy_intf_sel_mask = GENMASK_U16(6, 4),
+
+ .supports_rmii = true,
};
static int rk_gmac_clk_init(struct plat_stmmacenet_data *plat)
--
2.47.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH net-next 3/6] net: stmmac: rk: rk3328: gmac2phy only supports RMII
2026-02-04 9:14 [PATCH net-next 0/6] net: stmmac: rk: final cleanups part Russell King (Oracle)
2026-02-04 9:14 ` [PATCH net-next 1/6] net: stmmac: rk: introduce flags indicating support for RGMII/RMII Russell King (Oracle)
2026-02-04 9:14 ` [PATCH net-next 2/6] net: stmmac: rk: replace empty set_to_rmii() with supports_rmii Russell King (Oracle)
@ 2026-02-04 9:14 ` Russell King (Oracle)
2026-02-04 9:43 ` Maxime Chevallier
2026-02-04 20:00 ` Heiko Stübner
2026-02-04 9:14 ` [PATCH net-next 4/6] net: stmmac: rk: rk3528: gmac0 " Russell King (Oracle)
` (3 subsequent siblings)
6 siblings, 2 replies; 20+ messages in thread
From: Russell King (Oracle) @ 2026-02-04 9:14 UTC (permalink / raw)
To: Andrew Lunn
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Heiko Stuebner, Jakub Kicinski, linux-arm-kernel, linux-rockchip,
linux-stm32, netdev, Paolo Abeni
As detailed in a previous commit ("net: stmmac: rk: convert rk3328 to
use bsp_priv->id") rk3328 gmac2phy only supports RMII, whereas gmac2io
supports both RMII and RGMII. Clear supports_rgmii for gmac2phy.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
index 25ad8600e9e2..8dd2122fd9b1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
@@ -465,6 +465,7 @@ static int rk3328_init(struct rk_priv_data *bsp_priv)
case 1: /* gmac2phy */
bsp_priv->gmac_grf_reg = RK3328_GRF_MAC_CON2;
bsp_priv->clock_grf_reg = RK3328_GRF_MAC_CON2;
+ bsp_priv->supports_rgmii = false;
return 0;
default:
--
2.47.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH net-next 4/6] net: stmmac: rk: rk3528: gmac0 only supports RMII
2026-02-04 9:14 [PATCH net-next 0/6] net: stmmac: rk: final cleanups part Russell King (Oracle)
` (2 preceding siblings ...)
2026-02-04 9:14 ` [PATCH net-next 3/6] net: stmmac: rk: rk3328: gmac2phy only supports RMII Russell King (Oracle)
@ 2026-02-04 9:14 ` Russell King (Oracle)
2026-02-04 9:43 ` Maxime Chevallier
2026-02-04 20:01 ` Heiko Stübner
2026-02-04 9:14 ` [PATCH net-next 5/6] net: stmmac: rk: use rk_encode_wm16() for clock selection Russell King (Oracle)
` (2 subsequent siblings)
6 siblings, 2 replies; 20+ messages in thread
From: Russell King (Oracle) @ 2026-02-04 9:14 UTC (permalink / raw)
To: Andrew Lunn
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Heiko Stuebner, Jakub Kicinski, linux-arm-kernel, linux-rockchip,
linux-stm32, netdev, Paolo Abeni
RK3528 gmac0 dtsi contains:
gmac0: ethernet@ffbd0000 {
phy-handle = <&rmii0_phy>;
phy-mode = "rmii";
mdio0: mdio {
rmii0_phy: ethernet-phy@2 {
phy-is-integrated;
};
};
};
This follows the same pattern as rk3328, where this gmac instance
only supports RMII. Disable RGMII in phylink's supported_interfaces
mask for this gmac instance.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
index 8dd2122fd9b1..4099cbc5d0de 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
@@ -728,6 +728,7 @@ static int rk3528_init(struct rk_priv_data *bsp_priv)
case 0:
bsp_priv->clock_grf_reg = RK3528_VO_GRF_GMAC_CON;
bsp_priv->clock.rmii_clk_sel_mask = BIT_U16(3);
+ bsp_priv->supports_rgmii = false;
return 0;
case 1:
--
2.47.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH net-next 5/6] net: stmmac: rk: use rk_encode_wm16() for clock selection
2026-02-04 9:14 [PATCH net-next 0/6] net: stmmac: rk: final cleanups part Russell King (Oracle)
` (3 preceding siblings ...)
2026-02-04 9:14 ` [PATCH net-next 4/6] net: stmmac: rk: rk3528: gmac0 " Russell King (Oracle)
@ 2026-02-04 9:14 ` Russell King (Oracle)
2026-02-04 22:03 ` Heiko Stübner
2026-02-04 9:14 ` [PATCH net-next 6/6] net: stmmac: rk: rk3506, rk3528 and rk3588 have rmii_mode in clock register Russell King (Oracle)
2026-02-05 17:30 ` [PATCH net-next 0/6] net: stmmac: rk: final cleanups part patchwork-bot+netdevbpf
6 siblings, 1 reply; 20+ messages in thread
From: Russell King (Oracle) @ 2026-02-04 9:14 UTC (permalink / raw)
To: Andrew Lunn
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Heiko Stuebner, Jakub Kicinski, linux-arm-kernel, linux-rockchip,
linux-stm32, netdev, Paolo Abeni
Use rk_encode_wm16() for RMII clock gating control, and also for the
io_clksel bit used to select the transmit clock between CRU-derived
and IO-derived clock sources.
Both of these were configured via the "set_clock_selection" method in
the SoC specific operations, but there is no requirement to change the
io_clksel except when enabling clocks.
It is also possible that we don't need to ungate the RMII clock if we
are operating in RGMII mode, but this commit makes no change there.
Split up the configuration of these as separate functions, and remove
the set_clock_selection() method. Since these clocking bits are in the
same register that we call the "speed" register, move the logic for
writing that register into rk_write_speed_grf_reg().
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
.../net/ethernet/stmicro/stmmac/dwmac-rk.c | 174 ++++++++----------
1 file changed, 75 insertions(+), 99 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
index 4099cbc5d0de..ed9adac70f0a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
@@ -27,8 +27,17 @@
struct rk_priv_data;
struct rk_clock_fields {
+ /* io_clksel_cru_mask - io_clksel bit in clock GRF register which,
+ * when set, selects the tx clock from CRU.
+ */
+ u16 io_clksel_cru_mask;
+ /* io_clksel_io_mask - io_clksel bit in clock GRF register which,
+ * when set, selects the tx clock from IO.
+ */
+ u16 io_clksel_io_mask;
u16 gmii_clk_sel_mask;
u16 rmii_clk_sel_mask;
+ u16 rmii_gate_en_mask;
u16 mac_speed_mask;
};
@@ -39,8 +48,6 @@ struct rk_gmac_ops {
void (*set_to_rmii)(struct rk_priv_data *bsp_priv);
int (*set_speed)(struct rk_priv_data *bsp_priv,
phy_interface_t interface, int speed);
- void (*set_clock_selection)(struct rk_priv_data *bsp_priv, bool input,
- bool enable);
void (*integrated_phy_powerup)(struct rk_priv_data *bsp_priv);
void (*integrated_phy_powerdown)(struct rk_priv_data *bsp_priv);
@@ -171,6 +178,54 @@ static int rk_write_clock_grf_reg(struct rk_priv_data *bsp_priv, u32 val)
return regmap_write(regmap, bsp_priv->clock_grf_reg, val);
}
+static int rk_set_rmii_gate_en(struct rk_priv_data *bsp_priv, bool state)
+{
+ u32 val;
+
+ if (!bsp_priv->clock.rmii_gate_en_mask)
+ return 0;
+
+ val = rk_encode_wm16(state, bsp_priv->clock.rmii_gate_en_mask);
+
+ return rk_write_clock_grf_reg(bsp_priv, val);
+}
+
+static int rk_ungate_rmii_clock(struct rk_priv_data *bsp_priv)
+{
+ return rk_set_rmii_gate_en(bsp_priv, false);
+}
+
+static int rk_gate_rmii_clock(struct rk_priv_data *bsp_priv)
+{
+ return rk_set_rmii_gate_en(bsp_priv, true);
+}
+
+static int rk_configure_io_clksel(struct rk_priv_data *bsp_priv)
+{
+ bool io, cru;
+ u32 val;
+
+ if (!bsp_priv->clock.io_clksel_io_mask &&
+ !bsp_priv->clock.io_clksel_cru_mask)
+ return 0;
+
+ io = bsp_priv->clock_input;
+ cru = !io;
+
+ /* The io_clksel configuration can be either:
+ * 0=CRU, 1=IO (rk3506, rk3520, rk3576) or
+ * 0=IO, 1=CRU (rk3588)
+ * where CRU means the transmit clock comes from the CRU and IO
+ * means the transmit clock comes from IO.
+ *
+ * Handle this by having two masks.
+ */
+ val = rk_encode_wm16(io, bsp_priv->clock.io_clksel_io_mask) |
+ rk_encode_wm16(cru, bsp_priv->clock.io_clksel_cru_mask);
+
+ return rk_write_clock_grf_reg(bsp_priv, val);
+}
+
static int rk_set_clk_mac_speed(struct rk_priv_data *bsp_priv,
phy_interface_t interface, int speed)
{
@@ -637,12 +692,6 @@ static const struct rk_gmac_ops rk3399_ops = {
#define RK3506_GMAC_RMII_MODE GRF_BIT(1)
-#define RK3506_GMAC_CLK_SELECT_CRU GRF_CLR_BIT(5)
-#define RK3506_GMAC_CLK_SELECT_IO GRF_BIT(5)
-
-#define RK3506_GMAC_CLK_RMII_GATE GRF_BIT(2)
-#define RK3506_GMAC_CLK_RMII_NOGATE GRF_CLR_BIT(2)
-
static int rk3506_init(struct rk_priv_data *bsp_priv)
{
switch (bsp_priv->id) {
@@ -667,26 +716,13 @@ static void rk3506_set_to_rmii(struct rk_priv_data *bsp_priv)
regmap_write(bsp_priv->grf, offset, RK3506_GMAC_RMII_MODE);
}
-static void rk3506_set_clock_selection(struct rk_priv_data *bsp_priv,
- bool input, bool enable)
-{
- unsigned int value, offset, id = bsp_priv->id;
-
- offset = (id == 1) ? RK3506_GRF_SOC_CON11 : RK3506_GRF_SOC_CON8;
-
- value = input ? RK3506_GMAC_CLK_SELECT_IO :
- RK3506_GMAC_CLK_SELECT_CRU;
- value |= enable ? RK3506_GMAC_CLK_RMII_NOGATE :
- RK3506_GMAC_CLK_RMII_GATE;
- regmap_write(bsp_priv->grf, offset, value);
-}
-
static const struct rk_gmac_ops rk3506_ops = {
.init = rk3506_init,
.set_to_rmii = rk3506_set_to_rmii,
- .set_clock_selection = rk3506_set_clock_selection,
+ .clock.io_clksel_io_mask = BIT_U16(5),
.clock.rmii_clk_sel_mask = BIT_U16(3),
+ .clock.rmii_gate_en_mask = BIT_U16(2),
.regs_valid = true,
.regs = {
@@ -714,27 +750,22 @@ static const struct rk_gmac_ops rk3506_ops = {
#define RK3528_GMAC1_PHY_INTF_SEL_RGMII GRF_CLR_BIT(8)
#define RK3528_GMAC1_PHY_INTF_SEL_RMII GRF_BIT(8)
-#define RK3528_GMAC1_CLK_SELECT_CRU GRF_CLR_BIT(12)
-#define RK3528_GMAC1_CLK_SELECT_IO GRF_BIT(12)
-
-#define RK3528_GMAC0_CLK_RMII_GATE GRF_BIT(2)
-#define RK3528_GMAC0_CLK_RMII_NOGATE GRF_CLR_BIT(2)
-#define RK3528_GMAC1_CLK_RMII_GATE GRF_BIT(9)
-#define RK3528_GMAC1_CLK_RMII_NOGATE GRF_CLR_BIT(9)
-
static int rk3528_init(struct rk_priv_data *bsp_priv)
{
switch (bsp_priv->id) {
case 0:
bsp_priv->clock_grf_reg = RK3528_VO_GRF_GMAC_CON;
bsp_priv->clock.rmii_clk_sel_mask = BIT_U16(3);
+ bsp_priv->clock.rmii_gate_en_mask = BIT_U16(2);
bsp_priv->supports_rgmii = false;
return 0;
case 1:
bsp_priv->clock_grf_reg = RK3528_VPU_GRF_GMAC_CON5;
+ bsp_priv->clock.io_clksel_io_mask = BIT_U16(12);
bsp_priv->clock.gmii_clk_sel_mask = GENMASK_U16(11, 10);
bsp_priv->clock.rmii_clk_sel_mask = BIT_U16(10);
+ bsp_priv->clock.rmii_gate_en_mask = BIT_U16(9);
return 0;
default:
@@ -766,24 +797,6 @@ static void rk3528_set_to_rmii(struct rk_priv_data *bsp_priv)
RK3528_GMAC0_PHY_INTF_SEL_RMII);
}
-static void rk3528_set_clock_selection(struct rk_priv_data *bsp_priv,
- bool input, bool enable)
-{
- unsigned int val;
-
- if (bsp_priv->id == 1) {
- val = input ? RK3528_GMAC1_CLK_SELECT_IO :
- RK3528_GMAC1_CLK_SELECT_CRU;
- val |= enable ? RK3528_GMAC1_CLK_RMII_NOGATE :
- RK3528_GMAC1_CLK_RMII_GATE;
- regmap_write(bsp_priv->grf, RK3528_VPU_GRF_GMAC_CON5, val);
- } else {
- val = enable ? RK3528_GMAC0_CLK_RMII_NOGATE :
- RK3528_GMAC0_CLK_RMII_GATE;
- regmap_write(bsp_priv->grf, RK3528_VO_GRF_GMAC_CON, val);
- }
-}
-
static void rk3528_integrated_phy_powerup(struct rk_priv_data *bsp_priv)
{
rk_gmac_integrated_fephy_powerup(bsp_priv, RK3528_VO_GRF_MACPHY_CON0);
@@ -798,7 +811,6 @@ static const struct rk_gmac_ops rk3528_ops = {
.init = rk3528_init,
.set_to_rgmii = rk3528_set_to_rgmii,
.set_to_rmii = rk3528_set_to_rmii,
- .set_clock_selection = rk3528_set_clock_selection,
.integrated_phy_powerup = rk3528_integrated_phy_powerup,
.integrated_phy_powerdown = rk3528_integrated_phy_powerdown,
.regs_valid = true,
@@ -896,12 +908,6 @@ static const struct rk_gmac_ops rk3568_ops = {
#define RK3576_GRF_GMAC_CON0 0X0020
#define RK3576_GRF_GMAC_CON1 0X0024
-#define RK3576_GMAC_CLK_SELECT_IO GRF_BIT(7)
-#define RK3576_GMAC_CLK_SELECT_CRU GRF_CLR_BIT(7)
-
-#define RK3576_GMAC_CLK_RMII_GATE GRF_BIT(4)
-#define RK3576_GMAC_CLK_RMII_NOGATE GRF_CLR_BIT(4)
-
static int rk3576_init(struct rk_priv_data *bsp_priv)
{
switch (bsp_priv->id) {
@@ -943,31 +949,16 @@ static void rk3576_set_to_rgmii(struct rk_priv_data *bsp_priv,
RK3576_GMAC_CLK_RX_DL_CFG(rx_delay));
}
-static void rk3576_set_clock_selection(struct rk_priv_data *bsp_priv, bool input,
- bool enable)
-{
- unsigned int val = input ? RK3576_GMAC_CLK_SELECT_IO :
- RK3576_GMAC_CLK_SELECT_CRU;
- unsigned int offset_con;
-
- val |= enable ? RK3576_GMAC_CLK_RMII_NOGATE :
- RK3576_GMAC_CLK_RMII_GATE;
-
- offset_con = bsp_priv->id == 1 ? RK3576_GRF_GMAC_CON1 :
- RK3576_GRF_GMAC_CON0;
-
- regmap_write(bsp_priv->grf, offset_con, val);
-}
-
static const struct rk_gmac_ops rk3576_ops = {
.init = rk3576_init,
.set_to_rgmii = rk3576_set_to_rgmii,
- .set_clock_selection = rk3576_set_clock_selection,
.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,
@@ -1000,25 +991,23 @@ static const struct rk_gmac_ops rk3576_ops = {
#define RK3588_GMAC_CLK_RMII_MODE(id) GRF_BIT(5 * (id))
#define RK3588_GMAC_CLK_RGMII_MODE(id) GRF_CLR_BIT(5 * (id))
-#define RK3588_GMAC_CLK_SELECT_CRU(id) GRF_BIT(5 * (id) + 4)
-#define RK3588_GMAC_CLK_SELECT_IO(id) GRF_CLR_BIT(5 * (id) + 4)
-
-#define RK3588_GMAC_CLK_RMII_GATE(id) GRF_BIT(5 * (id) + 1)
-#define RK3588_GMAC_CLK_RMII_NOGATE(id) GRF_CLR_BIT(5 * (id) + 1)
-
static int rk3588_init(struct rk_priv_data *bsp_priv)
{
switch (bsp_priv->id) {
case 0:
bsp_priv->gmac_phy_intf_sel_mask = GENMASK_U16(5, 3);
+ bsp_priv->clock.io_clksel_cru_mask = BIT_U16(4);
bsp_priv->clock.gmii_clk_sel_mask = GENMASK_U16(3, 2);
bsp_priv->clock.rmii_clk_sel_mask = BIT_U16(2);
+ bsp_priv->clock.rmii_gate_en_mask = BIT_U16(1);
return 0;
case 1:
bsp_priv->gmac_phy_intf_sel_mask = GENMASK_U16(11, 9);
+ bsp_priv->clock.io_clksel_cru_mask = BIT_U16(9);
bsp_priv->clock.gmii_clk_sel_mask = GENMASK_U16(8, 7);
bsp_priv->clock.rmii_clk_sel_mask = BIT_U16(7);
+ bsp_priv->clock.rmii_gate_en_mask = BIT_U16(6);
return 0;
default:
@@ -1052,23 +1041,10 @@ static void rk3588_set_to_rmii(struct rk_priv_data *bsp_priv)
RK3588_GMAC_CLK_RMII_MODE(bsp_priv->id));
}
-static void rk3588_set_clock_selection(struct rk_priv_data *bsp_priv, bool input,
- bool enable)
-{
- unsigned int val = input ? RK3588_GMAC_CLK_SELECT_IO(bsp_priv->id) :
- RK3588_GMAC_CLK_SELECT_CRU(bsp_priv->id);
-
- val |= enable ? RK3588_GMAC_CLK_RMII_NOGATE(bsp_priv->id) :
- RK3588_GMAC_CLK_RMII_GATE(bsp_priv->id);
-
- regmap_write(bsp_priv->php_grf, RK3588_GRF_CLK_CON1, val);
-}
-
static const struct rk_gmac_ops rk3588_ops = {
.init = rk3588_init,
.set_to_rgmii = rk3588_set_to_rgmii,
.set_to_rmii = rk3588_set_to_rmii,
- .set_clock_selection = rk3588_set_clock_selection,
.gmac_grf_reg_in_php = true,
.gmac_grf_reg = RK3588_GRF_GMAC_CON0,
@@ -1216,19 +1192,15 @@ static int gmac_clk_enable(struct rk_priv_data *bsp_priv, bool enable)
if (ret)
return ret;
- if (bsp_priv->ops && bsp_priv->ops->set_clock_selection)
- bsp_priv->ops->set_clock_selection(bsp_priv,
- bsp_priv->clock_input, true);
+ rk_configure_io_clksel(bsp_priv);
+ rk_ungate_rmii_clock(bsp_priv);
mdelay(5);
bsp_priv->clk_enabled = true;
}
} else {
if (bsp_priv->clk_enabled) {
- if (bsp_priv->ops && bsp_priv->ops->set_clock_selection) {
- bsp_priv->ops->set_clock_selection(bsp_priv,
- bsp_priv->clock_input, false);
- }
+ rk_gate_rmii_clock(bsp_priv);
clk_bulk_disable_unprepare(bsp_priv->num_clks,
bsp_priv->clks);
@@ -1395,6 +1367,10 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev,
}
}
+ if (bsp_priv->clock.io_clksel_cru_mask &&
+ bsp_priv->clock.io_clksel_io_mask)
+ dev_warn(dev, "both CRU and IO io_clksel masks should not be populated - driver may malfunction\n");
+
return bsp_priv;
}
--
2.47.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH net-next 6/6] net: stmmac: rk: rk3506, rk3528 and rk3588 have rmii_mode in clock register
2026-02-04 9:14 [PATCH net-next 0/6] net: stmmac: rk: final cleanups part Russell King (Oracle)
` (4 preceding siblings ...)
2026-02-04 9:14 ` [PATCH net-next 5/6] net: stmmac: rk: use rk_encode_wm16() for clock selection Russell King (Oracle)
@ 2026-02-04 9:14 ` Russell King (Oracle)
2026-02-04 21:54 ` Heiko Stübner
2026-02-05 17:30 ` [PATCH net-next 0/6] net: stmmac: rk: final cleanups part patchwork-bot+netdevbpf
6 siblings, 1 reply; 20+ messages in thread
From: Russell King (Oracle) @ 2026-02-04 9:14 UTC (permalink / raw)
To: Andrew Lunn
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Heiko Stuebner, Jakub Kicinski, linux-arm-kernel, linux-rockchip,
linux-stm32, netdev, Paolo Abeni
rk3506, rk3528 and rk3588 have the rmii_mode bit in the clock GRF
register rather than the gmac GRF register. Provide a mask for this
field in the clock register, and convert these SoCs to use this.
Add the necessary code in rk_gmac_powerup() to write this field.
This allows us to get rid of these SoCs set_to_rmii() function. As
such, we need to mark these SoCs as supporting RMII mode.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
.../net/ethernet/stmicro/stmmac/dwmac-rk.c | 64 +++++++------------
1 file changed, 24 insertions(+), 40 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
index ed9adac70f0a..b0441a368cb1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
@@ -38,6 +38,7 @@ struct rk_clock_fields {
u16 gmii_clk_sel_mask;
u16 rmii_clk_sel_mask;
u16 rmii_gate_en_mask;
+ u16 rmii_mode_mask;
u16 mac_speed_mask;
};
@@ -708,21 +709,15 @@ static int rk3506_init(struct rk_priv_data *bsp_priv)
}
}
-static void rk3506_set_to_rmii(struct rk_priv_data *bsp_priv)
-{
- unsigned int id = bsp_priv->id, offset;
-
- offset = (id == 1) ? RK3506_GRF_SOC_CON11 : RK3506_GRF_SOC_CON8;
- regmap_write(bsp_priv->grf, offset, RK3506_GMAC_RMII_MODE);
-}
-
static const struct rk_gmac_ops rk3506_ops = {
.init = rk3506_init,
- .set_to_rmii = rk3506_set_to_rmii,
.clock.io_clksel_io_mask = BIT_U16(5),
.clock.rmii_clk_sel_mask = BIT_U16(3),
.clock.rmii_gate_en_mask = BIT_U16(2),
+ .clock.rmii_mode_mask = BIT_U16(1),
+
+ .supports_rmii = true,
.regs_valid = true,
.regs = {
@@ -746,10 +741,6 @@ static const struct rk_gmac_ops rk3506_ops = {
#define RK3528_GMAC_CLK_RX_DL_CFG(val) GRF_FIELD(15, 8, val)
#define RK3528_GMAC_CLK_TX_DL_CFG(val) GRF_FIELD(7, 0, val)
-#define RK3528_GMAC0_PHY_INTF_SEL_RMII GRF_BIT(1)
-#define RK3528_GMAC1_PHY_INTF_SEL_RGMII GRF_CLR_BIT(8)
-#define RK3528_GMAC1_PHY_INTF_SEL_RMII GRF_BIT(8)
-
static int rk3528_init(struct rk_priv_data *bsp_priv)
{
switch (bsp_priv->id) {
@@ -757,6 +748,7 @@ static int rk3528_init(struct rk_priv_data *bsp_priv)
bsp_priv->clock_grf_reg = RK3528_VO_GRF_GMAC_CON;
bsp_priv->clock.rmii_clk_sel_mask = BIT_U16(3);
bsp_priv->clock.rmii_gate_en_mask = BIT_U16(2);
+ bsp_priv->clock.rmii_mode_mask = BIT_U16(1);
bsp_priv->supports_rgmii = false;
return 0;
@@ -766,6 +758,7 @@ static int rk3528_init(struct rk_priv_data *bsp_priv)
bsp_priv->clock.gmii_clk_sel_mask = GENMASK_U16(11, 10);
bsp_priv->clock.rmii_clk_sel_mask = BIT_U16(10);
bsp_priv->clock.rmii_gate_en_mask = BIT_U16(9);
+ bsp_priv->clock.rmii_mode_mask = BIT_U16(8);
return 0;
default:
@@ -776,9 +769,6 @@ static int rk3528_init(struct rk_priv_data *bsp_priv)
static void rk3528_set_to_rgmii(struct rk_priv_data *bsp_priv,
int tx_delay, int rx_delay)
{
- regmap_write(bsp_priv->grf, RK3528_VPU_GRF_GMAC_CON5,
- RK3528_GMAC1_PHY_INTF_SEL_RGMII);
-
regmap_write(bsp_priv->grf, RK3528_VPU_GRF_GMAC_CON5,
DELAY_ENABLE(RK3528, tx_delay, rx_delay));
@@ -787,16 +777,6 @@ static void rk3528_set_to_rgmii(struct rk_priv_data *bsp_priv,
RK3528_GMAC_CLK_TX_DL_CFG(tx_delay));
}
-static void rk3528_set_to_rmii(struct rk_priv_data *bsp_priv)
-{
- if (bsp_priv->id == 1)
- regmap_write(bsp_priv->grf, RK3528_VPU_GRF_GMAC_CON5,
- RK3528_GMAC1_PHY_INTF_SEL_RMII);
- else
- regmap_write(bsp_priv->grf, RK3528_VO_GRF_GMAC_CON,
- RK3528_GMAC0_PHY_INTF_SEL_RMII);
-}
-
static void rk3528_integrated_phy_powerup(struct rk_priv_data *bsp_priv)
{
rk_gmac_integrated_fephy_powerup(bsp_priv, RK3528_VO_GRF_MACPHY_CON0);
@@ -810,9 +790,11 @@ static void rk3528_integrated_phy_powerdown(struct rk_priv_data *bsp_priv)
static const struct rk_gmac_ops rk3528_ops = {
.init = rk3528_init,
.set_to_rgmii = rk3528_set_to_rgmii,
- .set_to_rmii = rk3528_set_to_rmii,
.integrated_phy_powerup = rk3528_integrated_phy_powerup,
.integrated_phy_powerdown = rk3528_integrated_phy_powerdown,
+
+ .supports_rmii = true,
+
.regs_valid = true,
.regs = {
0xffbd0000, /* gmac0 */
@@ -988,9 +970,6 @@ static const struct rk_gmac_ops rk3576_ops = {
#define RK3588_GRF_GMAC_CON0 0X0008
#define RK3588_GRF_CLK_CON1 0X0070
-#define RK3588_GMAC_CLK_RMII_MODE(id) GRF_BIT(5 * (id))
-#define RK3588_GMAC_CLK_RGMII_MODE(id) GRF_CLR_BIT(5 * (id))
-
static int rk3588_init(struct rk_priv_data *bsp_priv)
{
switch (bsp_priv->id) {
@@ -1000,6 +979,7 @@ static int rk3588_init(struct rk_priv_data *bsp_priv)
bsp_priv->clock.gmii_clk_sel_mask = GENMASK_U16(3, 2);
bsp_priv->clock.rmii_clk_sel_mask = BIT_U16(2);
bsp_priv->clock.rmii_gate_en_mask = BIT_U16(1);
+ bsp_priv->clock.rmii_mode_mask = BIT_U16(0);
return 0;
case 1:
@@ -1008,6 +988,7 @@ static int rk3588_init(struct rk_priv_data *bsp_priv)
bsp_priv->clock.gmii_clk_sel_mask = GENMASK_U16(8, 7);
bsp_priv->clock.rmii_clk_sel_mask = BIT_U16(7);
bsp_priv->clock.rmii_gate_en_mask = BIT_U16(6);
+ bsp_priv->clock.rmii_mode_mask = BIT_U16(5);
return 0;
default:
@@ -1023,9 +1004,6 @@ static void rk3588_set_to_rgmii(struct rk_priv_data *bsp_priv,
offset_con = bsp_priv->id == 1 ? RK3588_GRF_GMAC_CON9 :
RK3588_GRF_GMAC_CON8;
- regmap_write(bsp_priv->php_grf, RK3588_GRF_CLK_CON1,
- RK3588_GMAC_CLK_RGMII_MODE(id));
-
regmap_write(bsp_priv->grf, RK3588_GRF_GMAC_CON7,
RK3588_GMAC_RXCLK_DLY_ENABLE(id) |
RK3588_GMAC_TXCLK_DLY_ENABLE(id));
@@ -1035,16 +1013,9 @@ static void rk3588_set_to_rgmii(struct rk_priv_data *bsp_priv,
RK3588_GMAC_CLK_TX_DL_CFG(tx_delay));
}
-static void rk3588_set_to_rmii(struct rk_priv_data *bsp_priv)
-{
- regmap_write(bsp_priv->php_grf, RK3588_GRF_CLK_CON1,
- RK3588_GMAC_CLK_RMII_MODE(bsp_priv->id));
-}
-
static const struct rk_gmac_ops rk3588_ops = {
.init = rk3588_init,
.set_to_rgmii = rk3588_set_to_rgmii,
- .set_to_rmii = rk3588_set_to_rmii,
.gmac_grf_reg_in_php = true,
.gmac_grf_reg = RK3588_GRF_GMAC_CON0,
@@ -1052,6 +1023,8 @@ static const struct rk_gmac_ops rk3588_ops = {
.clock_grf_reg_in_php = true,
.clock_grf_reg = RK3588_GRF_CLK_CON1,
+ .supports_rmii = true,
+
.php_grf_required = true,
.regs_valid = true,
.regs = {
@@ -1432,6 +1405,17 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_priv)
}
}
+ if (bsp_priv->clock.rmii_mode_mask) {
+ val = rk_encode_wm16(intf == PHY_INTF_SEL_RMII,
+ bsp_priv->clock.rmii_mode_mask);
+
+ ret = rk_write_clock_grf_reg(bsp_priv, val);
+ if (ret < 0) {
+ gmac_clk_enable(bsp_priv, false);
+ return ret;
+ }
+ }
+
/*rmii or rgmii*/
switch (bsp_priv->phy_iface) {
case PHY_INTERFACE_MODE_RGMII:
--
2.47.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH net-next 1/6] net: stmmac: rk: introduce flags indicating support for RGMII/RMII
2026-02-04 9:14 ` [PATCH net-next 1/6] net: stmmac: rk: introduce flags indicating support for RGMII/RMII Russell King (Oracle)
@ 2026-02-04 9:39 ` Maxime Chevallier
2026-02-04 19:57 ` Heiko Stübner
1 sibling, 0 replies; 20+ messages in thread
From: Maxime Chevallier @ 2026-02-04 9:39 UTC (permalink / raw)
To: Russell King (Oracle), Andrew Lunn
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Heiko Stuebner, Jakub Kicinski, linux-arm-kernel, linux-rockchip,
linux-stm32, netdev, Paolo Abeni
Hi,
On 04/02/2026 10:14, Russell King (Oracle) wrote:
> Introduce two boolean flags into struct rk_priv_data indicating
> whether RGMII and/or RMII is supported for this instance. Use these
> to configure the supported_interfaces mask for phylink, validate the
> interface mode. Initialise these from equivalent flags in the
> rk_gmac_ops or depending on the presence of the ops->set_to_rgmii and
> ops->set_to_mii methods. Finally, make ops->set_to_* optional.
>
> This will allow us to get rid of empty set_to_rmii() methods.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Maxime
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH net-next 2/6] net: stmmac: rk: replace empty set_to_rmii() with supports_rmii
2026-02-04 9:14 ` [PATCH net-next 2/6] net: stmmac: rk: replace empty set_to_rmii() with supports_rmii Russell King (Oracle)
@ 2026-02-04 9:40 ` Maxime Chevallier
2026-02-04 19:58 ` Heiko Stübner
1 sibling, 0 replies; 20+ messages in thread
From: Maxime Chevallier @ 2026-02-04 9:40 UTC (permalink / raw)
To: Russell King (Oracle), Andrew Lunn
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Heiko Stuebner, Jakub Kicinski, linux-arm-kernel, linux-rockchip,
linux-stm32, netdev, Paolo Abeni
Hi Russell,
On 04/02/2026 10:14, Russell King (Oracle) wrote:
> Rather than providing a now-empty set_to_rmii() method to indicate
> that RMII is supported, switch to setting ops->supports_rmii instead.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Maxime
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH net-next 3/6] net: stmmac: rk: rk3328: gmac2phy only supports RMII
2026-02-04 9:14 ` [PATCH net-next 3/6] net: stmmac: rk: rk3328: gmac2phy only supports RMII Russell King (Oracle)
@ 2026-02-04 9:43 ` Maxime Chevallier
2026-02-04 20:00 ` Heiko Stübner
1 sibling, 0 replies; 20+ messages in thread
From: Maxime Chevallier @ 2026-02-04 9:43 UTC (permalink / raw)
To: Russell King (Oracle), Andrew Lunn
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Heiko Stuebner, Jakub Kicinski, linux-arm-kernel, linux-rockchip,
linux-stm32, netdev, Paolo Abeni
On 04/02/2026 10:14, Russell King (Oracle) wrote:
> As detailed in a previous commit ("net: stmmac: rk: convert rk3328 to
> use bsp_priv->id") rk3328 gmac2phy only supports RMII, whereas gmac2io
> supports both RMII and RGMII. Clear supports_rgmii for gmac2phy.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Maxime
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH net-next 4/6] net: stmmac: rk: rk3528: gmac0 only supports RMII
2026-02-04 9:14 ` [PATCH net-next 4/6] net: stmmac: rk: rk3528: gmac0 " Russell King (Oracle)
@ 2026-02-04 9:43 ` Maxime Chevallier
2026-02-04 20:01 ` Heiko Stübner
1 sibling, 0 replies; 20+ messages in thread
From: Maxime Chevallier @ 2026-02-04 9:43 UTC (permalink / raw)
To: Russell King (Oracle), Andrew Lunn
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Heiko Stuebner, Jakub Kicinski, linux-arm-kernel, linux-rockchip,
linux-stm32, netdev, Paolo Abeni
On 04/02/2026 10:14, Russell King (Oracle) wrote:
> RK3528 gmac0 dtsi contains:
>
> gmac0: ethernet@ffbd0000 {
> phy-handle = <&rmii0_phy>;
> phy-mode = "rmii";
>
> mdio0: mdio {
> rmii0_phy: ethernet-phy@2 {
> phy-is-integrated;
> };
> };
> };
>
> This follows the same pattern as rk3328, where this gmac instance
> only supports RMII. Disable RGMII in phylink's supported_interfaces
> mask for this gmac instance.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Maxime
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH net-next 1/6] net: stmmac: rk: introduce flags indicating support for RGMII/RMII
2026-02-04 9:14 ` [PATCH net-next 1/6] net: stmmac: rk: introduce flags indicating support for RGMII/RMII Russell King (Oracle)
2026-02-04 9:39 ` Maxime Chevallier
@ 2026-02-04 19:57 ` Heiko Stübner
1 sibling, 0 replies; 20+ messages in thread
From: Heiko Stübner @ 2026-02-04 19:57 UTC (permalink / raw)
To: Andrew Lunn, Russell King (Oracle)
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, linux-arm-kernel, linux-rockchip, linux-stm32,
netdev, Paolo Abeni
Am Mittwoch, 4. Februar 2026, 10:14:17 Mitteleuropäische Normalzeit schrieb Russell King (Oracle):
> Introduce two boolean flags into struct rk_priv_data indicating
> whether RGMII and/or RMII is supported for this instance. Use these
> to configure the supported_interfaces mask for phylink, validate the
> interface mode. Initialise these from equivalent flags in the
> rk_gmac_ops or depending on the presence of the ops->set_to_rgmii and
> ops->set_to_mii methods. Finally, make ops->set_to_* optional.
>
> This will allow us to get rid of empty set_to_rmii() methods.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Heiko Stuebner <heiko@sntech.de> #px30,rk3328,rk3568,rk3588
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH net-next 2/6] net: stmmac: rk: replace empty set_to_rmii() with supports_rmii
2026-02-04 9:14 ` [PATCH net-next 2/6] net: stmmac: rk: replace empty set_to_rmii() with supports_rmii Russell King (Oracle)
2026-02-04 9:40 ` Maxime Chevallier
@ 2026-02-04 19:58 ` Heiko Stübner
1 sibling, 0 replies; 20+ messages in thread
From: Heiko Stübner @ 2026-02-04 19:58 UTC (permalink / raw)
To: Andrew Lunn, Russell King (Oracle)
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, linux-arm-kernel, linux-rockchip, linux-stm32,
netdev, Paolo Abeni
Am Mittwoch, 4. Februar 2026, 10:14:22 Mitteleuropäische Normalzeit schrieb Russell King (Oracle):
> Rather than providing a now-empty set_to_rmii() method to indicate
> that RMII is supported, switch to setting ops->supports_rmii instead.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Heiko Stuebner <heiko@sntech.de> #px30,rk3328,rk3568,rk3588
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH net-next 3/6] net: stmmac: rk: rk3328: gmac2phy only supports RMII
2026-02-04 9:14 ` [PATCH net-next 3/6] net: stmmac: rk: rk3328: gmac2phy only supports RMII Russell King (Oracle)
2026-02-04 9:43 ` Maxime Chevallier
@ 2026-02-04 20:00 ` Heiko Stübner
1 sibling, 0 replies; 20+ messages in thread
From: Heiko Stübner @ 2026-02-04 20:00 UTC (permalink / raw)
To: Andrew Lunn, Russell King (Oracle)
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, linux-arm-kernel, linux-rockchip, linux-stm32,
netdev, Paolo Abeni
Am Mittwoch, 4. Februar 2026, 10:14:28 Mitteleuropäische Normalzeit schrieb Russell King (Oracle):
> As detailed in a previous commit ("net: stmmac: rk: convert rk3328 to
> use bsp_priv->id") rk3328 gmac2phy only supports RMII, whereas gmac2io
> supports both RMII and RGMII. Clear supports_rgmii for gmac2phy.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Heiko Stuebner <heiko@sntech.de> #px30,rk3328 gmac2io,rk3568,rk3588
Sadly the rk3328-board I have only uses the gmac2io controller.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH net-next 4/6] net: stmmac: rk: rk3528: gmac0 only supports RMII
2026-02-04 9:14 ` [PATCH net-next 4/6] net: stmmac: rk: rk3528: gmac0 " Russell King (Oracle)
2026-02-04 9:43 ` Maxime Chevallier
@ 2026-02-04 20:01 ` Heiko Stübner
1 sibling, 0 replies; 20+ messages in thread
From: Heiko Stübner @ 2026-02-04 20:01 UTC (permalink / raw)
To: Andrew Lunn, Russell King (Oracle)
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, linux-arm-kernel, linux-rockchip, linux-stm32,
netdev, Paolo Abeni
Am Mittwoch, 4. Februar 2026, 10:14:33 Mitteleuropäische Normalzeit schrieb Russell King (Oracle):
> RK3528 gmac0 dtsi contains:
>
> gmac0: ethernet@ffbd0000 {
> phy-handle = <&rmii0_phy>;
> phy-mode = "rmii";
>
> mdio0: mdio {
> rmii0_phy: ethernet-phy@2 {
> phy-is-integrated;
> };
> };
> };
>
> This follows the same pattern as rk3328, where this gmac instance
> only supports RMII. Disable RGMII in phylink's supported_interfaces
> mask for this gmac instance.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH net-next 6/6] net: stmmac: rk: rk3506, rk3528 and rk3588 have rmii_mode in clock register
2026-02-04 9:14 ` [PATCH net-next 6/6] net: stmmac: rk: rk3506, rk3528 and rk3588 have rmii_mode in clock register Russell King (Oracle)
@ 2026-02-04 21:54 ` Heiko Stübner
0 siblings, 0 replies; 20+ messages in thread
From: Heiko Stübner @ 2026-02-04 21:54 UTC (permalink / raw)
To: Andrew Lunn, Russell King (Oracle)
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, linux-arm-kernel, linux-rockchip, linux-stm32,
netdev, Paolo Abeni
Am Mittwoch, 4. Februar 2026, 10:14:43 Mitteleuropäische Normalzeit schrieb Russell King (Oracle):
> rk3506, rk3528 and rk3588 have the rmii_mode bit in the clock GRF
> register rather than the gmac GRF register. Provide a mask for this
> field in the clock register, and convert these SoCs to use this.
> Add the necessary code in rk_gmac_powerup() to write this field.
>
> This allows us to get rid of these SoCs set_to_rmii() function. As
> such, we need to mark these SoCs as supporting RMII mode.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Heiko Stuebner <heiko@sntech.de> #px30,rk3328,rk3568,rk3588
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH net-next 5/6] net: stmmac: rk: use rk_encode_wm16() for clock selection
2026-02-04 9:14 ` [PATCH net-next 5/6] net: stmmac: rk: use rk_encode_wm16() for clock selection Russell King (Oracle)
@ 2026-02-04 22:03 ` Heiko Stübner
2026-02-04 22:26 ` Russell King (Oracle)
0 siblings, 1 reply; 20+ messages in thread
From: Heiko Stübner @ 2026-02-04 22:03 UTC (permalink / raw)
To: Andrew Lunn, Russell King (Oracle)
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, linux-arm-kernel, linux-rockchip, linux-stm32,
netdev, Paolo Abeni
Am Mittwoch, 4. Februar 2026, 10:14:38 Mitteleuropäische Normalzeit schrieb Russell King (Oracle):
> Use rk_encode_wm16() for RMII clock gating control, and also for the
> io_clksel bit used to select the transmit clock between CRU-derived
> and IO-derived clock sources.
>
> Both of these were configured via the "set_clock_selection" method in
> the SoC specific operations, but there is no requirement to change the
> io_clksel except when enabling clocks.
>
> It is also possible that we don't need to ungate the RMII clock if we
> are operating in RGMII mode, but this commit makes no change there.
>
> Split up the configuration of these as separate functions, and remove
> the set_clock_selection() method. Since these clocking bits are in the
> same register that we call the "speed" register, move the logic for
> writing that register into rk_write_speed_grf_reg().
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> .../net/ethernet/stmicro/stmmac/dwmac-rk.c | 174 ++++++++----------
> 1 file changed, 75 insertions(+), 99 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> index 4099cbc5d0de..ed9adac70f0a 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> @@ -27,8 +27,17 @@
> struct rk_priv_data;
>
> struct rk_clock_fields {
> + /* io_clksel_cru_mask - io_clksel bit in clock GRF register which,
> + * when set, selects the tx clock from CRU.
> + */
> + u16 io_clksel_cru_mask;
> + /* io_clksel_io_mask - io_clksel bit in clock GRF register which,
> + * when set, selects the tx clock from IO.
> + */
nit: comment stile does not seem to follow the kernel coding style
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst#n622
> + u16 io_clksel_io_mask;
> u16 gmii_clk_sel_mask;
> u16 rmii_clk_sel_mask;
> + u16 rmii_gate_en_mask;
> u16 mac_speed_mask;
> };
[...]
> + /* The io_clksel configuration can be either:
> + * 0=CRU, 1=IO (rk3506, rk3520, rk3576) or
> + * 0=IO, 1=CRU (rk3588)
> + * where CRU means the transmit clock comes from the CRU and IO
> + * means the transmit clock comes from IO.
> + *
> + * Handle this by having two masks.
> + */
nit: same as above
Other than these 2 nits, this looks good to me.
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Heiko Stuebner <heiko@sntech.de> #px30,rk3328,rk3568,rk3588
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH net-next 5/6] net: stmmac: rk: use rk_encode_wm16() for clock selection
2026-02-04 22:03 ` Heiko Stübner
@ 2026-02-04 22:26 ` Russell King (Oracle)
2026-02-05 7:44 ` Heiko Stübner
0 siblings, 1 reply; 20+ messages in thread
From: Russell King (Oracle) @ 2026-02-04 22:26 UTC (permalink / raw)
To: Heiko Stübner
Cc: Andrew Lunn, Alexandre Torgue, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, linux-arm-kernel, linux-rockchip,
linux-stm32, netdev, Paolo Abeni
On Wed, Feb 04, 2026 at 11:03:51PM +0100, Heiko Stübner wrote:
> Am Mittwoch, 4. Februar 2026, 10:14:38 Mitteleuropäische Normalzeit schrieb Russell King (Oracle):
> > Use rk_encode_wm16() for RMII clock gating control, and also for the
> > io_clksel bit used to select the transmit clock between CRU-derived
> > and IO-derived clock sources.
> >
> > Both of these were configured via the "set_clock_selection" method in
> > the SoC specific operations, but there is no requirement to change the
> > io_clksel except when enabling clocks.
> >
> > It is also possible that we don't need to ungate the RMII clock if we
> > are operating in RGMII mode, but this commit makes no change there.
> >
> > Split up the configuration of these as separate functions, and remove
> > the set_clock_selection() method. Since these clocking bits are in the
> > same register that we call the "speed" register, move the logic for
> > writing that register into rk_write_speed_grf_reg().
> >
> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > ---
> > .../net/ethernet/stmicro/stmmac/dwmac-rk.c | 174 ++++++++----------
> > 1 file changed, 75 insertions(+), 99 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> > index 4099cbc5d0de..ed9adac70f0a 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> > @@ -27,8 +27,17 @@
> > struct rk_priv_data;
> >
> > struct rk_clock_fields {
> > + /* io_clksel_cru_mask - io_clksel bit in clock GRF register which,
> > + * when set, selects the tx clock from CRU.
> > + */
> > + u16 io_clksel_cru_mask;
> > + /* io_clksel_io_mask - io_clksel bit in clock GRF register which,
> > + * when set, selects the tx clock from IO.
> > + */
>
> nit: comment stile does not seem to follow the kernel coding style
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst#n622
netdev has historically had this style which is separate from the rest
of the kernel. The file already uses this comment style, so it is
entirely correct to keep to the style which already exists in this
file, rather than mixing styles and turning it into a mess.
> Reviewed-by: Heiko Stuebner <heiko@sntech.de>
> Tested-by: Heiko Stuebner <heiko@sntech.de> #px30,rk3328,rk3568,rk3588
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH net-next 5/6] net: stmmac: rk: use rk_encode_wm16() for clock selection
2026-02-04 22:26 ` Russell King (Oracle)
@ 2026-02-05 7:44 ` Heiko Stübner
0 siblings, 0 replies; 20+ messages in thread
From: Heiko Stübner @ 2026-02-05 7:44 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Andrew Lunn, Alexandre Torgue, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, linux-arm-kernel, linux-rockchip,
linux-stm32, netdev, Paolo Abeni
Hi Russell,
Am Mittwoch, 4. Februar 2026, 23:26:21 Mitteleuropäische Normalzeit schrieb Russell King (Oracle):
> On Wed, Feb 04, 2026 at 11:03:51PM +0100, Heiko Stübner wrote:
> > Am Mittwoch, 4. Februar 2026, 10:14:38 Mitteleuropäische Normalzeit schrieb Russell King (Oracle):
> > > Use rk_encode_wm16() for RMII clock gating control, and also for the
> > > io_clksel bit used to select the transmit clock between CRU-derived
> > > and IO-derived clock sources.
> > >
> > > Both of these were configured via the "set_clock_selection" method in
> > > the SoC specific operations, but there is no requirement to change the
> > > io_clksel except when enabling clocks.
> > >
> > > It is also possible that we don't need to ungate the RMII clock if we
> > > are operating in RGMII mode, but this commit makes no change there.
> > >
> > > Split up the configuration of these as separate functions, and remove
> > > the set_clock_selection() method. Since these clocking bits are in the
> > > same register that we call the "speed" register, move the logic for
> > > writing that register into rk_write_speed_grf_reg().
> > >
> > > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > > ---
> > > .../net/ethernet/stmicro/stmmac/dwmac-rk.c | 174 ++++++++----------
> > > 1 file changed, 75 insertions(+), 99 deletions(-)
> > >
> > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> > > index 4099cbc5d0de..ed9adac70f0a 100644
> > > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> > > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> > > @@ -27,8 +27,17 @@
> > > struct rk_priv_data;
> > >
> > > struct rk_clock_fields {
> > > + /* io_clksel_cru_mask - io_clksel bit in clock GRF register which,
> > > + * when set, selects the tx clock from CRU.
> > > + */
> > > + u16 io_clksel_cru_mask;
> > > + /* io_clksel_io_mask - io_clksel bit in clock GRF register which,
> > > + * when set, selects the tx clock from IO.
> > > + */
> >
> > nit: comment stile does not seem to follow the kernel coding style
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst#n622
>
> netdev has historically had this style which is separate from the rest
> of the kernel. The file already uses this comment style, so it is
> entirely correct to keep to the style which already exists in this
> file, rather than mixing styles and turning it into a mess.
thanks for the clarification. Then the comment style is obviously fine.
Regards
Heiko
> > Reviewed-by: Heiko Stuebner <heiko@sntech.de>
> > Tested-by: Heiko Stuebner <heiko@sntech.de> #px30,rk3328,rk3568,rk3588
>
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH net-next 0/6] net: stmmac: rk: final cleanups part
2026-02-04 9:14 [PATCH net-next 0/6] net: stmmac: rk: final cleanups part Russell King (Oracle)
` (5 preceding siblings ...)
2026-02-04 9:14 ` [PATCH net-next 6/6] net: stmmac: rk: rk3506, rk3528 and rk3588 have rmii_mode in clock register Russell King (Oracle)
@ 2026-02-05 17:30 ` patchwork-bot+netdevbpf
6 siblings, 0 replies; 20+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-02-05 17:30 UTC (permalink / raw)
To: Russell King
Cc: andrew, alexandre.torgue, andrew+netdev, davem, edumazet, heiko,
kuba, linux-arm-kernel, linux-rockchip, linux-stm32, netdev,
pabeni
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 4 Feb 2026 09:14:02 +0000 you wrote:
> Hi,
>
> This is the last part of my current dwmac-rk cleanups.
>
> drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 361 ++++++++++---------------
> 1 file changed, 150 insertions(+), 211 deletions(-)
Here is the summary with links:
- [net-next,1/6] net: stmmac: rk: introduce flags indicating support for RGMII/RMII
https://git.kernel.org/netdev/net-next/c/d323769d64f2
- [net-next,2/6] net: stmmac: rk: replace empty set_to_rmii() with supports_rmii
https://git.kernel.org/netdev/net-next/c/a9d4aff670ed
- [net-next,3/6] net: stmmac: rk: rk3328: gmac2phy only supports RMII
https://git.kernel.org/netdev/net-next/c/f365541bf7b6
- [net-next,4/6] net: stmmac: rk: rk3528: gmac0 only supports RMII
https://git.kernel.org/netdev/net-next/c/d7d92037cbd8
- [net-next,5/6] net: stmmac: rk: use rk_encode_wm16() for clock selection
https://git.kernel.org/netdev/net-next/c/5c1fc7cb81df
- [net-next,6/6] net: stmmac: rk: rk3506, rk3528 and rk3588 have rmii_mode in clock register
https://git.kernel.org/netdev/net-next/c/b10d56b0db3a
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2026-02-05 17:30 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-04 9:14 [PATCH net-next 0/6] net: stmmac: rk: final cleanups part Russell King (Oracle)
2026-02-04 9:14 ` [PATCH net-next 1/6] net: stmmac: rk: introduce flags indicating support for RGMII/RMII Russell King (Oracle)
2026-02-04 9:39 ` Maxime Chevallier
2026-02-04 19:57 ` Heiko Stübner
2026-02-04 9:14 ` [PATCH net-next 2/6] net: stmmac: rk: replace empty set_to_rmii() with supports_rmii Russell King (Oracle)
2026-02-04 9:40 ` Maxime Chevallier
2026-02-04 19:58 ` Heiko Stübner
2026-02-04 9:14 ` [PATCH net-next 3/6] net: stmmac: rk: rk3328: gmac2phy only supports RMII Russell King (Oracle)
2026-02-04 9:43 ` Maxime Chevallier
2026-02-04 20:00 ` Heiko Stübner
2026-02-04 9:14 ` [PATCH net-next 4/6] net: stmmac: rk: rk3528: gmac0 " Russell King (Oracle)
2026-02-04 9:43 ` Maxime Chevallier
2026-02-04 20:01 ` Heiko Stübner
2026-02-04 9:14 ` [PATCH net-next 5/6] net: stmmac: rk: use rk_encode_wm16() for clock selection Russell King (Oracle)
2026-02-04 22:03 ` Heiko Stübner
2026-02-04 22:26 ` Russell King (Oracle)
2026-02-05 7:44 ` Heiko Stübner
2026-02-04 9:14 ` [PATCH net-next 6/6] net: stmmac: rk: rk3506, rk3528 and rk3588 have rmii_mode in clock register Russell King (Oracle)
2026-02-04 21:54 ` Heiko Stübner
2026-02-05 17:30 ` [PATCH net-next 0/6] net: stmmac: rk: final cleanups part patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox