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

Use the phy_clk to prepare_enable and unprepare_disable related phy clock.

Change-Id: Idcf3ee00c03b4a5009a6a9385077b0a421dbc601
Signed-off-by: David Wu <david.wu@rock-chips.com>
This commit is contained in:
David Wu
2020-04-01 14:44:40 +08:00
committed by Tao Huang
parent ea074eb627
commit a316b31f17

View File

@@ -1285,14 +1285,17 @@ 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);
if (IS_ERR(bsp_priv->clk_phy)) {
ret = PTR_ERR(bsp_priv->clk_phy);
dev_err(dev, "Cannot get PHY clock: %d\n", ret);
return -EINVAL;
/* If it is not integrated_phy, clk_phy is optional */
if (bsp_priv->integrated_phy) {
if (IS_ERR(bsp_priv->clk_phy)) {
ret = PTR_ERR(bsp_priv->clk_phy);
dev_err(dev, "Cannot get PHY clock: %d\n", ret);
return -EINVAL;
}
clk_set_rate(bsp_priv->clk_phy, 50000000);
}
clk_set_rate(bsp_priv->clk_phy, 50000000);
}
return 0;