diff options
author | Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> | 2007-02-16 09:36:55 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2007-02-17 15:05:45 -0500 |
commit | 9918cda52368ec3df5bb6bc1630ba8c070ad9fdd (patch) | |
tree | 4b0a6b5df2c8d5f27b3c945eaec0966d8bcf67d8 /arch/arm/mach-ns9xxx/irq.c | |
parent | ae0a846e411dc0b568e8ccda584896310ee5f369 (diff) |
[ARM] 4210/1: base for new machine type "NetSilicon NS9360"
Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-ns9xxx/irq.c')
-rw-r--r-- | arch/arm/mach-ns9xxx/irq.c | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/arch/arm/mach-ns9xxx/irq.c b/arch/arm/mach-ns9xxx/irq.c new file mode 100644 index 000000000000..83d92724a971 --- /dev/null +++ b/arch/arm/mach-ns9xxx/irq.c | |||
@@ -0,0 +1,94 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-ns9xxx/irq.c | ||
3 | * | ||
4 | * Copyright (C) 2006,2007 by Digi International Inc. | ||
5 | * All rights reserved. | ||
6 | * | ||
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. | ||
10 | */ | ||
11 | #include <linux/interrupt.h> | ||
12 | #include <asm/mach/irq.h> | ||
13 | #include <asm/mach-types.h> | ||
14 | #include <asm/arch-ns9xxx/regs-sys.h> | ||
15 | #include <asm/arch-ns9xxx/irqs.h> | ||
16 | #include <asm/arch-ns9xxx/board.h> | ||
17 | |||
18 | #include "generic.h" | ||
19 | |||
20 | static void ns9xxx_ack_irq_timer(unsigned int irq) | ||
21 | { | ||
22 | u32 tc = SYS_TC(irq - IRQ_TIMER0); | ||
23 | |||
24 | REGSET(tc, SYS_TCx, INTC, SET); | ||
25 | SYS_TC(irq - IRQ_TIMER0) = tc; | ||
26 | |||
27 | REGSET(tc, SYS_TCx, INTC, UNSET); | ||
28 | SYS_TC(irq - IRQ_TIMER0) = tc; | ||
29 | } | ||
30 | |||
31 | void (*ns9xxx_ack_irq_functions[NR_IRQS])(unsigned int) = { | ||
32 | [IRQ_TIMER0] = ns9xxx_ack_irq_timer, | ||
33 | [IRQ_TIMER1] = ns9xxx_ack_irq_timer, | ||
34 | [IRQ_TIMER2] = ns9xxx_ack_irq_timer, | ||
35 | [IRQ_TIMER3] = ns9xxx_ack_irq_timer, | ||
36 | }; | ||
37 | |||
38 | static void ns9xxx_mask_irq(unsigned int irq) | ||
39 | { | ||
40 | /* XXX: better use cpp symbols */ | ||
41 | SYS_IC(irq / 4) &= ~(1 << (7 + 8 * (3 - (irq & 3)))); | ||
42 | } | ||
43 | |||
44 | static void ns9xxx_ack_irq(unsigned int irq) | ||
45 | { | ||
46 | if (!ns9xxx_ack_irq_functions[irq]) { | ||
47 | printk(KERN_ERR "no ack function for irq %u\n", irq); | ||
48 | BUG(); | ||
49 | } | ||
50 | |||
51 | ns9xxx_ack_irq_functions[irq](irq); | ||
52 | SYS_ISRADDR = 0; | ||
53 | } | ||
54 | |||
55 | static void ns9xxx_maskack_irq(unsigned int irq) | ||
56 | { | ||
57 | ns9xxx_mask_irq(irq); | ||
58 | ns9xxx_ack_irq(irq); | ||
59 | } | ||
60 | |||
61 | static void ns9xxx_unmask_irq(unsigned int irq) | ||
62 | { | ||
63 | /* XXX: better use cpp symbols */ | ||
64 | SYS_IC(irq / 4) |= 1 << (7 + 8 * (3 - (irq & 3))); | ||
65 | } | ||
66 | |||
67 | static struct irq_chip ns9xxx_chip = { | ||
68 | .ack = ns9xxx_ack_irq, | ||
69 | .mask = ns9xxx_mask_irq, | ||
70 | .mask_ack = ns9xxx_maskack_irq, | ||
71 | .unmask = ns9xxx_unmask_irq, | ||
72 | }; | ||
73 | |||
74 | void __init ns9xxx_init_irq(void) | ||
75 | { | ||
76 | int i; | ||
77 | |||
78 | /* disable all IRQs */ | ||
79 | for (i = 0; i < 8; ++i) | ||
80 | SYS_IC(i) = (4 * i) << 24 | (4 * i + 1) << 16 | | ||
81 | (4 * i + 2) << 8 | (4 * i + 3); | ||
82 | |||
83 | /* simple interrupt prio table: | ||
84 | * prio(x) < prio(y) <=> x < y | ||
85 | */ | ||
86 | for (i = 0; i < 32; ++i) | ||
87 | SYS_IVA(i) = i; | ||
88 | |||
89 | for (i = IRQ_WATCHDOG; i <= IRQ_EXT3; ++i) { | ||
90 | set_irq_chip(i, &ns9xxx_chip); | ||
91 | set_irq_handler(i, handle_level_irq); | ||
92 | set_irq_flags(i, IRQF_VALID); | ||
93 | } | ||
94 | } | ||