wanzongshun | a62e903 | 2009-12-31 15:06:05 +0100 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-nuc93x/irq.c |
| 3 | * |
| 4 | * Copyright (c) 2008 Nuvoton technology corporation. |
| 5 | * |
| 6 | * Wan ZongShun <mcuos.com@gmail.com> |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation;version 2 of the License. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | #include <linux/init.h> |
| 15 | #include <linux/module.h> |
| 16 | #include <linux/interrupt.h> |
| 17 | #include <linux/ioport.h> |
| 18 | #include <linux/ptrace.h> |
| 19 | #include <linux/sysdev.h> |
| 20 | #include <linux/io.h> |
| 21 | |
| 22 | #include <asm/irq.h> |
| 23 | #include <asm/mach/irq.h> |
| 24 | |
| 25 | #include <mach/hardware.h> |
| 26 | #include <mach/regs-irq.h> |
| 27 | |
Lennert Buytenhek | 85dcd90 | 2010-11-29 10:38:52 +0100 | [diff] [blame] | 28 | static void nuc93x_irq_mask(struct irq_data *d) |
wanzongshun | a62e903 | 2009-12-31 15:06:05 +0100 | [diff] [blame] | 29 | { |
Lennert Buytenhek | 85dcd90 | 2010-11-29 10:38:52 +0100 | [diff] [blame] | 30 | __raw_writel(1 << d->irq, REG_AIC_MDCR); |
wanzongshun | a62e903 | 2009-12-31 15:06:05 +0100 | [diff] [blame] | 31 | } |
| 32 | |
| 33 | /* |
| 34 | * By the w90p910 spec,any irq,only write 1 |
| 35 | * to REG_AIC_EOSCR for ACK |
| 36 | */ |
| 37 | |
Lennert Buytenhek | 85dcd90 | 2010-11-29 10:38:52 +0100 | [diff] [blame] | 38 | static void nuc93x_irq_ack(struct irq_data *d) |
wanzongshun | a62e903 | 2009-12-31 15:06:05 +0100 | [diff] [blame] | 39 | { |
| 40 | __raw_writel(0x01, REG_AIC_EOSCR); |
| 41 | } |
| 42 | |
Lennert Buytenhek | 85dcd90 | 2010-11-29 10:38:52 +0100 | [diff] [blame] | 43 | static void nuc93x_irq_unmask(struct irq_data *d) |
wanzongshun | a62e903 | 2009-12-31 15:06:05 +0100 | [diff] [blame] | 44 | { |
Lennert Buytenhek | 85dcd90 | 2010-11-29 10:38:52 +0100 | [diff] [blame] | 45 | __raw_writel(1 << d->irq, REG_AIC_MECR); |
wanzongshun | a62e903 | 2009-12-31 15:06:05 +0100 | [diff] [blame] | 46 | |
| 47 | } |
| 48 | |
| 49 | static struct irq_chip nuc93x_irq_chip = { |
Lennert Buytenhek | 85dcd90 | 2010-11-29 10:38:52 +0100 | [diff] [blame] | 50 | .irq_ack = nuc93x_irq_ack, |
| 51 | .irq_mask = nuc93x_irq_mask, |
| 52 | .irq_unmask = nuc93x_irq_unmask, |
wanzongshun | a62e903 | 2009-12-31 15:06:05 +0100 | [diff] [blame] | 53 | }; |
| 54 | |
| 55 | void __init nuc93x_init_irq(void) |
| 56 | { |
| 57 | int irqno; |
| 58 | |
| 59 | __raw_writel(0xFFFFFFFE, REG_AIC_MDCR); |
| 60 | |
| 61 | for (irqno = IRQ_WDT; irqno <= NR_IRQS; irqno++) { |
Thomas Gleixner | f38c02f | 2011-03-24 13:35:09 +0100 | [diff] [blame] | 62 | irq_set_chip_and_handler(irqno, &nuc93x_irq_chip, |
| 63 | handle_level_irq); |
wanzongshun | a62e903 | 2009-12-31 15:06:05 +0100 | [diff] [blame] | 64 | set_irq_flags(irqno, IRQF_VALID); |
| 65 | } |
| 66 | } |