aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/freescale
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2014-07-07 19:23:04 -0400
committerDavid S. Miller <davem@davemloft.net>2014-07-08 00:21:22 -0400
commitd76cfae9674f325de35ff23ab07ff9c7d809de4a (patch)
treecdd379790314c82a2c556603ee0fda5c0286a16f /drivers/net/ethernet/freescale
parent0b146ca8d467c1dc6ad50628089d183608a47e40 (diff)
net: fec: stop the phy before shutting down the MAC
When the network interface goes down, stop the phy to prevent further link up status changes before taking the MAC or netif sections down. This prevents further reception of link up events which could potentially call fec_restart(). Since phy_stop() takes the mutex which adjust_link() runs under, we also ensure that adjust_link() will not already be processing a link up event. We also need to do this when suspending as well - we don't want a mis-timed phy state change to restart the MAC after we have stopped it for suspend, and thus need to restart the phy when resuming. Acked-by: Fugang Duan <B38611@freescale.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> 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.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index cf805468eecc..e0a1ac1826b7 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -2181,13 +2181,14 @@ fec_enet_close(struct net_device *ndev)
2181{ 2181{
2182 struct fec_enet_private *fep = netdev_priv(ndev); 2182 struct fec_enet_private *fep = netdev_priv(ndev);
2183 2183
2184 phy_stop(fep->phy_dev);
2185
2184 /* Don't know what to do yet. */ 2186 /* Don't know what to do yet. */
2185 napi_disable(&fep->napi); 2187 napi_disable(&fep->napi);
2186 fep->opened = 0; 2188 fep->opened = 0;
2187 netif_tx_disable(ndev); 2189 netif_tx_disable(ndev);
2188 fec_stop(ndev); 2190 fec_stop(ndev);
2189 2191
2190 phy_stop(fep->phy_dev);
2191 phy_disconnect(fep->phy_dev); 2192 phy_disconnect(fep->phy_dev);
2192 fep->phy_dev = NULL; 2193 fep->phy_dev = NULL;
2193 2194
@@ -2669,6 +2670,7 @@ fec_suspend(struct device *dev)
2669 struct fec_enet_private *fep = netdev_priv(ndev); 2670 struct fec_enet_private *fep = netdev_priv(ndev);
2670 2671
2671 if (netif_running(ndev)) { 2672 if (netif_running(ndev)) {
2673 phy_stop(fep->phy_dev);
2672 fec_stop(ndev); 2674 fec_stop(ndev);
2673 netif_device_detach(ndev); 2675 netif_device_detach(ndev);
2674 } 2676 }
@@ -2702,6 +2704,7 @@ fec_resume(struct device *dev)
2702 if (netif_running(ndev)) { 2704 if (netif_running(ndev)) {
2703 fec_restart(ndev, fep->full_duplex); 2705 fec_restart(ndev, fep->full_duplex);
2704 netif_device_attach(ndev); 2706 netif_device_attach(ndev);
2707 phy_start(fep->phy_dev);
2705 } 2708 }
2706 2709
2707 return 0; 2710 return 0;