aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/phy.c
diff options
context:
space:
mode:
authorJose Abreu <Jose.Abreu@synopsys.com>2019-09-05 07:43:10 -0400
committerDavid S. Miller <davem@davemloft.net>2019-09-06 09:11:21 -0400
commitfe4a7a41767a14dbb148e41b0659be38a696fe07 (patch)
tree66ef2e1f885eb399579451753411d11b94c29837 /drivers/net/phy/phy.c
parentd1967e495a8d1dd6b8ff2df9d3e045c5d60a37a6 (diff)
net: phy: Do not check Link status when loopback is enabled
While running stmmac selftests I found that in my 1G setup some tests were failling when running with PHY loopback enabled. It looks like when loopback is enabled the PHY will report that Link is down even though there is a valid connection. As in loopback mode the data will not be sent anywhere we can bypass the logic of checking if Link is valid thus saving unecessary reads. Signed-off-by: Jose Abreu <joabreu@synopsys.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/phy.c')
-rw-r--r--drivers/net/phy/phy.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 35d29a823af8..7c92afd36bbe 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -525,6 +525,12 @@ static int phy_check_link_status(struct phy_device *phydev)
525 525
526 WARN_ON(!mutex_is_locked(&phydev->lock)); 526 WARN_ON(!mutex_is_locked(&phydev->lock));
527 527
528 /* Keep previous state if loopback is enabled because some PHYs
529 * report that Link is Down when loopback is enabled.
530 */
531 if (phydev->loopback_enabled)
532 return 0;
533
528 err = phy_read_status(phydev); 534 err = phy_read_status(phydev);
529 if (err) 535 if (err)
530 return err; 536 return err;