/*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/delay.h>10#include <linux/interrupt.h>1112#include <loongson.h>13/*14* the first level int-handler will jump here if it is a bonito irq15*/16void bonito_irqdispatch(void)17{18u32 int_status;19int i;2021/* workaround the IO dma problem: let cpu looping to allow DMA finish */22int_status = LOONGSON_INTISR;23while (int_status & (1 << 10)) {24udelay(1);25int_status = LOONGSON_INTISR;26}2728/* Get pending sources, masked by current enables */29int_status = LOONGSON_INTISR & LOONGSON_INTEN;3031if (int_status) {32i = __ffs(int_status);33do_IRQ(LOONGSON_IRQ_BASE + i);34}35}3637asmlinkage void plat_irq_dispatch(void)38{39unsigned int pending;4041pending = read_c0_cause() & read_c0_status() & ST0_IM;4243/* machine-specific plat_irq_dispatch */44mach_irq_dispatch(pending);45}4647void __init arch_init_irq(void)48{49/*50* Clear all of the interrupts while we change the able around a bit.51* int-handler is not on bootstrap52*/53clear_c0_status(ST0_IM | ST0_BEV);5455/* no steer */56LOONGSON_INTSTEER = 0;5758/*59* Mask out all interrupt by writing "1" to all bit position in60* the interrupt reset reg.61*/62LOONGSON_INTENCLR = ~0;6364/* machine specific irq init */65mach_init_irq();66}676869