[PATCH] backlight: HP Jornada 680 Backlight driver updates/fixes
[linux-2.6-block.git] / include / asm-powerpc / timex.h
CommitLineData
dd56fdf2 1#ifndef _ASM_POWERPC_TIMEX_H
2#define _ASM_POWERPC_TIMEX_H
3
4#ifdef __KERNEL__
5
1da177e4 6/*
dd56fdf2 7 * PowerPC architecture timex specifications
1da177e4 8 */
1da177e4
LT
9
10#include <linux/config.h>
11#include <asm/cputable.h>
12
cbd27b8c 13#define CLOCK_TICK_RATE 1024000 /* Underlying HZ */
1da177e4
LT
14
15typedef unsigned long cycles_t;
16
1da177e4
LT
17static inline cycles_t get_cycles(void)
18{
dd56fdf2 19 cycles_t ret;
20
21#ifdef __powerpc64__
22
23 __asm__ __volatile__("mftb %0" : "=r" (ret) : );
24
25#else
26 /*
27 * For the "cycle" counter we use the timebase lower half.
28 * Currently only used on SMP.
29 */
30
31 ret = 0;
1da177e4
LT
32
33 __asm__ __volatile__(
34 "98: mftb %0\n"
35 "99:\n"
36 ".section __ftr_fixup,\"a\"\n"
37 " .long %1\n"
38 " .long 0\n"
39 " .long 98b\n"
40 " .long 99b\n"
41 ".previous"
42 : "=r" (ret) : "i" (CPU_FTR_601));
dd56fdf2 43#endif
44
1da177e4
LT
45 return ret;
46}
47
dd56fdf2 48#endif /* __KERNEL__ */
49#endif /* _ASM_POWERPC_TIMEX_H */