au1550_spi: fix prototype of irq handler
[wrt350n-kernel.git] / arch / x86 / lib / delay_64.c
blobbbc610518516b11c4bdbe1d10dacd29ce41130c6
1 /*
2 * Precise Delay Loops for x86-64
4 * Copyright (C) 1993 Linus Torvalds
5 * Copyright (C) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
7 * The __delay function must _NOT_ be inlined as its execution time
8 * depends wildly on alignment on many x86 processors.
9 */
11 #include <linux/module.h>
12 #include <linux/sched.h>
13 #include <linux/timex.h>
14 #include <linux/preempt.h>
15 #include <linux/delay.h>
16 #include <linux/init.h>
18 #include <asm/delay.h>
19 #include <asm/msr.h>
21 #ifdef CONFIG_SMP
22 #include <asm/smp.h>
23 #endif
25 int __devinit read_current_timer(unsigned long *timer_value)
27 rdtscll(*timer_value);
28 return 0;
31 void __delay(unsigned long loops)
33 unsigned bclock, now;
35 preempt_disable(); /* TSC's are pre-cpu */
36 rdtscl(bclock);
37 do {
38 rep_nop();
39 rdtscl(now);
41 while ((now-bclock) < loops);
42 preempt_enable();
44 EXPORT_SYMBOL(__delay);
46 inline void __const_udelay(unsigned long xloops)
48 __delay(((xloops * HZ *
49 cpu_data(raw_smp_processor_id()).loops_per_jiffy) >> 32) + 1);
51 EXPORT_SYMBOL(__const_udelay);
53 void __udelay(unsigned long usecs)
55 __const_udelay(usecs * 0x000010c7); /* 2**32 / 1000000 (rounded up) */
57 EXPORT_SYMBOL(__udelay);
59 void __ndelay(unsigned long nsecs)
61 __const_udelay(nsecs * 0x00005); /* 2**32 / 1000000000 (rounded up) */
63 EXPORT_SYMBOL(__ndelay);