From patchwork Thu Jul 7 23:02:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iyappan Subramanian X-Patchwork-Id: 9219881 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 19E1C6048B for ; Thu, 7 Jul 2016 23:06:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08F0923B3C for ; Thu, 7 Jul 2016 23:06:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1D8C27BF7; Thu, 7 Jul 2016 23:06:21 +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 7FD1F23B3C for ; Thu, 7 Jul 2016 23:06:21 +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 1bLILi-00035c-JI; Thu, 07 Jul 2016 23:04:50 +0000 Received: from mail-pa0-x230.google.com ([2607:f8b0:400e:c03::230]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bLIKI-0001gr-Ui for linux-arm-kernel@lists.infradead.org; Thu, 07 Jul 2016 23:03:25 +0000 Received: by mail-pa0-x230.google.com with SMTP id uj8so9753220pab.3 for ; Thu, 07 Jul 2016 16:03:02 -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=l5LZTZesWvxjOXsqf4hZlSo31R+ApRtTC8pf66m/FwnQbNXiPcYdKrD2gPgBuqIlBd ScxBd47PJwx+Wl4zFezPt1EZs7B0IJJlZVDaBj3Rpm9tToSy5L97X+DxSL4oaXUa8Qf9 8SG1AGmYuwRaVRasqea40C2uwGPONHHNfftPY= 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=OSZD791YtmaCvPmmdh6piYHIAJ8H3fwb3zci7tkzpfZ5pVVxigl05fE1WPyNskNYbw 49pE2RH+DcQ+QIslnDP0h6ruxTQl2Wg6SoGLfF4oXe1qzIumce8K5SIT2FUNiCNVpHFP DYX+qKiFyH/eVMA9BnuERRRd7ePIhHd19OHMTcr41wAACa/Q3HZ2YezxX6ffGGcTHSzG 2hVHGIa0x4Pt3xGiNx73Kuny7zLXvz+DLqe0xKXxdpbY26hB0FfkS9obn4BhYqNusQq+ WrN22AxvPBDECMeOJMY8l6pOneooSR5oBrM1Qzuf99YOH5JWaQz/dmsGUQnhyyUWu5vI gGZQ== X-Gm-Message-State: ALyK8tLnPNLaOru7peec4YYtSqz7YQzOrBZ9AJeFTyVOn+tqI40LlAqkdOmeGHeHPKpXnNHt X-Received: by 10.66.249.161 with SMTP id yv1mr4417335pac.39.1467932582173; Thu, 07 Jul 2016 16:03:02 -0700 (PDT) Received: from isubrama-dev.amcc.com ([206.80.4.98]) by smtp.gmail.com with ESMTPSA id r67sm4637090pfb.16.2016.07.07.16.03.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Jul 2016 16:03:01 -0700 (PDT) From: Iyappan Subramanian To: davem@davemloft.net, netdev@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 08/11] drivers: net: xgene: ethtool: Use phy_ethtool_gset and sset Date: Thu, 7 Jul 2016 16:02:56 -0700 Message-Id: <1467932579-14320-9-git-send-email-isubramanian@apm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1467932579-14320-1-git-send-email-isubramanian@apm.com> References: <1467932579-14320-1-git-send-email-isubramanian@apm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160707_160323_105620_48F09431 X-CRM114-Status: GOOD ( 13.37 ) 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: andrew@lunn.ch, patches@apm.com, linux@armlinux.org.uk, Iyappan Subramanian , matthias.bgg@gmail.com, linux-arm-kernel@lists.infradead.org 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; }