aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-powerpc
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2005-11-17 21:44:17 -0500
committerPaul Mackerras <paulus@samba.org>2005-11-17 22:08:12 -0500
commit6defa38b3754c84cd3449447477aed81ea979407 (patch)
treeb5f40628d6fd9001470aa2f9a8fa3f2ed08862c6 /include/asm-powerpc
parentfe7bce5ef70105a6546dc9b5c354219b9f6ea991 (diff)
powerpc: Fix delay functions for 601 processors
My earlier merge of delay.h introduced a timebase-based udelay for 32-bit machines but also broke the 601, which doesn't have the timebase register. This fixes it by using the 601's RTC register on the 601, and also moves __delay() and udelay() to be out-of-line in arch/powerpc/kernel/time.c. These functions aren't really performance critical, after all. Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/asm-powerpc')
-rw-r--r--include/asm-powerpc/delay.h40
1 files changed, 2 insertions, 38 deletions
diff --git a/include/asm-powerpc/delay.h b/include/asm-powerpc/delay.h
index 1492aa9ab716..54fe1f4f8fd0 100644
--- a/include/asm-powerpc/delay.h
+++ b/include/asm-powerpc/delay.h
@@ -13,43 +13,7 @@
13 * Anton Blanchard. 13 * Anton Blanchard.
14 */ 14 */
15 15
16extern unsigned long tb_ticks_per_usec; 16extern void __delay(unsigned long loops);
17 17extern void udelay(unsigned long usecs);
18#ifdef CONFIG_PPC64
19/* define these here to prevent circular dependencies */
20/* these instructions control the thread priority on multi-threaded cpus */
21#define __HMT_low() asm volatile("or 1,1,1")
22#define __HMT_medium() asm volatile("or 2,2,2")
23#else
24#define __HMT_low()
25#define __HMT_medium()
26#endif
27
28#define __barrier() asm volatile("" ::: "memory")
29
30static inline unsigned long __get_tb(void)
31{
32 unsigned long rval;
33
34 asm volatile("mftb %0" : "=r" (rval));
35 return rval;
36}
37
38static inline void __delay(unsigned long loops)
39{
40 unsigned long start = __get_tb();
41
42 while((__get_tb() - start) < loops)
43 __HMT_low();
44 __HMT_medium();
45 __barrier();
46}
47
48static inline void udelay(unsigned long usecs)
49{
50 unsigned long loops = tb_ticks_per_usec * usecs;
51
52 __delay(loops);
53}
54 18
55#endif /* _ASM_POWERPC_DELAY_H */ 19#endif /* _ASM_POWERPC_DELAY_H */