treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / arch / mips / dec / kn02-irq.c
blob7e18de5743bfb6351a018ac85580288ac0b57e6f
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * DECstation 5000/200 (KN02) Control and Status Register
4 * interrupts.
6 * Copyright (c) 2002, 2003, 2005 Maciej W. Rozycki
7 */
9 #include <linux/init.h>
10 #include <linux/irq.h>
11 #include <linux/types.h>
13 #include <asm/dec/kn02.h>
17 * Bits 7:0 of the Control Register are write-only -- the
18 * corresponding bits of the Status Register have a different
19 * meaning. Hence we use a cache. It speeds up things a bit
20 * as well.
22 * There is no default value -- it has to be initialized.
24 u32 cached_kn02_csr;
26 static int kn02_irq_base;
28 static void unmask_kn02_irq(struct irq_data *d)
30 volatile u32 *csr = (volatile u32 *)CKSEG1ADDR(KN02_SLOT_BASE +
31 KN02_CSR);
33 cached_kn02_csr |= (1 << (d->irq - kn02_irq_base + 16));
34 *csr = cached_kn02_csr;
37 static void mask_kn02_irq(struct irq_data *d)
39 volatile u32 *csr = (volatile u32 *)CKSEG1ADDR(KN02_SLOT_BASE +
40 KN02_CSR);
42 cached_kn02_csr &= ~(1 << (d->irq - kn02_irq_base + 16));
43 *csr = cached_kn02_csr;
46 static void ack_kn02_irq(struct irq_data *d)
48 mask_kn02_irq(d);
49 iob();
52 static struct irq_chip kn02_irq_type = {
53 .name = "KN02-CSR",
54 .irq_ack = ack_kn02_irq,
55 .irq_mask = mask_kn02_irq,
56 .irq_mask_ack = ack_kn02_irq,
57 .irq_unmask = unmask_kn02_irq,
60 void __init init_kn02_irqs(int base)
62 volatile u32 *csr = (volatile u32 *)CKSEG1ADDR(KN02_SLOT_BASE +
63 KN02_CSR);
64 int i;
66 /* Mask interrupts. */
67 cached_kn02_csr &= ~KN02_CSR_IOINTEN;
68 *csr = cached_kn02_csr;
69 iob();
71 for (i = base; i < base + KN02_IRQ_LINES; i++)
72 irq_set_chip_and_handler(i, &kn02_irq_type, handle_level_irq);
74 kn02_irq_base = base;