1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * DECstation 5000/200 (KN02) Control and Status Register
6 * Copyright (c) 2002, 2003, 2005 Maciej W. Rozycki
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
22 * There is no default value -- it has to be initialized.
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
+
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
+
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
)
52 static struct irq_chip kn02_irq_type
= {
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
+
66 /* Mask interrupts. */
67 cached_kn02_csr
&= ~KN02_CSR_IOINTEN
;
68 *csr
= cached_kn02_csr
;
71 for (i
= base
; i
< base
+ KN02_IRQ_LINES
; i
++)
72 irq_set_chip_and_handler(i
, &kn02_irq_type
, handle_level_irq
);