Path: blob/master/arch/mips/pmc-sierra/msp71xx/msp_irq_slp.c
15118 views
/*1* This file define the irq handler for MSP SLM subsystem interrupts.2*3* Copyright 2005-2006 PMC-Sierra, Inc, derived from irq_cpu.c4* Author: Andrew Hughes, [email protected]5*6* This program is free software; you can redistribute it and/or modify it7* under the terms of the GNU General Public License as published by the8* Free Software Foundation; either version 2 of the License, or (at your9* option) any later version.10*/1112#include <linux/init.h>13#include <linux/interrupt.h>14#include <linux/kernel.h>15#include <linux/bitops.h>1617#include <asm/mipsregs.h>18#include <asm/system.h>1920#include <msp_slp_int.h>21#include <msp_regs.h>2223static inline void unmask_msp_slp_irq(struct irq_data *d)24{25unsigned int irq = d->irq;2627/* check for PER interrupt range */28if (irq < MSP_PER_INTBASE)29*SLP_INT_MSK_REG |= (1 << (irq - MSP_SLP_INTBASE));30else31*PER_INT_MSK_REG |= (1 << (irq - MSP_PER_INTBASE));32}3334static inline void mask_msp_slp_irq(struct irq_data *d)35{36unsigned int irq = d->irq;3738/* check for PER interrupt range */39if (irq < MSP_PER_INTBASE)40*SLP_INT_MSK_REG &= ~(1 << (irq - MSP_SLP_INTBASE));41else42*PER_INT_MSK_REG &= ~(1 << (irq - MSP_PER_INTBASE));43}4445/*46* While we ack the interrupt interrupts are disabled and thus we don't need47* to deal with concurrency issues. Same for msp_slp_irq_end.48*/49static inline void ack_msp_slp_irq(struct irq_data *d)50{51unsigned int irq = d->irq;5253/* check for PER interrupt range */54if (irq < MSP_PER_INTBASE)55*SLP_INT_STS_REG = (1 << (irq - MSP_SLP_INTBASE));56else57*PER_INT_STS_REG = (1 << (irq - MSP_PER_INTBASE));58}5960static struct irq_chip msp_slp_irq_controller = {61.name = "MSP_SLP",62.irq_ack = ack_msp_slp_irq,63.irq_mask = mask_msp_slp_irq,64.irq_unmask = unmask_msp_slp_irq,65};6667void __init msp_slp_irq_init(void)68{69int i;7071/* Mask/clear interrupts. */72*SLP_INT_MSK_REG = 0x00000000;73*PER_INT_MSK_REG = 0x00000000;74*SLP_INT_STS_REG = 0xFFFFFFFF;75*PER_INT_STS_REG = 0xFFFFFFFF;7677/* initialize all the IRQ descriptors */78for (i = MSP_SLP_INTBASE; i < MSP_PER_INTBASE + 32; i++)79irq_set_chip_and_handler(i, &msp_slp_irq_controller,80handle_level_irq);81}8283void msp_slp_irq_dispatch(void)84{85u32 pending;86int intbase;8788intbase = MSP_SLP_INTBASE;89pending = *SLP_INT_STS_REG & *SLP_INT_MSK_REG;9091/* check for PER interrupt */92if (pending == (1 << (MSP_INT_PER - MSP_SLP_INTBASE))) {93intbase = MSP_PER_INTBASE;94pending = *PER_INT_STS_REG & *PER_INT_MSK_REG;95}9697/* check for spurious interrupt */98if (pending == 0x00000000) {99printk(KERN_ERR "Spurious %s interrupt?\n",100(intbase == MSP_SLP_INTBASE) ? "SLP" : "PER");101return;102}103104/* dispatch the irq */105do_IRQ(ffs(pending) + intbase - 1);106}107108109