diff mbox

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

Message ID 1274982828-13082-1-git-send-email-eric@eukrea.com
State Rejected, archived
Delegated to: David Miller
Headers show

Commit Message

Eric Benard May 27, 2010, 5:53 p.m. UTC
* with this patch, if the connection if active before suspend, it
will be active after resume.
* before this patch, it was necessary to close the interface and
reopen it to recover the connection.

Signed-off-by: Eric Bénard <eric@eukrea.com>
Cc: s.hauer@pengutronix.de
Cc: sshtylyov@mvista.com
Cc: linux-arm-kernel@lists.infradead.org
Cc: fabioestevam@yahoo.com
Cc: netdev@vger.kernel.org
---
 drivers/net/fec.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

Comments

David Miller May 29, 2010, 7:15 a.m. UTC | #1
From: Eric Bénard <eric@eukrea.com>
Date: Thu, 27 May 2010 19:53:48 +0200

> * with this patch, if the connection if active before suspend, it
> will be active after resume.
> * before this patch, it was necessary to close the interface and
> reopen it to recover the connection.
> 
> Signed-off-by: Eric Bénard <eric@eukrea.com>

On resume the PHY should be reset and the link renegotiated (or set to
a fixed speed/duplex if set by the user via ethtool) just like as
happens on ->open().

You seem to be avoiding that here.

If the PHY is not functioning properly after the ->resume() triggered
reset, fix that instead.

I'm not applying this patch, it doesn't look the right thing to do at
all.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 9b4e8f7..1521972 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -1974,10 +1974,11 @@  fec_suspend(struct platform_device *dev, pm_message_t state)
 	struct fec_enet_private *fep;
 
 	if (ndev) {
-		fep = netdev_priv(ndev);
 		if (netif_running(ndev)) {
+			fep = netdev_priv(ndev);
+			netif_stop_queue(ndev);
 			netif_device_detach(ndev);
-			fec_stop(ndev);
+			clk_disable(fep->clk);
 		}
 	}
 	return 0;
@@ -1987,11 +1988,14 @@  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);
+			fep = netdev_priv(ndev);
+			clk_enable(fep->clk);
 			netif_device_attach(ndev);
+			netif_start_queue(ndev);
 		}
 	}
 	return 0;