]> git.sur5r.net Git - u-boot/blobdiff - cpu/sa1100/interrupts.c
ColdFire: Update Freescale MCF52x2 platforms
[u-boot] / cpu / sa1100 / interrupts.c
index 75f939c2cf1d3671190ddfcffaf01bd5218cfddc..b393e0d435ea879cc261b191dd5de77ab7f84ce3 100644 (file)
@@ -31,8 +31,6 @@
 
 #include <asm/proc-armv/ptrace.h>
 
-extern void reset_cpu (ulong addr);
-
 #ifdef CONFIG_USE_IRQ
 /* enable IRQ/FIQ interrupts */
 void enable_interrupts (void)
@@ -208,13 +206,43 @@ ulong get_timer_masked (void)
 void udelay_masked (unsigned long usec)
 {
        ulong tmo;
+       ulong endtime;
+       signed long diff;
 
-       tmo = usec / 1000;
-       tmo *= CFG_HZ;
-       tmo /= 1000;
+       if (usec >= 1000) {
+               tmo = usec / 1000;
+               tmo *= CFG_HZ;
+               tmo /= 1000;
+       } else {
+               tmo = usec * CFG_HZ;
+               tmo /= (1000*1000);
+       }
 
-       reset_timer_masked ();
+       endtime = get_timer_masked () + tmo;
+
+       do {
+               ulong now = get_timer_masked ();
+               diff = endtime - now;
+       } while (diff >= 0);
+}
+
+/*
+ * This function is derived from PowerPC code (read timebase as long long).
+ * On ARM it just returns the timer value.
+ */
+unsigned long long get_ticks(void)
+{
+       return get_timer(0);
+}
+
+/*
+ * This function is derived from PowerPC code (timebase clock frequency).
+ * On ARM it returns the number of timer ticks per second.
+ */
+ulong get_tbclk (void)
+{
+       ulong tbclk;
 
-       while (tmo >= get_timer_masked ())
-               /*NOP*/;
+       tbclk = CFG_HZ;
+       return tbclk;
 }