aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/irqchip/irq-sirfsoc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/irqchip/irq-sirfsoc.c')
-rw-r--r--drivers/irqchip/irq-sirfsoc.c50
1 files changed, 26 insertions, 24 deletions
diff --git a/drivers/irqchip/irq-sirfsoc.c b/drivers/irqchip/irq-sirfsoc.c
index a469355df352..10cb21b9ba3d 100644
--- a/drivers/irqchip/irq-sirfsoc.c
+++ b/drivers/irqchip/irq-sirfsoc.c
@@ -11,40 +11,44 @@
11#include <linux/irq.h> 11#include <linux/irq.h>
12#include <linux/of.h> 12#include <linux/of.h>
13#include <linux/of_address.h> 13#include <linux/of_address.h>
14#include <linux/irqchip.h>
14#include <linux/irqdomain.h> 15#include <linux/irqdomain.h>
15#include <linux/syscore_ops.h> 16#include <linux/syscore_ops.h>
16#include <asm/mach/irq.h> 17#include <asm/mach/irq.h>
17#include <asm/exception.h> 18#include <asm/exception.h>
18#include "irqchip.h"
19 19
20#define SIRFSOC_INT_RISC_MASK0 0x0018 20#define SIRFSOC_INT_RISC_MASK0 0x0018
21#define SIRFSOC_INT_RISC_MASK1 0x001C 21#define SIRFSOC_INT_RISC_MASK1 0x001C
22#define SIRFSOC_INT_RISC_LEVEL0 0x0020 22#define SIRFSOC_INT_RISC_LEVEL0 0x0020
23#define SIRFSOC_INT_RISC_LEVEL1 0x0024 23#define SIRFSOC_INT_RISC_LEVEL1 0x0024
24#define SIRFSOC_INIT_IRQ_ID 0x0038 24#define SIRFSOC_INIT_IRQ_ID 0x0038
25#define SIRFSOC_INT_BASE_OFFSET 0x0004
25 26
26#define SIRFSOC_NUM_IRQS 64 27#define SIRFSOC_NUM_IRQS 64
28#define SIRFSOC_NUM_BANKS (SIRFSOC_NUM_IRQS / 32)
27 29
28static struct irq_domain *sirfsoc_irqdomain; 30static struct irq_domain *sirfsoc_irqdomain;
29 31
30static __init void 32static __init void sirfsoc_alloc_gc(void __iomem *base)
31sirfsoc_alloc_gc(void __iomem *base, unsigned int irq_start, unsigned int num)
32{ 33{
33 struct irq_chip_generic *gc;
34 struct irq_chip_type *ct;
35 int ret;
36 unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN; 34 unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN;
37 unsigned int set = IRQ_LEVEL; 35 unsigned int set = IRQ_LEVEL;
38 36 struct irq_chip_generic *gc;
39 ret = irq_alloc_domain_generic_chips(sirfsoc_irqdomain, num, 1, "irq_sirfsoc", 37 struct irq_chip_type *ct;
40 handle_level_irq, clr, set, IRQ_GC_INIT_MASK_CACHE); 38 int i;
41 39
42 gc = irq_get_domain_generic_chip(sirfsoc_irqdomain, irq_start); 40 irq_alloc_domain_generic_chips(sirfsoc_irqdomain, 32, 1, "irq_sirfsoc",
43 gc->reg_base = base; 41 handle_level_irq, clr, set,
44 ct = gc->chip_types; 42 IRQ_GC_INIT_MASK_CACHE);
45 ct->chip.irq_mask = irq_gc_mask_clr_bit; 43
46 ct->chip.irq_unmask = irq_gc_mask_set_bit; 44 for (i = 0; i < SIRFSOC_NUM_BANKS; i++) {
47 ct->regs.mask = SIRFSOC_INT_RISC_MASK0; 45 gc = irq_get_domain_generic_chip(sirfsoc_irqdomain, i * 32);
46 gc->reg_base = base + i * SIRFSOC_INT_BASE_OFFSET;
47 ct = gc->chip_types;
48 ct->chip.irq_mask = irq_gc_mask_clr_bit;
49 ct->chip.irq_unmask = irq_gc_mask_set_bit;
50 ct->regs.mask = SIRFSOC_INT_RISC_MASK0;
51 }
48} 52}
49 53
50static void __exception_irq_entry sirfsoc_handle_irq(struct pt_regs *regs) 54static void __exception_irq_entry sirfsoc_handle_irq(struct pt_regs *regs)
@@ -64,10 +68,8 @@ static int __init sirfsoc_irq_init(struct device_node *np,
64 panic("unable to map intc cpu registers\n"); 68 panic("unable to map intc cpu registers\n");
65 69
66 sirfsoc_irqdomain = irq_domain_add_linear(np, SIRFSOC_NUM_IRQS, 70 sirfsoc_irqdomain = irq_domain_add_linear(np, SIRFSOC_NUM_IRQS,
67 &irq_generic_chip_ops, base); 71 &irq_generic_chip_ops, base);
68 72 sirfsoc_alloc_gc(base);
69 sirfsoc_alloc_gc(base, 0, 32);
70 sirfsoc_alloc_gc(base + 4, 32, SIRFSOC_NUM_IRQS - 32);
71 73
72 writel_relaxed(0, base + SIRFSOC_INT_RISC_LEVEL0); 74 writel_relaxed(0, base + SIRFSOC_INT_RISC_LEVEL0);
73 writel_relaxed(0, base + SIRFSOC_INT_RISC_LEVEL1); 75 writel_relaxed(0, base + SIRFSOC_INT_RISC_LEVEL1);