summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2017-01-05 00:23:40 +0000
committerRussell King <rmk+kernel@armlinux.org.uk>2017-01-05 11:20:31 +0000
commitcb0f3cdddf8d4080f4531bd48c812e6d7263ead6 (patch)
tree1f3fc6de89dd561c1cbcbf4c28486673fe66f735
parent55c9212629a3af8bd038d45a975c1f0e41b2a5a6 (diff)
net: phy: don't double-read clause 45 status register
One of the design decisions behind the link status bit in the status register is that it latches low on link loss. This is so that link loss events are not missed. Double-reading the status register means that we always read the current state of the link, clearing any link loss event. This can cause problems - for example, if the link has negotiated a different set of operating parameters, these will not be communicated to the MAC as the PHY state machine will still think that the link has remained active. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r--drivers/net/phy/phy-c45.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c
index 1d841efc4d79..252e49864215 100644
--- a/drivers/net/phy/phy-c45.c
+++ b/drivers/net/phy/phy-c45.c
@@ -143,12 +143,9 @@ int genphy_c45_read_link(struct phy_device *phydev, u32 mmd_mask)
devad = __ffs(mmd_mask);
mmd_mask &= ~BIT(devad);
- val = phy_read_mmd(phydev, devad, MDIO_STAT1);
- if (val < 0)
- return val;
-
- /* Read twice because link state is latched and a
- * read moves the current state into the register
+ /* The link state is latched low so that momentary link
+ * drops can be detected. Do not double-read the status
+ * register if the link is down.
*/
val = phy_read_mmd(phydev, devad, MDIO_STAT1);
if (val < 0)