sh: rework intc2 code
[linux-2.6/btrfs-unstable.git] / arch / sparc64 / lib / delay.c
blobfb27e54a03ee11b9db711b9fbfe1b3f3db6894cb
1 /* delay.c: Delay loops for sparc64
3 * Copyright (C) 2004, 2006 David S. Miller <davem@davemloft.net>
5 * Based heavily upon x86 variant which is:
6 * Copyright (C) 1993 Linus Torvalds
7 * Copyright (C) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
8 */
10 #include <linux/delay.h>
11 #include <asm/timer.h>
13 void __delay(unsigned long loops)
15 unsigned long bclock, now;
17 bclock = tick_ops->get_tick();
18 do {
19 now = tick_ops->get_tick();
20 } while ((now-bclock) < loops);
23 /* We used to multiply by HZ after shifting down by 32 bits
24 * but that runs into problems for higher values of HZ and
25 * slow cpus.
27 void __const_udelay(unsigned long n)
29 n *= 4;
31 n *= (cpu_data(raw_smp_processor_id()).udelay_val * (HZ/4));
32 n >>= 32;
34 __delay(n + 1);
37 void __udelay(unsigned long n)
39 __const_udelay(n * 0x10c7UL);
43 void __ndelay(unsigned long n)
45 __const_udelay(n * 0x5UL);