Skip to contentSkip to conversation

net: stmmac: qcom-ethqos: use rgmii_clock() to set the link clock

PATCH Applied Russell King (Oracle) 4 participants 4 messages Feb 21, 2025 – Feb 24, 2025

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: stmmac: qcom-ethqos: use rgmii_clock() to set the link clock

The link clock operates at twice the RGMII clock rate. Therefore, we can use the rgmii_clock() helper to set this clock rate.

---
 .../stmicro/stmmac/dwmac-qcom-ethqos.c        | 23 ++++---------------
 1 file changed, 5 insertions(+), 18 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +5 -18
index 192f270197c8..eafe637540b6 100644
@@ -169,30 +169,17 @@ static void rgmii_dump(void *priv)
 		rgmii_readl(ethqos, EMAC_SYSTEM_LOW_POWER_DEBUG));
 }
 
-/* Clock rates */
-#define RGMII_1000_NOM_CLK_FREQ			(250 * 1000 * 1000UL)
-#define RGMII_ID_MODE_100_LOW_SVS_CLK_FREQ	 (50 * 1000 * 1000UL)
-#define RGMII_ID_MODE_10_LOW_SVS_CLK_FREQ	  (5 * 1000 * 1000UL)
-
 static void
 ethqos_update_link_clk(struct qcom_ethqos *ethqos, int speed)
 {
+	long rate;
+
 	if (!phy_interface_mode_is_rgmii(ethqos->phy_mode))
 		return;
 
-	switch (speed) {
-	case SPEED_1000:
-		ethqos->link_clk_rate =  RGMII_1000_NOM_CLK_FREQ;
-		break;
-
-	case SPEED_100:
-		ethqos->link_clk_rate =  RGMII_ID_MODE_100_LOW_SVS_CLK_FREQ;
-		break;
-
-	case SPEED_10:
-		ethqos->link_clk_rate =  RGMII_ID_MODE_10_LOW_SVS_CLK_FREQ;
-		break;
-	}
+	rate = rgmii_clock(speed);
+	if (rate > 0)
+		ethqos->link_clk_rate = rate * 2;
 
 	clk_set_rate(ethqos->link_clk, ethqos->link_clk_rate);
 }
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Russell King (Oracle)

The link clock operates at twice the RGMII clock rate. Therefore, we can use the rgmii_clock() helper to set this clock rate.

Signature · 1 line
~Vinod
#3 lore raw
In reply to Russell King (Oracle)
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 7 lines · On Fri, 21 Feb 2025 11:38:20 +0000 you wrote:

The link clock operates at twice the RGMII clock rate. Therefore, we can use the rgmii_clock() helper to set this clock rate.

---
 .../stmicro/stmmac/dwmac-qcom-ethqos.c        | 23 ++++---------------
 1 file changed, 5 insertions(+), 18 deletions(-)

Here is the summary with links:
- [net-next] net: stmmac: qcom-ethqos: use rgmii_clock() to set the link clock

    https://git.kernel.org/netdev/net-next/c/98f992884333

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html