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>
22 /* Disable interrupt number "irq" in the AVIC */
23 static void mxc_mask_irq(unsigned int irq)
25 __raw_writel(irq, AVIC_INTDISNUM);
28 /* Enable interrupt number "irq" in the AVIC */
29 static void mxc_unmask_irq(unsigned int irq)
31 __raw_writel(irq, AVIC_INTENNUM);
34 static struct irq_chip mxc_avic_chip = {
35 .mask_ack = mxc_mask_irq,
37 .unmask = mxc_unmask_irq,
41 * This function initializes the AVIC hardware and disables all the
42 * interrupts. It registers the interrupt enable and disable functions
43 * to the kernel for each interrupt source.
45 void __init mxc_init_irq(void)
50 /* put the AVIC into the reset value with
51 * all interrupts disabled
53 __raw_writel(0, AVIC_INTCNTL);
54 __raw_writel(0x1f, AVIC_NIMASK);
56 /* disable all interrupts */
57 __raw_writel(0, AVIC_INTENABLEH);
58 __raw_writel(0, AVIC_INTENABLEL);
61 __raw_writel(0, AVIC_INTTYPEH);
62 __raw_writel(0, AVIC_INTTYPEL);
63 for (i = 0; i < MXC_MAX_INT_LINES; i++) {
64 set_irq_chip(i, &mxc_avic_chip);
65 set_irq_handler(i, handle_level_irq);
66 set_irq_flags(i, IRQF_VALID);
69 /* Set WDOG2's interrupt the highest priority level (bit 28-31) */
70 reg = __raw_readl(AVIC_NIPRIORITY6);
72 __raw_writel(reg, AVIC_NIPRIORITY6);
74 printk(KERN_INFO "MXC IRQ initialized\n");