]> git.karo-electronics.de Git - linux-beck.git/commitdiff
irqchip: mips-gic: Export function to read counter width
authorAndrew Bresticker <abrestic@chromium.org>
Mon, 20 Oct 2014 19:03:49 +0000 (12:03 -0700)
committerRalf Baechle <ralf@linux-mips.org>
Mon, 24 Nov 2014 06:44:57 +0000 (07:44 +0100)
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>
arch/mips/include/asm/gic.h
arch/mips/kernel/csrc-gic.c
drivers/irqchip/irq-mips-gic.c

index 727b7bf903a8a1e8b48de6da64e606294df1d5aa..c88e1fa22365a852c965dd9e3b3fbe2c25c6eb46 100644 (file)
@@ -370,6 +370,7 @@ extern void gic_init(unsigned long gic_base_addr,
        unsigned int irqbase);
 extern void gic_clocksource_init(unsigned int);
 extern cycle_t gic_read_count(void);
+extern unsigned int gic_get_count_width(void);
 extern cycle_t gic_read_compare(void);
 extern void gic_write_compare(cycle_t cnt);
 extern void gic_write_cpu_compare(cycle_t cnt, int cpu);
index e026209011178342a6c98bbd709366fb8f3d06d8..ab615c6c51a503d87c73d6972526c5ae20681d2d 100644 (file)
@@ -23,15 +23,8 @@ static struct clocksource gic_clocksource = {
 
 void __init gic_clocksource_init(unsigned int frequency)
 {
-       unsigned int config, bits;
-
-       /* Calculate the clocksource mask. */
-       GICREAD(GIC_REG(SHARED, GIC_SH_CONFIG), config);
-       bits = 32 + ((config & GIC_SH_CONFIG_COUNTBITS_MSK) >>
-               (GIC_SH_CONFIG_COUNTBITS_SHF - 2));
-
        /* Set clocksource mask. */
-       gic_clocksource.mask = CLOCKSOURCE_MASK(bits);
+       gic_clocksource.mask = CLOCKSOURCE_MASK(gic_get_count_width());
 
        /* Calculate a somewhat reasonable rating value. */
        gic_clocksource.rating = 200 + frequency / 10000000;
index e49a39a8c8531b2af5d3397c87285653b32a0a5f..b5fad6377736d280a76c923f38e53efedd32011e 100644 (file)
@@ -63,6 +63,17 @@ cycle_t gic_read_count(void)
        return (((cycle_t) hi) << 32) + lo;
 }
 
+unsigned int gic_get_count_width(void)
+{
+       unsigned int bits, config;
+
+       GICREAD(GIC_REG(SHARED, GIC_SH_CONFIG), config);
+       bits = 32 + 4 * ((config & GIC_SH_CONFIG_COUNTBITS_MSK) >>
+                        GIC_SH_CONFIG_COUNTBITS_SHF);
+
+       return bits;
+}
+
 void gic_write_compare(cycle_t cnt)
 {
        GICWRITE(GIC_REG(VPE_LOCAL, GIC_VPE_COMPARE_HI),