Skip to content

Commit 6d61f48

Browse files
Dejin Zhengdavem330
authored andcommitted
net: phy: smsc: fix printing too many logs
Commit 7ae7ad2 ("net: phy: smsc: use phy_read_poll_timeout() to simplify the code") will print a lot of logs as follows when Ethernet cable is not connected: [ 4.473105] SMSC LAN8710/LAN8720 2188000.ethernet-1:00: lan87xx_read_status failed: -110 When wait 640 ms for check ENERGYON bit, the timeout should not be regarded as an actual error and an error message also should not be printed. due to a hardware bug in LAN87XX device, it leads to unstable detection of plugging in Ethernet cable when LAN87xx is in Energy Detect Power-Down mode. the workaround for it involves, when the link is down, and at each read_status() call: - disable EDPD mode, forcing the PHY out of low-power mode - waiting 640ms to see if we have any energy detected from the media - re-enable entry to EDPD mode This is presumably enough to allow the PHY to notice that a cable is connected, and resume normal operations to negotiate with the partner. The problem is that when no media is detected, the 640ms wait times out and this commit was modified to prints an error message. it is an inappropriate conversion by used phy_read_poll_timeout() to introduce this bug. so fix this issue by use read_poll_timeout() to replace phy_read_poll_timeout(). Fixes: 7ae7ad2 ("net: phy: smsc: use phy_read_poll_timeout() to simplify the code") Reported-by: Kevin Groeneveld <[email protected]> Signed-off-by: Dejin Zheng <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b0c34bd commit 6d61f48

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

drivers/net/phy/smsc.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,13 @@ static int lan87xx_read_status(struct phy_device *phydev)
122122
if (rc < 0)
123123
return rc;
124124

125-
/* Wait max 640 ms to detect energy */
126-
phy_read_poll_timeout(phydev, MII_LAN83C185_CTRL_STATUS, rc,
127-
rc & MII_LAN83C185_ENERGYON, 10000,
128-
640000, true);
125+
/* Wait max 640 ms to detect energy and the timeout is not
126+
* an actual error.
127+
*/
128+
read_poll_timeout(phy_read, rc,
129+
rc & MII_LAN83C185_ENERGYON || rc < 0,
130+
10000, 640000, true, phydev,
131+
MII_LAN83C185_CTRL_STATUS);
129132
if (rc < 0)
130133
return rc;
131134

0 commit comments

Comments
 (0)