aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-ns9xxx
diff options
context:
space:
mode:
authorUwe Kleine-König <Uwe.Kleine-Koenig@digi.com>2007-12-11 10:52:50 -0500
committerUwe Kleine-König <Uwe.Kleine-Koenig@digi.com>2008-03-31 04:33:11 -0400
commited6f5987235c628e1041311d7c1efdf659e2dad7 (patch)
treef0580d8d1531608020874ddb30e06dd690ecefa9 /arch/arm/mach-ns9xxx
parent5e69b945f20aec17bf057acbb61b6682461e7149 (diff)
ns9xxx: add support for irq priorisation
prio2irq(0) is the highest prioritized interrupt. For now there is no binary change intended. If you intend to change the priorisation, you have to assert: ∀ x ∈ {0, 1, ⋯ 31}: (irq2prio ∘ prio2irq)(x) = x Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
Diffstat (limited to 'arch/arm/mach-ns9xxx')
-rw-r--r--arch/arm/mach-ns9xxx/irq.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/arch/arm/mach-ns9xxx/irq.c b/arch/arm/mach-ns9xxx/irq.c
index 7ddc8fde7748..36e5835e6097 100644
--- a/arch/arm/mach-ns9xxx/irq.c
+++ b/arch/arm/mach-ns9xxx/irq.c
@@ -19,12 +19,17 @@
19 19
20#include "generic.h" 20#include "generic.h"
21 21
22/* simple interrupt prio table: prio(x) < prio(y) <=> x < y */
23#define irq2prio(i) (i)
24#define prio2irq(p) (p)
25
22static void ns9xxx_mask_irq(unsigned int irq) 26static void ns9xxx_mask_irq(unsigned int irq)
23{ 27{
24 /* XXX: better use cpp symbols */ 28 /* XXX: better use cpp symbols */
25 u32 ic = __raw_readl(SYS_IC(irq / 4)); 29 int prio = irq2prio(irq);
26 ic &= ~(1 << (7 + 8 * (3 - (irq & 3)))); 30 u32 ic = __raw_readl(SYS_IC(prio / 4));
27 __raw_writel(ic, SYS_IC(irq / 4)); 31 ic &= ~(1 << (7 + 8 * (3 - (prio & 3))));
32 __raw_writel(ic, SYS_IC(prio / 4));
28} 33}
29 34
30static void ns9xxx_ack_irq(unsigned int irq) 35static void ns9xxx_ack_irq(unsigned int irq)
@@ -41,9 +46,10 @@ static void ns9xxx_maskack_irq(unsigned int irq)
41static void ns9xxx_unmask_irq(unsigned int irq) 46static void ns9xxx_unmask_irq(unsigned int irq)
42{ 47{
43 /* XXX: better use cpp symbols */ 48 /* XXX: better use cpp symbols */
44 u32 ic = __raw_readl(SYS_IC(irq / 4)); 49 int prio = irq2prio(irq);
45 ic |= 1 << (7 + 8 * (3 - (irq & 3))); 50 u32 ic = __raw_readl(SYS_IC(prio / 4));
46 __raw_writel(ic, SYS_IC(irq / 4)); 51 ic |= 1 << (7 + 8 * (3 - (prio & 3)));
52 __raw_writel(ic, SYS_IC(prio / 4));
47} 53}
48 54
49static struct irq_chip ns9xxx_chip = { 55static struct irq_chip ns9xxx_chip = {
@@ -96,14 +102,14 @@ void __init ns9xxx_init_irq(void)
96 102
97 /* disable all IRQs */ 103 /* disable all IRQs */
98 for (i = 0; i < 8; ++i) 104 for (i = 0; i < 8; ++i)
99 __raw_writel((4 * i) << 24 | (4 * i + 1) << 16 | 105 __raw_writel(prio2irq(4 * i) << 24 |
100 (4 * i + 2) << 8 | (4 * i + 3), SYS_IC(i)); 106 prio2irq(4 * i + 1) << 16 |
107 prio2irq(4 * i + 2) << 8 |
108 prio2irq(4 * i + 3),
109 SYS_IC(i));
101 110
102 /* simple interrupt prio table:
103 * prio(x) < prio(y) <=> x < y
104 */
105 for (i = 0; i < 32; ++i) 111 for (i = 0; i < 32; ++i)
106 __raw_writel(i, SYS_IVA(i)); 112 __raw_writel(prio2irq(i), SYS_IVA(i));
107 113
108 for (i = 0; i <= 31; ++i) { 114 for (i = 0; i <= 31; ++i) {
109 set_irq_chip(i, &ns9xxx_chip); 115 set_irq_chip(i, &ns9xxx_chip);