Commit d265cf48 authored by Fabio Estevam's avatar Fabio Estevam Committed by David S. Miller

fec: Fix the order for enabling/disabling the clocks

On fec_probe the clocks are enabled in the following order:

clk_ahb -> clk_ipg -> clk_enet_out -> clk_ptp

, so in the error and remove paths we should disabled them in the opposite
order.

Also fix the order in the suspend/resume functions.
Signed-off-by: default avatarFabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9514fe7a
...@@ -2179,12 +2179,12 @@ fec_probe(struct platform_device *pdev) ...@@ -2179,12 +2179,12 @@ fec_probe(struct platform_device *pdev)
if (fep->reg_phy) if (fep->reg_phy)
regulator_disable(fep->reg_phy); regulator_disable(fep->reg_phy);
failed_regulator: failed_regulator:
clk_disable_unprepare(fep->clk_ahb);
clk_disable_unprepare(fep->clk_ipg);
if (fep->clk_enet_out)
clk_disable_unprepare(fep->clk_enet_out);
if (fep->clk_ptp) if (fep->clk_ptp)
clk_disable_unprepare(fep->clk_ptp); clk_disable_unprepare(fep->clk_ptp);
if (fep->clk_enet_out)
clk_disable_unprepare(fep->clk_enet_out);
clk_disable_unprepare(fep->clk_ipg);
clk_disable_unprepare(fep->clk_ahb);
failed_clk: failed_clk:
failed_ioremap: failed_ioremap:
free_netdev(ndev); free_netdev(ndev);
...@@ -2216,8 +2216,8 @@ fec_drv_remove(struct platform_device *pdev) ...@@ -2216,8 +2216,8 @@ fec_drv_remove(struct platform_device *pdev)
ptp_clock_unregister(fep->ptp_clock); ptp_clock_unregister(fep->ptp_clock);
if (fep->clk_enet_out) if (fep->clk_enet_out)
clk_disable_unprepare(fep->clk_enet_out); clk_disable_unprepare(fep->clk_enet_out);
clk_disable_unprepare(fep->clk_ahb);
clk_disable_unprepare(fep->clk_ipg); clk_disable_unprepare(fep->clk_ipg);
clk_disable_unprepare(fep->clk_ahb);
free_netdev(ndev); free_netdev(ndev);
return 0; return 0;
...@@ -2236,8 +2236,8 @@ fec_suspend(struct device *dev) ...@@ -2236,8 +2236,8 @@ fec_suspend(struct device *dev)
} }
if (fep->clk_enet_out) if (fep->clk_enet_out)
clk_disable_unprepare(fep->clk_enet_out); clk_disable_unprepare(fep->clk_enet_out);
clk_disable_unprepare(fep->clk_ahb);
clk_disable_unprepare(fep->clk_ipg); clk_disable_unprepare(fep->clk_ipg);
clk_disable_unprepare(fep->clk_ahb);
if (fep->reg_phy) if (fep->reg_phy)
regulator_disable(fep->reg_phy); regulator_disable(fep->reg_phy);
...@@ -2258,10 +2258,10 @@ fec_resume(struct device *dev) ...@@ -2258,10 +2258,10 @@ fec_resume(struct device *dev)
return ret; return ret;
} }
if (fep->clk_enet_out)
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 (fep->clk_enet_out)
clk_prepare_enable(fep->clk_enet_out);
if (netif_running(ndev)) { if (netif_running(ndev)) {
fec_restart(ndev, fep->full_duplex); fec_restart(ndev, fep->full_duplex);
netif_device_attach(ndev); netif_device_attach(ndev);
......
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