diff options
author | Andrew Bresticker <abrestic@chromium.org> | 2014-10-20 15:03:49 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-11-24 01:44:57 -0500 |
commit | 387904ff84caeeff5aa5aad43aef4d0e5ce4bb24 (patch) | |
tree | 781cc604660fd8f0ac99e8e5fda26aee13691385 /drivers/irqchip | |
parent | 7d9ad5d8c3639113765a3a0ad78c18a736d9f494 (diff) |
irqchip: mips-gic: Export function to read counter width
Export the function gic_get_count_width to read the width of
the GIC global counter from GIC_SH_CONFIG. Update the GIC
clocksource driver to use this new function.
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: Qais Yousef <qais.yousef@imgtec.com>
Cc: John Crispin <blogic@openwrt.org>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/8124/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'drivers/irqchip')
-rw-r--r-- | drivers/irqchip/irq-mips-gic.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c index e49a39a8c853..b5fad6377736 100644 --- a/drivers/irqchip/irq-mips-gic.c +++ b/drivers/irqchip/irq-mips-gic.c | |||
@@ -63,6 +63,17 @@ cycle_t gic_read_count(void) | |||
63 | return (((cycle_t) hi) << 32) + lo; | 63 | return (((cycle_t) hi) << 32) + lo; |
64 | } | 64 | } |
65 | 65 | ||
66 | unsigned int gic_get_count_width(void) | ||
67 | { | ||
68 | unsigned int bits, config; | ||
69 | |||
70 | GICREAD(GIC_REG(SHARED, GIC_SH_CONFIG), config); | ||
71 | bits = 32 + 4 * ((config & GIC_SH_CONFIG_COUNTBITS_MSK) >> | ||
72 | GIC_SH_CONFIG_COUNTBITS_SHF); | ||
73 | |||
74 | return bits; | ||
75 | } | ||
76 | |||
66 | void gic_write_compare(cycle_t cnt) | 77 | void gic_write_compare(cycle_t cnt) |
67 | { | 78 | { |
68 | GICWRITE(GIC_REG(VPE_LOCAL, GIC_VPE_COMPARE_HI), | 79 | GICWRITE(GIC_REG(VPE_LOCAL, GIC_VPE_COMPARE_HI), |