4 * (C) Copyright 2009, Greg Ungerer <gerg@snapgear.com>
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
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>
17 #include <asm/coldfire.h>
18 #include <asm/mcfsim.h>
19 #include <asm/traps.h>
21 static void intc_irq_mask(unsigned int irq)
23 if ((irq >= MCFINT_VECBASE) && (irq <= MCFINT_VECBASE + 63))
24 __raw_writeb(irq - MCFINT_VECBASE, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_SIMR);
27 static void intc_irq_unmask(unsigned int irq)
29 if ((irq >= MCFINT_VECBASE) && (irq <= MCFINT_VECBASE + 63))
30 __raw_writeb(irq - MCFINT_VECBASE, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_CIMR);
33 static int intc_irq_set_type(unsigned int irq, unsigned int type)
35 if ((irq >= MCFINT_VECBASE) && (irq <= MCFINT_VECBASE + 63))
36 __raw_writeb(5, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_ICR0 + irq - MCFINT_VECBASE);
40 static struct irq_chip intc_irq_chip = {
42 .mask = intc_irq_mask,
43 .unmask = intc_irq_unmask,
44 .set_type = intc_irq_set_type,
47 void __init init_IRQ(void)
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);