MOXA linux-2.6.x / linux-2.6.19-uc1 from UC-7110-LX-BOOTLOADER-1.9_VERSION-4.2.tgz
[linux-2.6.19-moxart.git] / arch / arm / mach-ks8695 / irq.c
blobeffa87c895237bef8c0cb55a4b76b2a478fd6174
1 /*
2 * linux/arch/arm/mach-ks8695/irq.c
4 * Copyright (C) 2002 Micrel Inc.
5 * Copyright (C) 2006 Greg Ungerer <gerg@snapgear.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <linux/init.h>
23 #include <linux/interrupt.h>
24 #include <asm/hardware.h>
25 #include <asm/irq.h>
26 #include <asm/io.h>
27 #include <asm/mach/irq.h>
29 static void ks8695_irq_mask(unsigned int irq)
31 unsigned long msk;
32 msk = __raw_readl(KS8695_REG(KS8695_INT_ENABLE));
33 msk &= ~(1 << irq);
34 __raw_writel(msk, KS8695_REG(KS8695_INT_ENABLE));
37 static void ks8695_irq_unmask(unsigned int irq)
39 unsigned long msk;
40 msk = __raw_readl(KS8695_REG(KS8695_INT_ENABLE));
41 msk |= (1 << irq);
42 __raw_writel(msk, KS8695_REG(KS8695_INT_ENABLE));
45 static int ks8695_irq_set_type(unsigned int irq, unsigned int type)
47 return 0;
50 struct irqchip ks8695_irq_chip = {
51 .ack = ks8695_irq_mask,
52 .mask = ks8695_irq_mask,
53 .unmask = ks8695_irq_unmask,
54 .set_type = ks8695_irq_set_type,
57 void __init ks8695_init_irq(void)
59 unsigned int i;
61 /* Disable all interrupts initially. */
62 __raw_writel(0, KS8695_REG(KS8695_INT_CONTL));
63 __raw_writel(0, KS8695_REG(KS8695_INT_ENABLE));
65 for (i = 0; (i < NR_IRQS); i++) {
66 set_irq_chip(i, &ks8695_irq_chip);
67 set_irq_handler(i, do_level_IRQ);
68 set_irq_flags(i, IRQF_VALID);