]> git.karo-electronics.de Git - karo-tx-linux.git/blob - arch/m68knommu/platform/coldfire/intc-simr.c
m68knommu: use general interrupt controller for ColdFire 520x family
[karo-tx-linux.git] / arch / m68knommu / platform / coldfire / intc-simr.c
1 /*
2  * intc-simr.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 static void intc_irq_mask(unsigned int irq)
22 {
23         if ((irq >= MCFINT_VECBASE) && (irq <= MCFINT_VECBASE + 63))
24                 __raw_writeb(irq - MCFINT_VECBASE, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_SIMR);
25 }
26
27 static void intc_irq_unmask(unsigned int irq)
28 {
29         if ((irq >= MCFINT_VECBASE) && (irq <= MCFINT_VECBASE + 63))
30                 __raw_writeb(irq - MCFINT_VECBASE, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_CIMR);
31 }
32
33 static int intc_irq_set_type(unsigned int irq, unsigned int type)
34 {
35         if ((irq >= MCFINT_VECBASE) && (irq <= MCFINT_VECBASE + 63))
36                 __raw_writeb(5, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_ICR0 + irq - MCFINT_VECBASE);
37         return 0;
38 }
39
40 static struct irq_chip intc_irq_chip = {
41         .name           = "CF-INTC",
42         .mask           = intc_irq_mask,
43         .unmask         = intc_irq_unmask,
44         .set_type       = intc_irq_set_type,
45 };
46
47 void __init init_IRQ(void)
48 {
49         int irq;
50
51         init_vectors();
52
53         for (irq = 0; (irq < NR_IRQS); irq++) {
54                 irq_desc[irq].status = IRQ_DISABLED;
55                 irq_desc[irq].action = NULL;
56                 irq_desc[irq].depth = 1;
57                 irq_desc[irq].chip = &intc_irq_chip;
58                 intc_irq_set_type(irq, 0);
59         }
60 }
61