Lines Matching +full:interrupt +full:- +full:src

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Support for the interrupt controllers found on Power Macintosh,
4 * currently Apple's "Grand Central" interrupt controller in all
18 #include <linux/interrupt.h>
30 #include <asm/pci-bridge.h>
61 static int pmac_irq_cascade = -1;
79 unsigned int src = irqd_to_hwirq(d); in pmac_mask_and_ack_irq() local
80 unsigned long bit = 1UL << (src & 0x1f); in pmac_mask_and_ack_irq()
81 int i = src >> 5; in pmac_mask_and_ack_irq()
85 __clear_bit(src, ppc_cached_irq_mask); in pmac_mask_and_ack_irq()
86 if (__test_and_clear_bit(src, ppc_lost_interrupts)) in pmac_mask_and_ack_irq()
88 out_le32(&pmac_irq_hw[i]->enable, ppc_cached_irq_mask[i]); in pmac_mask_and_ack_irq()
89 out_le32(&pmac_irq_hw[i]->ack, bit); in pmac_mask_and_ack_irq()
94 } while((in_le32(&pmac_irq_hw[i]->enable) & bit) in pmac_mask_and_ack_irq()
101 unsigned int src = irqd_to_hwirq(d); in pmac_ack_irq() local
102 unsigned long bit = 1UL << (src & 0x1f); in pmac_ack_irq()
103 int i = src >> 5; in pmac_ack_irq()
107 if (__test_and_clear_bit(src, ppc_lost_interrupts)) in pmac_ack_irq()
109 out_le32(&pmac_irq_hw[i]->ack, bit); in pmac_ack_irq()
110 (void)in_le32(&pmac_irq_hw[i]->ack); in pmac_ack_irq()
123 out_le32(&pmac_irq_hw[i]->enable, ppc_cached_irq_mask[i]); in __pmac_set_irq_mask()
129 } while((in_le32(&pmac_irq_hw[i]->enable) & bit) in __pmac_set_irq_mask()
134 * when the device interrupt is already on *doesn't* set in __pmac_set_irq_mask()
135 * the bit in the flag register or request another interrupt. in __pmac_set_irq_mask()
137 if (bit & ppc_cached_irq_mask[i] & in_le32(&pmac_irq_hw[i]->level)) in __pmac_set_irq_mask()
142 * edge interrupt, we clear any previous one on the controller
147 unsigned int src = irqd_to_hwirq(d); in pmac_startup_irq() local
148 unsigned long bit = 1UL << (src & 0x1f); in pmac_startup_irq()
149 int i = src >> 5; in pmac_startup_irq()
153 out_le32(&pmac_irq_hw[i]->ack, bit); in pmac_startup_irq()
154 __set_bit(src, ppc_cached_irq_mask); in pmac_startup_irq()
155 __pmac_set_irq_mask(src, 0); in pmac_startup_irq()
164 unsigned int src = irqd_to_hwirq(d); in pmac_mask_irq() local
167 __clear_bit(src, ppc_cached_irq_mask); in pmac_mask_irq()
168 __pmac_set_irq_mask(src, 1); in pmac_mask_irq()
175 unsigned int src = irqd_to_hwirq(d); in pmac_unmask_irq() local
178 __set_bit(src, ppc_cached_irq_mask); in pmac_unmask_irq()
179 __pmac_set_irq_mask(src, 0); in pmac_unmask_irq()
194 .name = "PMAC-PIC",
210 for (irq = max_irqs; (irq -= 32) >= max_real_irqs; ) { in gatwick_action()
212 bits = in_le32(&pmac_irq_hw[i]->event) | ppc_lost_interrupts[i]; in gatwick_action()
213 bits |= in_le32(&pmac_irq_hw[i]->level); in gatwick_action()
234 /* IPI's are a hack on the powersurge -- Cort */ in pmac_pic_get_irq()
240 for (irq = max_real_irqs; (irq -= 32) >= 0; ) { in pmac_pic_get_irq()
242 bits = in_le32(&pmac_irq_hw[i]->event) | ppc_lost_interrupts[i]; in pmac_pic_get_irq()
243 bits |= in_le32(&pmac_irq_hw[i]->level); in pmac_pic_get_irq()
267 return -EINVAL; in pmac_pic_host_map()
295 * Find the interrupt controller type & node in pmac_pic_probe_oldstyle()
306 } else if ((master = of_find_node_by_name(NULL, "mac-io")) != NULL) { in pmac_pic_probe_oldstyle()
313 slave = of_find_node_by_name(master, "mac-io"); in pmac_pic_probe_oldstyle()
364 max_irqs - max_real_irqs, pmac_irq_cascade); in pmac_pic_probe_oldstyle()
370 out_le32(&pmac_irq_hw[i]->enable, 0); in pmac_pic_probe_oldstyle()
376 pr_err("Failed to register cascade interrupt\n"); in pmac_pic_probe_oldstyle()
382 if (request_irq(i, xmon_irq, IRQF_NO_THREAD, "NMI - XMON", NULL)) in pmac_pic_probe_oldstyle()
383 pr_err("Failed to register NMI-XMON interrupt\n"); in pmac_pic_probe_oldstyle()
394 * Old machines just have a list of interrupt numbers in of_irq_parse_oldworld()
395 * and no interrupt-controller nodes. We also have dodgy in of_irq_parse_oldworld()
397 * missing behind pci-pci bridges and we have to get it in of_irq_parse_oldworld()
405 device = device->parent; in of_irq_parse_oldworld()
410 return -EINVAL; in of_irq_parse_oldworld()
414 return -EINVAL; in of_irq_parse_oldworld()
416 out_irq->np = NULL; in of_irq_parse_oldworld()
417 out_irq->args[0] = ints[index]; in of_irq_parse_oldworld()
418 out_irq->args_count = 1; in of_irq_parse_oldworld()
430 pswitch = of_find_node_by_name(NULL, "programmer-switch"); in pmac_pic_setup_mpic_nmi()
436 "NMI - XMON", NULL)) in pmac_pic_setup_mpic_nmi()
437 pr_err("Failed to register NMI-XMON interrupt\n"); in pmac_pic_setup_mpic_nmi()
453 if (of_property_read_bool(np, "big-endian")) in pmac_setup_one_mpic()
477 for_each_node_by_type(np, "open-pic") { in pmac_pic_probe_mpic()
496 return -ENODEV; in pmac_pic_probe_mpic()
534 * default interrupt controller (happens when booting with BootX). in pmac_pic_init()
541 for_each_node_with_property(np, "interrupt-controller") { in pmac_pic_init()
542 /* Skip /chosen/interrupt-controller */ in pmac_pic_init()
548 * interrupt controller too. */ in pmac_pic_init()
558 /* We first try to detect Apple's new Core99 chipset, since mac-io in pmac_pic_init()
572 * sleep_save_intrs() saves the states of all interrupt enables
574 * sleep_restore_intrs() restores the states of all interrupt enables.
584 int viaint = -1; in pmacpic_find_viaint()
591 np = of_find_node_by_name(NULL, "via-pmu"); in pmacpic_find_viaint()
612 out_le32(&pmac_irq_hw[0]->enable, ppc_cached_irq_mask[0]); in pmacpic_suspend()
614 out_le32(&pmac_irq_hw[1]->enable, ppc_cached_irq_mask[1]); in pmacpic_suspend()
615 (void)in_le32(&pmac_irq_hw[0]->event); in pmacpic_suspend()
618 (void)in_le32(&pmac_irq_hw[0]->enable); in pmacpic_suspend()
627 out_le32(&pmac_irq_hw[0]->enable, 0); in pmacpic_resume()
629 out_le32(&pmac_irq_hw[1]->enable, 0); in pmacpic_resume()