aboutsummaryrefslogtreecommitdiffstats
path: root/arch/xtensa
diff options
context:
space:
mode:
Diffstat (limited to 'arch/xtensa')
-rw-r--r--arch/xtensa/include/asm/delay.h13
-rw-r--r--arch/xtensa/variants/s6000/delay.c3
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
18extern unsigned long loops_per_jiffy; 18extern 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
27static __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
38static __inline__ void udelay (unsigned long usecs) 31static __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);