[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240306171446.859750-1-catalin.popescu@leica-geosystems.com>
Date: Wed, 6 Mar 2024 18:14:46 +0100
From: Catalin Popescu <catalin.popescu@...ca-geosystems.com>
To: andrew@...n.ch,
hkallweit1@...il.com,
linux@...linux.org.uk,
davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com
Cc: netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
bsp-development.geo@...ca-geosystems.com,
m.felsch@...gutronix.de,
Catalin Popescu <catalin.popescu@...ca-geosystems.com>
Subject: [PATCH net-next] net: phy: dp8382x: keep WOL setting across suspends
Unlike other ethernet PHYs from TI, PHY dp83822x has WOL enabled
at reset. The driver explicitly disables WOL in config_init callback
which is called during init and during resume from suspend. Hence,
WOL is unconditionally disabled during resume, even if it was enabled
before the suspend. We make sure that WOL configuration is persistent
across suspends.
Signed-off-by: Catalin Popescu <catalin.popescu@...ca-geosystems.com>
---
drivers/net/phy/dp83822.c | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/drivers/net/phy/dp83822.c b/drivers/net/phy/dp83822.c
index 95178e26a060..618317c1e27f 100644
--- a/drivers/net/phy/dp83822.c
+++ b/drivers/net/phy/dp83822.c
@@ -136,6 +136,7 @@
struct dp83822_private {
bool fx_signal_det_low;
+ bool wol_enabled;
int fx_enabled;
u16 fx_sd_enable;
u8 cfg_dac_minus;
@@ -146,8 +147,10 @@ static int dp83822_set_wol(struct phy_device *phydev,
struct ethtool_wolinfo *wol)
{
struct net_device *ndev = phydev->attached_dev;
+ struct dp83822_private *dp83822 = phydev->priv;
u16 value;
const u8 *mac;
+ int ret;
if (wol->wolopts & (WAKE_MAGIC | WAKE_MAGICSECURE)) {
mac = (const u8 *)ndev->dev_addr;
@@ -193,11 +196,17 @@ static int dp83822_set_wol(struct phy_device *phydev,
value |= DP83822_WOL_EN | DP83822_WOL_INDICATION_SEL |
DP83822_WOL_CLR_INDICATION;
- return phy_write_mmd(phydev, DP83822_DEVADDR,
- MII_DP83822_WOL_CFG, value);
+ ret = phy_write_mmd(phydev, DP83822_DEVADDR,
+ MII_DP83822_WOL_CFG, value);
+ if (!ret)
+ dp83822->wol_enabled = true;
+ return ret;
} else {
- return phy_clear_bits_mmd(phydev, DP83822_DEVADDR,
- MII_DP83822_WOL_CFG, DP83822_WOL_EN);
+ ret = phy_clear_bits_mmd(phydev, DP83822_DEVADDR,
+ MII_DP83822_WOL_CFG, DP83822_WOL_EN);
+ if (!ret)
+ dp83822->wol_enabled = false;
+ return ret;
}
}
@@ -493,6 +502,9 @@ static int dp83822_config_init(struct phy_device *phydev)
return err;
}
}
+
+ if (dp83822->wol_enabled)
+ return 0;
return dp8382x_disable_wol(phydev);
}
@@ -572,11 +584,17 @@ static int dp83826_config_init(struct phy_device *phydev)
return ret;
}
+ if (dp83822->wol_enabled)
+ return 0;
return dp8382x_disable_wol(phydev);
}
static int dp8382x_config_init(struct phy_device *phydev)
{
+ struct dp83822_private *dp83822 = phydev->priv;
+
+ if (dp83822->wol_enabled)
+ return 0;
return dp8382x_disable_wol(phydev);
}
base-commit: 61996c073c9b070922ad3a36c981ca6ddbea19a5
prerequisite-patch-id: 0000000000000000000000000000000000000000
--
2.34.1
Powered by blists - more mailing lists