2 * arch/arm/mach-ns9xxx/irq.c
4 * Copyright (C) 2006,2007 by Digi International Inc.
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
11 #include <linux/interrupt.h>
13 #include <asm/mach/irq.h>
14 #include <asm/mach-types.h>
15 #include <asm/arch-ns9xxx/regs-sys.h>
16 #include <asm/arch-ns9xxx/irqs.h>
17 #include <asm/arch-ns9xxx/board.h>
21 static void ns9xxx_mask_irq(unsigned int irq
)
23 /* XXX: better use cpp symbols */
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));
29 static void ns9xxx_ack_irq(unsigned int irq
)
31 __raw_writel(0, SYS_ISRADDR
);
34 static void ns9xxx_maskack_irq(unsigned int irq
)
40 static void ns9xxx_unmask_irq(unsigned int irq
)
42 /* XXX: better use cpp symbols */
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));
48 static struct irq_chip ns9xxx_chip
= {
49 .ack
= ns9xxx_ack_irq
,
50 .mask
= ns9xxx_mask_irq
,
51 .mask_ack
= ns9xxx_maskack_irq
,
52 .unmask
= ns9xxx_unmask_irq
,
55 void __init
ns9xxx_init_irq(void)
59 /* disable all IRQs */
60 for (i
= 0; i
< 8; ++i
)
61 __raw_writel((4 * i
) << 24 | (4 * i
+ 1) << 16 |
62 (4 * i
+ 2) << 8 | (4 * i
+ 3), SYS_IC(i
));
64 /* simple interrupt prio table:
65 * prio(x) < prio(y) <=> x < y
67 for (i
= 0; i
< 32; ++i
)
68 __raw_writel(i
, SYS_IVA(i
));
70 for (i
= IRQ_WATCHDOG
; i
<= IRQ_EXT3
; ++i
) {
71 set_irq_chip(i
, &ns9xxx_chip
);
72 set_irq_handler(i
, handle_level_irq
);
73 set_irq_flags(i
, IRQF_VALID
);