From patchwork Thu Jul 21 06:59:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iyappan Subramanian X-Patchwork-Id: 9241005 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 5C78B602F0 for ; Thu, 21 Jul 2016 07:03:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F06727BFC for ; Thu, 21 Jul 2016 07:03:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 43D6927D85; Thu, 21 Jul 2016 07:03:20 +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 D012F27BFC for ; Thu, 21 Jul 2016 07:03:19 +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 1bQ7zK-00014e-3B; Thu, 21 Jul 2016 07:01:42 +0000 Received: from mail-pf0-x235.google.com ([2607:f8b0:400e:c00::235]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bQ7xH-00070n-5O for linux-arm-kernel@lists.infradead.org; Thu, 21 Jul 2016 06:59:38 +0000 Received: by mail-pf0-x235.google.com with SMTP id y134so27373623pfg.0 for ; Wed, 20 Jul 2016 23:59:14 -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=Zbb0uWYxJHQCtM9APVkxzS/kvHwPf6CKlGujgYLRTkB7dqfPiDVzT8vN5Bom+JWtAx A+uvXuXbkKVt9Tp6knlQlW41w0liYk64iJGhW9lZQBcxuE180pYkCH6PlPAClaVEu5sx 4frfGcfgThO2HO5G0Z9ZhwyCrjnIkqhRwU8LQ= 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=CJYVAXNvaPR2TOyqlspMEq6JXaKXDusBZ31gAIu+xY/86QBq1pu/rlputS37DPE9Wn XOsSsJ2SJqBtbSAT/l76PvuCElwqLBwPnGEQ62kjmtMTxgABmHuu49fa1akN/CCOq097 U3n/fRo9ANODHlRCH7uMwqZoZgfWzo3Ta1YuKFV2UQYIITZ/LcUwSkLb9JJwBKt2ebKw dr6LeGy+7tQ7Ukua+OMIrGEfxc/q7DGR+KPie+6L+RK5ZSj0SdeuVARcg+ZuyXUiXVJL GbdzeZH3IvH8eUuOvbOd1riKB9mOx6W9l3MchJpv/N8g/VRoyg7W6HaUc8Q0TTnmxFyi HMjA== X-Gm-Message-State: ALyK8tLQXXvzUxeycgqAEQrG8NxNp0hWunPUb02E0ilXJH90/NJ7URaUVvz850Z29VmyhKOX X-Received: by 10.98.48.65 with SMTP id w62mr13939415pfw.18.1469084353859; Wed, 20 Jul 2016 23:59:13 -0700 (PDT) Received: from isubrama-dev.amcc.com ([206.80.4.98]) by smtp.gmail.com with ESMTPSA id yo10sm9278188pab.4.2016.07.20.23.59.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Jul 2016 23:59:13 -0700 (PDT) From: Iyappan Subramanian To: davem@davemloft.net, netdev@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v6 09/12] drivers: net: xgene: ethtool: Use phy_ethtool_gset and sset Date: Wed, 20 Jul 2016 23:59:27 -0700 Message-Id: <1469084370-16781-10-git-send-email-isubramanian@apm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1469084370-16781-1-git-send-email-isubramanian@apm.com> References: <1469084370-16781-1-git-send-email-isubramanian@apm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160720_235935_566149_B3B96F4B X-CRM114-Status: GOOD ( 12.32 ) 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; }