net: ethernet: stmmac: dwmac-rk: Make the clk_phy could be used for external phy
Subsystems (5)
PATCH 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.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +12 -4
@@ -1558,6 +1558,7 @@ static int rk_gmac_clk_init(struct plat_stmmacenet_data *plat)struct device *dev = &bsp_priv->pdev->dev;int phy_iface = bsp_priv->phy_iface;int i, j, ret; +unsigned int rate; bsp_priv->clk_enabled = false;
@@ -1595,12 +1596,19 @@ 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" ); + + ret =of_property_read_u32 (plat->phy_node,"clock-frequency" , &rate); +if (ret) + rate =0 ; +clk_set_rate (bsp_priv->clk_phy, rate ? rate :50000000 ); + } }return 0 ;
Signature · 1 line
2.49.0
Quoted 8 lines · Chaoyi Chen
From: Chaoyi Chen <[email protected]>
For external phy,
clk_physhould be optional, and some external phy need the clock input fromclk_phy. This patch adds support for settingclk_phyfor external phy.Signed-off-by David Wu <[email protected]>Signed-off-by Chaoyi Chen <[email protected]>
Please take a read of:
https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
net-next is closed at the moment for the merge window.
You also need the indicate the tree in the Subject: line.
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c static int rk_gmac_clk_init(struct plat_stmmacenet_data *plat) · line 1561
Quoted 13 lines
--- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +1
-0@@ -1558,6 +1558,7 @@ static int rk_gmac_clk_init(struct plat_stmmacenet_data *plat)struct device *dev = &bsp_priv->pdev->dev;int phy_iface = bsp_priv->phy_iface;int i, j, ret; +unsigned int rate;
Reverse Christmas tree. Longest to shortest.
Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +1
-1bsp_priv->clk_enabled = false;@@ -1595,12 +1596,19 @@ 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 );
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c static int rk_gmac_clk_init(struct plat_stmmacenet_data *plat) · line 1607
Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +6
-3ret =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" ); + + ret =of_property_read_u32 (plat->phy_node,"clock-frequency" , &rate);
Is this property already in the DT binding?
Andrew
---
pw-bot: cr
Hi Andrew,
Quoted 9 lines · Andrew Lunn
Quoted 8 lines · Chaoyi Chen
From: Chaoyi Chen <[email protected]>
For external phy,
clk_physhould be optional, and some external phy need the clock input fromclk_phy. This patch adds support for settingclk_phyfor external phy.Signed-off-by David Wu <[email protected]>Signed-off-by Chaoyi Chen <[email protected]>
Quoted 7 lines
Please take a read of:
https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
net-next is closed at the moment for the merge window.
You also need the indicate the tree in the Subject: line.
Sorry for that, I will send v2 at an appropriate time.
Quoted 5 lines
Quoted 5 lines
--- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c static int rk_gmac_clk_init(struct plat_stmmacenet_data *plat) · line 1561
Quoted 9 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +1
-0@@ -1558,6 +1558,7 @@ static int rk_gmac_clk_init(struct plat_stmmacenet_data *plat)struct device *dev = &bsp_priv->pdev->dev;int phy_iface = bsp_priv->phy_iface;int i, j, ret; +unsigned int rate;Reverse Christmas tree. Longest to shortest.
Will fix in v2.
Quoted 8 lines
Quoted 8 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +0
-0bsp_priv->clk_enabled = false;@@ -1595,12 +1596,19 @@ static int rk_gmac_clk_init(struct plat_stmmacenet_data *plat)clk_set_rate (bsp_priv->clk_mac,50000000 ); }
Quoted 14 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c static int rk_gmac_clk_init(struct plat_stmmacenet_data *plat) · line 1607
Quoted 13 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +7
-4-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" ); + + ret =of_property_read_u32 (plat->phy_node,"clock-frequency" , &rate);Is this property already in the DT binding?
I didn't see explicit binding, but make dtbs_check W=1 didn't generate any warning. I will drop this in v2.
Quoted 8 lines
Andrew
---
pw-bot: cr
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip