diff options
author | Wolfgang Denk <wd@denx.de> | 2010-02-08 22:09:24 +0100 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2010-02-08 22:09:24 +0100 |
commit | 0b692dcb190655c7eb96b6b8003bee163e3b58dd (patch) | |
tree | c916bb2d2c653d695c3f100b95954f70725a1608 /common/miiphyutil.c | |
parent | e39bf1e2a9e437174687de687c127ec980a93eeb (diff) | |
parent | ab5a0dcb9c8f19e351fc33c5db91469bfb1d9438 (diff) | |
download | talos-obmc-uboot-0b692dcb190655c7eb96b6b8003bee163e3b58dd.tar.gz talos-obmc-uboot-0b692dcb190655c7eb96b6b8003bee163e3b58dd.zip |
Merge branch 'master' of git://git.denx.de/u-boot-net
Diffstat (limited to 'common/miiphyutil.c')
-rw-r--r-- | common/miiphyutil.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/common/miiphyutil.c b/common/miiphyutil.c index 196ef4a7ba..856fbc70b8 100644 --- a/common/miiphyutil.c +++ b/common/miiphyutil.c @@ -293,7 +293,7 @@ int miiphy_info (char *devname, unsigned char addr, unsigned int *oui, int miiphy_reset (char *devname, unsigned char addr) { unsigned short reg; - int loop_cnt; + int timeout = 500; if (miiphy_read (devname, addr, PHY_BMCR, ®) != 0) { debug ("PHY status read failed\n"); @@ -311,13 +311,13 @@ int miiphy_reset (char *devname, unsigned char addr) * auto-clearing). This should happen within 0.5 seconds per the * IEEE spec. */ - loop_cnt = 0; reg = 0x8000; - while (((reg & 0x8000) != 0) && (loop_cnt++ < 1000000)) { - if (miiphy_read (devname, addr, PHY_BMCR, ®) != 0) { - debug ("PHY status read failed\n"); - return (-1); + while (((reg & 0x8000) != 0) && timeout--) { + if (miiphy_read(devname, addr, PHY_BMCR, ®) != 0) { + debug("PHY status read failed\n"); + return -1; } + udelay(1000); } if ((reg & 0x8000) == 0) { return (0); |