Skip to contentSkip to conversation

net: ethernet: stmmac: dwmac-rk: Make the clk_phy could be used for external phy

PATCH Superseded Chaoyi Chen 2 participants 2 messages Aug 12, 2025 – Aug 13, 2025

Subsystems (5)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net: ethernet: stmmac: dwmac-rk: Make the clk_phy could be used for external phy

From: Chaoyi Chen <[email protected]>

For external phy, clk_phy should be optional, and some external phy need the clock input from clk_phy. This patch adds support for setting clk_phy for external phy.

---

Changes in v2:
- Link to V1: https://lore.kernel.org/netdev/[email protected]/
- Remove get clock frequency from DT prop

 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +7 -4
index 700858ff6f7c..36fab70283de 100644
@@ -1595,12 +1595,15 @@ static int rk_gmac_clk_init(struct plat_stmmacenet_data *plat)
 		clk_set_rate(bsp_priv->clk_mac, 50000000);
 	}
 
-	if (plat->phy_node && bsp_priv->integrated_phy) {
+	if (plat->phy_node) {
 		bsp_priv->clk_phy = of_clk_get(plat->phy_node, 0);
 		ret = PTR_ERR_OR_ZERO(bsp_priv->clk_phy);
-		if (ret)
-			return dev_err_probe(dev, ret, "Cannot get PHY clock\n");
-		clk_set_rate(bsp_priv->clk_phy, 50000000);
+		/* If it is not integrated_phy, clk_phy is optional */
+		if (bsp_priv->integrated_phy) {
+			if (ret)
+				return dev_err_probe(dev, ret, "Cannot get PHY clock\n");
+			clk_set_rate(bsp_priv->clk_phy, 50000000);
+		}
 	}
 
 	return 0;
Signature · 1 line
2.49.0
maintainer
#1 lore raw
Quoted 3 lines · On Tue, 12 Aug 2025 09:21:27 +0800 Chaoyi Chen wrote:

For external phy, clk_phy should be optional, and some external phy need the clock input from clk_phy. This patch adds support for setting clk_phy for external phy.

This patch doesn't seem to apply to net-next/main, please rebase & repost.

Signature · 1 line
pw-bot: cr