ramips: fix patches after 3.14.32 bump
[openwrt.git] / target / linux / ramips / patches-3.14 / 0025-MIPS-ralink-allow-loading-irq-registers-from-the-dev.patch
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
5  devicetree
6
7 Signed-off-by: John Crispin <blogic@openwrt.org>
8 ---
9  arch/mips/ralink/irq.c |   33 +++++++++++++++++++++++----------
10  1 file changed, 23 insertions(+), 10 deletions(-)
11
12 --- a/arch/mips/ralink/irq.c
13 +++ b/arch/mips/ralink/irq.c
14 @@ -20,14 +20,6 @@
15  
16  #include "common.h"
17  
18 -/* INTC register offsets */
19 -#define INTC_REG_STATUS0       0x00
20 -#define INTC_REG_STATUS1       0x04
21 -#define INTC_REG_TYPE          0x20
22 -#define INTC_REG_RAW_STATUS    0x30
23 -#define INTC_REG_ENABLE                0x34
24 -#define INTC_REG_DISABLE       0x38
25 -
26  #define INTC_INT_GLOBAL                BIT(31)
27  
28  #define RALINK_CPU_IRQ_INTC    (MIPS_CPU_IRQ_BASE + 2)
29 @@ -44,16 +36,34 @@
30  
31  #define RALINK_INTC_IRQ_PERFC   (RALINK_INTC_IRQ_BASE + 9)
32  
33 +enum rt_intc_regs_enum {
34 +       INTC_REG_STATUS0 = 0,
35 +       INTC_REG_STATUS1,
36 +       INTC_REG_TYPE,
37 +       INTC_REG_RAW_STATUS,
38 +       INTC_REG_ENABLE,
39 +       INTC_REG_DISABLE,
40 +};
41 +
42 +static u32 rt_intc_regs[] = {
43 +       [INTC_REG_STATUS0] = 0x00,
44 +       [INTC_REG_STATUS1] = 0x04,
45 +       [INTC_REG_TYPE] = 0x20,
46 +       [INTC_REG_RAW_STATUS] = 0x30,
47 +       [INTC_REG_ENABLE] = 0x34,
48 +       [INTC_REG_DISABLE] = 0x38,
49 +};
50 +
51  static void __iomem *rt_intc_membase;
52  
53  static inline void rt_intc_w32(u32 val, unsigned reg)
54  {
55 -       __raw_writel(val, rt_intc_membase + reg);
56 +       __raw_writel(val, rt_intc_membase + rt_intc_regs[reg]);
57  }
58  
59  static inline u32 rt_intc_r32(unsigned reg)
60  {
61 -       return __raw_readl(rt_intc_membase + reg);
62 +       return __raw_readl(rt_intc_membase + rt_intc_regs[reg]);
63  }
64  
65  static void ralink_intc_irq_unmask(struct irq_data *d)
66 @@ -134,6 +144,9 @@ static int __init intc_of_init(struct de
67         struct irq_domain *domain;
68         int irq;
69  
70 +       if (!of_property_read_u32_array(node, "ralink,intc-registers", rt_intc_regs, 6))
71 +               pr_info("intc: using register map from devicetree\n");
72 +
73         irq = irq_of_parse_and_map(node, 0);
74         if (!irq)
75                 panic("Failed to get INTC IRQ");