summaryrefslogtreecommitdiff
path: root/drivers/net/tsec.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2009-08-21 23:03:58 +0200
committerWolfgang Denk <wd@denx.de>2009-08-21 23:03:58 +0200
commitdb81c0d27654ed18b12ba94f05f9578294cb62ed (patch)
treeef3af435e6559eae353a07cb3af999da60d4b212 /drivers/net/tsec.c
parent269610f6ba2e4a7bc27d2e53d43160614016964f (diff)
parentb1e849f2201bbbf3ca81fde164f154f9caf7f0e9 (diff)
downloadu-boot-imx-db81c0d27654ed18b12ba94f05f9578294cb62ed.zip
u-boot-imx-db81c0d27654ed18b12ba94f05f9578294cb62ed.tar.gz
u-boot-imx-db81c0d27654ed18b12ba94f05f9578294cb62ed.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-net
Diffstat (limited to 'drivers/net/tsec.c')
-rw-r--r--drivers/net/tsec.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index a9ba683..9c9fd37 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -356,8 +356,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)
{
@@ -366,8 +366,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");
@@ -388,15 +387,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;
}