* [PATCH v2] net: phy: at803x: disable WOL at probe
@ 2022-05-27 8:49 Viorel Suman (OSS)
2022-05-31 4:40 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Viorel Suman (OSS) @ 2022-05-27 8:49 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Luo Jie, netdev,
linux-kernel
Cc: linux-imx, Viorel Suman
From: Viorel Suman <viorel.suman@nxp.com>
Before 7beecaf7d507b ("net: phy: at803x: improve the WOL feature") patch
"at803x_get_wol" implementation used AT803X_INTR_ENABLE_WOL value to set
WAKE_MAGIC flag, and now AT803X_WOL_EN value is used for the same purpose.
The problem here is that the values of these two bits are different after
hardware reset: AT803X_INTR_ENABLE_WOL=0 after hardware reset, but
AT803X_WOL_EN=1. So now, if called right after boot, "at803x_get_wol" will
set WAKE_MAGIC flag, even if WOL function is not enabled by calling
"at803x_set_wol" function. The patch disables WOL function on probe thus
the behavior is consistent.
Fixes: 7beecaf7d507b ("net: phy: at803x: improve the WOL feature")
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
---
drivers/net/phy/at803x.c | 33 ++++++++++++++++++++++-----------
1 file changed, 22 insertions(+), 11 deletions(-)
Changes since v1:
- addressed Jakub comments
diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index 73926006d319..6a467e7817a6 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -433,20 +433,21 @@ static void at803x_context_restore(struct phy_device *phydev,
static int at803x_set_wol(struct phy_device *phydev,
struct ethtool_wolinfo *wol)
{
- struct net_device *ndev = phydev->attached_dev;
- const u8 *mac;
int ret, irq_enabled;
- unsigned int i;
- static const unsigned int offsets[] = {
- AT803X_LOC_MAC_ADDR_32_47_OFFSET,
- AT803X_LOC_MAC_ADDR_16_31_OFFSET,
- AT803X_LOC_MAC_ADDR_0_15_OFFSET,
- };
-
- if (!ndev)
- return -ENODEV;
if (wol->wolopts & WAKE_MAGIC) {
+ struct net_device *ndev = phydev->attached_dev;
+ const u8 *mac;
+ unsigned int i;
+ static const unsigned int offsets[] = {
+ AT803X_LOC_MAC_ADDR_32_47_OFFSET,
+ AT803X_LOC_MAC_ADDR_16_31_OFFSET,
+ AT803X_LOC_MAC_ADDR_0_15_OFFSET,
+ };
+
+ if (!ndev)
+ return -ENODEV;
+
mac = (const u8 *) ndev->dev_addr;
if (!is_valid_ether_addr(mac))
@@ -857,6 +858,9 @@ static int at803x_probe(struct phy_device *phydev)
if (phydev->drv->phy_id == ATH8031_PHY_ID) {
int ccr = phy_read(phydev, AT803X_REG_CHIP_CONFIG);
int mode_cfg;
+ struct ethtool_wolinfo wol = {
+ .wolopts = 0,
+ };
if (ccr < 0)
goto err;
@@ -872,6 +876,13 @@ static int at803x_probe(struct phy_device *phydev)
priv->is_fiber = true;
break;
}
+
+ /* Disable WOL by default */
+ ret = at803x_set_wol(phydev, &wol);
+ if (ret < 0) {
+ phydev_err(phydev, "failed to disable WOL on probe: %d\n", ret);
+ goto err;
+ }
}
return 0;
--
2.35.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] net: phy: at803x: disable WOL at probe
2022-05-27 8:49 [PATCH v2] net: phy: at803x: disable WOL at probe Viorel Suman (OSS)
@ 2022-05-31 4:40 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-05-31 4:40 UTC (permalink / raw)
To: Viorel Suman
Cc: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni, luoj,
netdev, linux-kernel, linux-imx, viorel.suman
Hello:
This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Fri, 27 May 2022 11:49:34 +0300 you wrote:
> From: Viorel Suman <viorel.suman@nxp.com>
>
> Before 7beecaf7d507b ("net: phy: at803x: improve the WOL feature") patch
> "at803x_get_wol" implementation used AT803X_INTR_ENABLE_WOL value to set
> WAKE_MAGIC flag, and now AT803X_WOL_EN value is used for the same purpose.
> The problem here is that the values of these two bits are different after
> hardware reset: AT803X_INTR_ENABLE_WOL=0 after hardware reset, but
> AT803X_WOL_EN=1. So now, if called right after boot, "at803x_get_wol" will
> set WAKE_MAGIC flag, even if WOL function is not enabled by calling
> "at803x_set_wol" function. The patch disables WOL function on probe thus
> the behavior is consistent.
>
> [...]
Here is the summary with links:
- [v2] net: phy: at803x: disable WOL at probe
https://git.kernel.org/netdev/net/c/d7cd5e06c9dd
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-05-31 4:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-27 8:49 [PATCH v2] net: phy: at803x: disable WOL at probe Viorel Suman (OSS)
2022-05-31 4:40 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.