// SPDX-License-Identifier: GPL-2.0-or-later1/*2* Copyright (C) 2007 Lemote Inc. & Institute of Computing Technology3* Author: Fuxin Zhang, [email protected]4*/5#include <linux/delay.h>6#include <linux/interrupt.h>78#include <loongson.h>9/*10* the first level int-handler will jump here if it is a bonito irq11*/12void bonito_irqdispatch(void)13{14u32 int_status;15int i;1617/* workaround the IO dma problem: let cpu looping to allow DMA finish */18int_status = LOONGSON_INTISR;19while (int_status & (1 << 10)) {20udelay(1);21int_status = LOONGSON_INTISR;22}2324/* Get pending sources, masked by current enables */25int_status = LOONGSON_INTISR & LOONGSON_INTEN;2627if (int_status) {28i = __ffs(int_status);29do_IRQ(LOONGSON_IRQ_BASE + i);30}31}3233asmlinkage void plat_irq_dispatch(void)34{35unsigned int pending;3637pending = read_c0_cause() & read_c0_status() & ST0_IM;3839/* machine-specific plat_irq_dispatch */40mach_irq_dispatch(pending);41}4243void __init arch_init_irq(void)44{45/*46* Clear all of the interrupts while we change the able around a bit.47* int-handler is not on bootstrap48*/49clear_c0_status(ST0_IM | ST0_BEV);5051/* no steer */52LOONGSON_INTSTEER = 0;5354/*55* Mask out all interrupt by writing "1" to all bit position in56* the interrupt reset reg.57*/58LOONGSON_INTENCLR = ~0;5960/* machine specific irq init */61mach_init_irq();62}636465