diff options
author | Greg Ungerer <gerg@uclinux.org> | 2009-04-27 01:38:03 -0400 |
---|---|---|
committer | Greg Ungerer <gerg@uclinux.org> | 2009-09-15 19:43:40 -0400 |
commit | 2fba4f0b035f7723073068cf8b3a01ec38f72ed5 (patch) | |
tree | 425625ccb967a444250be4f47808be63148f73ad /arch/m68knommu | |
parent | d0d77c26cb6195e881325befc950cc54732ba261 (diff) |
m68knommu: general interrupt controller for ColdFire many 52xx parts
Create general interrupt controller code for the many ColdFire version 2
cores that use the two region INTC interrupt controller. This includes the
523x family, 5270, 5271, 5274, 5275, and the 528x families.
This code does proper masking and unmasking of interrupts. With this in
place some of the driver hacks in place to support ColdFire interrupts
can finally go away.
Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Diffstat (limited to 'arch/m68knommu')
-rw-r--r-- | arch/m68knommu/kernel/irq.c | 3 | ||||
-rw-r--r-- | arch/m68knommu/platform/coldfire/Makefile | 6 | ||||
-rw-r--r-- | arch/m68knommu/platform/coldfire/intc-2.c | 93 |
3 files changed, 98 insertions, 4 deletions
diff --git a/arch/m68knommu/kernel/irq.c b/arch/m68knommu/kernel/irq.c index 47f6af57e18e..f9965d7ee7c5 100644 --- a/arch/m68knommu/kernel/irq.c +++ b/arch/m68knommu/kernel/irq.c | |||
@@ -29,7 +29,8 @@ asmlinkage void do_IRQ(int irq, struct pt_regs *regs) | |||
29 | set_irq_regs(oldregs); | 29 | set_irq_regs(oldregs); |
30 | } | 30 | } |
31 | 31 | ||
32 | #if !defined(CONFIG_M520x) | 32 | #if !defined(CONFIG_M520x) && !defined(CONFIG_M523x) && \ |
33 | !defined(CONFIG_M527x) && !defined(CONFIG_M528x) | ||
33 | 34 | ||
34 | static struct irq_chip m_irq_chip = { | 35 | static struct irq_chip m_irq_chip = { |
35 | .name = "M68K-INTC", | 36 | .name = "M68K-INTC", |
diff --git a/arch/m68knommu/platform/coldfire/Makefile b/arch/m68knommu/platform/coldfire/Makefile index dd242db7daa1..bce9a62d3a13 100644 --- a/arch/m68knommu/platform/coldfire/Makefile +++ b/arch/m68knommu/platform/coldfire/Makefile | |||
@@ -18,11 +18,11 @@ obj-$(CONFIG_COLDFIRE) += clk.o dma.o entry.o vectors.o | |||
18 | obj-$(CONFIG_M5206) += timers.o | 18 | obj-$(CONFIG_M5206) += timers.o |
19 | obj-$(CONFIG_M5206e) += timers.o | 19 | obj-$(CONFIG_M5206e) += timers.o |
20 | obj-$(CONFIG_M520x) += pit.o intc-simr.o | 20 | obj-$(CONFIG_M520x) += pit.o intc-simr.o |
21 | obj-$(CONFIG_M523x) += pit.o dma_timer.o | 21 | obj-$(CONFIG_M523x) += pit.o dma_timer.o intc-2.o |
22 | obj-$(CONFIG_M5249) += timers.o | 22 | obj-$(CONFIG_M5249) += timers.o |
23 | obj-$(CONFIG_M527x) += pit.o | 23 | obj-$(CONFIG_M527x) += pit.o intc-2.o |
24 | obj-$(CONFIG_M5272) += timers.o | 24 | obj-$(CONFIG_M5272) += timers.o |
25 | obj-$(CONFIG_M528x) += pit.o | 25 | obj-$(CONFIG_M528x) += pit.o intc-2.o |
26 | obj-$(CONFIG_M5307) += timers.o | 26 | obj-$(CONFIG_M5307) += timers.o |
27 | obj-$(CONFIG_M532x) += timers.o | 27 | obj-$(CONFIG_M532x) += timers.o |
28 | obj-$(CONFIG_M5407) += timers.o | 28 | obj-$(CONFIG_M5407) += timers.o |
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 | |||