Skip to contentSkip to conversation

ns83820: Minor ethtool stuff and some cleanups

PATCH In review Denis Kirjanov 2 participants 5 messages Sep 3, 2010 – Sep 7, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ns83820: Minor ethtool stuff and some cleanups

Some ethtool stuff for the ns83820:
1/3 Remove unused have_optical variable.
2/3 Add copper device settings
3/3 Use predefined autoneg constants

Regards,
Denis

#1 lore raw

PATCH 1/3 ns83820: Remove unused have_optical variable.

---
 drivers/net/ns83820.c |   11 +----------
 1 files changed, 1 insertions(+), 10 deletions(-)
drivers/net/ns83820.c +1 -10
index 447c2c4..3347125 100644
@@ -1246,7 +1246,6 @@ static int ns83820_get_settings(struct net_device *ndev,
 {
 	struct ns83820 *dev = PRIV(ndev);
 	u32 cfg, tanar, tbicr;
-	int have_optical = 0;
 	int fullduplex   = 0;
 
 	/*
@@ -1267,15 +1266,7 @@ static int ns83820_get_settings(struct net_device *ndev,
 	tanar = readl(dev->base + TANAR);
 	tbicr = readl(dev->base + TBICR);
 
-	if (dev->CFG_cache & CFG_TBI_EN) {
-		/* we have an optical interface */
-		have_optical = 1;
-		fullduplex = (cfg & CFG_DUPSTS) ? 1 : 0;
-
-	} else {
-		/* We have copper */
-		fullduplex = (cfg & CFG_DUPSTS) ? 1 : 0;
-        }
+	fullduplex = (cfg & CFG_DUPSTS) ? 1 : 0;
 
 	cmd->supported = SUPPORTED_Autoneg;
 
Signature · 1 line
1.6.4.4
#2 lore raw

PATCH 2/3 ns83820: Add copper device settings

In reply to Denis Kirjanov
---
 drivers/net/ns83820.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
drivers/net/ns83820.c +10 -2
index 3347125..712422a 100644
@@ -1270,13 +1270,21 @@ static int ns83820_get_settings(struct net_device *ndev,
 
 	cmd->supported = SUPPORTED_Autoneg;
 
-	/* we have optical interface */
 	if (dev->CFG_cache & CFG_TBI_EN) {
+		/* we have optical interface */
 		cmd->supported |= SUPPORTED_1000baseT_Half |
 					SUPPORTED_1000baseT_Full |
 					SUPPORTED_FIBRE;
 		cmd->port       = PORT_FIBRE;
-	} /* TODO: else copper related  support */
+	} else {
+		/* we have copper */
+		cmd->supported |= SUPPORTED_10baseT_Half |
+			SUPPORTED_10baseT_Full | SUPPORTED_100baseT_Half |
+			SUPPORTED_100baseT_Full | SUPPORTED_1000baseT_Half |
+			SUPPORTED_1000baseT_Full |
+			SUPPORTED_MII;
+		cmd->port = PORT_MII;
+	}
 
 	cmd->duplex = fullduplex ? DUPLEX_FULL : DUPLEX_HALF;
 	switch (cfg / CFG_SPDSTS0 & 3) {
Signature · 1 line
1.6.4.4
#3 lore raw

PATCH 3/3 ns83820: Use predefined autoneg constants

In reply to Denis Kirjanov
---
 drivers/net/ns83820.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/net/ns83820.c +2 -1
index 712422a..bfab215 100644
@@ -1298,7 +1298,8 @@ static int ns83820_get_settings(struct net_device *ndev,
 		cmd->speed = SPEED_10;
 		break;
 	}
-	cmd->autoneg = (tbicr & TBICR_MR_AN_ENABLE) ? 1: 0;
+	cmd->autoneg = (tbicr & TBICR_MR_AN_ENABLE)
+		? AUTONEG_ENABLE : AUTONEG_DISABLE;
 	return 0;
 }
 
Signature · 1 line
1.6.4.4
maintainer
#4 lore raw
In reply to Denis Kirjanov

From: Denis Kirjanov <[email protected]>
Date: Fri, 3 Sep 2010 20:05:38 +0000

Quoted 4 lines

Some ethtool stuff for the ns83820:
1/3 Remove unused have_optical variable.
2/3 Add copper device settings
3/3 Use predefined autoneg constants

All applied, thanks Denis.