diff options
author | Baruch Siach <baruch@tkos.co.il> | 2013-06-17 04:29:44 -0400 |
---|---|---|
committer | Chris Zankel <chris@zankel.net> | 2013-07-08 04:11:37 -0400 |
commit | 8102f47ab5fcffc50f3ff94ca9b9073c12c18cc7 (patch) | |
tree | 48d788aac62e3036455d834d9df0d11dc0d543b5 | |
parent | e504c4b6076d9ec1caccaac65803fe3fc29afec8 (diff) |
xtensa: consolidate ccount access routines
Use get_ccount everywhere; remove xtensa_get_ccount.
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Chris Zankel <chris@zankel.net>
-rw-r--r-- | arch/xtensa/include/asm/delay.h | 13 | ||||
-rw-r--r-- | arch/xtensa/variants/s6000/delay.c | 3 |
2 files changed, 4 insertions, 12 deletions
diff --git a/arch/xtensa/include/asm/delay.h b/arch/xtensa/include/asm/delay.h index 61fc5faeb46c..3899610c1dff 100644 --- a/arch/xtensa/include/asm/delay.h +++ b/arch/xtensa/include/asm/delay.h | |||
@@ -12,7 +12,7 @@ | |||
12 | #ifndef _XTENSA_DELAY_H | 12 | #ifndef _XTENSA_DELAY_H |
13 | #define _XTENSA_DELAY_H | 13 | #define _XTENSA_DELAY_H |
14 | 14 | ||
15 | #include <asm/processor.h> | 15 | #include <asm/timex.h> |
16 | #include <asm/param.h> | 16 | #include <asm/param.h> |
17 | 17 | ||
18 | extern unsigned long loops_per_jiffy; | 18 | extern unsigned long loops_per_jiffy; |
@@ -24,24 +24,17 @@ static inline void __delay(unsigned long loops) | |||
24 | : "=r" (loops) : "0" (loops)); | 24 | : "=r" (loops) : "0" (loops)); |
25 | } | 25 | } |
26 | 26 | ||
27 | static __inline__ u32 xtensa_get_ccount(void) | ||
28 | { | ||
29 | u32 ccount; | ||
30 | asm volatile ("rsr %0, ccount\n" : "=r" (ccount)); | ||
31 | return ccount; | ||
32 | } | ||
33 | |||
34 | /* For SMP/NUMA systems, change boot_cpu_data to something like | 27 | /* For SMP/NUMA systems, change boot_cpu_data to something like |
35 | * local_cpu_data->... where local_cpu_data points to the current | 28 | * local_cpu_data->... where local_cpu_data points to the current |
36 | * cpu. */ | 29 | * cpu. */ |
37 | 30 | ||
38 | static __inline__ void udelay (unsigned long usecs) | 31 | static __inline__ void udelay (unsigned long usecs) |
39 | { | 32 | { |
40 | unsigned long start = xtensa_get_ccount(); | 33 | unsigned long start = get_ccount(); |
41 | unsigned long cycles = usecs * (loops_per_jiffy / (1000000UL / HZ)); | 34 | unsigned long cycles = usecs * (loops_per_jiffy / (1000000UL / HZ)); |
42 | 35 | ||
43 | /* Note: all variables are unsigned (can wrap around)! */ | 36 | /* Note: all variables are unsigned (can wrap around)! */ |
44 | while (((unsigned long)xtensa_get_ccount()) - start < cycles) | 37 | while (((unsigned long)get_ccount()) - start < cycles) |
45 | ; | 38 | ; |
46 | } | 39 | } |
47 | 40 | ||
diff --git a/arch/xtensa/variants/s6000/delay.c b/arch/xtensa/variants/s6000/delay.c index baefd3a3c2aa..39154563ee17 100644 --- a/arch/xtensa/variants/s6000/delay.c +++ b/arch/xtensa/variants/s6000/delay.c | |||
@@ -1,4 +1,3 @@ | |||
1 | #include <asm/delay.h> | ||
2 | #include <asm/timex.h> | 1 | #include <asm/timex.h> |
3 | #include <asm/io.h> | 2 | #include <asm/io.h> |
4 | #include <variant/hardware.h> | 3 | #include <variant/hardware.h> |
@@ -17,7 +16,7 @@ void platform_calibrate_ccount(void) | |||
17 | "1: l32i %0, %2, 0 ;" | 16 | "1: l32i %0, %2, 0 ;" |
18 | " beq %0, %1, 1b ;" | 17 | " beq %0, %1, 1b ;" |
19 | : "=&a"(u) : "a"(t), "a"(tstamp)); | 18 | : "=&a"(u) : "a"(t), "a"(tstamp)); |
20 | b = xtensa_get_ccount(); | 19 | b = get_ccount(); |
21 | if (i == LOOPS) | 20 | if (i == LOOPS) |
22 | a = b; | 21 | a = b; |
23 | } while (--i >= 0); | 22 | } while (--i >= 0); |