Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  * Copyright 2001 MontaVista Software Inc.
0004  * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
0005  * Copyright (C) 2000, 2001 Ralf Baechle (ralf@gnu.org)
0006  *
0007  * Copyright (C) 2007 Lemote Inc. & Institute of Computing Technology
0008  * Author: Fuxin Zhang, zhangfx@lemote.com
0009  */
0010 #include <linux/interrupt.h>
0011 #include <linux/compiler.h>
0012 
0013 #include <loongson.h>
0014 
0015 static inline void bonito_irq_enable(struct irq_data *d)
0016 {
0017     LOONGSON_INTENSET = (1 << (d->irq - LOONGSON_IRQ_BASE));
0018     mmiowb();
0019 }
0020 
0021 static inline void bonito_irq_disable(struct irq_data *d)
0022 {
0023     LOONGSON_INTENCLR = (1 << (d->irq - LOONGSON_IRQ_BASE));
0024     mmiowb();
0025 }
0026 
0027 static struct irq_chip bonito_irq_type = {
0028     .name       = "bonito_irq",
0029     .irq_mask   = bonito_irq_disable,
0030     .irq_unmask = bonito_irq_enable,
0031 };
0032 
0033 void bonito_irq_init(void)
0034 {
0035     u32 i;
0036 
0037     for (i = LOONGSON_IRQ_BASE; i < LOONGSON_IRQ_BASE + 32; i++)
0038         irq_set_chip_and_handler(i, &bonito_irq_type,
0039                      handle_level_irq);
0040 
0041 #ifdef CONFIG_CPU_LOONGSON2E
0042     i = LOONGSON_IRQ_BASE + 10;
0043     if (request_irq(i, no_action, 0, "dma_timeout", NULL))
0044         pr_err("Failed to request irq %d (dma_timeout)\n", i);
0045 #endif
0046 }