summaryrefslogtreecommitdiff
path: root/lib_mips
diff options
context:
space:
mode:
Diffstat (limited to 'lib_mips')
-rw-r--r--lib_mips/time.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib_mips/time.c b/lib_mips/time.c
index 2c696b709d2..fe365303b4d 100644
--- a/lib_mips/time.c
+++ b/lib_mips/time.c
@@ -51,13 +51,12 @@ void set_timer(ulong t)
write_c0_count(t);
}
-void udelay (unsigned long usec)
+void udelay(unsigned long usec)
{
- ulong tmo;
- ulong start = get_timer(0);
+ unsigned int tmo;
- tmo = usec * (CFG_HZ / 1000000);
- while ((ulong)((read_c0_count() - start)) < tmo)
+ tmo = read_c0_count() + (usec * (CFG_MIPS_TIMER_FREQ / 1000000));
+ while ((tmo - read_c0_count()) < 0x7fffffff)
/*NOP*/;
}