Path: blob/master/arch/mips/pmc-sierra/msp71xx/msp_irq.c
15118 views
/*1* IRQ vector handles2*3* Copyright (C) 1995, 1996, 1997, 2003 by Ralf Baechle4*5* This file is subject to the terms and conditions of the GNU General Public6* License. See the file "COPYING" in the main directory of this archive7* for more details.8*/910#include <linux/kernel.h>11#include <linux/init.h>12#include <linux/irq.h>13#include <linux/interrupt.h>14#include <linux/ptrace.h>15#include <linux/time.h>1617#include <asm/irq_cpu.h>1819#include <msp_int.h>2021/* SLP bases systems */22extern void msp_slp_irq_init(void);23extern void msp_slp_irq_dispatch(void);2425/* CIC based systems */26extern void msp_cic_irq_init(void);27extern void msp_cic_irq_dispatch(void);2829/* VSMP support init */30extern void msp_vsmp_int_init(void);3132/* vectored interrupt implementation */3334/* SW0/1 interrupts are used for SMP/SMTC */35static inline void mac0_int_dispatch(void) { do_IRQ(MSP_INT_MAC0); }36static inline void mac1_int_dispatch(void) { do_IRQ(MSP_INT_MAC1); }37static inline void mac2_int_dispatch(void) { do_IRQ(MSP_INT_SAR); }38static inline void usb_int_dispatch(void) { do_IRQ(MSP_INT_USB); }39static inline void sec_int_dispatch(void) { do_IRQ(MSP_INT_SEC); }4041/*42* The PMC-Sierra MSP interrupts are arranged in a 3 level cascaded43* hierarchical system. The first level are the direct MIPS interrupts44* and are assigned the interrupt range 0-7. The second level is the SLM45* interrupt controller and is assigned the range 8-39. The third level46* comprises the Peripherial block, the PCI block, the PCI MSI block and47* the SLP. The PCI interrupts and the SLP errors are handled by the48* relevant subsystems so the core interrupt code needs only concern49* itself with the Peripheral block. These are assigned interrupts in50* the range 40-71.51*/5253asmlinkage void plat_irq_dispatch(struct pt_regs *regs)54{55u32 pending;5657pending = read_c0_status() & read_c0_cause();5859/*60* jump to the correct interrupt routine61* These are arranged in priority order and the timer62* comes first!63*/6465#ifdef CONFIG_IRQ_MSP_CIC /* break out the CIC stuff for now */66if (pending & C_IRQ4) /* do the peripherals first, that's the timer */67msp_cic_irq_dispatch();6869else if (pending & C_IRQ0)70do_IRQ(MSP_INT_MAC0);7172else if (pending & C_IRQ1)73do_IRQ(MSP_INT_MAC1);7475else if (pending & C_IRQ2)76do_IRQ(MSP_INT_USB);7778else if (pending & C_IRQ3)79do_IRQ(MSP_INT_SAR);8081else if (pending & C_IRQ5)82do_IRQ(MSP_INT_SEC);8384#else85if (pending & C_IRQ5)86do_IRQ(MSP_INT_TIMER);8788else if (pending & C_IRQ0)89do_IRQ(MSP_INT_MAC0);9091else if (pending & C_IRQ1)92do_IRQ(MSP_INT_MAC1);9394else if (pending & C_IRQ3)95do_IRQ(MSP_INT_VE);9697else if (pending & C_IRQ4)98msp_slp_irq_dispatch();99#endif100101else if (pending & C_SW0) /* do software after hardware */102do_IRQ(MSP_INT_SW0);103104else if (pending & C_SW1)105do_IRQ(MSP_INT_SW1);106}107108static struct irqaction cic_cascade_msp = {109.handler = no_action,110.name = "MSP CIC cascade"111};112113static struct irqaction per_cascade_msp = {114.handler = no_action,115.name = "MSP PER cascade"116};117118void __init arch_init_irq(void)119{120/* assume we'll be using vectored interrupt mode except in UP mode*/121#ifdef CONFIG_MIPS_MT122BUG_ON(!cpu_has_vint);123#endif124/* initialize the 1st-level CPU based interrupt controller */125mips_cpu_irq_init();126127#ifdef CONFIG_IRQ_MSP_CIC128msp_cic_irq_init();129#ifdef CONFIG_MIPS_MT130set_vi_handler(MSP_INT_CIC, msp_cic_irq_dispatch);131set_vi_handler(MSP_INT_MAC0, mac0_int_dispatch);132set_vi_handler(MSP_INT_MAC1, mac1_int_dispatch);133set_vi_handler(MSP_INT_SAR, mac2_int_dispatch);134set_vi_handler(MSP_INT_USB, usb_int_dispatch);135set_vi_handler(MSP_INT_SEC, sec_int_dispatch);136#ifdef CONFIG_MIPS_MT_SMP137msp_vsmp_int_init();138#elif defined CONFIG_MIPS_MT_SMTC139/*Set hwmask for all platform devices */140irq_hwmask[MSP_INT_MAC0] = C_IRQ0;141irq_hwmask[MSP_INT_MAC1] = C_IRQ1;142irq_hwmask[MSP_INT_USB] = C_IRQ2;143irq_hwmask[MSP_INT_SAR] = C_IRQ3;144irq_hwmask[MSP_INT_SEC] = C_IRQ5;145146#endif /* CONFIG_MIPS_MT_SMP */147#endif /* CONFIG_MIPS_MT */148/* setup the cascaded interrupts */149setup_irq(MSP_INT_CIC, &cic_cascade_msp);150setup_irq(MSP_INT_PER, &per_cascade_msp);151152#else153/* setup the 2nd-level SLP register based interrupt controller */154/* VSMP /SMTC support support is not enabled for SLP */155msp_slp_irq_init();156157/* setup the cascaded SLP/PER interrupts */158setup_irq(MSP_INT_SLP, &cic_cascade_msp);159setup_irq(MSP_INT_PER, &per_cascade_msp);160#endif161}162163164