WoL fixes for DP83822 and DP83tc811
Subsystems (3)
v3 cover WoL fixes for DP83822 and DP83tc811
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(-)
Signature · 1 line
2.25.1
PATCH v3 1/2 net: phy: DP83822: Fix WoL in config init to be disabled
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.
--- drivers/net/phy/dp83822.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-)
drivers/net/phy/dp83822.c +14 -16
@@ -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)
Signature · 1 line
2.25.1
PATCH v3 2/2 net: phy: DP83TC811: Fix WoL in config init to be disabled
In reply to Dan MurphyThe 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.
DP83TC811 phy")
--- drivers/net/phy/dp83tc811.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/net/phy/dp83tc811.c +12 -9
@@ -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)
Signature · 1 line
2.25.1
David Miller
maintainerFrom: Dan Murphy <[email protected]>
Date: Tue, 28 Apr 2020 11:03:52 -0500
Quoted 4 lines
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 theset_wolcall.
Series applied, thanks.