Path: blob/master/arch/mips/loongson/fuloong-2e/irq.c
15118 views
/*1* Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology2* Author: Fuxin Zhang, [email protected]3*4* This program is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License as published by the6* Free Software Foundation; either version 2 of the License, or (at your7* option) any later version.8*/9#include <linux/interrupt.h>1011#include <asm/irq_cpu.h>12#include <asm/i8259.h>1314#include <loongson.h>1516static void i8259_irqdispatch(void)17{18int irq;1920irq = i8259_irq();21if (irq >= 0)22do_IRQ(irq);23else24spurious_interrupt();25}2627asmlinkage void mach_irq_dispatch(unsigned int pending)28{29if (pending & CAUSEF_IP7)30do_IRQ(MIPS_CPU_IRQ_BASE + 7);31else if (pending & CAUSEF_IP6) /* perf counter loverflow */32do_perfcnt_IRQ();33else if (pending & CAUSEF_IP5)34i8259_irqdispatch();35else if (pending & CAUSEF_IP2)36bonito_irqdispatch();37else38spurious_interrupt();39}4041static struct irqaction cascade_irqaction = {42.handler = no_action,43.name = "cascade",44};4546void __init mach_init_irq(void)47{48/* init all controller49* 0-15 ------> i8259 interrupt50* 16-23 ------> mips cpu interrupt51* 32-63 ------> bonito irq52*/5354/* most bonito irq should be level triggered */55LOONGSON_INTEDGE = LOONGSON_ICU_SYSTEMERR | LOONGSON_ICU_MASTERERR |56LOONGSON_ICU_RETRYERR | LOONGSON_ICU_MBOXES;5758/* Sets the first-level interrupt dispatcher. */59mips_cpu_irq_init();60init_i8259_irqs();61bonito_irq_init();6263/* bonito irq at IP2 */64setup_irq(MIPS_CPU_IRQ_BASE + 2, &cascade_irqaction);65/* 8259 irq at IP5 */66setup_irq(MIPS_CPU_IRQ_BASE + 5, &cascade_irqaction);67}686970