Commit e3fe8558 authored by Eric Bénard's avatar Eric Bénard Committed by David S. Miller

net/fec: fix pm to survive to suspend/resume

* in the actual driver, calling fec_stop and fec_enet_init doesn't
allow to have a working network interface at resume (where a
ifconfig down and up is required to recover the interface)
* by using fec_enet_close and fec_enet_open, this patch solves this
problem and handle the case where the link changed between suspend
and resume
* this patch also disable clock at suspend and reenable it at resume
Signed-off-by: default avatarEric Bénard <eric@eukrea.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b1011b37
...@@ -1373,10 +1373,9 @@ fec_suspend(struct platform_device *dev, pm_message_t state) ...@@ -1373,10 +1373,9 @@ fec_suspend(struct platform_device *dev, pm_message_t state)
if (ndev) { if (ndev) {
fep = netdev_priv(ndev); fep = netdev_priv(ndev);
if (netif_running(ndev)) { if (netif_running(ndev))
netif_device_detach(ndev); fec_enet_close(ndev);
fec_stop(ndev); clk_disable(fep->clk);
}
} }
return 0; return 0;
} }
...@@ -1385,12 +1384,13 @@ static int ...@@ -1385,12 +1384,13 @@ static int
fec_resume(struct platform_device *dev) fec_resume(struct platform_device *dev)
{ {
struct net_device *ndev = platform_get_drvdata(dev); struct net_device *ndev = platform_get_drvdata(dev);
struct fec_enet_private *fep;
if (ndev) { if (ndev) {
if (netif_running(ndev)) { fep = netdev_priv(ndev);
fec_enet_init(ndev, 0); clk_enable(fep->clk);
netif_device_attach(ndev); if (netif_running(ndev))
} fec_enet_open(ndev);
} }
return 0; return 0;
} }
......
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