Commit 9ef9ecfa authored by Catalin Popescu's avatar Catalin Popescu Committed by Jakub Kicinski

net: phy: dp8382x: keep WOL settings across suspends

Unlike other ethernet PHYs from TI, PHY dp8382x 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: default avatarCatalin Popescu <catalin.popescu@leica-geosystems.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20240408082602.3654090-1-catalin.popescu@leica-geosystems.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 6a053f07
...@@ -140,9 +140,10 @@ struct dp83822_private { ...@@ -140,9 +140,10 @@ struct dp83822_private {
u16 fx_sd_enable; u16 fx_sd_enable;
u8 cfg_dac_minus; u8 cfg_dac_minus;
u8 cfg_dac_plus; u8 cfg_dac_plus;
struct ethtool_wolinfo wol;
}; };
static int dp83822_set_wol(struct phy_device *phydev, static int dp83822_config_wol(struct phy_device *phydev,
struct ethtool_wolinfo *wol) struct ethtool_wolinfo *wol)
{ {
struct net_device *ndev = phydev->attached_dev; struct net_device *ndev = phydev->attached_dev;
...@@ -197,10 +198,25 @@ static int dp83822_set_wol(struct phy_device *phydev, ...@@ -197,10 +198,25 @@ static int dp83822_set_wol(struct phy_device *phydev,
MII_DP83822_WOL_CFG, value); MII_DP83822_WOL_CFG, value);
} else { } else {
return phy_clear_bits_mmd(phydev, DP83822_DEVADDR, return phy_clear_bits_mmd(phydev, DP83822_DEVADDR,
MII_DP83822_WOL_CFG, DP83822_WOL_EN); MII_DP83822_WOL_CFG,
DP83822_WOL_EN |
DP83822_WOL_MAGIC_EN |
DP83822_WOL_SECURE_ON);
} }
} }
static int dp83822_set_wol(struct phy_device *phydev,
struct ethtool_wolinfo *wol)
{
struct dp83822_private *dp83822 = phydev->priv;
int ret;
ret = dp83822_config_wol(phydev, wol);
if (!ret)
memcpy(&dp83822->wol, wol, sizeof(*wol));
return ret;
}
static void dp83822_get_wol(struct phy_device *phydev, static void dp83822_get_wol(struct phy_device *phydev,
struct ethtool_wolinfo *wol) struct ethtool_wolinfo *wol)
{ {
...@@ -346,13 +362,6 @@ static irqreturn_t dp83822_handle_interrupt(struct phy_device *phydev) ...@@ -346,13 +362,6 @@ static irqreturn_t dp83822_handle_interrupt(struct phy_device *phydev)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static int dp8382x_disable_wol(struct phy_device *phydev)
{
return phy_clear_bits_mmd(phydev, DP83822_DEVADDR, MII_DP83822_WOL_CFG,
DP83822_WOL_EN | DP83822_WOL_MAGIC_EN |
DP83822_WOL_SECURE_ON);
}
static int dp83822_read_status(struct phy_device *phydev) static int dp83822_read_status(struct phy_device *phydev)
{ {
struct dp83822_private *dp83822 = phydev->priv; struct dp83822_private *dp83822 = phydev->priv;
...@@ -496,7 +505,7 @@ static int dp83822_config_init(struct phy_device *phydev) ...@@ -496,7 +505,7 @@ static int dp83822_config_init(struct phy_device *phydev)
return err; return err;
} }
} }
return dp8382x_disable_wol(phydev); return dp83822_config_wol(phydev, &dp83822->wol);
} }
static int dp83826_config_rmii_mode(struct phy_device *phydev) static int dp83826_config_rmii_mode(struct phy_device *phydev)
...@@ -575,12 +584,14 @@ static int dp83826_config_init(struct phy_device *phydev) ...@@ -575,12 +584,14 @@ static int dp83826_config_init(struct phy_device *phydev)
return ret; return ret;
} }
return dp8382x_disable_wol(phydev); return dp83822_config_wol(phydev, &dp83822->wol);
} }
static int dp8382x_config_init(struct phy_device *phydev) static int dp8382x_config_init(struct phy_device *phydev)
{ {
return dp8382x_disable_wol(phydev); struct dp83822_private *dp83822 = phydev->priv;
return dp83822_config_wol(phydev, &dp83822->wol);
} }
static int dp83822_phy_reset(struct phy_device *phydev) static int dp83822_phy_reset(struct phy_device *phydev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment