diff options
| author | Russell King <rmk+kernel@arm.linux.org.uk> | 2013-10-07 10:43:04 -0400 |
|---|---|---|
| committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2013-10-07 10:43:04 -0400 |
| commit | a56e74f546b64be93731e42d83baf5b538cc1b11 (patch) | |
| tree | 18f6dee45d801e57ac9db2a31664b0d5c0762c50 /arch/mips/include/asm/timex.h | |
| parent | d08e2e09042bd3f7ef66a35cb4bb92794ab26bb2 (diff) | |
| parent | e4e7f10bfc4069925e99cc4b428c3434e30b6c3f (diff) | |
Merge branch 'arm-aesbs' of git://git.linaro.org/people/ardbiesheuvel/linux-arm into devel-stable
Diffstat (limited to 'arch/mips/include/asm/timex.h')
| -rw-r--r-- | arch/mips/include/asm/timex.h | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/arch/mips/include/asm/timex.h b/arch/mips/include/asm/timex.h index 6529704aa73a..c5424757da65 100644 --- a/arch/mips/include/asm/timex.h +++ b/arch/mips/include/asm/timex.h | |||
| @@ -10,7 +10,9 @@ | |||
| 10 | 10 | ||
| 11 | #ifdef __KERNEL__ | 11 | #ifdef __KERNEL__ |
| 12 | 12 | ||
| 13 | #include <asm/cpu-features.h> | ||
| 13 | #include <asm/mipsregs.h> | 14 | #include <asm/mipsregs.h> |
| 15 | #include <asm/cpu-type.h> | ||
| 14 | 16 | ||
| 15 | /* | 17 | /* |
| 16 | * This is the clock rate of the i8253 PIT. A MIPS system may not have | 18 | * This is the clock rate of the i8253 PIT. A MIPS system may not have |
| @@ -33,9 +35,38 @@ | |||
| 33 | 35 | ||
| 34 | typedef unsigned int cycles_t; | 36 | typedef unsigned int cycles_t; |
| 35 | 37 | ||
| 38 | /* | ||
| 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. | ||
| 42 | * | ||
| 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 | ||
| 46 | * fine details right. | ||
| 47 | */ | ||
| 36 | static inline cycles_t get_cycles(void) | 48 | static inline cycles_t get_cycles(void) |
| 37 | { | 49 | { |
| 38 | return 0; | 50 | switch (boot_cpu_type()) { |
| 51 | case CPU_R4400PC: | ||
| 52 | case CPU_R4400SC: | ||
| 53 | case CPU_R4400MC: | ||
| 54 | if ((read_c0_prid() & 0xff) >= 0x0050) | ||
| 55 | return read_c0_count(); | ||
| 56 | break; | ||
| 57 | |||
| 58 | case CPU_R4000PC: | ||
| 59 | case CPU_R4000SC: | ||
| 60 | case CPU_R4000MC: | ||
| 61 | break; | ||
| 62 | |||
| 63 | default: | ||
| 64 | if (cpu_has_counter) | ||
| 65 | return read_c0_count(); | ||
| 66 | break; | ||
| 67 | } | ||
| 68 | |||
| 69 | return 0; /* no usable counter */ | ||
| 39 | } | 70 | } |
| 40 | 71 | ||
| 41 | #endif /* __KERNEL__ */ | 72 | #endif /* __KERNEL__ */ |
