net: marvell: mvpp2: fix AN restart
authorRussell King <rmk+kernel@armlinux.org.uk>
Fri, 8 Feb 2019 15:35:59 +0000 (15:35 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 9 Feb 2019 07:08:39 +0000 (23:08 -0800)
phylink already limits which interface modes are able to call the
MACs AN restart function, but in any case, the commentry seems
incorrect: the AN restart bit does not automatically clear when
set.  This has been found via manual setting using devmem2, and
we can observe that the AN does indeed restart and complete, yet
the AN restart bit remains set.  Explicitly clear the AN restart
bit.

Tested-by: Sven Auhagen <sven.auhagen@voleatech.de>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c

index 133a6d4f94a13a256f3d0d2b9e4b5e2a9787c092..8a2dd9104e37e3019f17ef066f67b93e2a248ae7 100644 (file)
@@ -4497,17 +4497,12 @@ static int mvpp2_phylink_mac_link_state(struct net_device *dev,
 static void mvpp2_mac_an_restart(struct net_device *dev)
 {
        struct mvpp2_port *port = netdev_priv(dev);
-       u32 val;
-
-       if (port->phy_interface != PHY_INTERFACE_MODE_SGMII)
-               return;
+       u32 val = readl(port->base + MVPP2_GMAC_AUTONEG_CONFIG);
 
-       val = readl(port->base + MVPP2_GMAC_AUTONEG_CONFIG);
-       /* The RESTART_AN bit is cleared by the h/w after restarting the AN
-        * process.
-        */
-       val |= MVPP2_GMAC_IN_BAND_RESTART_AN | MVPP2_GMAC_IN_BAND_AUTONEG;
-       writel(val, port->base + MVPP2_GMAC_AUTONEG_CONFIG);
+       writel(val | MVPP2_GMAC_IN_BAND_RESTART_AN,
+              port->base + MVPP2_GMAC_AUTONEG_CONFIG);
+       writel(val & ~MVPP2_GMAC_IN_BAND_RESTART_AN,
+              port->base + MVPP2_GMAC_AUTONEG_CONFIG);
 }
 
 static void mvpp2_xlg_config(struct mvpp2_port *port, unsigned int mode,