]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
fec: Add support to restart autonegotiate
authorChris Healy <cphealy@gmail.com>
Mon, 17 Jun 2013 14:25:06 +0000 (07:25 -0700)
committerJason Liu <r64343@freescale.com>
Wed, 30 Oct 2013 01:54:20 +0000 (09:54 +0800)
Add ethtool operation to restart autonegotiation via the PHY.

Tested on i.MX28EVK.

Signed-off-by: Chris Healy <cphealy@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/fec_main.c

index 6e8422c0a12bec4debe1a24118351f434ab8b74f..239255cb304e847edacf8c2b1a778895fd8b33c5 100644 (file)
@@ -1445,6 +1445,17 @@ static int fec_enet_set_pauseparam(struct net_device *ndev,
 
 #endif /* !defined(CONFIG_M5272) */
 
+static int fec_enet_nway_reset(struct net_device *dev)
+{
+       struct fec_enet_private *fep = netdev_priv(dev);
+       struct phy_device *phydev = fep->phy_dev;
+
+       if (!phydev)
+               return -ENODEV;
+
+       return genphy_restart_aneg(phydev);
+}
+
 static const struct ethtool_ops fec_enet_ethtool_ops = {
 #if !defined(CONFIG_M5272)
        .get_pauseparam         = fec_enet_get_pauseparam,
@@ -1455,6 +1466,7 @@ static const struct ethtool_ops fec_enet_ethtool_ops = {
        .get_drvinfo            = fec_enet_get_drvinfo,
        .get_link               = ethtool_op_get_link,
        .get_ts_info            = fec_enet_get_ts_info,
+       .nway_reset             = fec_enet_nway_reset,
 };
 
 static int fec_enet_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)