summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorRichard Retanubun <RichardRetanubun@RuggedCom.com>2009-01-23 14:42:58 -0500
committerJohn Rigby <jrigby@freescale.com>2009-02-06 14:54:47 -0700
commitc4ff77f5e6c3a01610ce97434c0d59acb1476f95 (patch)
tree095aaafabcf5d3711f5f9114c855de6121c49d39 /drivers/net
parent92d3e6e0ffcbb7224c83104f8d87b5b4bf39a38f (diff)
downloadu-boot-imx-c4ff77f5e6c3a01610ce97434c0d59acb1476f95.zip
u-boot-imx-c4ff77f5e6c3a01610ce97434c0d59acb1476f95.tar.gz
u-boot-imx-c4ff77f5e6c3a01610ce97434c0d59acb1476f95.tar.bz2
Coldfire: mcfmii: Allow non-autonegotiating PHYs to use mii command
Modified mii_init to support boards with PHYs that are not set to autonegotiate, but still want to use u-boot's mii commands to probe the smi bus. Such PHYs will not set the Autonegotiate-done bit. Signed-off-by: Richard Retanubun <RichardRetanubun@RuggedCom.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/mcfmii.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/drivers/net/mcfmii.c b/drivers/net/mcfmii.c
index 2b733c6..4f1c0a0 100644
--- a/drivers/net/mcfmii.c
+++ b/drivers/net/mcfmii.c
@@ -226,7 +226,8 @@ void __mii_init(void)
volatile FEC_T *fecp;
struct eth_device *dev;
int miispd = 0, i = 0;
- u16 autoneg = 0;
+ u16 status = 0;
+ u16 linkgood = 0;
/* retrieve from register structure */
dev = eth_get_dev();
@@ -250,22 +251,32 @@ void __mii_init(void)
info->phy_addr = mii_discover_phy(dev);
-#define AUTONEGLINK (PHY_BMSR_AUTN_COMP | PHY_BMSR_LS)
while (i < MCFFEC_TOUT_LOOP) {
- autoneg = 0;
- miiphy_read(dev->name, info->phy_addr, PHY_BMSR, &autoneg);
+ status = 0;
i++;
-
- if ((autoneg & AUTONEGLINK) == AUTONEGLINK)
+ /* Read PHY control register */
+ miiphy_read(dev->name, info->phy_addr, PHY_BMCR, &status);
+
+ /* If phy set to autonegotiate, wait for autonegotiation done,
+ * if phy is not autonegotiating, just wait for link up.
+ */
+ if ((status & PHY_BMCR_AUTON) == PHY_BMCR_AUTON) {
+ linkgood = (PHY_BMSR_AUTN_COMP | PHY_BMSR_LS);
+ } else {
+ linkgood = PHY_BMSR_LS;
+ }
+ /* Read PHY status register */
+ miiphy_read(dev->name, info->phy_addr, PHY_BMSR, &status);
+ if ((status & linkgood) == linkgood)
break;
udelay(500);
}
if (i >= MCFFEC_TOUT_LOOP) {
- printf("Auto Negotiation not complete\n");
+ printf("Link UP timeout\n");
}
- /* adapt to the half/full speed settings */
+ /* adapt to the duplex and speed settings of the phy */
info->dup_spd = miiphy_duplex(dev->name, info->phy_addr) << 16;
info->dup_spd |= miiphy_speed(dev->name, info->phy_addr);
}