]> git.dujemihanovic.xyz Git - linux.git/commitdiff
net: dsa: mv88e6xxx: correctly report serdes link failure
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Tue, 7 Jun 2022 11:28:52 +0000 (12:28 +0100)
committerJakub Kicinski <kuba@kernel.org>
Thu, 9 Jun 2022 03:58:30 +0000 (20:58 -0700)
Phylink wants to know if the link has dropped since the last time state
was retrieved, and the BMSR gives us that. Read the BMSR and use it when
deciding the link state. Fill in the an_complete member as well for the
emulated PHY state.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/mv88e6xxx/serdes.c

index 47bf87d530b093eb2481e3a810b1a53f893a29b1..d94150d8f3f47c40269351d00540fca87a226385 100644 (file)
@@ -53,6 +53,14 @@ static int mv88e6xxx_serdes_pcs_get_state(struct mv88e6xxx_chip *chip,
                                          u16 bmsr, u16 lpa, u16 status,
                                          struct phylink_link_state *state)
 {
+       state->link = false;
+
+       /* If the BMSR reports that the link had failed, report this to
+        * phylink.
+        */
+       if (!(bmsr & BMSR_LSTATUS))
+               return 0;
+
        state->link = !!(status & MV88E6390_SGMII_PHY_STATUS_LINK);
        state->an_complete = !!(bmsr & BMSR_ANEGCOMPLETE);