From: Shinya Kuribayashi Date: Thu, 5 Jun 2008 13:29:00 +0000 (+0900) Subject: [MIPS] lib_mips/time.c: Fix udelay X-Git-Tag: v1.3.4-rc1~104^2~6 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=199e4f657c8af42efe3fb3ba1d1104eb6bb28c25;p=oweals%2Fu-boot.git [MIPS] lib_mips/time.c: Fix udelay What we have to do is just to wait for given micro-seconds. No need to take into account current time, get_timer and CFG_HZ. Signed-off-by: Shinya Kuribayashi --- diff --git a/lib_mips/time.c b/lib_mips/time.c index 2c696b709d..fe365303b4 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*/; }