aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/lib64/udelay.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/lib64/udelay.c')
-rw-r--r--arch/sh/lib64/udelay.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/arch/sh/lib64/udelay.c b/arch/sh/lib64/udelay.c
index 23c7d17fb9f7..d76bd801194f 100644
--- a/arch/sh/lib64/udelay.c
+++ b/arch/sh/lib64/udelay.c
@@ -21,7 +21,7 @@
21 * a 1GHz box, that's about 2 seconds. 21 * a 1GHz box, that's about 2 seconds.
22 */ 22 */
23 23
24void __delay(int loops) 24void __delay(unsigned long loops)
25{ 25{
26 long long dummy; 26 long long dummy;
27 __asm__ __volatile__("gettr tr0, %1\n\t" 27 __asm__ __volatile__("gettr tr0, %1\n\t"
@@ -33,24 +33,17 @@ void __delay(int loops)
33 :"0"(loops)); 33 :"0"(loops));
34} 34}
35 35
36void __udelay(unsigned long long usecs, unsigned long lpj) 36inline void __const_udelay(unsigned long xloops)
37{ 37{
38 usecs *= (((unsigned long long) HZ << 32) / 1000000) * lpj; 38 __delay(xloops * (HZ * cpu_data[raw_smp_processor_id()].loops_per_jiffy));
39 __delay((long long) usecs >> 32);
40} 39}
41 40
42void __ndelay(unsigned long long nsecs, unsigned long lpj) 41void __udelay(unsigned long usecs)
43{ 42{
44 nsecs *= (((unsigned long long) HZ << 32) / 1000000000) * lpj; 43 __const_udelay(usecs * 0x000010c6); /* 2**32 / 1000000 */
45 __delay((long long) nsecs >> 32);
46} 44}
47 45
48void udelay(unsigned long usecs) 46void __ndelay(unsigned long nsecs)
49{ 47{
50 __udelay(usecs, cpu_data[raw_smp_processor_id()].loops_per_jiffy); 48 __const_udelay(nsecs * 0x00000005);
51}
52
53void ndelay(unsigned long nsecs)
54{
55 __ndelay(nsecs, cpu_data[raw_smp_processor_id()].loops_per_jiffy);
56} 49}