Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / arch / sh / lib64 / udelay.c
blob03708dda4f9211219c025d7cff1f3ccab16b986e
1 /*
2 * arch/sh/lib64/udelay.c
4 * Delay routines, using a pre-computed "loops_per_jiffy" value.
6 * Copyright (C) 2000, 2001 Paolo Alberelli
7 * Copyright (C) 2003, 2004 Paul Mundt
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive
11 * for more details.
13 #include <linux/sched.h>
14 #include <asm/param.h>
17 * Use only for very small delays (< 1 msec).
19 * The active part of our cycle counter is only 32-bits wide, and
20 * we're treating the difference between two marks as signed. On
21 * a 1GHz box, that's about 2 seconds.
24 <<<<<<< HEAD:arch/sh/lib64/udelay.c
25 void __delay(int loops)
26 =======
27 void __delay(unsigned long loops)
28 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sh/lib64/udelay.c
30 long long dummy;
31 __asm__ __volatile__("gettr tr0, %1\n\t"
32 "pta $+4, tr0\n\t"
33 "addi %0, -1, %0\n\t"
34 "bne %0, r63, tr0\n\t"
35 "ptabs %1, tr0\n\t":"=r"(loops),
36 "=r"(dummy)
37 :"0"(loops));
40 <<<<<<< HEAD:arch/sh/lib64/udelay.c
41 void __udelay(unsigned long long usecs, unsigned long lpj)
42 =======
43 inline void __const_udelay(unsigned long xloops)
44 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sh/lib64/udelay.c
46 <<<<<<< HEAD:arch/sh/lib64/udelay.c
47 usecs *= (((unsigned long long) HZ << 32) / 1000000) * lpj;
48 __delay((long long) usecs >> 32);
49 =======
50 __delay(xloops * (HZ * cpu_data[raw_smp_processor_id()].loops_per_jiffy));
51 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sh/lib64/udelay.c
54 <<<<<<< HEAD:arch/sh/lib64/udelay.c
55 void __ndelay(unsigned long long nsecs, unsigned long lpj)
56 =======
57 void __udelay(unsigned long usecs)
58 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sh/lib64/udelay.c
60 <<<<<<< HEAD:arch/sh/lib64/udelay.c
61 nsecs *= (((unsigned long long) HZ << 32) / 1000000000) * lpj;
62 __delay((long long) nsecs >> 32);
63 =======
64 __const_udelay(usecs * 0x000010c6); /* 2**32 / 1000000 */
65 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sh/lib64/udelay.c
68 <<<<<<< HEAD:arch/sh/lib64/udelay.c
69 void udelay(unsigned long usecs)
70 =======
71 void __ndelay(unsigned long nsecs)
72 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sh/lib64/udelay.c
74 <<<<<<< HEAD:arch/sh/lib64/udelay.c
75 __udelay(usecs, cpu_data[raw_smp_processor_id()].loops_per_jiffy);
78 void ndelay(unsigned long nsecs)
80 __ndelay(nsecs, cpu_data[raw_smp_processor_id()].loops_per_jiffy);
81 =======
82 __const_udelay(nsecs * 0x00000005);
83 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sh/lib64/udelay.c