1 /*
2 * linux/arch/arm/mach-w90x900/irq.c
3 *
4 * based on linux/arch/arm/plat-s3c24xx/irq.c by Ben Dooks
5 *
6 * Copyright (c) 2008 Nuvoton technology corporation
7 * All rights reserved.
8 *
9 * Wan ZongShun <mcuos.com@gmail.com>
10 *
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.
15 *
16 */
17
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>
25
26 #include <asm/irq.h>
27 #include <asm/mach/irq.h>
28
29 #include <mach/hardware.h>
30 #include <mach/regs-irq.h>
31
w90x900_irq_mask(unsigned int irq)32 static void w90x900_irq_mask(unsigned int irq)
33 {
34 __raw_writel(1 << irq, REG_AIC_MDCR);
35 }
36
37 /*
38 * By the w90p910 spec,any irq,only write 1
39 * to REG_AIC_EOSCR for ACK
40 */
41
w90x900_irq_ack(unsigned int irq)42 static void w90x900_irq_ack(unsigned int irq)
43 {
44 __raw_writel(0x01, REG_AIC_EOSCR);
45 }
46
w90x900_irq_unmask(unsigned int irq)47 static void w90x900_irq_unmask(unsigned int irq)
48 {
49 unsigned long mask;
50
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);
55 }
56 __raw_writel(1 << irq, REG_AIC_MECR);
57 }
58
59 static struct irq_chip w90x900_irq_chip = {
60 .ack = w90x900_irq_ack,
61 .mask = w90x900_irq_mask,
62 .unmask = w90x900_irq_unmask,
63 };
64
w90x900_init_irq(void)65 void __init w90x900_init_irq(void)
66 {
67 int irqno;
68
69 __raw_writel(0xFFFFFFFE, REG_AIC_MDCR);
70
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);
75 }
76 }
77