summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSascha Hauer <sha@octopus.labnet.pengutronix.de>2007-09-11 10:22:00 +0200
committerSascha Hauer <sha@octopus.labnet.pengutronix.de>2007-09-11 10:22:00 +0200
commit13e43a3536f68adaa1b5751bb9e44ca52d8f30a5 (patch)
tree96e6e9f02f75cb231f193062ac6ffc8c5c30c32c /drivers
parent3fc674cc516c005e1b7f1499134c77a1383c725c (diff)
downloadbarebox-13e43a3536f68adaa1b5751bb9e44ca52d8f30a5.tar.gz
barebox-13e43a3536f68adaa1b5751bb9e44ca52d8f30a5.tar.xz
use timeout loop instead of udelay/counter combination
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/miiphy.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/net/miiphy.c b/drivers/net/miiphy.c
index fb5f5d3881..5fe7dc8e04 100644
--- a/drivers/net/miiphy.c
+++ b/drivers/net/miiphy.c
@@ -24,6 +24,7 @@
#include <driver.h>
#include <init.h>
#include <miiphy.h>
+#include <clock.h>
int miiphy_restart_aneg(struct miiphy_device *mdev)
{
@@ -67,17 +68,15 @@ int miiphy_restart_aneg(struct miiphy_device *mdev)
int miiphy_wait_aneg(struct miiphy_device *mdev)
{
- int timeout = 1;
+ uint64_t start;
uint16_t status;
/*
* Wait for AN completion
*/
- timeout = 5000;
+ start = get_time_ns();
do {
- udelay(1000);
-
- if (!timeout--) {
+ if (is_timeout(start, 5 * SECOND)) {
printf("%s: Autonegotiation timeout\n", mdev->dev.id);
return -1;
}