aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-ns9xxx/irq.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-ns9xxx/irq.c')
-rw-r--r--arch/arm/mach-ns9xxx/irq.c50
1 files changed, 11 insertions, 39 deletions
diff --git a/arch/arm/mach-ns9xxx/irq.c b/arch/arm/mach-ns9xxx/irq.c
index b8c7b00522e6..00001b874e97 100644
--- a/arch/arm/mach-ns9xxx/irq.c
+++ b/arch/arm/mach-ns9xxx/irq.c
@@ -9,6 +9,7 @@
9 * the Free Software Foundation. 9 * the Free Software Foundation.
10 */ 10 */
11#include <linux/interrupt.h> 11#include <linux/interrupt.h>
12#include <asm/io.h>
12#include <asm/mach/irq.h> 13#include <asm/mach/irq.h>
13#include <asm/mach-types.h> 14#include <asm/mach-types.h>
14#include <asm/arch-ns9xxx/regs-sys.h> 15#include <asm/arch-ns9xxx/regs-sys.h>
@@ -17,48 +18,17 @@
17 18
18#include "generic.h" 19#include "generic.h"
19 20
20static void ns9xxx_ack_irq_timer(unsigned int irq)
21{
22 u32 tc = SYS_TC(irq - IRQ_TIMER0);
23
24 /*
25 * If the timer is programmed to halt on terminal count, the
26 * timer must be disabled before clearing the interrupt.
27 */
28 if (REGGET(tc, SYS_TCx, REN) == 0) {
29 REGSET(tc, SYS_TCx, TEN, DIS);
30 SYS_TC(irq - IRQ_TIMER0) = tc;
31 }
32
33 REGSET(tc, SYS_TCx, INTC, SET);
34 SYS_TC(irq - IRQ_TIMER0) = tc;
35
36 REGSET(tc, SYS_TCx, INTC, UNSET);
37 SYS_TC(irq - IRQ_TIMER0) = tc;
38}
39
40static void (*ns9xxx_ack_irq_functions[NR_IRQS])(unsigned int) = {
41 [IRQ_TIMER0] = ns9xxx_ack_irq_timer,
42 [IRQ_TIMER1] = ns9xxx_ack_irq_timer,
43 [IRQ_TIMER2] = ns9xxx_ack_irq_timer,
44 [IRQ_TIMER3] = ns9xxx_ack_irq_timer,
45};
46
47static void ns9xxx_mask_irq(unsigned int irq) 21static void ns9xxx_mask_irq(unsigned int irq)
48{ 22{
49 /* XXX: better use cpp symbols */ 23 /* XXX: better use cpp symbols */
50 SYS_IC(irq / 4) &= ~(1 << (7 + 8 * (3 - (irq & 3)))); 24 u32 ic = __raw_readl(SYS_IC(irq / 4));
25 ic &= ~(1 << (7 + 8 * (3 - (irq & 3))));
26 __raw_writel(ic, SYS_IC(irq / 4));
51} 27}
52 28
53static void ns9xxx_ack_irq(unsigned int irq) 29static void ns9xxx_ack_irq(unsigned int irq)
54{ 30{
55 if (!ns9xxx_ack_irq_functions[irq]) { 31 __raw_writel(0, SYS_ISRADDR);
56 printk(KERN_ERR "no ack function for irq %u\n", irq);
57 BUG();
58 }
59
60 ns9xxx_ack_irq_functions[irq](irq);
61 SYS_ISRADDR = 0;
62} 32}
63 33
64static void ns9xxx_maskack_irq(unsigned int irq) 34static void ns9xxx_maskack_irq(unsigned int irq)
@@ -70,7 +40,9 @@ static void ns9xxx_maskack_irq(unsigned int irq)
70static void ns9xxx_unmask_irq(unsigned int irq) 40static void ns9xxx_unmask_irq(unsigned int irq)
71{ 41{
72 /* XXX: better use cpp symbols */ 42 /* XXX: better use cpp symbols */
73 SYS_IC(irq / 4) |= 1 << (7 + 8 * (3 - (irq & 3))); 43 u32 ic = __raw_readl(SYS_IC(irq / 4));
44 ic |= 1 << (7 + 8 * (3 - (irq & 3)));
45 __raw_writel(ic, SYS_IC(irq / 4));
74} 46}
75 47
76static struct irq_chip ns9xxx_chip = { 48static struct irq_chip ns9xxx_chip = {
@@ -86,14 +58,14 @@ void __init ns9xxx_init_irq(void)
86 58
87 /* disable all IRQs */ 59 /* disable all IRQs */
88 for (i = 0; i < 8; ++i) 60 for (i = 0; i < 8; ++i)
89 SYS_IC(i) = (4 * i) << 24 | (4 * i + 1) << 16 | 61 __raw_writel((4 * i) << 24 | (4 * i + 1) << 16 |
90 (4 * i + 2) << 8 | (4 * i + 3); 62 (4 * i + 2) << 8 | (4 * i + 3), SYS_IC(i));
91 63
92 /* simple interrupt prio table: 64 /* simple interrupt prio table:
93 * prio(x) < prio(y) <=> x < y 65 * prio(x) < prio(y) <=> x < y
94 */ 66 */
95 for (i = 0; i < 32; ++i) 67 for (i = 0; i < 32; ++i)
96 SYS_IVA(i) = i; 68 __raw_writel(i, SYS_IVA(i));
97 69
98 for (i = IRQ_WATCHDOG; i <= IRQ_EXT3; ++i) { 70 for (i = IRQ_WATCHDOG; i <= IRQ_EXT3; ++i) {
99 set_irq_chip(i, &ns9xxx_chip); 71 set_irq_chip(i, &ns9xxx_chip);