lkml.org 
[lkml]   [2021]   [Jul]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH net] net: phy: reconfigure PHY WOL in resume if WOL option still enabled
Date
From: Mohammad Athari Bin Ismail <mohammad.athari.ismail@intel.com>

When the PHY wakes up from suspend through WOL event, there is a need to
reconfigure the WOL if the WOL option still enabled. The main operation
is to clear the WOL event status. So that, subsequent WOL event can be
triggered properly.

This fix is needed especially for the PHY that operates in PHY_POLL mode
where there is no handler (such as interrupt handler) available to clear
the WOL event status.

Fixes: 611d779af7ca ("net: phy: fix MDIO bus PM PHY resuming")
Signed-off-by: Mohammad Athari Bin Ismail <mohammad.athari.ismail@intel.com>
---
drivers/net/phy/phy_device.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 5d5f9a9ee768..d68703ce03b1 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -295,6 +295,7 @@ static __maybe_unused int mdio_bus_phy_suspend(struct device *dev)

static __maybe_unused int mdio_bus_phy_resume(struct device *dev)
{
+ struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL };
struct phy_device *phydev = to_phy_device(dev);
int ret;

@@ -314,6 +315,13 @@ static __maybe_unused int mdio_bus_phy_resume(struct device *dev)
if (ret < 0)
return ret;
no_resume:
+ /* If the PHY has WOL option still enabled, reconfigure the WOL mainly
+ * to clear the WOL event status.
+ */
+ phy_ethtool_get_wol(phydev, &wol);
+ if (wol.wolopts)
+ phy_ethtool_set_wol(phydev, &wol);
+
if (phydev->attached_dev && phydev->adjust_link)
phy_start_machine(phydev);

--
2.17.1
\
 
 \ /
  Last update: 2021-07-08 02:45    [W:0.079 / U:0.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site