blob: f237bf4d5c3a12dc7cfdec02f370f2775bff047b [file] [log] [blame]
Mark.Zhana240a462006-05-06 17:04:20 +08001/*
2 * irq.c: GT64120 Interrupt Controller
3 *
4 * Copyright (C) 2006, Wind River System Inc.
5 * Author: Rongkai.Zhan, <rongkai.zhan@windriver.com>
6 *
Ralf Baechle70342282013-01-22 12:59:30 +01007 * 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
Mark.Zhana240a462006-05-06 17:04:20 +08009 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
Yoichi Yuasa4b92fe22007-10-10 00:28:26 +090012#include <linux/hardirq.h>
Mark.Zhana240a462006-05-06 17:04:20 +080013#include <linux/init.h>
Yoichi Yuasa4b92fe22007-10-10 00:28:26 +090014#include <linux/irq.h>
15
Mark.Zhana240a462006-05-06 17:04:20 +080016#include <asm/gt64120.h>
Yoichi Yuasa4b92fe22007-10-10 00:28:26 +090017#include <asm/irq_cpu.h>
18#include <asm/mipsregs.h>
Mark.Zhana240a462006-05-06 17:04:20 +080019
Ralf Baechle937a8012006-10-07 19:44:33 +010020asmlinkage void plat_irq_dispatch(void)
Mark.Zhan92478572006-06-20 18:15:02 +080021{
Thiemo Seufer119537c2007-03-19 00:13:37 +000022 unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM;
Mark.Zhan92478572006-06-20 18:15:02 +080023
24 if (pending & STATUSF_IP7)
Ralf Baechle937a8012006-10-07 19:44:33 +010025 do_IRQ(WRPPMC_MIPS_TIMER_IRQ); /* CPU Compare/Count internal timer */
Mark.Zhan92478572006-06-20 18:15:02 +080026 else if (pending & STATUSF_IP6)
Ralf Baechle937a8012006-10-07 19:44:33 +010027 do_IRQ(WRPPMC_UART16550_IRQ); /* UART 16550 port */
Mark.Zhan92478572006-06-20 18:15:02 +080028 else if (pending & STATUSF_IP3)
Ralf Baechle937a8012006-10-07 19:44:33 +010029 do_IRQ(WRPPMC_PCI_INTA_IRQ); /* PCI INT_A */
Mark.Zhan92478572006-06-20 18:15:02 +080030 else
Ralf Baechle937a8012006-10-07 19:44:33 +010031 spurious_interrupt();
Mark.Zhan92478572006-06-20 18:15:02 +080032}
Mark.Zhana240a462006-05-06 17:04:20 +080033
34/**
35 * Initialize GT64120 Interrupt Controller
36 */
37void 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
50void __init arch_init_irq(void)
51{
Mark.Zhana240a462006-05-06 17:04:20 +080052 /* IRQ 0 - 7 are for MIPS common irq_cpu controller */
Atsushi Nemoto97dcb822007-01-08 02:14:29 +090053 mips_cpu_irq_init();
Mark.Zhana240a462006-05-06 17:04:20 +080054
55 gt64120_init_pic();
56}