]> www.infradead.org Git - users/willy/linux.git/commitdiff
net: ethernet: stmmac: dwmac-rk: Make the clk_phy could be used for external phy
authorChaoyi Chen <chaoyi.chen@rock-chips.com>
Fri, 15 Aug 2025 02:35:15 +0000 (10:35 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 19 Aug 2025 13:57:28 +0000 (15:57 +0200)
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.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Chaoyi Chen <chaoyi.chen@rock-chips.com>
Link: https://patch.msgid.link/20250815023515.114-1-kernel@airkyi.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c

index 7c898768d5448ac2ac09bac4857cea4e9095064a..9fc41207cc459313e575a2b00236b82611ad9603 100644 (file)
@@ -1412,12 +1412,15 @@ static int rk_gmac_clk_init(struct plat_stmmacenet_data *plat)
                clk_set_rate(plat->stmmac_clk, 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;