Lines Matching +full:interrupt +full:- +full:src
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * External Interrupt Controller on Spider South Bridge
10 #include <linux/interrupt.h>
19 #include "interrupt.h"
21 /* register layout taken from Spider spec, table 7.4-4 */
65 unsigned int src) in spider_get_irq_config() argument
67 return pic->regs + TIR_CFGA + 8 * src; in spider_get_irq_config()
89 unsigned int src = irqd_to_hwirq(d); in spider_ack_irq() local
97 if (src < 47 || src > 50) in spider_ack_irq()
101 out_be32(pic->regs + TIR_EDC, 0x100 | (src & 0xf)); in spider_ack_irq()
116 return -EINVAL; in spider_set_irq_type()
134 return -EINVAL; in spider_set_irq_type()
139 * be the same as the interrupt source number. I don't know whether in spider_set_irq_type()
145 (pic->node_id << 4) | 0xe); in spider_set_irq_type()
162 irq_set_chip_data(virq, h->host_data); in spider_host_map()
176 /* Spider interrupts have 2 cells, first is the interrupt source, in spider_host_xlate()
178 * because old device-trees encode a node number in there in spider_host_xlate()
196 cs = in_be32(pic->regs + TIR_CS) >> 24; in spider_irq_cascade()
198 generic_handle_domain_irq(pic->host, cs); in spider_irq_cascade()
200 chip->irq_eoi(&desc->irq_data); in spider_irq_cascade()
203 /* For hooking up the cascade we have a problem. Our device-tree is
204 * crap and we don't know on which BE iic interrupt we are hooked on at
209 * interrupt-map property which is pretty strange.
219 of_node = irq_domain_get_of_node(pic->host); in spider_find_cascade_and_node()
222 * tree in case the device-tree is ever fixed in spider_find_cascade_and_node()
229 tmp = of_get_property(of_node, "#interrupt-cells", NULL); in spider_find_cascade_and_node()
233 imap = of_get_property(of_node, "interrupt-map", &imaplen); in spider_find_cascade_and_node()
240 tmp = of_get_property(iic, "#interrupt-cells", NULL); in spider_find_cascade_and_node()
246 /* Assume unit is last entry of interrupt specifier */ in spider_find_cascade_and_node()
247 unit = imap[intsize - 1]; in spider_find_cascade_and_node()
249 tmp = of_get_property(iic, "ibm,interrupt-server-ranges", NULL); in spider_find_cascade_and_node()
255 pic->node_id = (*tmp) >> 1; in spider_find_cascade_and_node()
262 /* Manufacture an IIC interrupt number of class 2 */ in spider_find_cascade_and_node()
264 (pic->node_id << IIC_IRQ_NODE_SHIFT) | in spider_find_cascade_and_node()
280 pic->regs = ioremap(addr, 0x1000); in spider_init_one()
281 if (pic->regs == NULL) in spider_init_one()
285 pic->host = irq_domain_add_linear(of_node, SPIDER_SRC_COUNT, in spider_init_one()
287 if (pic->host == NULL) in spider_init_one()
292 void __iomem *cfg = pic->regs + TIR_CFGA + 8 * i; in spider_init_one()
297 out_be32(pic->regs + TIR_MSK, 0x0); in spider_init_one()
299 /* enable interrupt packets to be output */ in spider_init_one()
300 out_be32(pic->regs + TIR_PIEN, in_be32(pic->regs + TIR_PIEN) | 0x1); in spider_init_one()
302 /* Hook up the cascade interrupt to the iic and nodeid */ in spider_init_one()
310 pic->node_id, addr, of_node); in spider_init_one()
312 /* Enable the interrupt detection enable bit. Do this last! */ in spider_init_one()
313 out_be32(pic->regs + TIR_DEN, in_be32(pic->regs + TIR_DEN) | 0x1); in spider_init_one()
326 * device-tree is bogus anyway) so all we can do is pray or maybe test in spider_init_IRQ()
327 * the address and deduce the node-id in spider_init_IRQ()
329 for_each_node_by_name(dn, "interrupt-controller") { in spider_init_IRQ()
330 if (of_device_is_compatible(dn, "CBEA,platform-spider-pic")) { in spider_init_IRQ()
332 printk(KERN_WARNING "spider-pic: Failed\n"); in spider_init_IRQ()
335 } else if (of_device_is_compatible(dn, "sti,platform-spider-pic") in spider_init_IRQ()