18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * IRQ vector handles 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public 58c2ecf20Sopenharmony_ci * License. See the file "COPYING" in the main directory of this archive 68c2ecf20Sopenharmony_ci * for more details. 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * Copyright (C) 1995, 1996, 1997, 2003 by Ralf Baechle 98c2ecf20Sopenharmony_ci */ 108c2ecf20Sopenharmony_ci#include <linux/kernel.h> 118c2ecf20Sopenharmony_ci#include <linux/init.h> 128c2ecf20Sopenharmony_ci#include <linux/irq.h> 138c2ecf20Sopenharmony_ci#include <linux/interrupt.h> 148c2ecf20Sopenharmony_ci#include <linux/pci.h> 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#include <asm/i8259.h> 178c2ecf20Sopenharmony_ci#include <asm/irq_cpu.h> 188c2ecf20Sopenharmony_ci#include <asm/irq_gt641xx.h> 198c2ecf20Sopenharmony_ci#include <asm/gt64120.h> 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#include <irq.h> 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ciasmlinkage void plat_irq_dispatch(void) 248c2ecf20Sopenharmony_ci{ 258c2ecf20Sopenharmony_ci unsigned pending = read_c0_status() & read_c0_cause() & ST0_IM; 268c2ecf20Sopenharmony_ci int irq; 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci if (pending & CAUSEF_IP2) 298c2ecf20Sopenharmony_ci gt641xx_irq_dispatch(); 308c2ecf20Sopenharmony_ci else if (pending & CAUSEF_IP6) { 318c2ecf20Sopenharmony_ci irq = i8259_irq(); 328c2ecf20Sopenharmony_ci if (irq < 0) 338c2ecf20Sopenharmony_ci spurious_interrupt(); 348c2ecf20Sopenharmony_ci else 358c2ecf20Sopenharmony_ci do_IRQ(irq); 368c2ecf20Sopenharmony_ci } else if (pending & CAUSEF_IP3) 378c2ecf20Sopenharmony_ci do_IRQ(MIPS_CPU_IRQ_BASE + 3); 388c2ecf20Sopenharmony_ci else if (pending & CAUSEF_IP4) 398c2ecf20Sopenharmony_ci do_IRQ(MIPS_CPU_IRQ_BASE + 4); 408c2ecf20Sopenharmony_ci else if (pending & CAUSEF_IP5) 418c2ecf20Sopenharmony_ci do_IRQ(MIPS_CPU_IRQ_BASE + 5); 428c2ecf20Sopenharmony_ci else if (pending & CAUSEF_IP7) 438c2ecf20Sopenharmony_ci do_IRQ(MIPS_CPU_IRQ_BASE + 7); 448c2ecf20Sopenharmony_ci else 458c2ecf20Sopenharmony_ci spurious_interrupt(); 468c2ecf20Sopenharmony_ci} 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_civoid __init arch_init_irq(void) 498c2ecf20Sopenharmony_ci{ 508c2ecf20Sopenharmony_ci mips_cpu_irq_init(); 518c2ecf20Sopenharmony_ci gt641xx_irq_init(); 528c2ecf20Sopenharmony_ci init_i8259_irqs(); 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci if (request_irq(GT641XX_CASCADE_IRQ, no_action, IRQF_NO_THREAD, 558c2ecf20Sopenharmony_ci "cascade", NULL)) { 568c2ecf20Sopenharmony_ci pr_err("Failed to request irq %d (cascade)\n", 578c2ecf20Sopenharmony_ci GT641XX_CASCADE_IRQ); 588c2ecf20Sopenharmony_ci } 598c2ecf20Sopenharmony_ci if (request_irq(I8259_CASCADE_IRQ, no_action, IRQF_NO_THREAD, 608c2ecf20Sopenharmony_ci "cascade", NULL)) { 618c2ecf20Sopenharmony_ci pr_err("Failed to request irq %d (cascade)\n", 628c2ecf20Sopenharmony_ci I8259_CASCADE_IRQ); 638c2ecf20Sopenharmony_ci } 648c2ecf20Sopenharmony_ci} 65