1 From b1cc9a15f6ead8dbd849257e42d69a5799fb7597 Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Wed, 6 Aug 2014 18:24:36 +0200
4 Subject: [PATCH 25/57] MIPS: ralink: allow loading irq registers from the
7 Signed-off-by: John Crispin <blogic@openwrt.org>
9 arch/mips/ralink/irq.c | 33 +++++++++++++++++++++++----------
10 1 file changed, 23 insertions(+), 10 deletions(-)
12 diff --git a/arch/mips/ralink/irq.c b/arch/mips/ralink/irq.c
13 index 781b3d1..82c3146 100644
14 --- a/arch/mips/ralink/irq.c
15 +++ b/arch/mips/ralink/irq.c
20 -/* INTC register offsets */
21 -#define INTC_REG_STATUS0 0x00
22 -#define INTC_REG_STATUS1 0x04
23 -#define INTC_REG_TYPE 0x20
24 -#define INTC_REG_RAW_STATUS 0x30
25 -#define INTC_REG_ENABLE 0x34
26 -#define INTC_REG_DISABLE 0x38
28 #define INTC_INT_GLOBAL BIT(31)
30 #define RALINK_CPU_IRQ_INTC (MIPS_CPU_IRQ_BASE + 2)
33 #define RALINK_INTC_IRQ_PERFC (RALINK_INTC_IRQ_BASE + 9)
35 +enum rt_intc_regs_enum {
36 + INTC_REG_STATUS0 = 0,
39 + INTC_REG_RAW_STATUS,
44 +static u32 rt_intc_regs[] = {
45 + [INTC_REG_STATUS0] = 0x00,
46 + [INTC_REG_STATUS1] = 0x04,
47 + [INTC_REG_TYPE] = 0x20,
48 + [INTC_REG_RAW_STATUS] = 0x30,
49 + [INTC_REG_ENABLE] = 0x34,
50 + [INTC_REG_DISABLE] = 0x38,
53 static void __iomem *rt_intc_membase;
55 static inline void rt_intc_w32(u32 val, unsigned reg)
57 - __raw_writel(val, rt_intc_membase + reg);
58 + __raw_writel(val, rt_intc_membase + rt_intc_regs[reg]);
61 static inline u32 rt_intc_r32(unsigned reg)
63 - return __raw_readl(rt_intc_membase + reg);
64 + return __raw_readl(rt_intc_membase + rt_intc_regs[reg]);
67 static void ralink_intc_irq_unmask(struct irq_data *d)
68 @@ -134,6 +144,9 @@ static int __init intc_of_init(struct device_node *node,
69 struct irq_domain *domain;
72 + if (!of_property_read_u32_array(node, "ralink,intc-registers", rt_intc_regs, 6))
73 + pr_info("intc: using register map from devicetree\n");
75 irq = irq_of_parse_and_map(node, 0);
77 panic("Failed to get INTC IRQ");