]> err.no Git - linux-2.6/blobdiff - arch/sparc64/kernel/time.c
[SPARC64]: More sensible udelay implementation.
[linux-2.6] / arch / sparc64 / kernel / time.c
index a31a0439244f387973893d3a9d215ebd4ae0555c..62e316ab1339a0ed1687728dd5db0f7c89f31ec2 100644 (file)
@@ -849,9 +849,6 @@ static unsigned long sparc64_init_timers(void)
 {
        struct device_node *dp;
        unsigned long clock;
-#ifdef CONFIG_SMP
-       extern void smp_tick_init(void);
-#endif
 
        dp = of_find_node_by_path("/");
        if (tlb_type == spitfire) {
@@ -874,10 +871,6 @@ static unsigned long sparc64_init_timers(void)
                clock = of_getintprop_default(dp, "stick-frequency", 0);
        }
 
-#ifdef CONFIG_SMP
-       smp_tick_init();
-#endif
-
        return clock;
 }
 
@@ -1038,10 +1031,31 @@ static void __init setup_clockevent_multiplier(unsigned long hz)
        sparc64_clockevent.mult = mult;
 }
 
+static unsigned long tb_ticks_per_usec __read_mostly;
+
+void __delay(unsigned long loops)
+{
+       unsigned long bclock, now;
+
+       bclock = tick_ops->get_tick();
+       do {
+               now = tick_ops->get_tick();
+       } while ((now-bclock) < loops);
+}
+EXPORT_SYMBOL(__delay);
+
+void udelay(unsigned long usecs)
+{
+       __delay(tb_ticks_per_usec * usecs);
+}
+EXPORT_SYMBOL(udelay);
+
 void __init time_init(void)
 {
        unsigned long clock = sparc64_init_timers();
 
+       tb_ticks_per_usec = clock / USEC_PER_SEC;
+
        timer_ticks_per_nsec_quotient =
                clocksource_hz2mult(clock, SPARC64_NSEC_PER_CYC_SHIFT);