From: Florian Fainelli <f.fainelli@gmail.com>
To: netdev@vger.kernel.org
Cc: Florian Fainelli <f.fainelli@gmail.com>,
davem@davemloft.net, andrew@lunn.ch, opendmb@gmail.com,
Marc Gonzalez <marc_gonzalez@sigmadesigns.com>,
slash.tmp@free.fr, david.daney@cavium.com,
geert+renesas@glider.be
Subject: [RFC net-next 2/4] net: smsc911x: Properly manage PHY during suspend/resume
Date: Wed, 25 Oct 2017 16:21:22 -0700 [thread overview]
Message-ID: <20171025232124.14120-3-f.fainelli@gmail.com> (raw)
In-Reply-To: <20171025232124.14120-1-f.fainelli@gmail.com>
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(+)
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);
}
--
2.9.3
next prev parent reply other threads:[~2017-10-25 23:21 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-25 23:21 [RFC net-next 0/4] net: phy: PHY_HALTED, the return of the state Florian Fainelli
2017-10-25 23:21 ` [RFC net-next 1/4] net: phy: Export phy_stop_machine() Florian Fainelli
2017-10-30 13:44 ` Geert Uytterhoeven
2017-10-25 23:21 ` Florian Fainelli [this message]
2017-10-30 13:45 ` [RFC net-next 2/4] net: smsc911x: Properly manage PHY during suspend/resume Geert Uytterhoeven
2017-10-25 23:21 ` [RFC net-next 3/4] net: phy: Force PHY_HALTED during phy_disconnect() Florian Fainelli
2017-10-25 23:21 ` [RFC net-next 4/4] net: phy: Correctly process PHY_HALTED in phy_stop_machine() Florian Fainelli
2017-10-30 13:56 ` Geert Uytterhoeven
2017-10-30 16:09 ` Florian Fainelli
2017-10-31 15:26 ` Geert Uytterhoeven
2017-10-31 16:33 ` Florian Fainelli
2017-11-06 15:50 ` Geert Uytterhoeven
2017-11-27 4:05 ` Florian Fainelli
2017-11-27 7:48 ` Geert Uytterhoeven
2017-12-04 15:08 ` Marc Gonzalez
2017-10-27 11:35 ` [RFC net-next 0/4] net: phy: PHY_HALTED, the return of the state Andrew Lunn
2017-10-30 15:44 ` Marc Gonzalez
2017-10-30 16:27 ` David Daney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171025232124.14120-3-f.fainelli@gmail.com \
--to=f.fainelli@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=david.daney@cavium.com \
--cc=geert+renesas@glider.be \
--cc=marc_gonzalez@sigmadesigns.com \
--cc=netdev@vger.kernel.org \
--cc=opendmb@gmail.com \
--cc=slash.tmp@free.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).