diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-09-19 08:47:57 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-09-19 08:47:57 -0400 |
commit | 40d743b8c16a8cf6e30c1d941aa6147f9550ea75 (patch) | |
tree | 9fcdf9a06b18a275253048d1ea7c9803cec38845 /arch/m68knommu/platform/coldfire/intc-2.c | |
parent | 7da18afa423f167e7ef3c9728e584d8bf05bd55a (diff) | |
parent | 83e686ea0291ee93b87dcdc00b96443b80de56c9 (diff) |
Merge branch 'for-rmk' of git://linux-arm.org/linux-2.6
Diffstat (limited to 'arch/m68knommu/platform/coldfire/intc-2.c')
-rw-r--r-- | arch/m68knommu/platform/coldfire/intc-2.c | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/arch/m68knommu/platform/coldfire/intc-2.c b/arch/m68knommu/platform/coldfire/intc-2.c new file mode 100644 index 000000000000..5598c8b8661f --- /dev/null +++ b/arch/m68knommu/platform/coldfire/intc-2.c | |||
@@ -0,0 +1,93 @@ | |||
1 | /* | ||
2 | * intc-1.c | ||
3 | * | ||
4 | * (C) Copyright 2009, Greg Ungerer <gerg@snapgear.com> | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file COPYING in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | |||
11 | #include <linux/types.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/interrupt.h> | ||
15 | #include <linux/irq.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <asm/coldfire.h> | ||
18 | #include <asm/mcfsim.h> | ||
19 | #include <asm/traps.h> | ||
20 | |||
21 | /* | ||
22 | * Each vector needs a unique priority and level asscoiated with it. | ||
23 | * We don't really care so much what they are, we don't rely on the | ||
24 | * tranditional priority interrupt scheme of the m68k/ColdFire. | ||
25 | */ | ||
26 | static u8 intc_intpri = 0x36; | ||
27 | |||
28 | static void intc_irq_mask(unsigned int irq) | ||
29 | { | ||
30 | if ((irq >= MCFINT_VECBASE) && (irq <= MCFINT_VECBASE + 128)) { | ||
31 | unsigned long imraddr; | ||
32 | u32 val, imrbit; | ||
33 | |||
34 | irq -= MCFINT_VECBASE; | ||
35 | imraddr = MCF_IPSBAR; | ||
36 | imraddr += (irq & 0x40) ? MCFICM_INTC1 : MCFICM_INTC0; | ||
37 | imraddr += (irq & 0x20) ? MCFINTC_IMRH : MCFINTC_IMRL; | ||
38 | imrbit = 0x1 << (irq & 0x1f); | ||
39 | |||
40 | val = __raw_readl(imraddr); | ||
41 | __raw_writel(val | imrbit, imraddr); | ||
42 | } | ||
43 | } | ||
44 | |||
45 | static void intc_irq_unmask(unsigned int irq) | ||
46 | { | ||
47 | if ((irq >= MCFINT_VECBASE) && (irq <= MCFINT_VECBASE + 128)) { | ||
48 | unsigned long intaddr, imraddr, icraddr; | ||
49 | u32 val, imrbit; | ||
50 | |||
51 | irq -= MCFINT_VECBASE; | ||
52 | intaddr = MCF_IPSBAR; | ||
53 | intaddr += (irq & 0x40) ? MCFICM_INTC1 : MCFICM_INTC0; | ||
54 | imraddr = intaddr + ((irq & 0x20) ? MCFINTC_IMRH : MCFINTC_IMRL); | ||
55 | icraddr = intaddr + MCFINTC_ICR0 + (irq & 0x3f); | ||
56 | imrbit = 0x1 << (irq & 0x1f); | ||
57 | |||
58 | /* Don't set the "maskall" bit! */ | ||
59 | if ((irq & 0x20) == 0) | ||
60 | imrbit |= 0x1; | ||
61 | |||
62 | if (__raw_readb(icraddr) == 0) | ||
63 | __raw_writeb(intc_intpri--, icraddr); | ||
64 | |||
65 | val = __raw_readl(imraddr); | ||
66 | __raw_writel(val & ~imrbit, imraddr); | ||
67 | } | ||
68 | } | ||
69 | |||
70 | static struct irq_chip intc_irq_chip = { | ||
71 | .name = "CF-INTC", | ||
72 | .mask = intc_irq_mask, | ||
73 | .unmask = intc_irq_unmask, | ||
74 | }; | ||
75 | |||
76 | void __init init_IRQ(void) | ||
77 | { | ||
78 | int irq; | ||
79 | |||
80 | init_vectors(); | ||
81 | |||
82 | /* Mask all interrupt sources */ | ||
83 | __raw_writel(0x1, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRL); | ||
84 | __raw_writel(0x1, MCF_IPSBAR + MCFICM_INTC1 + MCFINTC_IMRL); | ||
85 | |||
86 | for (irq = 0; (irq < NR_IRQS); irq++) { | ||
87 | irq_desc[irq].status = IRQ_DISABLED; | ||
88 | irq_desc[irq].action = NULL; | ||
89 | irq_desc[irq].depth = 1; | ||
90 | irq_desc[irq].chip = &intc_irq_chip; | ||
91 | } | ||
92 | } | ||
93 | |||