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 <[EMAIL PROTECTED]>
---

 lib_mips/time.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)


diff --git a/lib_mips/time.c b/lib_mips/time.c
index f03f023..154d792 100644
--- a/lib_mips/time.c
+++ b/lib_mips/time.c
@@ -51,13 +51,13 @@ void set_timer(ulong t)
        write_32bit_cp0_register(CP0_COUNT, t);
 }
 
-void udelay (unsigned long usec)
+void udelay(unsigned long usec)
 {
        ulong tmo;
-       ulong start = get_timer(0);
+       unsigned int start = read_32bit_cp0_register(CP0_COUNT);
 
-       tmo = usec * (CFG_HZ / 1000000);
-       while ((ulong)((read_32bit_cp0_register(CP0_COUNT) - start)) < tmo)
+       tmo = start + (usec * (CONFIG_MIPS_TIMER_FREQ / 1000000));
+       while ((ulong)(tmo - read_32bit_cp0_register(CP0_COUNT)) < 0x7fffffff)
                /*NOP*/;
 }
 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

Reply via email to