diff options
author | Mark Brown <broonie@linaro.org> | 2013-10-03 17:29:05 +0100 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-10-03 17:29:05 +0100 |
commit | 8e9c4aa4e7bd600d30e15ec82be9b670a1ec3da9 (patch) | |
tree | 3b19eb54c684e36feab568078018dea31c43a79f /arch/mips/include/asm/timex.h | |
parent | d60336e2f136287de821901d4a1b56179a0f7b69 (diff) | |
parent | 1d73ad298d1bfeee5d77c19e5cd667c551e30632 (diff) | |
download | linux-8e9c4aa4e7bd600d30e15ec82be9b670a1ec3da9.tar.bz2 |
Merge remote-tracking branch 'asoc/fix/fsl' into asoc-fsl
Conflicts:
sound/soc/fsl/fsl_ssi.c
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 @@ #ifdef __KERNEL__ +#include <asm/cpu-features.h> #include <asm/mipsregs.h> +#include <asm/cpu-type.h> /* * This is the clock rate of the i8253 PIT. A MIPS system may not have @@ -33,9 +35,38 @@ typedef unsigned int cycles_t; +/* + * On R4000/R4400 before version 5.0 an erratum exists such that if the + * cycle counter is read in the exact moment that it is matching the + * compare register, no interrupt will be generated. + * + * There is a suggested workaround and also the erratum can't strike if + * the compare interrupt isn't being used as the clock source device. + * However for now the implementaton of this function doesn't get these + * fine details right. + */ static inline cycles_t get_cycles(void) { - return 0; + switch (boot_cpu_type()) { + case CPU_R4400PC: + case CPU_R4400SC: + case CPU_R4400MC: + if ((read_c0_prid() & 0xff) >= 0x0050) + return read_c0_count(); + break; + + case CPU_R4000PC: + case CPU_R4000SC: + case CPU_R4000MC: + break; + + default: + if (cpu_has_counter) + return read_c0_count(); + break; + } + + return 0; /* no usable counter */ } #endif /* __KERNEL__ */ |