From: Laurent Badel <laurentbadel@eaton.com>
To: <netdev@vger.kernel.org>, Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, <linux-kernel@vger.kernel.org>,
"Rafael J . Wysocki" <rjw@rjwysocki.net>,
Pavel Machek <pavel@ucw.cz>, <linux-pm@vger.kernel.org>
Cc: Laurent Badel <laurentbadel@eaton.com>
Subject: [PATCH net 1/1] net: phy: Reconfigure PHY interrupt in mdio_bus_phy_restore()
Date: Fri, 22 Jan 2021 15:35:24 +0100 [thread overview]
Message-ID: <20210122143524.14516-2-laurentbadel@eaton.com> (raw)
In-Reply-To: <20210122143524.14516-1-laurentbadel@eaton.com>
Some PHY (e.g. SMSC LAN87xx) clear their interrupt mask on software
reset. This breaks the ethernet interface on resuming from hibernation,
if the PHY is running in interrupt mode, so reconfigure interrupts
after the software reset in mdio_bus_phy_restore().
Signed-off-by: Laurent Badel <laurentbadel@eaton.com>
---
drivers/net/phy/phy_device.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 80c2e646c093..5070eed55447 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -324,6 +324,15 @@ static int mdio_bus_phy_restore(struct device *dev)
if (ret < 0)
return ret;
+ if (phydev->drv->config_intr && phy_interrupt_is_valid(phydev))
+ {
+ /* Some PHYs (e.g. SMSC LAN8720) clear their
+ * interrupt mask on software reset.
+ */
+ phy_free_interrupt(phydev);
+ phy_request_interrupt(phydev);
+ }
+
if (phydev->attached_dev && phydev->adjust_link)
phy_start_machine(phydev);
--
2.17.1
-----------------------------
Eaton Industries Manufacturing GmbH ~ Registered place of business: Route de la Longeraie 7, 1110, Morges, Switzerland
-----------------------------
next prev parent reply other threads:[~2021-01-22 14:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-22 14:35 [PATCH net 0/1] net: phy: Fix interrupt mask loss on resume from hibernation Laurent Badel
2021-01-22 14:35 ` Laurent Badel [this message]
2021-01-22 15:19 ` Heiner Kallweit
2021-01-22 16:12 ` [EXTERNAL] " Badel, Laurent
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=20210122143524.14516-2-laurentbadel@eaton.com \
--to=laurentbadel@eaton.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=rjw@rjwysocki.net \
/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
all inboxes | Powered by JetHome®