Merge tag 'locks-v3.16-2' of git://git.samba.org/jlayton/linux
[linux/fpc-iii.git] / arch / powerpc / include / asm / timex.h
blob2cf846edb3fcc4e941e44a8fc032eecd789b22d7
1 #ifndef _ASM_POWERPC_TIMEX_H
2 #define _ASM_POWERPC_TIMEX_H
4 #ifdef __KERNEL__
6 /*
7 * PowerPC architecture timex specifications
8 */
10 #include <asm/cputable.h>
11 #include <asm/reg.h>
13 #define CLOCK_TICK_RATE 1024000 /* Underlying HZ */
15 typedef unsigned long cycles_t;
17 static inline cycles_t get_cycles(void)
19 #ifdef __powerpc64__
20 return mftb();
21 #else
22 cycles_t ret;
25 * For the "cycle" counter we use the timebase lower half.
26 * Currently only used on SMP.
29 ret = 0;
31 __asm__ __volatile__(
32 #ifdef CONFIG_8xx
33 "97: mftb %0\n"
34 #else
35 "97: mfspr %0, %2\n"
36 #endif
37 "99:\n"
38 ".section __ftr_fixup,\"a\"\n"
39 ".align 2\n"
40 "98:\n"
41 " .long %1\n"
42 " .long 0\n"
43 " .long 97b-98b\n"
44 " .long 99b-98b\n"
45 " .long 0\n"
46 " .long 0\n"
47 ".previous"
48 #ifdef CONFIG_8xx
49 : "=r" (ret) : "i" (CPU_FTR_601));
50 #else
51 : "=r" (ret) : "i" (CPU_FTR_601), "i" (SPRN_TBRL));
52 #endif
53 return ret;
54 #endif
57 #endif /* __KERNEL__ */
58 #endif /* _ASM_POWERPC_TIMEX_H */