2 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 #include <linux/module.h>
12 #include <linux/moduleparam.h>
13 #include <linux/init.h>
14 #include <linux/device.h>
15 #include <linux/errno.h>
16 #include <asm/hardware.h>
19 #include <asm/mach/irq.h>
20 #include <asm/arch/common.h>
23 * Disable interrupt number "irq" in the AVIC
25 * @param irq interrupt source number
27 static void mxc_mask_irq(unsigned int irq
)
29 __raw_writel(irq
, AVIC_INTDISNUM
);
33 * Enable interrupt number "irq" in the AVIC
35 * @param irq interrupt source number
37 static void mxc_unmask_irq(unsigned int irq
)
39 __raw_writel(irq
, AVIC_INTENNUM
);
42 static struct irq_chip mxc_avic_chip
= {
43 .mask_ack
= mxc_mask_irq
,
45 .unmask
= mxc_unmask_irq
,
49 * This function initializes the AVIC hardware and disables all the
50 * interrupts. It registers the interrupt enable and disable functions
51 * to the kernel for each interrupt source.
53 void __init
mxc_init_irq(void)
58 /* put the AVIC into the reset value with
59 * all interrupts disabled
61 __raw_writel(0, AVIC_INTCNTL
);
62 __raw_writel(0x1f, AVIC_NIMASK
);
64 /* disable all interrupts */
65 __raw_writel(0, AVIC_INTENABLEH
);
66 __raw_writel(0, AVIC_INTENABLEL
);
69 __raw_writel(0, AVIC_INTTYPEH
);
70 __raw_writel(0, AVIC_INTTYPEL
);
71 for (i
= 0; i
< MXC_MAX_INT_LINES
; i
++) {
72 set_irq_chip(i
, &mxc_avic_chip
);
73 set_irq_handler(i
, handle_level_irq
);
74 set_irq_flags(i
, IRQF_VALID
);
77 /* Set WDOG2's interrupt the highest priority level (bit 28-31) */
78 reg
= __raw_readl(AVIC_NIPRIORITY6
);
80 __raw_writel(reg
, AVIC_NIPRIORITY6
);
82 printk(KERN_INFO
"MXC IRQ initialized\n");