2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 1998, 1999, 2003 by Ralf Baechle
13 #include <asm/cpu-features.h>
14 #include <asm/mipsregs.h>
15 #include <asm/cpu-type.h>
18 * This is the clock rate of the i8253 PIT. A MIPS system may not have
19 * a PIT by the symbol is used all over the kernel including some APIs.
20 * So keeping it defined to the number for the PIT is the only sane thing
23 #define CLOCK_TICK_RATE 1193182
26 * Standard way to access the cycle counter.
27 * Currently only used on SMP for scheduling.
29 * Only the low 32 bits are available as a continuously counting entity.
30 * But this only means we'll force a reschedule every 8 seconds or so,
31 * which isn't an evil thing.
33 * We know that all SMP capable CPUs have cycle counters.
36 typedef unsigned int cycles_t
;
39 * On R4000/R4400 before version 5.0 an erratum exists such that if the
40 * cycle counter is read in the exact moment that it is matching the
41 * compare register, no interrupt will be generated.
43 * There is a suggested workaround and also the erratum can't strike if
44 * the compare interrupt isn't being used as the clock source device.
45 * However for now the implementaton of this function doesn't get these
48 static inline cycles_t
get_cycles(void)
50 switch (boot_cpu_type()) {
54 if ((read_c0_prid() & 0xff) >= 0x0050)
55 return read_c0_count();
65 return read_c0_count();
69 return 0; /* no usable counter */
72 #endif /* __KERNEL__ */
74 #endif /* _ASM_TIMEX_H */