summaryrefslogtreecommitdiffstats
path: root/drivers/irqchip
diff options
context:
space:
mode:
authorPaul Burton <paul.burton@imgtec.com>2017-08-12 21:36:10 -0700
committerRalf Baechle <ralf@linux-mips.org>2017-08-30 14:03:40 +0200
commit582e2b4aecdacc0a3bd39daa63648a88cad6a26f (patch)
tree95d7af378753efafd395147e5c76b51dfb0df120 /drivers/irqchip
parenta0ffec3d4aff071534d61d8e743562223a0cf8a4 (diff)
downloadlinux-582e2b4aecdacc0a3bd39daa63648a88cad6a26f.tar.gz
linux-582e2b4aecdacc0a3bd39daa63648a88cad6a26f.tar.bz2
linux-582e2b4aecdacc0a3bd39daa63648a88cad6a26f.zip
MIPS: GIC: Introduce asm/mips-gic.h with accessor functions
This patch introduces a new header providing accessor functions for the MIPS Global Interrupt Controller (GIC) mirroring those provided for the other 2 components of the MIPS Coherent Processing System (CPS) - the Coherence Manager (CM) & Cluster Power Controller (CPC). This header makes use of the new standardised CPS accessor macros where possible, but does require some custom accessors for cases where we have either a bit or a register per interrupt. A major advantage of this over the existing include/linux/irqchip/mips-gic.h definitions is that code performing accesses can become much simpler, for example this: gic_update_bits(GIC_REG(SHARED, GIC_SH_SET_TRIGGER) + GIC_INTR_OFS(intr), 1ul << GIC_INTR_BIT(intr), (unsigned long)trig << GIC_INTR_BIT(intr)); ...can become simply: change_gic_trig(intr, trig); The accessors handle 32 vs 64 bit in the same way as for CM & CPC code, which means that GIC code will also not need to worry about the access size in most cases. They are also accessible outside of drivers/irqchip/irq-mips-gic.c which will allow for simplification in the use of the non-interrupt portions of the GIC (eg. counters) which currently require the interrupt controller driver to expose helper functions for access. This patch doesn't change any existing code over to use the new accessors yet, since a wholesale change would be invasive & difficult to review. Instead follow-on patches will convert code piecemeal to use this new header. The one change to existing code is to rename gic_base to mips_gic_base & make it global, in order to fit in with the naming expected by the standardised CPS accessor macros. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Acked-by: Marc Zyngier <marc.zyngier@arm.com> Cc: Jason Cooper <jason@lakedaemon.net> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/17020/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'drivers/irqchip')
-rw-r--r--drivers/irqchip/irq-mips-gic.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c
index 4115b84976e6..9102a69a9ebf 100644
--- a/drivers/irqchip/irq-mips-gic.c
+++ b/drivers/irqchip/irq-mips-gic.c
@@ -24,14 +24,13 @@
#include <dt-bindings/interrupt-controller/mips-gic.h>
unsigned int gic_present;
+void __iomem *mips_gic_base;
struct gic_pcpu_mask {
DECLARE_BITMAP(pcpu_mask, GIC_MAX_INTRS);
};
static unsigned long __gic_base_addr;
-
-static void __iomem *gic_base;
static struct gic_pcpu_mask pcpu_masks[NR_CPUS];
static DEFINE_SPINLOCK(gic_lock);
static struct irq_domain *gic_irq_domain;
@@ -48,12 +47,12 @@ static void __gic_irq_dispatch(void);
static inline u32 gic_read32(unsigned int reg)
{
- return __raw_readl(gic_base + reg);
+ return __raw_readl(mips_gic_base + reg);
}
static inline u64 gic_read64(unsigned int reg)
{
- return __raw_readq(gic_base + reg);
+ return __raw_readq(mips_gic_base + reg);
}
static inline unsigned long gic_read(unsigned int reg)
@@ -66,12 +65,12 @@ static inline unsigned long gic_read(unsigned int reg)
static inline void gic_write32(unsigned int reg, u32 val)
{
- return __raw_writel(val, gic_base + reg);
+ return __raw_writel(val, mips_gic_base + reg);
}
static inline void gic_write64(unsigned int reg, u64 val)
{
- return __raw_writeq(val, gic_base + reg);
+ return __raw_writeq(val, mips_gic_base + reg);
}
static inline void gic_write(unsigned int reg, unsigned long val)
@@ -891,7 +890,7 @@ static void __init __gic_init(unsigned long gic_base_addr,
__gic_base_addr = gic_base_addr;
- gic_base = ioremap_nocache(gic_base_addr, gic_addrspace_size);
+ mips_gic_base = ioremap_nocache(gic_base_addr, gic_addrspace_size);
gicconfig = gic_read(GIC_REG(SHARED, GIC_SH_CONFIG));
gic_shared_intrs = (gicconfig & GIC_SH_CONFIG_NUMINTRS_MSK) >>