public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] tsec: Wait for auto-negotiation to complete without link
@ 2009-02-04 21:14 Peter Tyser
  2009-02-04 21:20 ` Andy Fleming
                   ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Peter Tyser @ 2009-02-04 21:14 UTC (permalink / raw)
  To: u-boot

Previously, waiting for auto-negotiation would only occur if a valid
link had been detected.  Problems arose when attempting to use a
tsec immediately after bootup but before link was achieved, eg:
=> dhcp
Auto-neg error, defaulting to 10BT/HD
eTSEC1: No link.
Auto-neg error, defaulting to 10BT/HD
eTSEC2: No link.
=>

With this patch applied the same operation as above resulted in:
=> dhcp
Waiting for PHY auto negotiation to complete. done
Enet starting in 1000BT/FD
Speed: 1000, full duplex

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
---

 drivers/net/tsec.c |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index dc90f23..2e30fe9 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -352,8 +352,8 @@ uint mii_cr_init(uint mii_reg, struct tsec_private * priv)
 		return MIIM_CR_INIT;
 }
 
-/* Parse the status register for link, and then do
- * auto-negotiation
+/*
+ * Wait for auto-negotiation to complete, then determine link
  */
 uint mii_parse_sr(uint mii_reg, struct tsec_private * priv)
 {
@@ -362,8 +362,7 @@ uint mii_parse_sr(uint mii_reg, struct tsec_private * priv)
 	 * (ie - we're capable and it's not done)
 	 */
 	mii_reg = read_phy_reg(priv, MIIM_STATUS);
-	if ((mii_reg & MIIM_STATUS_LINK) && (mii_reg & PHY_BMSR_AUTN_ABLE)
-	    && !(mii_reg & PHY_BMSR_AUTN_COMP)) {
+	if ((mii_reg & PHY_BMSR_AUTN_ABLE) && !(mii_reg & PHY_BMSR_AUTN_COMP)) {
 		int i = 0;
 
 		puts("Waiting for PHY auto negotiation to complete");
@@ -384,15 +383,15 @@ uint mii_parse_sr(uint mii_reg, struct tsec_private * priv)
 			mii_reg = read_phy_reg(priv, MIIM_STATUS);
 		}
 		puts(" done\n");
-		priv->link = 1;
+
+		/* Link status bit is latched low, read it again */
+		mii_reg = read_phy_reg(priv, MIIM_STATUS);
+
 		udelay(500000);	/* another 500 ms (results in faster booting) */
-	} else {
-		if (mii_reg & MIIM_STATUS_LINK)
-			priv->link = 1;
-		else
-			priv->link = 0;
 	}
 
+	priv->link = mii_reg & MIIM_STATUS_LINK ? 1 : 0;
+
 	return 0;
 }
 
-- 
1.6.0.2.GIT

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

end of thread, other threads:[~2009-08-21 17:35 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-04 21:14 [U-Boot] [PATCH] tsec: Wait for auto-negotiation to complete without link Peter Tyser
2009-02-04 21:20 ` Andy Fleming
2009-02-04 21:26   ` Wolfgang Denk
2009-02-04 21:45     ` Peter Tyser
2009-02-04 23:07     ` Andy Fleming
2009-02-05 16:27       ` Peter Tyser
2009-02-06 13:32         ` Jerry Van Baren
2009-02-06 18:49           ` Andy Fleming
2009-02-06 19:30             ` Jerry Van Baren
2009-02-10  0:56               ` Andy Fleming
2009-02-10 13:59                 ` Jerry Van Baren
2009-02-10 17:31                   ` Scott Wood
2009-02-25 20:30                     ` Peter Tyser
2009-02-04 21:49   ` Scott Wood
2009-02-04 21:58     ` Wolfgang Denk
2009-02-04 22:00       ` Scott Wood
2009-02-04 22:19         ` Wolfgang Denk
2009-02-06 13:16       ` Jerry Van Baren
2009-02-06 17:16         ` Ben Warren
2009-07-19 20:14 ` Peter Tyser
2009-08-04 22:50   ` Peter Tyser
2009-08-21 17:04     ` Peter Tyser
2009-08-21 17:35 ` Ben Warren

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