netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/2] fix at803x wol setting
@ 2023-08-02 19:13 Li Yang
  2023-08-02 19:13 ` [PATCH v4 1/2] net: phy: at803x: fix the wol setting functions Li Yang
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Li Yang @ 2023-08-02 19:13 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, David S . Miller,
	Jakub Kicinski, David Bauer
  Cc: netdev, linux-kernel, Li Yang

v3:
  Break long lines
  Add back error checking of phy_read

v4:
  Disable WoL in 1588 register for AR8031 in probe

Li Yang (2):
  net: phy: at803x: fix the wol setting functions
  net: phy: at803x: remove set/get wol callbacks for AR8032

 drivers/net/phy/at803x.c | 47 +++++++++++++++++++++-------------------
 1 file changed, 25 insertions(+), 22 deletions(-)

-- 
2.25.1.377.g2d2118b


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v4 1/2] net: phy: at803x: fix the wol setting functions
  2023-08-02 19:13 [PATCH v4 0/2] fix at803x wol setting Li Yang
@ 2023-08-02 19:13 ` Li Yang
  2023-08-03  9:11   ` Russell King (Oracle)
  2023-08-02 19:13 ` [PATCH v4 2/2] net: phy: at803x: remove set/get wol callbacks for AR8032 Li Yang
  2023-08-04  9:10 ` [PATCH v4 0/2] fix at803x wol setting patchwork-bot+netdevbpf
  2 siblings, 1 reply; 5+ messages in thread
From: Li Yang @ 2023-08-02 19:13 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, David S . Miller,
	Jakub Kicinski, David Bauer
  Cc: netdev, linux-kernel, Li Yang, Viorel Suman, Wei Fang

In commit 7beecaf7d507 ("net: phy: at803x: improve the WOL feature"), it
seems not correct to use a wol_en bit in a 1588 Control Register which is
only available on AR8031/AR8033(share the same phy_id) to determine if WoL
is enabled.  Change it back to use AT803X_INTR_ENABLE_WOL for determining
the WoL status which is applicable on all chips supporting wol. Also update
the at803x_set_wol() function to only update the 1588 register on chips
having it.  After this change, disabling wol at probe from commit
d7cd5e06c9dd ("net: phy: at803x: disable WOL at probe") is no longer
needed.  Change it to just disable the WoL bit in 1588 register for
AR8031/AR8033 to be aligned with AT803X_INTR_ENABLE_WOL in probe.

Fixes: 7beecaf7d507 ("net: phy: at803x: improve the WOL feature")
Signed-off-by: Li Yang <leoyang.li@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Wei Fang <wei.fang@nxp.com>
---
 drivers/net/phy/at803x.c | 45 ++++++++++++++++++++++------------------
 1 file changed, 25 insertions(+), 20 deletions(-)

diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index c1f307d90518..9c2c2e2ee94b 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -459,21 +459,27 @@ static int at803x_set_wol(struct phy_device *phydev,
 			phy_write_mmd(phydev, MDIO_MMD_PCS, offsets[i],
 				      mac[(i * 2) + 1] | (mac[(i * 2)] << 8));
 
-		/* Enable WOL function */
-		ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, AT803X_PHY_MMD3_WOL_CTRL,
-				0, AT803X_WOL_EN);
-		if (ret)
-			return ret;
+		/* Enable WOL function for 1588 */
+		if (phydev->drv->phy_id == ATH8031_PHY_ID) {
+			ret = phy_modify_mmd(phydev, MDIO_MMD_PCS,
+					     AT803X_PHY_MMD3_WOL_CTRL,
+					     0, AT803X_WOL_EN);
+			if (ret)
+				return ret;
+		}
 		/* Enable WOL interrupt */
 		ret = phy_modify(phydev, AT803X_INTR_ENABLE, 0, AT803X_INTR_ENABLE_WOL);
 		if (ret)
 			return ret;
 	} else {
-		/* Disable WoL function */
-		ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, AT803X_PHY_MMD3_WOL_CTRL,
-				AT803X_WOL_EN, 0);
-		if (ret)
-			return ret;
+		/* Disable WoL function for 1588 */
+		if (phydev->drv->phy_id == ATH8031_PHY_ID) {
+			ret = phy_modify_mmd(phydev, MDIO_MMD_PCS,
+					     AT803X_PHY_MMD3_WOL_CTRL,
+					     AT803X_WOL_EN, 0);
+			if (ret)
+				return ret;
+		}
 		/* Disable WOL interrupt */
 		ret = phy_modify(phydev, AT803X_INTR_ENABLE, AT803X_INTR_ENABLE_WOL, 0);
 		if (ret)
@@ -508,11 +514,11 @@ static void at803x_get_wol(struct phy_device *phydev,
 	wol->supported = WAKE_MAGIC;
 	wol->wolopts = 0;
 
-	value = phy_read_mmd(phydev, MDIO_MMD_PCS, AT803X_PHY_MMD3_WOL_CTRL);
+	value = phy_read(phydev, AT803X_INTR_ENABLE);
 	if (value < 0)
 		return;
 
-	if (value & AT803X_WOL_EN)
+	if (value & AT803X_INTR_ENABLE_WOL)
 		wol->wolopts |= WAKE_MAGIC;
 }
 
@@ -858,9 +864,6 @@ 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)
 			return ccr;
@@ -877,12 +880,14 @@ static int at803x_probe(struct phy_device *phydev)
 			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);
+		/* Disable WoL in 1588 register which is enabled
+		 * by default
+		 */
+		ret = phy_modify_mmd(phydev, MDIO_MMD_PCS,
+				     AT803X_PHY_MMD3_WOL_CTRL,
+				     AT803X_WOL_EN, 0);
+		if (ret)
 			return ret;
-		}
 	}
 
 	return 0;
-- 
2.25.1.377.g2d2118b


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v4 2/2] net: phy: at803x: remove set/get wol callbacks for AR8032
  2023-08-02 19:13 [PATCH v4 0/2] fix at803x wol setting Li Yang
  2023-08-02 19:13 ` [PATCH v4 1/2] net: phy: at803x: fix the wol setting functions Li Yang
@ 2023-08-02 19:13 ` Li Yang
  2023-08-04  9:10 ` [PATCH v4 0/2] fix at803x wol setting patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: Li Yang @ 2023-08-02 19:13 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, David S . Miller,
	Jakub Kicinski, David Bauer
  Cc: netdev, linux-kernel, Li Yang

Since the AR8032 part does not support wol, remove related callbacks
from it.

Fixes: 5800091a2061 ("net: phy: at803x: add support for AR8032 PHY")
Signed-off-by: Li Yang <leoyang.li@nxp.com>
Cc: David Bauer <mail@david-bauer.net>
---
 drivers/net/phy/at803x.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index 9c2c2e2ee94b..8a77ec33b417 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -2064,8 +2064,6 @@ static struct phy_driver at803x_driver[] = {
 	.flags			= PHY_POLL_CABLE_TEST,
 	.config_init		= at803x_config_init,
 	.link_change_notify	= at803x_link_change_notify,
-	.set_wol		= at803x_set_wol,
-	.get_wol		= at803x_get_wol,
 	.suspend		= at803x_suspend,
 	.resume			= at803x_resume,
 	/* PHY_BASIC_FEATURES */
-- 
2.25.1.377.g2d2118b


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v4 1/2] net: phy: at803x: fix the wol setting functions
  2023-08-02 19:13 ` [PATCH v4 1/2] net: phy: at803x: fix the wol setting functions Li Yang
@ 2023-08-03  9:11   ` Russell King (Oracle)
  0 siblings, 0 replies; 5+ messages in thread
From: Russell King (Oracle) @ 2023-08-03  9:11 UTC (permalink / raw)
  To: Li Yang
  Cc: Andrew Lunn, Heiner Kallweit, David S . Miller, Jakub Kicinski,
	David Bauer, netdev, linux-kernel, Viorel Suman, Wei Fang

On Wed, Aug 02, 2023 at 02:13:46PM -0500, Li Yang wrote:
> In commit 7beecaf7d507 ("net: phy: at803x: improve the WOL feature"), it
> seems not correct to use a wol_en bit in a 1588 Control Register which is
> only available on AR8031/AR8033(share the same phy_id) to determine if WoL
> is enabled.  Change it back to use AT803X_INTR_ENABLE_WOL for determining
> the WoL status which is applicable on all chips supporting wol. Also update
> the at803x_set_wol() function to only update the 1588 register on chips
> having it.  After this change, disabling wol at probe from commit
> d7cd5e06c9dd ("net: phy: at803x: disable WOL at probe") is no longer
> needed.  Change it to just disable the WoL bit in 1588 register for
> AR8031/AR8033 to be aligned with AT803X_INTR_ENABLE_WOL in probe.
> 
> Fixes: 7beecaf7d507 ("net: phy: at803x: improve the WOL feature")
> Signed-off-by: Li Yang <leoyang.li@nxp.com>
> Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
> Reviewed-by: Wei Fang <wei.fang@nxp.com>

Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Thanks!

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v4 0/2] fix at803x wol setting
  2023-08-02 19:13 [PATCH v4 0/2] fix at803x wol setting Li Yang
  2023-08-02 19:13 ` [PATCH v4 1/2] net: phy: at803x: fix the wol setting functions Li Yang
  2023-08-02 19:13 ` [PATCH v4 2/2] net: phy: at803x: remove set/get wol callbacks for AR8032 Li Yang
@ 2023-08-04  9:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-08-04  9:10 UTC (permalink / raw)
  To: Li Yang; +Cc: andrew, hkallweit1, linux, davem, kuba, mail, netdev,
	linux-kernel

Hello:

This series was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Wed,  2 Aug 2023 14:13:45 -0500 you wrote:
> v3:
>   Break long lines
>   Add back error checking of phy_read
> 
> v4:
>   Disable WoL in 1588 register for AR8031 in probe
> 
> [...]

Here is the summary with links:
  - [v4,1/2] net: phy: at803x: fix the wol setting functions
    https://git.kernel.org/netdev/net/c/e58f30246c35
  - [v4,2/2] net: phy: at803x: remove set/get wol callbacks for AR8032
    https://git.kernel.org/netdev/net/c/d7791cec2304

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] 5+ messages in thread

end of thread, other threads:[~2023-08-04  9:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-02 19:13 [PATCH v4 0/2] fix at803x wol setting Li Yang
2023-08-02 19:13 ` [PATCH v4 1/2] net: phy: at803x: fix the wol setting functions Li Yang
2023-08-03  9:11   ` Russell King (Oracle)
2023-08-02 19:13 ` [PATCH v4 2/2] net: phy: at803x: remove set/get wol callbacks for AR8032 Li Yang
2023-08-04  9:10 ` [PATCH v4 0/2] fix at803x wol setting patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).