summaryrefslogtreecommitdiff
path: root/lib_mips
diff options
context:
space:
mode:
authorShinya Kuribayashi <skuribay@ruby.dti.ne.jp>2008-06-05 22:29:00 +0900
committerShinya Kuribayashi <skuribay@ruby.dti.ne.jp>2008-06-05 22:29:00 +0900
commit199e4f657c8af42efe3fb3ba1d1104eb6bb28c25 (patch)
treec4245d2ea3700fcd86d94c6a6dfaea7dcf9dd3b6 /lib_mips
parentc7e38e413ae69120d3e51f132c7cb1d6b3514d03 (diff)
downloadu-boot-imx-199e4f657c8af42efe3fb3ba1d1104eb6bb28c25.zip
u-boot-imx-199e4f657c8af42efe3fb3ba1d1104eb6bb28c25.tar.gz
u-boot-imx-199e4f657c8af42efe3fb3ba1d1104eb6bb28c25.tar.bz2
[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 <skuribay@ruby.dti.ne.jp>
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 2c696b7..fe36530 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*/;
}