linux-mips
[Top] [All Lists]

[PATCH 1/3 net-next] bcm63xx_enet: implement reset autoneg ethtool callb

To: davem@davemloft.net
Subject: [PATCH 1/3 net-next] bcm63xx_enet: implement reset autoneg ethtool callback
From: Florian Fainelli <florian@openwrt.org>
Date: Tue, 4 Jun 2013 22:53:33 +0100
Cc: ralf@linux-mips.org, blogic@openwrt.org, linux-mips@linux-mips.org, cernekee@gmail.com, mbizon@freebox.fr, jogo@openwrt.org, netdev@vger.kernel.org
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=D4MmHFLhcdsn2dKRJ6FUpkfK/yRoIFQxLm56JgTlP7Y=; b=fcHPiog94DFcQqOTDWvrFiTrdURNrEze5mhTNuAIo3N8Fn3Xwd1aTXmZd4ExNR+bV7 li2yLUmrk/yctVaLtISKozsoNQ7SArXSi+O39+Wj6x+QSUK/zFmNLL2zcUyLvYzkUrV/ SAPK5YkaT93zHjNFpw0X4dtPci4JYQ5NjRAgfxT0d4vBZ+jjZIMhGYqeZq7G5OekShXt 0Zt4SfU4FLzaTZFVXHUUJxc+NZBrRSZp7uCSkkc4b9tl0f1PI01vAfeWoXAB3TZ95WN2 dYtVZaSljm8dQxfk56amJpjcdncaU0gdNQ3R0hhCnx2b/+R/D3FYgqlndaRokva3yhKK UyiQ==
In-reply-to: <1370382815-17904-1-git-send-email-florian@openwrt.org>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1370382815-17904-1-git-send-email-florian@openwrt.org>
Sender: linux-mips-bounce@linux-mips.org
From: Maxime Bizon <mbizon@freebox.fr>

Implement the rset_nway ethtool callback which uses libphy generic
autonegotiation restart function.

Signed-off-by: Maxime Bizon <mbizon@freebox.fr>
---
 drivers/net/ethernet/broadcom/bcm63xx_enet.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c 
b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
index e46466c..bc1a994 100644
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -1328,6 +1328,20 @@ static void bcm_enet_get_ethtool_stats(struct net_device 
*netdev,
        mutex_unlock(&priv->mib_update_lock);
 }
 
+static int bcm_enet_nway_reset(struct net_device *dev)
+{
+       struct bcm_enet_priv *priv;
+
+       priv = netdev_priv(dev);
+       if (priv->has_phy) {
+               if (!priv->phydev)
+                       return -ENODEV;
+               return genphy_restart_aneg(priv->phydev);
+       }
+
+       return -EOPNOTSUPP;
+}
+
 static int bcm_enet_get_settings(struct net_device *dev,
                                 struct ethtool_cmd *cmd)
 {
@@ -1470,6 +1484,7 @@ static const struct ethtool_ops bcm_enet_ethtool_ops = {
        .get_strings            = bcm_enet_get_strings,
        .get_sset_count         = bcm_enet_get_sset_count,
        .get_ethtool_stats      = bcm_enet_get_ethtool_stats,
+       .nway_reset             = bcm_enet_nway_reset,
        .get_settings           = bcm_enet_get_settings,
        .set_settings           = bcm_enet_set_settings,
        .get_drvinfo            = bcm_enet_get_drvinfo,
-- 
1.7.10.4


<Prev in Thread] Current Thread [Next in Thread>