aboutsummaryrefslogtreecommitdiffstats
path: root/arch/xtensa/include/asm/delay.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/xtensa/include/asm/delay.h')
-rw-r--r--arch/xtensa/include/asm/delay.h13
1 files changed, 3 insertions, 10 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