Linux 2.6.31.6
[linux/fpc-iii.git] / arch / arm / mach-w90x900 / irq.c
blob0b4fc194729c7b56fa00f299be9ba213a777c835
1 /*
2 * linux/arch/arm/mach-w90x900/irq.c
4 * based on linux/arch/arm/plat-s3c24xx/irq.c by Ben Dooks
6 * Copyright (c) 2008 Nuvoton technology corporation
7 * All rights reserved.
9 * Wan ZongShun <mcuos.com@gmail.com>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
18 #include <linux/init.h>
19 #include <linux/module.h>
20 #include <linux/interrupt.h>
21 #include <linux/ioport.h>
22 #include <linux/ptrace.h>
23 #include <linux/sysdev.h>
24 #include <linux/io.h>
26 #include <asm/irq.h>
27 #include <asm/mach/irq.h>
29 #include <mach/hardware.h>
30 #include <mach/regs-irq.h>
32 static void w90x900_irq_mask(unsigned int irq)
34 __raw_writel(1 << irq, REG_AIC_MDCR);
38 * By the w90p910 spec,any irq,only write 1
39 * to REG_AIC_EOSCR for ACK
42 static void w90x900_irq_ack(unsigned int irq)
44 __raw_writel(0x01, REG_AIC_EOSCR);
47 static void w90x900_irq_unmask(unsigned int irq)
49 unsigned long mask;
51 if (irq == IRQ_T_INT_GROUP) {
52 mask = __raw_readl(REG_AIC_GEN);
53 __raw_writel(TIME_GROUP_IRQ | mask, REG_AIC_GEN);
54 __raw_writel(1 << IRQ_T_INT_GROUP, REG_AIC_MECR);
56 __raw_writel(1 << irq, REG_AIC_MECR);
59 static struct irq_chip w90x900_irq_chip = {
60 .ack = w90x900_irq_ack,
61 .mask = w90x900_irq_mask,
62 .unmask = w90x900_irq_unmask,
65 void __init w90x900_init_irq(void)
67 int irqno;
69 __raw_writel(0xFFFFFFFE, REG_AIC_MDCR);
71 for (irqno = IRQ_WDT; irqno <= IRQ_ADC; irqno++) {
72 set_irq_chip(irqno, &w90x900_irq_chip);
73 set_irq_handler(irqno, handle_level_irq);
74 set_irq_flags(irqno, IRQF_VALID);