import of upstream 2.4.34.4 from kernel.org
[linux-2.4.git] / arch / mips / cobalt / via.c
1 /*
2  * VIA chipset irq handling
3  *
4  * This file is subject to the terms and conditions of the GNU General Public
5  * License.  See the file "COPYING" in the main directory of this archive
6  * for more details.
7  *
8  * Copyright (C) 1996, 1997 by Ralf Baechle
9  * Copyright (C) 2001, 2002, 2003 by Liam Davies (ldavies@agile.tv)
10  *
11  */
12
13 #include <linux/irq.h>
14 #include <linux/kernel.h>
15
16 #include <asm/ptrace.h>
17 #include <asm/io.h>
18 #include <asm/gt64120/gt64120.h>
19 #include <asm/cobalt/cobalt.h>
20
21 asmlinkage void via_irq(struct pt_regs *regs)
22 {
23         char mstat, sstat;
24
25         /* Read Master Status */
26         outb(0x0C, 0x20);
27         mstat = inb(0x20);
28
29         if (mstat < 0) {
30                 mstat &= 0x7f;
31                 if (mstat != 2) {
32                         do_IRQ(mstat, regs);
33                         outb(mstat | 0x20, 0x20);
34                 } else {
35                         sstat = inb(0xA0);
36
37                         /* Slave interrupt */
38                         outb(0x0C, 0xA0);
39                         sstat = inb(0xA0);
40
41                         if (sstat < 0) {
42                                 do_IRQ((sstat + 8) & 0x7f, regs);
43                                 outb(0x22, 0x20);
44                                 outb((sstat & 0x7f) | 0x20, 0xA0);
45                         } else {
46                                 printk("Spurious slave interrupt...\n");
47                         }
48                 }
49         } else
50                 printk("Spurious master interrupt...");
51 }
52
53 asmlinkage void galileo_irq(struct pt_regs *regs)
54 {
55         unsigned long irq_src;
56
57         irq_src = GALILEO_INL(GT_INTRCAUSE_OFS);
58
59         /* Check for timer irq ... */
60         if (irq_src & GALILEO_T0EXP) {
61                 /* Clear the int line */
62                 GALILEO_OUTL(0, GT_INTRCAUSE_OFS);
63                 do_IRQ(COBALT_TIMER_IRQ, regs);
64         } else
65                 printk("Spurious Galileo interrupt...\n");
66 }