Lines Matching +full:host +full:- +full:to +full:- +full:chip
1 // SPDX-License-Identifier: GPL-2.0-or-later
21 /* register layout taken from Spider spec, table 7.4-4 */
53 struct irq_domain *host; member
67 return pic->regs + TIR_CFGA + 8 * src; in spider_get_irq_config()
96 /* Only interrupts 47 to 50 can be set to edge */ 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()
138 * that I've kept around is the priority to the BE which I set to in spider_set_irq_type()
140 * that's supposed to make any kind of sense however, we'll have to 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()
178 * because old device-trees encode a node number in there in spider_host_xlate()
192 struct irq_chip *chip = irq_desc_get_chip(desc); in spider_irq_cascade() local
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
206 * informations though: which BE node we are connected to and whether
207 * we are connected to IOIF0 or IOIF1. Right now, we really only care
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()
247 unit = imap[intsize - 1]; in spider_find_cascade_and_node()
248 /* Ok, we have a unit, now let's try to get the node */ 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()
259 * the iic host from the iic OF node, but that way I'm still compatible in spider_find_cascade_and_node()
264 (pic->node_id << IIC_IRQ_NODE_SHIFT) | in spider_find_cascade_and_node()
268 printk(KERN_ERR "spider_pic: failed to map cascade !"); in spider_find_cascade_and_node()
273 static void __init spider_init_one(struct device_node *of_node, int chip, in spider_init_one() argument
276 struct spider_pic *pic = &spider_pics[chip]; in spider_init_one()
280 pic->regs = ioremap(addr, 0x1000); in spider_init_one()
281 if (pic->regs == NULL) in spider_init_one()
284 /* Allocate a host */ 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()
288 panic("spider_pic: can't allocate irq host !"); 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()
313 out_be32(pic->regs + TIR_DEN, in_be32(pic->regs + TIR_DEN) | 0x1); in spider_init_one()
320 int chip = 0; in spider_init_IRQ() local
324 * we need to get the node from the device tree instead. in spider_init_IRQ()
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()
336 && (chip < 2)) { in spider_init_IRQ()
339 r.start = hard_coded_pics[chip]; in spider_init_IRQ()
342 spider_init_one(dn, chip++, r.start); in spider_init_IRQ()