aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/freescale
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@freescale.com>2013-07-21 12:24:59 -0400
committerDavid S. Miller <davem@davemloft.net>2013-07-22 19:50:31 -0400
commit9514fe7a2352e35ff571467afba24ab904a1befe (patch)
treed05b846b6f2bfaa70fc81bcee563b946fc5369c2 /drivers/net/ethernet/freescale
parenteda297729171fe16bf34fe5b0419dfb69060f623 (diff)
fec: Do not enable/disable optional clocks unconditionally
clk_enet_out and clk_ptp are optional clocks, so we should not enable/disable them unconditionally. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/freescale')
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index d3ad5ea711d3..beaa5762e041 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -2105,8 +2105,10 @@ fec_probe(struct platform_device *pdev)
2105 2105
2106 clk_prepare_enable(fep->clk_ahb); 2106 clk_prepare_enable(fep->clk_ahb);
2107 clk_prepare_enable(fep->clk_ipg); 2107 clk_prepare_enable(fep->clk_ipg);
2108 clk_prepare_enable(fep->clk_enet_out); 2108 if (fep->clk_enet_out)
2109 clk_prepare_enable(fep->clk_ptp); 2109 clk_prepare_enable(fep->clk_enet_out);
2110 if (fep->clk_ptp)
2111 clk_prepare_enable(fep->clk_ptp);
2110 2112
2111 fep->reg_phy = devm_regulator_get(&pdev->dev, "phy"); 2113 fep->reg_phy = devm_regulator_get(&pdev->dev, "phy");
2112 if (!IS_ERR(fep->reg_phy)) { 2114 if (!IS_ERR(fep->reg_phy)) {
@@ -2179,8 +2181,10 @@ failed_init:
2179failed_regulator: 2181failed_regulator:
2180 clk_disable_unprepare(fep->clk_ahb); 2182 clk_disable_unprepare(fep->clk_ahb);
2181 clk_disable_unprepare(fep->clk_ipg); 2183 clk_disable_unprepare(fep->clk_ipg);
2182 clk_disable_unprepare(fep->clk_enet_out); 2184 if (fep->clk_enet_out)
2183 clk_disable_unprepare(fep->clk_ptp); 2185 clk_disable_unprepare(fep->clk_enet_out);
2186 if (fep->clk_ptp)
2187 clk_disable_unprepare(fep->clk_ptp);
2184failed_clk: 2188failed_clk:
2185failed_ioremap: 2189failed_ioremap:
2186 free_netdev(ndev); 2190 free_netdev(ndev);
@@ -2206,10 +2210,12 @@ fec_drv_remove(struct platform_device *pdev)
2206 } 2210 }
2207 if (fep->reg_phy) 2211 if (fep->reg_phy)
2208 regulator_disable(fep->reg_phy); 2212 regulator_disable(fep->reg_phy);
2209 clk_disable_unprepare(fep->clk_ptp); 2213 if (fep->clk_ptp)
2214 clk_disable_unprepare(fep->clk_ptp);
2210 if (fep->ptp_clock) 2215 if (fep->ptp_clock)
2211 ptp_clock_unregister(fep->ptp_clock); 2216 ptp_clock_unregister(fep->ptp_clock);
2212 clk_disable_unprepare(fep->clk_enet_out); 2217 if (fep->clk_enet_out)
2218 clk_disable_unprepare(fep->clk_enet_out);
2213 clk_disable_unprepare(fep->clk_ahb); 2219 clk_disable_unprepare(fep->clk_ahb);
2214 clk_disable_unprepare(fep->clk_ipg); 2220 clk_disable_unprepare(fep->clk_ipg);
2215 free_netdev(ndev); 2221 free_netdev(ndev);
@@ -2228,7 +2234,8 @@ fec_suspend(struct device *dev)
2228 fec_stop(ndev); 2234 fec_stop(ndev);
2229 netif_device_detach(ndev); 2235 netif_device_detach(ndev);
2230 } 2236 }
2231 clk_disable_unprepare(fep->clk_enet_out); 2237 if (fep->clk_enet_out)
2238 clk_disable_unprepare(fep->clk_enet_out);
2232 clk_disable_unprepare(fep->clk_ahb); 2239 clk_disable_unprepare(fep->clk_ahb);
2233 clk_disable_unprepare(fep->clk_ipg); 2240 clk_disable_unprepare(fep->clk_ipg);
2234 2241
@@ -2251,7 +2258,8 @@ fec_resume(struct device *dev)
2251 return ret; 2258 return ret;
2252 } 2259 }
2253 2260
2254 clk_prepare_enable(fep->clk_enet_out); 2261 if (fep->clk_enet_out)
2262 clk_prepare_enable(fep->clk_enet_out);
2255 clk_prepare_enable(fep->clk_ahb); 2263 clk_prepare_enable(fep->clk_ahb);
2256 clk_prepare_enable(fep->clk_ipg); 2264 clk_prepare_enable(fep->clk_ipg);
2257 if (netif_running(ndev)) { 2265 if (netif_running(ndev)) {