Skip to content

Commit 6c59904

Browse files
Dan Murphydavem330
authored andcommitted
net: phy: DP83TC811: 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. Fixes: 6d749428788b ("net: phy: DP83TC811: Introduce support for the DP83TC811 phy") Signed-off-by: Dan Murphy <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 600ac36 commit 6c59904

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

drivers/net/phy/dp83tc811.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -139,16 +139,19 @@ static int dp83811_set_wol(struct phy_device *phydev,
139139
value &= ~DP83811_WOL_SECURE_ON;
140140
}
141141

142-
value |= (DP83811_WOL_EN | DP83811_WOL_INDICATION_SEL |
143-
DP83811_WOL_CLR_INDICATION);
144-
phy_write_mmd(phydev, DP83811_DEVADDR, MII_DP83811_WOL_CFG,
145-
value);
142+
/* Clear any pending WoL interrupt */
143+
phy_read(phydev, MII_DP83811_INT_STAT1);
144+
145+
value |= DP83811_WOL_EN | DP83811_WOL_INDICATION_SEL |
146+
DP83811_WOL_CLR_INDICATION;
147+
148+
return phy_write_mmd(phydev, DP83811_DEVADDR,
149+
MII_DP83811_WOL_CFG, value);
146150
} else {
147-
phy_clear_bits_mmd(phydev, DP83811_DEVADDR, MII_DP83811_WOL_CFG,
148-
DP83811_WOL_EN);
151+
return phy_clear_bits_mmd(phydev, DP83811_DEVADDR,
152+
MII_DP83811_WOL_CFG, DP83811_WOL_EN);
149153
}
150154

151-
return 0;
152155
}
153156

154157
static void dp83811_get_wol(struct phy_device *phydev,
@@ -292,8 +295,8 @@ static int dp83811_config_init(struct phy_device *phydev)
292295

293296
value = DP83811_WOL_MAGIC_EN | DP83811_WOL_SECURE_ON | DP83811_WOL_EN;
294297

295-
return phy_write_mmd(phydev, DP83811_DEVADDR, MII_DP83811_WOL_CFG,
296-
value);
298+
return phy_clear_bits_mmd(phydev, DP83811_DEVADDR, MII_DP83811_WOL_CFG,
299+
value);
297300
}
298301

299302
static int dp83811_phy_reset(struct phy_device *phydev)

0 commit comments

Comments
 (0)