Mark.Zhan | a240a46 | 2006-05-06 17:04:20 +0800 | [diff] [blame] | 1 | /* |
| 2 | * irq.c: GT64120 Interrupt Controller |
| 3 | * |
| 4 | * Copyright (C) 2006, Wind River System Inc. |
| 5 | * Author: Rongkai.Zhan, <rongkai.zhan@windriver.com> |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify it |
| 8 | * under the terms of the GNU General Public License as published by the |
| 9 | * Free Software Foundation; either version 2 of the License, or (at your |
| 10 | * option) any later version. |
| 11 | */ |
| 12 | #include <linux/errno.h> |
| 13 | #include <linux/init.h> |
| 14 | #include <linux/kernel_stat.h> |
| 15 | #include <linux/module.h> |
| 16 | #include <linux/signal.h> |
| 17 | #include <linux/sched.h> |
| 18 | #include <linux/types.h> |
| 19 | #include <linux/interrupt.h> |
| 20 | #include <linux/ioport.h> |
| 21 | #include <linux/timex.h> |
| 22 | #include <linux/slab.h> |
| 23 | #include <linux/random.h> |
| 24 | #include <linux/bitops.h> |
| 25 | #include <asm/bootinfo.h> |
| 26 | #include <asm/io.h> |
| 27 | #include <asm/bitops.h> |
| 28 | #include <asm/mipsregs.h> |
| 29 | #include <asm/system.h> |
| 30 | #include <asm/irq_cpu.h> |
| 31 | #include <asm/gt64120.h> |
| 32 | |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 33 | asmlinkage void plat_irq_dispatch(void) |
Mark.Zhan | 9247857 | 2006-06-20 18:15:02 +0800 | [diff] [blame] | 34 | { |
Thiemo Seufer | 119537c | 2007-03-19 00:13:37 +0000 | [diff] [blame] | 35 | unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM; |
Mark.Zhan | 9247857 | 2006-06-20 18:15:02 +0800 | [diff] [blame] | 36 | |
| 37 | if (pending & STATUSF_IP7) |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 38 | do_IRQ(WRPPMC_MIPS_TIMER_IRQ); /* CPU Compare/Count internal timer */ |
Mark.Zhan | 9247857 | 2006-06-20 18:15:02 +0800 | [diff] [blame] | 39 | else if (pending & STATUSF_IP6) |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 40 | do_IRQ(WRPPMC_UART16550_IRQ); /* UART 16550 port */ |
Mark.Zhan | 9247857 | 2006-06-20 18:15:02 +0800 | [diff] [blame] | 41 | else if (pending & STATUSF_IP3) |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 42 | do_IRQ(WRPPMC_PCI_INTA_IRQ); /* PCI INT_A */ |
Mark.Zhan | 9247857 | 2006-06-20 18:15:02 +0800 | [diff] [blame] | 43 | else |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 44 | spurious_interrupt(); |
Mark.Zhan | 9247857 | 2006-06-20 18:15:02 +0800 | [diff] [blame] | 45 | } |
Mark.Zhan | a240a46 | 2006-05-06 17:04:20 +0800 | [diff] [blame] | 46 | |
| 47 | /** |
| 48 | * Initialize GT64120 Interrupt Controller |
| 49 | */ |
| 50 | void gt64120_init_pic(void) |
| 51 | { |
| 52 | /* clear CPU Interrupt Cause Registers */ |
| 53 | GT_WRITE(GT_INTRCAUSE_OFS, (0x1F << 21)); |
| 54 | GT_WRITE(GT_HINTRCAUSE_OFS, 0x00); |
| 55 | |
| 56 | /* Disable all interrupts from GT64120 bridge chip */ |
| 57 | GT_WRITE(GT_INTRMASK_OFS, 0x00); |
| 58 | GT_WRITE(GT_HINTRMASK_OFS, 0x00); |
| 59 | GT_WRITE(GT_PCI0_ICMASK_OFS, 0x00); |
| 60 | GT_WRITE(GT_PCI0_HICMASK_OFS, 0x00); |
| 61 | } |
| 62 | |
| 63 | void __init arch_init_irq(void) |
| 64 | { |
Mark.Zhan | a240a46 | 2006-05-06 17:04:20 +0800 | [diff] [blame] | 65 | /* IRQ 0 - 7 are for MIPS common irq_cpu controller */ |
Atsushi Nemoto | 97dcb82 | 2007-01-08 02:14:29 +0900 | [diff] [blame] | 66 | mips_cpu_irq_init(); |
Mark.Zhan | a240a46 | 2006-05-06 17:04:20 +0800 | [diff] [blame] | 67 | |
| 68 | gt64120_init_pic(); |
| 69 | } |