1 // SPDX-License-Identifier: GPL-2.0
3 * linux/arch/alpha/kernel/irq_pyxis.c
5 * Based on code written by David A Rusling (david.rusling@reo.mts.dec.com).
7 * IRQ Code common to all PYXIS core logic chips.
10 #include <linux/init.h>
11 #include <linux/sched.h>
12 #include <linux/irq.h>
15 #include <asm/core_cia.h>
21 /* Note mask bit is true for ENABLED irqs. */
22 static unsigned long cached_irq_mask
;
25 pyxis_update_irq_hw(unsigned long mask
)
27 *(vulp
)PYXIS_INT_MASK
= mask
;
29 *(vulp
)PYXIS_INT_MASK
;
33 pyxis_enable_irq(struct irq_data
*d
)
35 pyxis_update_irq_hw(cached_irq_mask
|= 1UL << (d
->irq
- 16));
39 pyxis_disable_irq(struct irq_data
*d
)
41 pyxis_update_irq_hw(cached_irq_mask
&= ~(1UL << (d
->irq
- 16)));
45 pyxis_mask_and_ack_irq(struct irq_data
*d
)
47 unsigned long bit
= 1UL << (d
->irq
- 16);
48 unsigned long mask
= cached_irq_mask
&= ~bit
;
50 /* Disable the interrupt. */
51 *(vulp
)PYXIS_INT_MASK
= mask
;
53 /* Ack PYXIS PCI interrupt. */
54 *(vulp
)PYXIS_INT_REQ
= bit
;
56 /* Re-read to force both writes. */
57 *(vulp
)PYXIS_INT_MASK
;
60 static struct irq_chip pyxis_irq_type
= {
62 .irq_mask_ack
= pyxis_mask_and_ack_irq
,
63 .irq_mask
= pyxis_disable_irq
,
64 .irq_unmask
= pyxis_enable_irq
,
68 pyxis_device_interrupt(unsigned long vector
)
73 /* Read the interrupt summary register of PYXIS */
74 pld
= *(vulp
)PYXIS_INT_REQ
;
75 pld
&= cached_irq_mask
;
78 * Now for every possible bit set, work through them and call
79 * the appropriate interrupt handler.
83 pld
&= pld
- 1; /* clear least bit set */
85 isa_device_interrupt(vector
);
92 init_pyxis_irqs(unsigned long ignore_mask
)
96 *(vulp
)PYXIS_INT_MASK
= 0; /* disable all */
97 *(vulp
)PYXIS_INT_REQ
= -1; /* flush all */
100 /* Send -INTA pulses to clear any pending interrupts ...*/
103 for (i
= 16; i
< 48; ++i
) {
104 if ((ignore_mask
>> i
) & 1)
106 irq_set_chip_and_handler(i
, &pyxis_irq_type
, handle_level_irq
);
107 irq_set_status_flags(i
, IRQ_LEVEL
);
110 if (request_irq(16 + 7, no_action
, 0, "isa-cascade", NULL
))
111 pr_err("Failed to register isa-cascade interrupt\n");