public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/5] tsec: Clean up Broadcom PHY status parsing
@ 2009-11-09 19:09 Peter Tyser
  2009-11-09 19:09 ` [U-Boot] [PATCH 2/5] tsec: Make functions/data static when possible Peter Tyser
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Peter Tyser @ 2009-11-09 19:09 UTC (permalink / raw)
  To: u-boot

- Remove unnecessary printing "Enet starting in <speed>/<duplex>"
    This same information is already printed during normal ethernet
    operation in the form "Speed: 1000, full duplex".

- Add a check for link before determining link speed and duplex
    If there is no link, speed/duplex don't matter.  This also removes
    the annoying and unneeded "Auto-neg error, defaulting to 10BT/HD"
    message that occurs when no link is detected.

- Whitespace and line > 80 characters cleanup

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
---
 drivers/net/tsec.c |   77 +++++++++++++++++++++++-----------------------------
 1 files changed, 34 insertions(+), 43 deletions(-)

diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index d8b6619..1038285 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -487,50 +487,41 @@ uint mii_BCM54xx_wirespeed(uint mii_reg, struct tsec_private *priv)
  */
 uint mii_parse_BCM54xx_sr(uint mii_reg, struct tsec_private *priv)
 {
+	/* If there is no link, speed and duplex don't matter */
+	if (!priv->link)
+		return 0;
 
-	switch((mii_reg & MIIM_BCM54xx_AUXSTATUS_LINKMODE_MASK) >> MIIM_BCM54xx_AUXSTATUS_LINKMODE_SHIFT){
-
-		case 1:
-			printf("Enet starting in 10BT/HD\n");
-			priv->duplexity = 0;
-			priv->speed = 10;
-			break;
-
-		case 2:
-			printf("Enet starting in 10BT/FD\n");
-			priv->duplexity = 1;
-			priv->speed = 10;
-			break;
-
-		case 3:
-			printf("Enet starting in 100BT/HD\n");
-			priv->duplexity = 0;
-			priv->speed = 100;
-			break;
-
-		case 5:
-			printf("Enet starting in 100BT/FD\n");
-			priv->duplexity = 1;
-			priv->speed = 100;
-			break;
-
-		case 6:
-			printf("Enet starting in 1000BT/HD\n");
-			priv->duplexity = 0;
-			priv->speed = 1000;
-			break;
-
-		case 7:
-			printf("Enet starting in 1000BT/FD\n");
-			priv->duplexity = 1;
-			priv->speed = 1000;
-			break;
-
-		default:
-			printf("Auto-neg error, defaulting to 10BT/HD\n");
-			priv->duplexity = 0;
-			priv->speed = 10;
-			break;
+	switch ((mii_reg & MIIM_BCM54xx_AUXSTATUS_LINKMODE_MASK) >>
+		MIIM_BCM54xx_AUXSTATUS_LINKMODE_SHIFT) {
+	case 1:
+		priv->duplexity = 0;
+		priv->speed = 10;
+		break;
+	case 2:
+		priv->duplexity = 1;
+		priv->speed = 10;
+		break;
+	case 3:
+		priv->duplexity = 0;
+		priv->speed = 100;
+		break;
+	case 5:
+		priv->duplexity = 1;
+		priv->speed = 100;
+		break;
+	case 6:
+		priv->duplexity = 0;
+		priv->speed = 1000;
+		break;
+	case 7:
+		priv->duplexity = 1;
+		priv->speed = 1000;
+		break;
+	default:
+		printf("Auto-neg error, defaulting to 10BT/HD\n");
+		priv->duplexity = 0;
+		priv->speed = 10;
+		break;
 	}
 
 	return 0;
-- 
1.6.2.1

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

end of thread, other threads:[~2010-01-27  8:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-09 19:09 [U-Boot] [PATCH 1/5] tsec: Clean up Broadcom PHY status parsing Peter Tyser
2009-11-09 19:09 ` [U-Boot] [PATCH 2/5] tsec: Make functions/data static when possible Peter Tyser
2009-11-09 19:09 ` [U-Boot] [PATCH 3/5] tsec: General cleanup Peter Tyser
2009-11-09 19:09 ` [U-Boot] [PATCH 4/5] tsec: Add support for using the BCM5482 PHY in fiber mode Peter Tyser
2009-11-09 19:09 ` [U-Boot] [PATCH 5/5] tsec: Add TSEC_FIBER flag Peter Tyser
2009-11-09 19:16 ` [U-Boot] [PATCH 1/5] tsec: Clean up Broadcom PHY status parsing Peter Tyser
2009-12-16 15:48 ` Peter Tyser
2010-01-27  8:01 ` Ben Warren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox