Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / mach-s3c2410 / bast-irq.c
blob5e5bbe893cbb7f61fc620896b3a50c0164fdd71e
1 /* linux/arch/arm/mach-s3c2410/bast-irq.c
3 * Copyright (c) 2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
6 * http://www.simtec.co.uk/products/EB2410ITX/
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; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * Modifications:
23 * 08-Jan-2003 BJD Moved from central IRQ code
27 #include <linux/init.h>
28 #include <linux/module.h>
29 #include <linux/ioport.h>
30 #include <linux/ptrace.h>
31 #include <linux/sysdev.h>
33 #include <asm/hardware.h>
34 #include <asm/irq.h>
35 #include <asm/io.h>
37 #include <asm/mach/irq.h>
38 #include <asm/hardware/s3c2410/irq.h>
40 #if 0
41 #include <asm/debug-ll.h>
42 #endif
44 #define irqdbf(x...)
45 #define irqdbf2(x...)
48 /* handle PC104 ISA interrupts from the system CPLD */
50 /* table of ISA irq nos to the relevant mask... zero means
51 * the irq is not implemented
53 static unsigned char bast_pc104_irqmasks[] = {
54 0, /* 0 */
55 0, /* 1 */
56 0, /* 2 */
57 1, /* 3 */
58 0, /* 4 */
59 2, /* 5 */
60 0, /* 6 */
61 4, /* 7 */
62 0, /* 8 */
63 0, /* 9 */
64 8, /* 10 */
65 0, /* 11 */
66 0, /* 12 */
67 0, /* 13 */
68 0, /* 14 */
69 0, /* 15 */
72 static unsigned char bast_pc104_irqs[] = { 3, 5, 7, 10 };
74 static void
75 bast_pc104_mask(unsigned int irqno)
77 unsigned long temp;
79 temp = __raw_readb(BAST_VA_PC104_IRQMASK);
80 temp &= ~bast_pc104_irqmasks[irqno];
81 __raw_writeb(temp, BAST_VA_PC104_IRQMASK);
83 if (temp == 0)
84 bast_extint_mask(IRQ_ISA);
87 static void
88 bast_pc104_ack(unsigned int irqno)
90 bast_extint_ack(IRQ_ISA);
93 static void
94 bast_pc104_unmask(unsigned int irqno)
96 unsigned long temp;
98 temp = __raw_readb(BAST_VA_PC104_IRQMASK);
99 temp |= bast_pc104_irqmasks[irqno];
100 __raw_writeb(temp, BAST_VA_PC104_IRQMASK);
102 bast_extint_unmask(IRQ_ISA);
105 static struct bast_pc104_chip = {
106 .mask = bast_pc104_mask,
107 .unmask = bast_pc104_unmask,
108 .ack = bast_pc104_ack
111 static void
112 bast_irq_pc104_demux(unsigned int irq,
113 struct irqdesc *desc,
114 struct pt_regs *regs)
116 unsigned int stat;
117 unsigned int irqno;
118 int i;
120 stat = __raw_readb(BAST_VA_PC104_IRQREQ) & 0xf;
122 for (i = 0; i < 4 && stat != 0; i++) {
123 if (stat & 1) {
124 irqno = bast_pc104_irqs[i];
125 desc = irq_desc + irqno;
127 desc->handle(irqno, desc, regs);
130 stat >>= 1;