diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2011-04-15 05:19:57 -0400 |
---|---|---|
committer | Sekhar Nori <nsekhar@ti.com> | 2011-05-11 13:10:06 -0400 |
commit | aac4dd1dab8acfc244d697473d2a5f4424a5746c (patch) | |
tree | 3c90bb2ab04a9974583a72a2cd76ffb880597aa5 | |
parent | cfefd21e693dca791bf9ecfc9dd3794facad533c (diff) |
arm: davinci: Use generic irq chip
Simple conversion which simply uses the fact that the second irq chip
base address has offset 0x04 to the first one.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-and-Tested-by: Kevin Hilman <khilman@ti.com>
Tested-by: Sekhar Nori <nsekhar@ti.com>
-rw-r--r-- | arch/arm/mach-davinci/irq.c | 93 |
1 files changed, 20 insertions, 73 deletions
diff --git a/arch/arm/mach-davinci/irq.c b/arch/arm/mach-davinci/irq.c index e6269a6e0014..bfe68ec4e1a6 100644 --- a/arch/arm/mach-davinci/irq.c +++ b/arch/arm/mach-davinci/irq.c | |||
@@ -29,8 +29,6 @@ | |||
29 | #include <mach/common.h> | 29 | #include <mach/common.h> |
30 | #include <asm/mach/irq.h> | 30 | #include <asm/mach/irq.h> |
31 | 31 | ||
32 | #define IRQ_BIT(irq) ((irq) & 0x1f) | ||
33 | |||
34 | #define FIQ_REG0_OFFSET 0x0000 | 32 | #define FIQ_REG0_OFFSET 0x0000 |
35 | #define FIQ_REG1_OFFSET 0x0004 | 33 | #define FIQ_REG1_OFFSET 0x0004 |
36 | #define IRQ_REG0_OFFSET 0x0008 | 34 | #define IRQ_REG0_OFFSET 0x0008 |
@@ -42,78 +40,33 @@ | |||
42 | #define IRQ_INTPRI0_REG_OFFSET 0x0030 | 40 | #define IRQ_INTPRI0_REG_OFFSET 0x0030 |
43 | #define IRQ_INTPRI7_REG_OFFSET 0x004C | 41 | #define IRQ_INTPRI7_REG_OFFSET 0x004C |
44 | 42 | ||
45 | static inline unsigned int davinci_irq_readl(int offset) | ||
46 | { | ||
47 | return __raw_readl(davinci_intc_base + offset); | ||
48 | } | ||
49 | |||
50 | static inline void davinci_irq_writel(unsigned long value, int offset) | 43 | static inline void davinci_irq_writel(unsigned long value, int offset) |
51 | { | 44 | { |
52 | __raw_writel(value, davinci_intc_base + offset); | 45 | __raw_writel(value, davinci_intc_base + offset); |
53 | } | 46 | } |
54 | 47 | ||
55 | /* Disable interrupt */ | 48 | static __init void |
56 | static void davinci_mask_irq(struct irq_data *d) | 49 | davinci_alloc_gc(void __iomem *base, unsigned int irq_start, unsigned int num) |
57 | { | 50 | { |
58 | unsigned int mask; | 51 | struct irq_chip_generic *gc; |
59 | u32 l; | 52 | struct irq_chip_type *ct; |
60 | 53 | ||
61 | mask = 1 << IRQ_BIT(d->irq); | 54 | gc = irq_alloc_generic_chip("AINTC", 1, irq_start, base, handle_edge_irq); |
62 | 55 | ct = gc->chip_types; | |
63 | if (d->irq > 31) { | 56 | ct->chip.irq_ack = irq_gc_ack; |
64 | l = davinci_irq_readl(IRQ_ENT_REG1_OFFSET); | 57 | ct->chip.irq_mask = irq_gc_mask_clr_bit; |
65 | l &= ~mask; | 58 | ct->chip.irq_unmask = irq_gc_mask_set_bit; |
66 | davinci_irq_writel(l, IRQ_ENT_REG1_OFFSET); | 59 | |
67 | } else { | 60 | ct->regs.ack = IRQ_REG0_OFFSET; |
68 | l = davinci_irq_readl(IRQ_ENT_REG0_OFFSET); | 61 | ct->regs.mask = IRQ_ENT_REG0_OFFSET; |
69 | l &= ~mask; | 62 | irq_setup_generic_chip(gc, IRQ_MSK(num), IRQ_GC_INIT_MASK_CACHE, |
70 | davinci_irq_writel(l, IRQ_ENT_REG0_OFFSET); | 63 | IRQ_NOREQUEST | IRQ_NOPROBE, 0); |
71 | } | ||
72 | } | ||
73 | |||
74 | /* Enable interrupt */ | ||
75 | static void davinci_unmask_irq(struct irq_data *d) | ||
76 | { | ||
77 | unsigned int mask; | ||
78 | u32 l; | ||
79 | |||
80 | mask = 1 << IRQ_BIT(d->irq); | ||
81 | |||
82 | if (d->irq > 31) { | ||
83 | l = davinci_irq_readl(IRQ_ENT_REG1_OFFSET); | ||
84 | l |= mask; | ||
85 | davinci_irq_writel(l, IRQ_ENT_REG1_OFFSET); | ||
86 | } else { | ||
87 | l = davinci_irq_readl(IRQ_ENT_REG0_OFFSET); | ||
88 | l |= mask; | ||
89 | davinci_irq_writel(l, IRQ_ENT_REG0_OFFSET); | ||
90 | } | ||
91 | } | 64 | } |
92 | 65 | ||
93 | /* EOI interrupt */ | ||
94 | static void davinci_ack_irq(struct irq_data *d) | ||
95 | { | ||
96 | unsigned int mask; | ||
97 | |||
98 | mask = 1 << IRQ_BIT(d->irq); | ||
99 | |||
100 | if (d->irq > 31) | ||
101 | davinci_irq_writel(mask, IRQ_REG1_OFFSET); | ||
102 | else | ||
103 | davinci_irq_writel(mask, IRQ_REG0_OFFSET); | ||
104 | } | ||
105 | |||
106 | static struct irq_chip davinci_irq_chip_0 = { | ||
107 | .name = "AINTC", | ||
108 | .irq_ack = davinci_ack_irq, | ||
109 | .irq_mask = davinci_mask_irq, | ||
110 | .irq_unmask = davinci_unmask_irq, | ||
111 | }; | ||
112 | |||
113 | /* ARM Interrupt Controller Initialization */ | 66 | /* ARM Interrupt Controller Initialization */ |
114 | void __init davinci_irq_init(void) | 67 | void __init davinci_irq_init(void) |
115 | { | 68 | { |
116 | unsigned i; | 69 | unsigned i, j; |
117 | const u8 *davinci_def_priorities = davinci_soc_info.intc_irq_prios; | 70 | const u8 *davinci_def_priorities = davinci_soc_info.intc_irq_prios; |
118 | 71 | ||
119 | davinci_intc_type = DAVINCI_INTC_TYPE_AINTC; | 72 | davinci_intc_type = DAVINCI_INTC_TYPE_AINTC; |
@@ -144,7 +97,6 @@ void __init davinci_irq_init(void) | |||
144 | davinci_irq_writel(~0x0, IRQ_REG1_OFFSET); | 97 | davinci_irq_writel(~0x0, IRQ_REG1_OFFSET); |
145 | 98 | ||
146 | for (i = IRQ_INTPRI0_REG_OFFSET; i <= IRQ_INTPRI7_REG_OFFSET; i += 4) { | 99 | for (i = IRQ_INTPRI0_REG_OFFSET; i <= IRQ_INTPRI7_REG_OFFSET; i += 4) { |
147 | unsigned j; | ||
148 | u32 pri; | 100 | u32 pri; |
149 | 101 | ||
150 | for (j = 0, pri = 0; j < 32; j += 4, davinci_def_priorities++) | 102 | for (j = 0, pri = 0; j < 32; j += 4, davinci_def_priorities++) |
@@ -152,13 +104,8 @@ void __init davinci_irq_init(void) | |||
152 | davinci_irq_writel(pri, i); | 104 | davinci_irq_writel(pri, i); |
153 | } | 105 | } |
154 | 106 | ||
155 | /* set up genirq dispatch for ARM INTC */ | 107 | for (i = 0, j = 0; i < davinci_soc_info.intc_irq_num; i += 32, j += 0x04) |
156 | for (i = 0; i < davinci_soc_info.intc_irq_num; i++) { | 108 | davinci_alloc_gc(davinci_intc_base + j, i, 32); |
157 | irq_set_chip(i, &davinci_irq_chip_0); | 109 | |
158 | set_irq_flags(i, IRQF_VALID | IRQF_PROBE); | 110 | irq_set_handler(IRQ_TINT1_TINT34, handle_level_irq); |
159 | if (i != IRQ_TINT1_TINT34) | ||
160 | irq_set_handler(i, handle_edge_irq); | ||
161 | else | ||
162 | irq_set_handler(i, handle_level_irq); | ||
163 | } | ||
164 | } | 111 | } |