diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2007-07-14 05:23:37 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-07-16 07:05:02 -0400 |
commit | 8b99cfb8cc51adae7f5294c8962a026c63100959 (patch) | |
tree | 349cebcae3eda608f1ed52fa3afcf661fca075a9 /include | |
parent | 27a2ef382c7935a4dd02bff9fd361ce118df98c6 (diff) |
[SPARC64]: More sensible udelay implementation.
Take a page from the powerpc folks and just calculate the
delay factor directly.
Since frequency scaling chips use a system-tick register,
the value is going to be the same system-wide.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-sparc64/bugs.h | 5 | ||||
-rw-r--r-- | include/asm-sparc64/cpudata.h | 2 | ||||
-rw-r--r-- | include/asm-sparc64/delay.h | 32 |
3 files changed, 7 insertions, 32 deletions
diff --git a/include/asm-sparc64/bugs.h b/include/asm-sparc64/bugs.h index bf39d86c0c9e..11ade6841971 100644 --- a/include/asm-sparc64/bugs.h +++ b/include/asm-sparc64/bugs.h | |||
@@ -4,12 +4,7 @@ | |||
4 | */ | 4 | */ |
5 | #include <asm/sstate.h> | 5 | #include <asm/sstate.h> |
6 | 6 | ||
7 | extern unsigned long loops_per_jiffy; | ||
8 | |||
9 | static void __init check_bugs(void) | 7 | static void __init check_bugs(void) |
10 | { | 8 | { |
11 | #ifndef CONFIG_SMP | ||
12 | cpu_data(0).udelay_val = loops_per_jiffy; | ||
13 | #endif | ||
14 | sstate_running(); | 9 | sstate_running(); |
15 | } | 10 | } |
diff --git a/include/asm-sparc64/cpudata.h b/include/asm-sparc64/cpudata.h index 0016d8b4531c..98a6e609163e 100644 --- a/include/asm-sparc64/cpudata.h +++ b/include/asm-sparc64/cpudata.h | |||
@@ -19,7 +19,7 @@ typedef struct { | |||
19 | unsigned int __softirq_pending; /* must be 1st, see rtrap.S */ | 19 | unsigned int __softirq_pending; /* must be 1st, see rtrap.S */ |
20 | unsigned int __pad0; | 20 | unsigned int __pad0; |
21 | unsigned long clock_tick; /* %tick's per second */ | 21 | unsigned long clock_tick; /* %tick's per second */ |
22 | unsigned long udelay_val; | 22 | unsigned long __pad; |
23 | unsigned int __pad1; | 23 | unsigned int __pad1; |
24 | unsigned int __pad2; | 24 | unsigned int __pad2; |
25 | 25 | ||
diff --git a/include/asm-sparc64/delay.h b/include/asm-sparc64/delay.h index a4aae6f80627..a77aa622d762 100644 --- a/include/asm-sparc64/delay.h +++ b/include/asm-sparc64/delay.h | |||
@@ -1,37 +1,17 @@ | |||
1 | /* delay.h: Linux delay routines on sparc64. | 1 | /* delay.h: Linux delay routines on sparc64. |
2 | * | 2 | * |
3 | * Copyright (C) 1996, 2004 David S. Miller (davem@davemloft.net). | 3 | * Copyright (C) 1996, 2004, 2007 David S. Miller (davem@davemloft.net). |
4 | * | ||
5 | * Based heavily upon x86 variant which is: | ||
6 | * Copyright (C) 1993 Linus Torvalds | ||
7 | * | ||
8 | * Delay routines calling functions in arch/sparc64/lib/delay.c | ||
9 | */ | 4 | */ |
10 | 5 | ||
11 | #ifndef __SPARC64_DELAY_H | 6 | #ifndef _SPARC64_DELAY_H |
12 | #define __SPARC64_DELAY_H | 7 | #define _SPARC64_DELAY_H |
13 | |||
14 | #include <linux/param.h> | ||
15 | #include <asm/cpudata.h> | ||
16 | 8 | ||
17 | #ifndef __ASSEMBLY__ | 9 | #ifndef __ASSEMBLY__ |
18 | 10 | ||
19 | extern void __bad_udelay(void); | ||
20 | extern void __bad_ndelay(void); | ||
21 | |||
22 | extern void __udelay(unsigned long usecs); | ||
23 | extern void __ndelay(unsigned long nsecs); | ||
24 | extern void __const_udelay(unsigned long usecs); | ||
25 | extern void __delay(unsigned long loops); | 11 | extern void __delay(unsigned long loops); |
26 | 12 | extern void udelay(unsigned long usecs); | |
27 | #define udelay(n) (__builtin_constant_p(n) ? \ | 13 | #define mdelay(n) udelay((n) * 1000) |
28 | ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c7ul)) : \ | ||
29 | __udelay(n)) | ||
30 | |||
31 | #define ndelay(n) (__builtin_constant_p(n) ? \ | ||
32 | ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \ | ||
33 | __ndelay(n)) | ||
34 | 14 | ||
35 | #endif /* !__ASSEMBLY__ */ | 15 | #endif /* !__ASSEMBLY__ */ |
36 | 16 | ||
37 | #endif /* defined(__SPARC64_DELAY_H) */ | 17 | #endif /* _SPARC64_DELAY_H */ |