netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] fec: Add support to restart autonegotiate
@ 2013-06-17 14:25 cphealy
  2013-06-17 23:34 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: cphealy @ 2013-06-17 14:25 UTC (permalink / raw)
  To: David S. Miller, Fabio Estevam, Frank Li, Shawn Guo, Jim Baxter,
	netdev
  Cc: Chris Healy

From: Chris Healy <cphealy@gmail.com>

Add ethtool operation to restart autonegotiation via the PHY.

Tested on i.MX28EVK.

Signed-off-by: Chris Healy <cphealy@gmail.com>
---
 drivers/net/ethernet/freescale/fec_main.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index a667015..a327492 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1436,6 +1436,17 @@ static int fec_enet_set_pauseparam(struct net_device *ndev,
 	return 0;
 }
 
+static int fec_enet_nway_reset(struct net_device *dev)
+{
+	struct fec_enet_private *fep = netdev_priv(dev);
+	struct phy_device *phydev = fep->phy_dev;
+
+	if (!phydev)
+		return -ENODEV;
+
+	return genphy_restart_aneg(phydev);
+}
+
 static const struct ethtool_ops fec_enet_ethtool_ops = {
 	.get_pauseparam		= fec_enet_get_pauseparam,
 	.set_pauseparam		= fec_enet_set_pauseparam,
@@ -1444,6 +1455,7 @@ static const struct ethtool_ops fec_enet_ethtool_ops = {
 	.get_drvinfo		= fec_enet_get_drvinfo,
 	.get_link		= ethtool_op_get_link,
 	.get_ts_info		= fec_enet_get_ts_info,
+	.nway_reset		= fec_enet_nway_reset,
 };
 
 static int fec_enet_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH 1/1] fec: Add support to restart autonegotiate
@ 2013-06-17  0:04 cphealy
  2013-06-17 13:44 ` Sergei Shtylyov
  0 siblings, 1 reply; 4+ messages in thread
From: cphealy @ 2013-06-17  0:04 UTC (permalink / raw)
  To: David S. Miller, Fabio Estevam, Frank Li, Shawn Guo, Jim Baxter,
	netdev
  Cc: Chris

From: Chris <cphealy@gmail.com>

Add ethtool operation to restart autonegotiation via the PHY.

Also cleanup two whitespace errors that break kernel guidelines.

Tested on i.MX28EVK.

Signed-off-by: Chris <cphealy@gmail.com>
---
 drivers/net/ethernet/freescale/fec_main.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index a667015..c6be728 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -150,7 +150,7 @@ MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC address");
 #define	FEC_FLASHMAC	0xf0006000
 #elif defined(CONFIG_CANCam)
 #define	FEC_FLASHMAC	0xf0020000
-#elif defined (CONFIG_M5272C3)
+#elif defined(CONFIG_M5272C3)
 #define	FEC_FLASHMAC	(0xffe04000 + 4)
 #elif defined(CONFIG_MOD5272)
 #define FEC_FLASHMAC	0xffc0406b
@@ -1206,8 +1206,7 @@ static int fec_enet_mii_probe(struct net_device *ndev)
 	if (id_entry->driver_data & FEC_QUIRK_HAS_GBIT) {
 		phy_dev->supported &= PHY_GBIT_FEATURES;
 		phy_dev->supported |= SUPPORTED_Pause;
-	}
-	else
+	} else
 		phy_dev->supported &= PHY_BASIC_FEATURES;
 
 	phy_dev->advertising = phy_dev->supported;
@@ -1436,6 +1435,17 @@ static int fec_enet_set_pauseparam(struct net_device *ndev,
 	return 0;
 }
 
+static int fec_enet_nway_reset(struct net_device *dev)
+{
+	struct fec_enet_private *fep = netdev_priv(dev);
+	struct phy_device *phydev = fep->phy_dev;
+
+	if (!phydev)
+		return -ENODEV;
+
+	return genphy_restart_aneg(phydev);
+}
+
 static const struct ethtool_ops fec_enet_ethtool_ops = {
 	.get_pauseparam		= fec_enet_get_pauseparam,
 	.set_pauseparam		= fec_enet_set_pauseparam,
@@ -1444,6 +1454,7 @@ static const struct ethtool_ops fec_enet_ethtool_ops = {
 	.get_drvinfo		= fec_enet_get_drvinfo,
 	.get_link		= ethtool_op_get_link,
 	.get_ts_info		= fec_enet_get_ts_info,
+	.nway_reset		= fec_enet_nway_reset,
 };
 
 static int fec_enet_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-06-17 23:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-17 14:25 [PATCH 1/1] fec: Add support to restart autonegotiate cphealy
2013-06-17 23:34 ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2013-06-17  0:04 cphealy
2013-06-17 13:44 ` Sergei Shtylyov

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).