提交 7613afda 编写于 作者: A Andy Fleming 提交者: Wolfgang Denk

Don't wait for disconnected TSECs

The TSEC driver's PHY code waits a long time for autonegotiation to
complete, even if the link is down.  The PHY knows the link is
down or up before autonegotiation completes, so we can short-circuit
the process if the link is down.
Signed-off-by: NAndy Fleming <afleming@freescale.com>
上级 b96c83d4
...@@ -347,17 +347,16 @@ uint mii_cr_init(uint mii_reg, struct tsec_private * priv) ...@@ -347,17 +347,16 @@ uint mii_cr_init(uint mii_reg, struct tsec_private * priv)
uint mii_parse_sr(uint mii_reg, struct tsec_private * priv) uint mii_parse_sr(uint mii_reg, struct tsec_private * priv)
{ {
/* /*
* Wait if PHY is capable of autonegotiation and autonegotiation * Wait if the link is up, and autonegotiation is in progress
* is not complete. * (ie - we're capable and it's not done)
*/ */
mii_reg = read_phy_reg(priv, MIIM_STATUS); mii_reg = read_phy_reg(priv, MIIM_STATUS);
if ((mii_reg & PHY_BMSR_AUTN_ABLE) if ((mii_reg & MIIM_STATUS_LINK) && (mii_reg & PHY_BMSR_AUTN_ABLE)
&& !(mii_reg & PHY_BMSR_AUTN_COMP)) { && !(mii_reg & PHY_BMSR_AUTN_COMP)) {
int i = 0; int i = 0;
puts("Waiting for PHY auto negotiation to complete"); puts("Waiting for PHY auto negotiation to complete");
while (!((mii_reg & PHY_BMSR_AUTN_COMP) while (!(mii_reg & PHY_BMSR_AUTN_COMP)) {
&& (mii_reg & MIIM_STATUS_LINK))) {
/* /*
* Timeout reached ? * Timeout reached ?
*/ */
...@@ -377,7 +376,10 @@ uint mii_parse_sr(uint mii_reg, struct tsec_private * priv) ...@@ -377,7 +376,10 @@ uint mii_parse_sr(uint mii_reg, struct tsec_private * priv)
priv->link = 1; priv->link = 1;
udelay(500000); /* another 500 ms (results in faster booting) */ udelay(500000); /* another 500 ms (results in faster booting) */
} else { } else {
priv->link = 1; if (mii_reg & MIIM_STATUS_LINK)
priv->link = 1;
else
priv->link = 0;
} }
return 0; return 0;
...@@ -517,16 +519,13 @@ uint mii_parse_88E1011_psr(uint mii_reg, struct tsec_private * priv) ...@@ -517,16 +519,13 @@ uint mii_parse_88E1011_psr(uint mii_reg, struct tsec_private * priv)
mii_reg = read_phy_reg(priv, MIIM_88E1011_PHY_STATUS); mii_reg = read_phy_reg(priv, MIIM_88E1011_PHY_STATUS);
if (!((mii_reg & MIIM_88E1011_PHYSTAT_SPDDONE) && if ((mii_reg & MIIM_88E1011_PHYSTAT_LINK) &&
(mii_reg & MIIM_88E1011_PHYSTAT_LINK))) { !(mii_reg & MIIM_88E1011_PHYSTAT_SPDDONE)) {
int i = 0; int i = 0;
puts("Waiting for PHY realtime link"); puts("Waiting for PHY realtime link");
while (!((mii_reg & MIIM_88E1011_PHYSTAT_SPDDONE) && while (!(mii_reg & MIIM_88E1011_PHYSTAT_SPDDONE)) {
(mii_reg & MIIM_88E1011_PHYSTAT_LINK))) { /* Timeout reached ? */
/*
* Timeout reached ?
*/
if (i > PHY_AUTONEGOTIATE_TIMEOUT) { if (i > PHY_AUTONEGOTIATE_TIMEOUT) {
puts(" TIMEOUT !\n"); puts(" TIMEOUT !\n");
priv->link = 0; priv->link = 0;
...@@ -541,6 +540,11 @@ uint mii_parse_88E1011_psr(uint mii_reg, struct tsec_private * priv) ...@@ -541,6 +540,11 @@ uint mii_parse_88E1011_psr(uint mii_reg, struct tsec_private * priv)
} }
puts(" done\n"); puts(" done\n");
udelay(500000); /* another 500 ms (results in faster booting) */ udelay(500000); /* another 500 ms (results in faster booting) */
} else {
if (mii_reg & MIIM_88E1011_PHYSTAT_LINK)
priv->link = 1;
else
priv->link = 0;
} }
if (mii_reg & MIIM_88E1011_PHYSTAT_DUPLEX) if (mii_reg & MIIM_88E1011_PHYSTAT_DUPLEX)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册