Commit daa7d392 authored by Wolfram Sang's avatar Wolfram Sang Committed by Shawn Guo

net: freescale: fec: add support for optional enet_out clk

Some MX28 boards need the internal enet_out clock to be enabled. So, do
this in the driver iff the clock was referenced via devicetree.
Signed-off-by: default avatarWolfram Sang <w.sang@pengutronix.de>
Signed-off-by: default avatarShawn Guo <shawn.guo@linaro.org>
Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c29dc2d7
...@@ -1802,6 +1802,11 @@ fec_probe(struct platform_device *pdev) ...@@ -1802,6 +1802,11 @@ fec_probe(struct platform_device *pdev)
goto failed_clk; goto failed_clk;
} }
/* enet_out is optional, depends on board */
fep->clk_enet_out = devm_clk_get(&pdev->dev, "enet_out");
if (IS_ERR(fep->clk_enet_out))
fep->clk_enet_out = NULL;
fep->clk_ptp = devm_clk_get(&pdev->dev, "ptp"); fep->clk_ptp = devm_clk_get(&pdev->dev, "ptp");
fep->bufdesc_ex = fep->bufdesc_ex =
pdev->id_entry->driver_data & FEC_QUIRK_HAS_BUFDESC_EX; pdev->id_entry->driver_data & FEC_QUIRK_HAS_BUFDESC_EX;
...@@ -1812,6 +1817,7 @@ fec_probe(struct platform_device *pdev) ...@@ -1812,6 +1817,7 @@ fec_probe(struct platform_device *pdev)
clk_prepare_enable(fep->clk_ahb); clk_prepare_enable(fep->clk_ahb);
clk_prepare_enable(fep->clk_ipg); clk_prepare_enable(fep->clk_ipg);
clk_prepare_enable(fep->clk_enet_out);
clk_prepare_enable(fep->clk_ptp); clk_prepare_enable(fep->clk_ptp);
reg_phy = devm_regulator_get(&pdev->dev, "phy"); reg_phy = devm_regulator_get(&pdev->dev, "phy");
...@@ -1877,6 +1883,7 @@ fec_probe(struct platform_device *pdev) ...@@ -1877,6 +1883,7 @@ fec_probe(struct platform_device *pdev)
failed_regulator: failed_regulator:
clk_disable_unprepare(fep->clk_ahb); clk_disable_unprepare(fep->clk_ahb);
clk_disable_unprepare(fep->clk_ipg); clk_disable_unprepare(fep->clk_ipg);
clk_disable_unprepare(fep->clk_enet_out);
clk_disable_unprepare(fep->clk_ptp); clk_disable_unprepare(fep->clk_ptp);
failed_pin: failed_pin:
failed_clk: failed_clk:
...@@ -1903,6 +1910,7 @@ fec_drv_remove(struct platform_device *pdev) ...@@ -1903,6 +1910,7 @@ fec_drv_remove(struct platform_device *pdev)
clk_disable_unprepare(fep->clk_ptp); clk_disable_unprepare(fep->clk_ptp);
if (fep->ptp_clock) if (fep->ptp_clock)
ptp_clock_unregister(fep->ptp_clock); ptp_clock_unregister(fep->ptp_clock);
clk_disable_unprepare(fep->clk_enet_out);
clk_disable_unprepare(fep->clk_ahb); clk_disable_unprepare(fep->clk_ahb);
clk_disable_unprepare(fep->clk_ipg); clk_disable_unprepare(fep->clk_ipg);
for (i = 0; i < FEC_IRQ_NUM; i++) { for (i = 0; i < FEC_IRQ_NUM; i++) {
...@@ -1933,6 +1941,7 @@ fec_suspend(struct device *dev) ...@@ -1933,6 +1941,7 @@ fec_suspend(struct device *dev)
fec_stop(ndev); fec_stop(ndev);
netif_device_detach(ndev); netif_device_detach(ndev);
} }
clk_disable_unprepare(fep->clk_enet_out);
clk_disable_unprepare(fep->clk_ahb); clk_disable_unprepare(fep->clk_ahb);
clk_disable_unprepare(fep->clk_ipg); clk_disable_unprepare(fep->clk_ipg);
...@@ -1945,6 +1954,7 @@ fec_resume(struct device *dev) ...@@ -1945,6 +1954,7 @@ fec_resume(struct device *dev)
struct net_device *ndev = dev_get_drvdata(dev); struct net_device *ndev = dev_get_drvdata(dev);
struct fec_enet_private *fep = netdev_priv(ndev); struct fec_enet_private *fep = netdev_priv(ndev);
clk_prepare_enable(fep->clk_enet_out);
clk_prepare_enable(fep->clk_ahb); clk_prepare_enable(fep->clk_ahb);
clk_prepare_enable(fep->clk_ipg); clk_prepare_enable(fep->clk_ipg);
if (netif_running(ndev)) { if (netif_running(ndev)) {
......
...@@ -207,6 +207,7 @@ struct fec_enet_private { ...@@ -207,6 +207,7 @@ struct fec_enet_private {
struct clk *clk_ipg; struct clk *clk_ipg;
struct clk *clk_ahb; struct clk *clk_ahb;
struct clk *clk_enet_out;
struct clk *clk_ptp; struct clk *clk_ptp;
/* The saved address of a sent-in-place packet/buffer, for skfree(). */ /* The saved address of a sent-in-place packet/buffer, for skfree(). */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment