devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Iyappan Subramanian <isubramanian@apm.com>
To: davem@davemloft.net, netdev@vger.kernel.org, devicetree@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org, patches@apm.com,
	linux@armlinux.org.uk, Iyappan Subramanian <isubramanian@apm.com>
Subject: [PATCH v6 09/12] drivers: net: xgene: ethtool: Use phy_ethtool_gset and sset
Date: Wed, 20 Jul 2016 23:59:27 -0700	[thread overview]
Message-ID: <1469084370-16781-10-git-send-email-isubramanian@apm.com> (raw)
In-Reply-To: <1469084370-16781-1-git-send-email-isubramanian@apm.com>

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 <isubramanian@apm.com>
Tested-by: Fushen Chen <fchen@apm.com>
Tested-by: Toan Le <toanle@apm.com>
---
 .../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;
 }
 
-- 
1.9.1

  parent reply	other threads:[~2016-07-21  6:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-21  6:59 [PATCH v6 00/12] drivers: net: xgene: Fix module crash and 1G hot-plug Iyappan Subramanian
2016-07-21  6:59 ` [PATCH v6 01/12] drivers: net: xgene: Separate set_speed from mac_init Iyappan Subramanian
2016-07-21  6:59 ` [PATCH v6 02/12] drivers: net: xgene: Fix module unload crash - hw resource cleanup Iyappan Subramanian
     [not found] ` <1469084370-16781-1-git-send-email-isubramanian-qTEPVZfXA3Y@public.gmane.org>
2016-07-21  6:59   ` [PATCH v6 03/12] drivers: net: xgene: Fix module unload crash - change sw sequence Iyappan Subramanian
2016-07-21  6:59   ` [PATCH v6 05/12] drivers: net: phy: xgene: Add MDIO driver Iyappan Subramanian
2016-07-21  6:59   ` [PATCH v6 06/12] drivers: net: xgene: Add backward compatibility Iyappan Subramanian
2016-07-21 21:52     ` kbuild test robot
2016-07-21  6:59   ` [PATCH v6 11/12] Documentation: dtb: xgene: Add MDIO node Iyappan Subramanian
2016-07-21 22:01     ` Rob Herring
2016-07-21 22:31       ` Iyappan Subramanian
2016-07-21  6:59   ` [PATCH v6 12/12] MAINTAINERS: xgene: Add driver and documentation path Iyappan Subramanian
2016-07-21  6:59 ` [PATCH v6 04/12] drivers: net: xgene: Fix module unload crash - clkrst sequence Iyappan Subramanian
2016-07-21  6:59 ` [PATCH v6 07/12] drivers: net: xgene: Enable MDIO driver Iyappan Subramanian
2016-07-21  6:59 ` [PATCH v6 08/12] drivers: net: xgene: Use exported functions Iyappan Subramanian
2016-07-21  6:59 ` Iyappan Subramanian [this message]
2016-07-21  6:59 ` [PATCH v6 10/12] dtb: xgene: Add MDIO node Iyappan Subramanian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1469084370-16781-10-git-send-email-isubramanian@apm.com \
    --to=isubramanian@apm.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=patches@apm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).