Commit da114122 authored by Chaoyi Chen's avatar Chaoyi Chen Committed by Paolo Abeni
Browse files

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



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: default avatarDavid Wu <david.wu@rock-chips.com>
Signed-off-by: default avatarChaoyi Chen <chaoyi.chen@rock-chips.com>
Link: https://patch.msgid.link/20250815023515.114-1-kernel@airkyi.com


Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 0283b8f1
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -1412,13 +1412,16 @@ 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 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;
}