aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/octeon/ethernet-mdio.c
diff options
context:
space:
mode:
authorAaro Koskinen <aaro.koskinen@iki.fi>2016-02-12 01:02:26 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-02-11 19:40:02 -0800
commit710086dbbbeb8ac22dc04ad5c9426b8cabac735c (patch)
treee07d879a91a49d0653ed61f60a66b791c346f735 /drivers/staging/octeon/ethernet-mdio.c
parentstaging: octeon: Remove unneeded parentheses in assignment (diff)
downloadlinux-dev-710086dbbbeb8ac22dc04ad5c9426b8cabac735c.tar.xz
linux-dev-710086dbbbeb8ac22dc04ad5c9426b8cabac735c.zip
staging: octeon: refactor rgmii 10 mbps preamble error checking
Refactor RGMII 10 Mbps preamble error checking. The current implementation does not work correctly in phydev mode since only the link status changes trigger the callback, and if we stay on 10 Mbps operation the periodic checks for error counters are never done. Provide a periodic worker also during the phydev operation, and notify the link status changes through the phydev instead of the inband status change interrupt. This also has the benefit that we don't need to use legacy CVMX MDIO calls to check the PHY state, and we can avoid races that trigger bogus "Using 10Mbps with software preamble removal" logs when interfaces are being bringed up. It also avoids some corner-case crashes when the in-band interrupt triggers while the interface is being taken down. Tested on EdgeRouter Lite & D-Link DSR-1000N. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/octeon/ethernet-mdio.c')
-rw-r--r--drivers/staging/octeon/ethernet-mdio.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c
index fd9b3d899c1f..55abd83c38b6 100644
--- a/drivers/staging/octeon/ethernet-mdio.c
+++ b/drivers/staging/octeon/ethernet-mdio.c
@@ -118,13 +118,20 @@ void cvm_oct_adjust_link(struct net_device *dev)
struct octeon_ethernet *priv = netdev_priv(dev);
cvmx_helper_link_info_t link_info;
+ link_info.u64 = 0;
+ link_info.s.link_up = priv->phydev->link ? 1 : 0;
+ link_info.s.full_duplex = priv->phydev->duplex ? 1 : 0;
+ link_info.s.speed = priv->phydev->speed;
+ priv->link_info = link_info.u64;
+
+ /*
+ * The polling task need to know about link status changes.
+ */
+ if (priv->poll)
+ priv->poll(dev);
+
if (priv->last_link != priv->phydev->link) {
priv->last_link = priv->phydev->link;
- link_info.u64 = 0;
- link_info.s.link_up = priv->last_link ? 1 : 0;
- link_info.s.full_duplex = priv->phydev->duplex ? 1 : 0;
- link_info.s.speed = priv->phydev->speed;
-
cvmx_helper_link_set(priv->port, link_info);
cvm_oct_note_carrier(priv, link_info);
}