From patchwork Tue Jul 26 00:12:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iyappan Subramanian X-Patchwork-Id: 9247277 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 2CE2F607FD for ; Tue, 26 Jul 2016 00:25:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CF6F22380 for ; Tue, 26 Jul 2016 00:25:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 106562787C; Tue, 26 Jul 2016 00:25:56 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9858722380 for ; Tue, 26 Jul 2016 00:25:55 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bRq0u-0004R5-64; Tue, 26 Jul 2016 00:14:24 +0000 Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bRq0Q-0004HU-6k for linux-arm-kernel@lists.infradead.org; Tue, 26 Jul 2016 00:13:56 +0000 Received: by mail-pa0-x235.google.com with SMTP id fi15so65901945pac.1 for ; Mon, 25 Jul 2016 17:12:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apm.com; s=apm; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=b+putup+VAblNf2tXS2lyCgUN8QnaGQEydyAcoh/Z1w=; b=Qy+ZV1kklRQ3ZOhx8/xnCRE+dG0cqUsmslz59HoKugQzgGCYo1pymSMAz9EQ9cZgzd x1x3fPIkibBVNfo+KtvFbzkL+DSE9RUWVDSiJkgVVZ27zacdNnFRb+fCUVX3aodqaFGH YONW694paY32uwtjIKf0tpuchMFzpva38isTk= 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:in-reply-to :references; bh=b+putup+VAblNf2tXS2lyCgUN8QnaGQEydyAcoh/Z1w=; b=BJfW+lQMCw8Uj1mdQLKjTaf0pTyqAQ8s8CeJD/slNGmHvddAakOhseL4mmMXqr0OTi pmkSDaF9RxF3f1w4nG/EWOnZzAgCNIb7lOta2Hzpf2Vuah5tm30ei1JIQL3SpPlw7en1 7Pc0ltxCej+lQobHGN8mGWowQ6VPYXOHdGnGBCtc7+MKj0f7gST0qAkMXjaVVb5oynkW 6zvmWWIHqWlpxvnLE0vp+Xfkh3hC3RAM57tLwO03sdG66Xfe5EYq0kMjag5tb0b02KEt NRyKi0S/EO8TUyCnT1kdTH6ylsgRujpBHfUNzmqFt6pyfTAd3facu6HmW71SP7REC197 yCPQ== X-Gm-Message-State: AEkoouvxQ66fHlCKQ+OqVEVTRfbgolF4B/oNtD+GKl7Q9H87YgUACXq040qAxs7sFN6VDPZ4 X-Received: by 10.66.245.1 with SMTP id xk1mr34675173pac.58.1469491966677; Mon, 25 Jul 2016 17:12:46 -0700 (PDT) Received: from isubrama-dev.amcc.com ([206.80.4.98]) by smtp.gmail.com with ESMTPSA id x9sm3739538pfk.79.2016.07.25.17.12.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Jul 2016 17:12:46 -0700 (PDT) From: Iyappan Subramanian To: davem@davemloft.net, netdev@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH net-next v7 09/12] drivers: net: xgene: ethtool: Use phy_ethtool_gset and sset Date: Mon, 25 Jul 2016 17:12:44 -0700 Message-Id: <1469491967-28627-10-git-send-email-isubramanian@apm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1469491967-28627-1-git-send-email-isubramanian@apm.com> References: <1469491967-28627-1-git-send-email-isubramanian@apm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160725_171354_454289_F14BBC8E X-CRM114-Status: GOOD ( 12.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: patches@apm.com, linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, Iyappan Subramanian MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Changed SGMII 1G get_settings to use phy_ethtool_gset. Changed SGMII 1G set_settings to use phy_ethtool_sset. Signed-off-by: Iyappan Subramanian Tested-by: Fushen Chen Tested-by: Toan Le --- .../net/ethernet/apm/xgene/xgene_enet_ethtool.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c b/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c index 416d6eb..22a7b26 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c @@ -65,8 +65,15 @@ static int xgene_get_settings(struct net_device *ndev, struct ethtool_cmd *cmd) return phy_ethtool_gset(phydev, cmd); } else if (pdata->phy_mode == PHY_INTERFACE_MODE_SGMII) { - cmd->supported = SUPPORTED_1000baseT_Full | - SUPPORTED_Autoneg | SUPPORTED_MII; + if (pdata->mdio_driver) { + if (!phydev) + return -ENODEV; + + return phy_ethtool_gset(phydev, cmd); + } + + cmd->supported = SUPPORTED_1000baseT_Full | SUPPORTED_Autoneg | + SUPPORTED_MII; cmd->advertising = cmd->supported; ethtool_cmd_speed_set(cmd, SPEED_1000); cmd->duplex = DUPLEX_FULL; @@ -92,12 +99,21 @@ static int xgene_set_settings(struct net_device *ndev, struct ethtool_cmd *cmd) struct phy_device *phydev = pdata->phy_dev; if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) { - if (phydev == NULL) + if (!phydev) return -ENODEV; return phy_ethtool_sset(phydev, cmd); } + if (pdata->phy_mode == PHY_INTERFACE_MODE_SGMII) { + if (pdata->mdio_driver) { + if (!phydev) + return -ENODEV; + + return phy_ethtool_sset(phydev, cmd); + } + } + return -EINVAL; }