net/fec: fix pm to survive to suspend/resume
authorEric Bénard <eric@eukrea.com>
Wed, 2 Jun 2010 13:13:34 +0000 (06:13 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 2 Jun 2010 13:13:34 +0000 (06:13 -0700)
* 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: Eric Bénard <eric@eukrea.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/fec.c

index ddf7a86cd4661f0cdfa438d7a2a9dae6db68acec..edfff92a6d8ebd8c141b9697b216efccfbbec226 100644 (file)
@@ -1373,10 +1373,9 @@ fec_suspend(struct platform_device *dev, pm_message_t state)
 
        if (ndev) {
                fep = netdev_priv(ndev);
-               if (netif_running(ndev)) {
-                       netif_device_detach(ndev);
-                       fec_stop(ndev);
-               }
+               if (netif_running(ndev))
+                       fec_enet_close(ndev);
+               clk_disable(fep->clk);
        }
        return 0;
 }
@@ -1385,12 +1384,13 @@ static int
 fec_resume(struct platform_device *dev)
 {
        struct net_device *ndev = platform_get_drvdata(dev);
+       struct fec_enet_private *fep;
 
        if (ndev) {
-               if (netif_running(ndev)) {
-                       fec_enet_init(ndev, 0);
-                       netif_device_attach(ndev);
-               }
+               fep = netdev_priv(ndev);
+               clk_enable(fep->clk);
+               if (netif_running(ndev))
+                       fec_enet_open(ndev);
        }
        return 0;
 }