Path: blob/master/arch/mips/pmc-sierra/yosemite/irq.c
15118 views
/*1* Copyright (C) 2003 PMC-Sierra Inc.2* Author: Manish Lachwani ([email protected])3*4* Copyright (C) 2006 Ralf Baechle ([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*11* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED12* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF13* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN14* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,15* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT16* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF17* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON18* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT19* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF20* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.21*22* You should have received a copy of the GNU General Public License along23* with this program; if not, write to the Free Software Foundation, Inc.,24* 675 Mass Ave, Cambridge, MA 02139, USA.25*26* Second level Interrupt handlers for the PMC-Sierra Titan/Yosemite board27*/28#include <linux/errno.h>29#include <linux/init.h>30#include <linux/kernel_stat.h>31#include <linux/module.h>32#include <linux/signal.h>33#include <linux/sched.h>34#include <linux/types.h>35#include <linux/interrupt.h>36#include <linux/ioport.h>37#include <linux/irq.h>38#include <linux/timex.h>39#include <linux/random.h>40#include <linux/bitops.h>41#include <asm/bootinfo.h>42#include <asm/io.h>43#include <asm/irq.h>44#include <asm/irq_cpu.h>45#include <asm/mipsregs.h>46#include <asm/system.h>47#include <asm/titan_dep.h>4849/* Hypertransport specific */50#define IRQ_ACK_BITS 0x00000000 /* Ack bits */5152#define HYPERTRANSPORT_INTA 0x78 /* INTA# */53#define HYPERTRANSPORT_INTB 0x79 /* INTB# */54#define HYPERTRANSPORT_INTC 0x7a /* INTC# */55#define HYPERTRANSPORT_INTD 0x7b /* INTD# */5657extern void titan_mailbox_irq(void);5859#ifdef CONFIG_HYPERTRANSPORT60/*61* Handle hypertransport & SMP interrupts. The interrupt lines are scarce.62* For interprocessor interrupts, the best thing to do is to use the INTMSG63* register. We use the same external interrupt line, i.e. INTB3 and monitor64* another status bit65*/66static void ll_ht_smp_irq_handler(int irq)67{68u32 status = OCD_READ(RM9000x2_OCD_INTP0STATUS4);6970/* Ack all the bits that correspond to the interrupt sources */71if (status != 0)72OCD_WRITE(RM9000x2_OCD_INTP0STATUS4, IRQ_ACK_BITS);7374status = OCD_READ(RM9000x2_OCD_INTP1STATUS4);75if (status != 0)76OCD_WRITE(RM9000x2_OCD_INTP1STATUS4, IRQ_ACK_BITS);7778#ifdef CONFIG_HT_LEVEL_TRIGGER79/*80* Level Trigger Mode only. Send the HT EOI message back to the source.81*/82switch (status) {83case 0x1000000:84OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTA);85break;86case 0x2000000:87OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTB);88break;89case 0x4000000:90OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTC);91break;92case 0x8000000:93OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTD);94break;95case 0x0000001:96/* PLX */97OCD_WRITE(RM9000x2_OCD_HTEOI, 0x20);98OCD_WRITE(IRQ_CLEAR_REG, IRQ_ACK_BITS);99break;100case 0xf000000:101OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTA);102OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTB);103OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTC);104OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTD);105break;106}107#endif /* CONFIG_HT_LEVEL_TRIGGER */108109do_IRQ(irq);110}111#endif112113asmlinkage void plat_irq_dispatch(void)114{115unsigned int cause = read_c0_cause();116unsigned int status = read_c0_status();117unsigned int pending = cause & status;118119if (pending & STATUSF_IP7) {120do_IRQ(7);121} else if (pending & STATUSF_IP2) {122#ifdef CONFIG_HYPERTRANSPORT123ll_ht_smp_irq_handler(2);124#else125do_IRQ(2);126#endif127} else if (pending & STATUSF_IP3) {128do_IRQ(3);129} else if (pending & STATUSF_IP4) {130do_IRQ(4);131} else if (pending & STATUSF_IP5) {132#ifdef CONFIG_SMP133titan_mailbox_irq();134#else135do_IRQ(5);136#endif137} else if (pending & STATUSF_IP6) {138do_IRQ(4);139}140}141142/*143* Initialize the next level interrupt handler144*/145void __init arch_init_irq(void)146{147clear_c0_status(ST0_IM);148149mips_cpu_irq_init();150rm7k_cpu_irq_init();151rm9k_cpu_irq_init();152}153154155