/*1* Copyright (C) 2004 Florian Schirmer <[email protected]>2*3* This program is free software; you can redistribute it and/or modify it4* under the terms of the GNU General Public License as published by the5* Free Software Foundation; either version 2 of the License, or (at your6* option) any later version.7*8* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED9* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF10* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN11* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,12* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT13* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF14* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON15* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT16* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF17* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.18*19* You should have received a copy of the GNU General Public License along20* with this program; if not, write to the Free Software Foundation, Inc.,21* 675 Mass Ave, Cambridge, MA 02139, USA.22*/2324#include "bcm47xx_private.h"2526#include <linux/types.h>27#include <linux/interrupt.h>28#include <linux/irq.h>29#include <asm/setup.h>30#include <asm/irq_cpu.h>31#include <bcm47xx.h>3233asmlinkage void plat_irq_dispatch(void)34{35u32 cause;3637cause = read_c0_cause() & read_c0_status() & CAUSEF_IP;3839clear_c0_status(cause);4041if (cause & CAUSEF_IP7)42do_IRQ(7);43if (cause & CAUSEF_IP2)44do_IRQ(2);45if (cause & CAUSEF_IP3)46do_IRQ(3);47if (cause & CAUSEF_IP4)48do_IRQ(4);49if (cause & CAUSEF_IP5)50do_IRQ(5);51if (cause & CAUSEF_IP6)52do_IRQ(6);53}5455#define DEFINE_HWx_IRQDISPATCH(x) \56static void bcm47xx_hw ## x ## _irqdispatch(void) \57{ \58do_IRQ(x); \59}60DEFINE_HWx_IRQDISPATCH(2)61DEFINE_HWx_IRQDISPATCH(3)62DEFINE_HWx_IRQDISPATCH(4)63DEFINE_HWx_IRQDISPATCH(5)64DEFINE_HWx_IRQDISPATCH(6)65DEFINE_HWx_IRQDISPATCH(7)6667void __init arch_init_irq(void)68{69/*70* This is the first arch callback after mm_init (we can use kmalloc),71* so let's finish bus initialization now.72*/73bcm47xx_bus_setup();7475#ifdef CONFIG_BCM47XX_BCMA76if (bcm47xx_bus_type == BCM47XX_BUS_TYPE_BCMA) {77bcma_write32(bcm47xx_bus.bcma.bus.drv_mips.core,78BCMA_MIPS_MIPS74K_INTMASK(5), 1 << 31);79/*80* the kernel reads the timer irq from some register and thinks81* it's #5, but we offset it by 2 and route to #782*/83cp0_compare_irq = 7;84}85#endif86mips_cpu_irq_init();8788if (cpu_has_vint) {89pr_info("Setting up vectored interrupts\n");90set_vi_handler(2, bcm47xx_hw2_irqdispatch);91set_vi_handler(3, bcm47xx_hw3_irqdispatch);92set_vi_handler(4, bcm47xx_hw4_irqdispatch);93set_vi_handler(5, bcm47xx_hw5_irqdispatch);94set_vi_handler(6, bcm47xx_hw6_irqdispatch);95set_vi_handler(7, bcm47xx_hw7_irqdispatch);96}97}9899100