| 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 |  */ | 
| Yoichi Yuasa | 4b92fe2 | 2007-10-10 00:28:26 +0900 | [diff] [blame] | 12 | #include <linux/hardirq.h> | 
| Mark.Zhan | a240a46 | 2006-05-06 17:04:20 +0800 | [diff] [blame] | 13 | #include <linux/init.h> | 
| Yoichi Yuasa | 4b92fe2 | 2007-10-10 00:28:26 +0900 | [diff] [blame] | 14 | #include <linux/irq.h> | 
 | 15 |  | 
| Mark.Zhan | a240a46 | 2006-05-06 17:04:20 +0800 | [diff] [blame] | 16 | #include <asm/gt64120.h> | 
| Yoichi Yuasa | 4b92fe2 | 2007-10-10 00:28:26 +0900 | [diff] [blame] | 17 | #include <asm/irq_cpu.h> | 
 | 18 | #include <asm/mipsregs.h> | 
| Mark.Zhan | a240a46 | 2006-05-06 17:04:20 +0800 | [diff] [blame] | 19 |  | 
| Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 20 | asmlinkage void plat_irq_dispatch(void) | 
| Mark.Zhan | 9247857 | 2006-06-20 18:15:02 +0800 | [diff] [blame] | 21 | { | 
| Thiemo Seufer | 119537c | 2007-03-19 00:13:37 +0000 | [diff] [blame] | 22 | 	unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM; | 
| Mark.Zhan | 9247857 | 2006-06-20 18:15:02 +0800 | [diff] [blame] | 23 |  | 
 | 24 | 	if (pending & STATUSF_IP7) | 
| Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 25 | 		do_IRQ(WRPPMC_MIPS_TIMER_IRQ);	/* CPU Compare/Count internal timer */ | 
| Mark.Zhan | 9247857 | 2006-06-20 18:15:02 +0800 | [diff] [blame] | 26 | 	else if (pending & STATUSF_IP6) | 
| Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 27 | 		do_IRQ(WRPPMC_UART16550_IRQ);	/* UART 16550 port */ | 
| Mark.Zhan | 9247857 | 2006-06-20 18:15:02 +0800 | [diff] [blame] | 28 | 	else if (pending & STATUSF_IP3) | 
| Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 29 | 		do_IRQ(WRPPMC_PCI_INTA_IRQ);	/* PCI INT_A */ | 
| Mark.Zhan | 9247857 | 2006-06-20 18:15:02 +0800 | [diff] [blame] | 30 | 	else | 
| Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 31 | 		spurious_interrupt(); | 
| Mark.Zhan | 9247857 | 2006-06-20 18:15:02 +0800 | [diff] [blame] | 32 | } | 
| Mark.Zhan | a240a46 | 2006-05-06 17:04:20 +0800 | [diff] [blame] | 33 |  | 
 | 34 | /** | 
 | 35 |  * Initialize GT64120 Interrupt Controller | 
 | 36 |  */ | 
 | 37 | void gt64120_init_pic(void) | 
 | 38 | { | 
 | 39 | 	/* clear CPU Interrupt Cause Registers */ | 
 | 40 | 	GT_WRITE(GT_INTRCAUSE_OFS, (0x1F << 21)); | 
 | 41 | 	GT_WRITE(GT_HINTRCAUSE_OFS, 0x00); | 
 | 42 |  | 
 | 43 | 	/* Disable all interrupts from GT64120 bridge chip */ | 
 | 44 | 	GT_WRITE(GT_INTRMASK_OFS, 0x00); | 
 | 45 | 	GT_WRITE(GT_HINTRMASK_OFS, 0x00); | 
 | 46 | 	GT_WRITE(GT_PCI0_ICMASK_OFS, 0x00); | 
 | 47 | 	GT_WRITE(GT_PCI0_HICMASK_OFS, 0x00); | 
 | 48 | } | 
 | 49 |  | 
 | 50 | void __init arch_init_irq(void) | 
 | 51 | { | 
| Mark.Zhan | a240a46 | 2006-05-06 17:04:20 +0800 | [diff] [blame] | 52 | 	/* IRQ 0 - 7 are for MIPS common irq_cpu controller */ | 
| Atsushi Nemoto | 97dcb82 | 2007-01-08 02:14:29 +0900 | [diff] [blame] | 53 | 	mips_cpu_irq_init(); | 
| Mark.Zhan | a240a46 | 2006-05-06 17:04:20 +0800 | [diff] [blame] | 54 |  | 
 | 55 | 	gt64120_init_pic(); | 
 | 56 | } |