]>
Commit | Line | Data |
---|---|---|
9918cda5 UKK |
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> | |
361c7ad6 | 12 | #include <asm/io.h> |
9918cda5 UKK |
13 | #include <asm/mach/irq.h> |
14 | #include <asm/mach-types.h> | |
724ce5ee | 15 | #include <asm/arch-ns9xxx/regs-sys-common.h> |
9918cda5 UKK |
16 | #include <asm/arch-ns9xxx/irqs.h> |
17 | #include <asm/arch-ns9xxx/board.h> | |
18 | ||
19 | #include "generic.h" | |
20 | ||
9918cda5 UKK |
21 | static void ns9xxx_mask_irq(unsigned int irq) |
22 | { | |
23 | /* XXX: better use cpp symbols */ | |
361c7ad6 UKK |
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)); | |
9918cda5 UKK |
27 | } |
28 | ||
29 | static void ns9xxx_ack_irq(unsigned int irq) | |
30 | { | |
361c7ad6 | 31 | __raw_writel(0, SYS_ISRADDR); |
9918cda5 UKK |
32 | } |
33 | ||
34 | static void ns9xxx_maskack_irq(unsigned int irq) | |
35 | { | |
36 | ns9xxx_mask_irq(irq); | |
37 | ns9xxx_ack_irq(irq); | |
38 | } | |
39 | ||
40 | static void ns9xxx_unmask_irq(unsigned int irq) | |
41 | { | |
42 | /* XXX: better use cpp symbols */ | |
361c7ad6 UKK |
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)); | |
9918cda5 UKK |
46 | } |
47 | ||
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, | |
53 | }; | |
54 | ||
55 | void __init ns9xxx_init_irq(void) | |
56 | { | |
57 | int i; | |
58 | ||
59 | /* disable all IRQs */ | |
60 | for (i = 0; i < 8; ++i) | |
361c7ad6 UKK |
61 | __raw_writel((4 * i) << 24 | (4 * i + 1) << 16 | |
62 | (4 * i + 2) << 8 | (4 * i + 3), SYS_IC(i)); | |
9918cda5 UKK |
63 | |
64 | /* simple interrupt prio table: | |
65 | * prio(x) < prio(y) <=> x < y | |
66 | */ | |
67 | for (i = 0; i < 32; ++i) | |
361c7ad6 | 68 | __raw_writel(i, SYS_IVA(i)); |
9918cda5 | 69 | |
724ce5ee | 70 | for (i = 0; i <= 31; ++i) { |
9918cda5 UKK |
71 | set_irq_chip(i, &ns9xxx_chip); |
72 | set_irq_handler(i, handle_level_irq); | |
73 | set_irq_flags(i, IRQF_VALID); | |
74 | } | |
75 | } |