[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-24
Subject:    [TG3]: Wait a bit for BMSR/BMCR bits to settle in PHY setup.
From:       Linux Kernel Mailing List <linux-kernel () vger ! kernel ! org>
Date:       2004-03-31 22:06:13
Message-ID: 200405211104.i4LB48k5009895 () hera ! kernel ! org
[Download RAW message or body]

ChangeSet 1.1302.54.10, 2004/03/31 14:06:13-08:00, davem@nuts.davemloft.net

	[TG3]: Wait a bit for BMSR/BMCR bits to settle in PHY setup.



 tg3.c |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)


diff -Nru a/drivers/net/tg3.c b/drivers/net/tg3.c
--- a/drivers/net/tg3.c	2004-05-21 04:04:10 -07:00
+++ b/drivers/net/tg3.c	2004-05-21 04:04:10 -07:00
@@ -1322,8 +1322,14 @@
 	current_speed = SPEED_INVALID;
 	current_duplex = DUPLEX_INVALID;
 
-	tg3_readphy(tp, MII_BMSR, &bmsr);
-	tg3_readphy(tp, MII_BMSR, &bmsr);
+	bmsr = 0;
+	for (i = 0; i < 100; i++) {
+		tg3_readphy(tp, MII_BMSR, &bmsr);
+		tg3_readphy(tp, MII_BMSR, &bmsr);
+		if (bmsr & BMSR_LSTATUS)
+			break;
+		udelay(40);
+	}
 
 	if (bmsr & BMSR_LSTATUS) {
 		u32 aux_stat, bmcr;
@@ -1339,8 +1345,16 @@
 		tg3_aux_stat_to_speed_duplex(tp, aux_stat,
 					     &current_speed,
 					     &current_duplex);
-		tg3_readphy(tp, MII_BMCR, &bmcr);
-		tg3_readphy(tp, MII_BMCR, &bmcr);
+
+		bmcr = 0;
+		for (i = 0; i < 200; i++) {
+			tg3_readphy(tp, MII_BMCR, &bmcr);
+			tg3_readphy(tp, MII_BMCR, &bmcr);
+			if (bmcr && bmcr != 0x7fff)
+				break;
+			udelay(10);
+		}
+
 		if (tp->link_config.autoneg == AUTONEG_ENABLE) {
 			if (bmcr & BMCR_ANENABLE) {
 				u32 gig_ctrl;
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-24" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic