From patchwork Mon Nov 28 09:47:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yegor Yefremov X-Patchwork-Id: 9449237 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 70E276071C for ; Mon, 28 Nov 2016 09:48:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E9DC2621F for ; Mon, 28 Nov 2016 09:48:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61A3E26224; Mon, 28 Nov 2016 09:48:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D2BD52621F for ; Mon, 28 Nov 2016 09:48:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932728AbcK1JsL (ORCPT ); Mon, 28 Nov 2016 04:48:11 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:34898 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932575AbcK1JsG (ORCPT ); Mon, 28 Nov 2016 04:48:06 -0500 Received: by mail-wm0-f65.google.com with SMTP id a20so17983760wme.2; Mon, 28 Nov 2016 01:48:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=HViLEWCweuhv0k+IVt9vUdEg2l/BgTWYnWNo+peoTkQ=; b=r/7l8VbFTRC2cMpXmGxY3IZdlF3i9791sVoIfFBYYu2dq9hbmyr1uIIJUDXMsFqcYN xS/JErN6ptKQXp1vftxAUz9ZYb4grGUrIbJOeoWiRoQRcV1pwiJaHeiVvmDwVUnFaFW8 iUlzlHqpDnVgQ+C9mRq1j34KxKNeCGTsg13tuiTrmyk82Ph1eVl0gEyRkIjwBqBJuZPx /w8V+ANv3eMRvFho2KLqiFKmUfn+DNYdtKazmhNcepN9m85eXCIqiHlP1zT35LAfNm9w foqHUiRPygyvpRHO4HzoSenQjS54VXbm8qyWoxiUHLi7HwXHMyefqDAjxMBImMeKnJbW ELEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=HViLEWCweuhv0k+IVt9vUdEg2l/BgTWYnWNo+peoTkQ=; b=ByDYuO91jbu2anwF3aIK285xwjxjTuoyBT43eI6AQaa02PJRr+X6tkM5f1WK7/hHQ+ 9wJ+mMIsw+aOSWwcl4nqn7t9oW+tTmh+AxZSMyG2J5o5uJESoGHM4WCobUTBiLTUQTzO cuTlqNl8VQ6RQScq+mwf9EP7/pY6HCa1JH5iuF4OlHjm/ablGGeDV5bhhZHeSQjNR5NA T7Jk//W26b6UeZF/txkY3HBBwAQFuf52J17xKFSQeNJDeTkEuDnmAuG+VWl2+vBcXP1c 7b4AnvEhhsYbMVjM0icS7d3/wlD00aEGOzODOPJ2ej033EXj6yb3J0dJ0/6UEgaf+nNC 2SGA== X-Gm-Message-State: AKaTC03HWNZXs8jwLYto/ld45bT2oB5Y+NKxZBh26tnHxYZGvVlosmQNHI0xvKzqYDTOqw== X-Received: by 10.28.69.130 with SMTP id l2mr18654343wmi.123.1480326485183; Mon, 28 Nov 2016 01:48:05 -0800 (PST) Received: from development1.visionsystems.de (mail.visionsystems.de. [213.209.99.202]) by smtp.gmail.com with ESMTPSA id v3sm31196246wjp.13.2016.11.28.01.48.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Nov 2016 01:48:04 -0800 (PST) From: yegorslists@googlemail.com To: netdev@vger.kernel.org Cc: linux-omap@vger.kernel.org, grygorii.strashko@ti.com, mugunthanvnm@ti.com, davem@davemloft.net, Yegor Yefremov Subject: [PATCH] cpsw: ethtool: add support for nway reset Date: Mon, 28 Nov 2016 10:47:52 +0100 Message-Id: <1480326472-5849-1-git-send-email-yegorslists@googlemail.com> X-Mailer: git-send-email 2.1.4 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Yegor Yefremov This patch adds support for ethtool's '-r' command. Restarting N-WAY negotiation can be useful to activate newly changed EEE settings etc. Signed-off-by: Yegor Yefremov --- drivers/net/ethernet/ti/cpsw.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index df87bff..caec6ac 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -2261,6 +2261,18 @@ static int cpsw_set_eee(struct net_device *ndev, struct ethtool_eee *edata) return -EOPNOTSUPP; } +static int cpsw_nway_reset(struct net_device *ndev) +{ + struct cpsw_priv *priv = netdev_priv(ndev); + struct cpsw_common *cpsw = priv->cpsw; + int slave_no = cpsw_slave_index(cpsw, priv); + + if (cpsw->slaves[slave_no].phy) + return genphy_restart_aneg(cpsw->slaves[slave_no].phy); + else + return -EOPNOTSUPP; +} + static const struct ethtool_ops cpsw_ethtool_ops = { .get_drvinfo = cpsw_get_drvinfo, .get_msglevel = cpsw_get_msglevel, @@ -2286,6 +2298,7 @@ static const struct ethtool_ops cpsw_ethtool_ops = { .set_link_ksettings = cpsw_set_link_ksettings, .get_eee = cpsw_get_eee, .set_eee = cpsw_set_eee, + .nway_reset = cpsw_nway_reset, }; static void cpsw_slave_init(struct cpsw_slave *slave, struct cpsw_common *cpsw,