diff mbox series

[RFC,net-next,2/4] net: smsc911x: Properly manage PHY during suspend/resume

Message ID 20171025232124.14120-3-f.fainelli@gmail.com
State RFC, archived
Delegated to: David Miller
Headers show
Series [RFC,net-next,1/4] net: phy: Export phy_stop_machine() | expand

Commit Message

Florian Fainelli Oct. 25, 2017, 11:21 p.m. UTC
Commit 2aa70f864955 ("net: smsc911x: Quieten netif during suspend")
addressed the network device parts of the suspend/resume process, but
this is not enough, we can also need to manage the PHY state machine
during suspend.

Because Geert indicated that we are going to cut the power to the block,
we need the hard synchronization that phy_stop_machine() guarantees,
conversely use phy_start_machine() to resume properly.

There appears to be a desire to enable Wake-on-LAN, which is obviously
dependent on the PHY not being suspend, so we don't suspend it. A future
patch should probably add proper support for turning on/off Wake-on-LAN
on a PHY activity/password etc. basis.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/smsc/smsc911x.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Geert Uytterhoeven Oct. 30, 2017, 1:45 p.m. UTC | #1
On Thu, Oct 26, 2017 at 1:21 AM, Florian Fainelli <f.fainelli@gmail.com> wrote:
> Commit 2aa70f864955 ("net: smsc911x: Quieten netif during suspend")
> addressed the network device parts of the suspend/resume process, but
> this is not enough, we can also need to manage the PHY state machine
> during suspend.
>
> Because Geert indicated that we are going to cut the power to the block,
> we need the hard synchronization that phy_stop_machine() guarantees,
> conversely use phy_start_machine() to resume properly.
>
> There appears to be a desire to enable Wake-on-LAN, which is obviously
> dependent on the PHY not being suspend, so we don't suspend it. A future
> patch should probably add proper support for turning on/off Wake-on-LAN
> on a PHY activity/password etc. basis.
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Reviewed-and-tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
diff mbox series

Patch

diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index 012fb66eed8d..82f9a175073f 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -2598,6 +2598,11 @@  static int smsc911x_suspend(struct device *dev)
 	if (netif_running(ndev)) {
 		netif_stop_queue(ndev);
 		netif_device_detach(ndev);
+		phy_stop(ndev->phydev);
+		/* Use a hard synchronization here because we will cut the
+		 * power fo the block next
+		 */
+		phy_stop_machine(ndev->phydev);
 	}
 
 	/* enable wake on LAN, energy detection and the external PME
@@ -2638,6 +2643,8 @@  static int smsc911x_resume(struct device *dev)
 
 	if (netif_running(ndev)) {
 		netif_device_attach(ndev);
+		phy_start_machine(ndev->phydev);
+		phy_start(ndev->phydev);
 		netif_start_queue(ndev);
 	}