Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / arch / powerpc / include / asm / timex.h
blob926b9f91a3ef26f6fbbab910586d8ba165a0d0d9
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_POWERPC_TIMEX_H
3 #define _ASM_POWERPC_TIMEX_H
5 #ifdef __KERNEL__
7 /*
8 * PowerPC architecture timex specifications
9 */
11 #include <asm/cputable.h>
12 #include <asm/reg.h>
14 #define CLOCK_TICK_RATE 1024000 /* Underlying HZ */
16 typedef unsigned long cycles_t;
18 static inline cycles_t get_cycles(void)
20 #ifdef __powerpc64__
21 return mftb();
22 #else
23 cycles_t ret;
26 * For the "cycle" counter we use the timebase lower half.
27 * Currently only used on SMP.
30 ret = 0;
32 __asm__ __volatile__(
33 #ifdef CONFIG_PPC_8xx
34 "97: mftb %0\n"
35 #else
36 "97: mfspr %0, %2\n"
37 #endif
38 "99:\n"
39 ".section __ftr_fixup,\"a\"\n"
40 ".align 2\n"
41 "98:\n"
42 " .long %1\n"
43 " .long 0\n"
44 " .long 97b-98b\n"
45 " .long 99b-98b\n"
46 " .long 0\n"
47 " .long 0\n"
48 ".previous"
49 : "=r" (ret) : "i" (CPU_FTR_601), "i" (SPRN_TBRL));
50 return ret;
51 #endif
54 #endif /* __KERNEL__ */
55 #endif /* _ASM_POWERPC_TIMEX_H */