]> git.baikalelectronics.ru Git - kernel.git/commit
net: phylink: Force retrigger in case of latched link-fail indicator
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Tue, 23 Nov 2021 15:44:03 +0000 (16:44 +0100)
committerJakub Kicinski <kuba@kernel.org>
Thu, 25 Nov 2021 02:40:07 +0000 (18:40 -0800)
commitd4bd842def9150317f8851c48773d32123818054
treefc745cb9ac180c3db85443ab3baad920eaf7bd66
parent28f5c01a1311a7aefd5ee9f7ea6b08525a7ee46f
net: phylink: Force retrigger in case of latched link-fail indicator

On mv88e6xxx 1G/2.5G PCS, the SerDes register 4.2001.2 has the following
description:
  This register bit indicates when link was lost since the last
  read. For the current link status, read this register
  back-to-back.

Thus to get current link state, we need to read the register twice.

But doing that in the link change interrupt handler would lead to
potentially ignoring link down events, which we really want to avoid.

Thus this needs to be solved in phylink's resolve, by retriggering
another resolve in the event when PCS reports link down and previous
link was up, and by re-reading PCS state if the previous link was down.

The wrong value is read when phylink requests change from sgmii to
2500base-x mode, and link won't come up. This fixes the bug.

Fixes: d3eead77c792 ("phylink: add phylink infrastructure")
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Marek BehĂșn <kabel@kernel.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/phylink.c