All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v3 0/2]  WoL fixes for DP83822 and DP83tc811
@ 2020-04-28 16:03 Dan Murphy
  2020-04-28 16:03 ` [PATCH net v3 1/2] net: phy: DP83822: Fix WoL in config init to be disabled Dan Murphy
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dan Murphy @ 2020-04-28 16:03 UTC (permalink / raw)
  To: andrew, f.fainelli, hkallweit1
  Cc: linux, davem, linux-kernel, netdev, afd, Dan Murphy

Hello

The WoL feature for each device was enabled during boot or when the PHY was
brought up which may be undesired.  These patches disable the WoL in the
config_init.  The disabling and enabling of the WoL is now done though the
set_wol call.

Dan

Dan Murphy (2):
  net: phy: DP83822: Fix WoL in config init to be disabled
  net: phy: DP83TC811: Fix WoL in config init to be disabled

 drivers/net/phy/dp83822.c   | 30 ++++++++++++++----------------
 drivers/net/phy/dp83tc811.c | 21 ++++++++++++---------
 2 files changed, 26 insertions(+), 25 deletions(-)

-- 
2.25.1


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

* [PATCH net v3 1/2] net: phy: DP83822: Fix WoL in config init to be disabled
  2020-04-28 16:03 [PATCH net v3 0/2] WoL fixes for DP83822 and DP83tc811 Dan Murphy
@ 2020-04-28 16:03 ` Dan Murphy
  2020-04-28 16:03 ` [PATCH net v3 2/2] net: phy: DP83TC811: " Dan Murphy
  2020-05-01 22:24 ` [PATCH net v3 0/2] WoL fixes for DP83822 and DP83tc811 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Dan Murphy @ 2020-04-28 16:03 UTC (permalink / raw)
  To: andrew, f.fainelli, hkallweit1
  Cc: linux, davem, linux-kernel, netdev, afd, Dan Murphy

The WoL feature should be disabled when config_init is called and the
feature should turned on or off  when set_wol is called.

In addition updated the calls to modify the registers to use the set_bit
and clear_bit function calls.

Fixes: 3b427751a9d0 ("net: phy: DP83822 initial driver submission")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 drivers/net/phy/dp83822.c | 30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/drivers/net/phy/dp83822.c b/drivers/net/phy/dp83822.c
index fe9aa3ad52a7..1dd19d0cb269 100644
--- a/drivers/net/phy/dp83822.c
+++ b/drivers/net/phy/dp83822.c
@@ -137,19 +137,18 @@ static int dp83822_set_wol(struct phy_device *phydev,
 			value &= ~DP83822_WOL_SECURE_ON;
 		}
 
-		value |= (DP83822_WOL_EN | DP83822_WOL_INDICATION_SEL |
-			  DP83822_WOL_CLR_INDICATION);
-		phy_write_mmd(phydev, DP83822_DEVADDR, MII_DP83822_WOL_CFG,
-			      value);
+		/* Clear any pending WoL interrupt */
+		phy_read(phydev, MII_DP83822_MISR2);
+
+		value |= DP83822_WOL_EN | DP83822_WOL_INDICATION_SEL |
+			 DP83822_WOL_CLR_INDICATION;
+
+		return phy_write_mmd(phydev, DP83822_DEVADDR,
+				     MII_DP83822_WOL_CFG, value);
 	} else {
-		value = phy_read_mmd(phydev, DP83822_DEVADDR,
-				     MII_DP83822_WOL_CFG);
-		value &= ~DP83822_WOL_EN;
-		phy_write_mmd(phydev, DP83822_DEVADDR, MII_DP83822_WOL_CFG,
-			      value);
+		return phy_clear_bits_mmd(phydev, DP83822_DEVADDR,
+					  MII_DP83822_WOL_CFG, DP83822_WOL_EN);
 	}
-
-	return 0;
 }
 
 static void dp83822_get_wol(struct phy_device *phydev,
@@ -258,12 +257,11 @@ static int dp83822_config_intr(struct phy_device *phydev)
 
 static int dp83822_config_init(struct phy_device *phydev)
 {
-	int value;
-
-	value = DP83822_WOL_MAGIC_EN | DP83822_WOL_SECURE_ON | DP83822_WOL_EN;
+	int value = DP83822_WOL_EN | DP83822_WOL_MAGIC_EN |
+		    DP83822_WOL_SECURE_ON;
 
-	return phy_write_mmd(phydev, DP83822_DEVADDR, MII_DP83822_WOL_CFG,
-	      value);
+	return phy_clear_bits_mmd(phydev, DP83822_DEVADDR,
+				  MII_DP83822_WOL_CFG, value);
 }
 
 static int dp83822_phy_reset(struct phy_device *phydev)
-- 
2.25.1


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

* [PATCH net v3 2/2] net: phy: DP83TC811: Fix WoL in config init to be disabled
  2020-04-28 16:03 [PATCH net v3 0/2] WoL fixes for DP83822 and DP83tc811 Dan Murphy
  2020-04-28 16:03 ` [PATCH net v3 1/2] net: phy: DP83822: Fix WoL in config init to be disabled Dan Murphy
@ 2020-04-28 16:03 ` Dan Murphy
  2020-05-01 22:24 ` [PATCH net v3 0/2] WoL fixes for DP83822 and DP83tc811 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Dan Murphy @ 2020-04-28 16:03 UTC (permalink / raw)
  To: andrew, f.fainelli, hkallweit1
  Cc: linux, davem, linux-kernel, netdev, afd, Dan Murphy

The WoL feature should be disabled when config_init is called and the
feature should turned on or off  when set_wol is called.

In addition updated the calls to modify the registers to use the set_bit
and clear_bit function calls.

Fixes: 6d749428788b ("net: phy: DP83TC811: Introduce support for the
DP83TC811 phy")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 drivers/net/phy/dp83tc811.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/net/phy/dp83tc811.c b/drivers/net/phy/dp83tc811.c
index 06f08832ebcd..d73725312c7c 100644
--- a/drivers/net/phy/dp83tc811.c
+++ b/drivers/net/phy/dp83tc811.c
@@ -139,16 +139,19 @@ static int dp83811_set_wol(struct phy_device *phydev,
 			value &= ~DP83811_WOL_SECURE_ON;
 		}
 
-		value |= (DP83811_WOL_EN | DP83811_WOL_INDICATION_SEL |
-			  DP83811_WOL_CLR_INDICATION);
-		phy_write_mmd(phydev, DP83811_DEVADDR, MII_DP83811_WOL_CFG,
-			      value);
+		/* Clear any pending WoL interrupt */
+		phy_read(phydev, MII_DP83811_INT_STAT1);
+
+		value |= DP83811_WOL_EN | DP83811_WOL_INDICATION_SEL |
+			 DP83811_WOL_CLR_INDICATION;
+
+		return phy_write_mmd(phydev, DP83811_DEVADDR,
+				     MII_DP83811_WOL_CFG, value);
 	} else {
-		phy_clear_bits_mmd(phydev, DP83811_DEVADDR, MII_DP83811_WOL_CFG,
-				   DP83811_WOL_EN);
+		return phy_clear_bits_mmd(phydev, DP83811_DEVADDR,
+					  MII_DP83811_WOL_CFG, DP83811_WOL_EN);
 	}
 
-	return 0;
 }
 
 static void dp83811_get_wol(struct phy_device *phydev,
@@ -292,8 +295,8 @@ static int dp83811_config_init(struct phy_device *phydev)
 
 	value = DP83811_WOL_MAGIC_EN | DP83811_WOL_SECURE_ON | DP83811_WOL_EN;
 
-	return phy_write_mmd(phydev, DP83811_DEVADDR, MII_DP83811_WOL_CFG,
-	      value);
+	return phy_clear_bits_mmd(phydev, DP83811_DEVADDR, MII_DP83811_WOL_CFG,
+				  value);
 }
 
 static int dp83811_phy_reset(struct phy_device *phydev)
-- 
2.25.1


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

* Re: [PATCH net v3 0/2] WoL fixes for DP83822 and DP83tc811
  2020-04-28 16:03 [PATCH net v3 0/2] WoL fixes for DP83822 and DP83tc811 Dan Murphy
  2020-04-28 16:03 ` [PATCH net v3 1/2] net: phy: DP83822: Fix WoL in config init to be disabled Dan Murphy
  2020-04-28 16:03 ` [PATCH net v3 2/2] net: phy: DP83TC811: " Dan Murphy
@ 2020-05-01 22:24 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2020-05-01 22:24 UTC (permalink / raw)
  To: dmurphy; +Cc: andrew, f.fainelli, hkallweit1, linux, linux-kernel, netdev, afd

From: Dan Murphy <dmurphy@ti.com>
Date: Tue, 28 Apr 2020 11:03:52 -0500

> The WoL feature for each device was enabled during boot or when the PHY was
> brought up which may be undesired.  These patches disable the WoL in the
> config_init.  The disabling and enabling of the WoL is now done though the
> set_wol call.

Series applied, thanks.

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

end of thread, other threads:[~2020-05-01 22:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-28 16:03 [PATCH net v3 0/2] WoL fixes for DP83822 and DP83tc811 Dan Murphy
2020-04-28 16:03 ` [PATCH net v3 1/2] net: phy: DP83822: Fix WoL in config init to be disabled Dan Murphy
2020-04-28 16:03 ` [PATCH net v3 2/2] net: phy: DP83TC811: " Dan Murphy
2020-05-01 22:24 ` [PATCH net v3 0/2] WoL fixes for DP83822 and DP83tc811 David Miller

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.