Lines Matching +full:ls1021a +full:- +full:extirq

1 // SPDX-License-Identifier: GPL-2.0+
6 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
8 * Copyright (C) 1996-2001 Cort Dougan
29 * irq_of_parse_and_map - Parse and map an interrupt into linux virq space
48 * of_irq_find_parent - Given a device node, find its interrupt parent node
63 if (of_property_read_u32(child, "interrupt-parent", &parent)) { in of_irq_find_parent()
73 } while (p && of_get_property(p, "#interrupt-cells", NULL) == NULL); in of_irq_find_parent()
80 * These interrupt controllers abuse interrupt-map for unspeakable
89 "CBEA,platform-spider-pic",
90 "sti,platform-spider-pic",
91 "realtek,rtl-intc",
92 "fsl,ls1021a-extirq",
93 "fsl,ls1043a-extirq",
94 "fsl,ls1088a-extirq",
95 "renesas,rza1-irqc",
100 * of_irq_parse_raw - Low level interrupt tree parsing
104 * This function is a low-level interrupt tree walking function. It
108 * input, walks the tree looking for any interrupt-map properties, translates
120 int imaplen, match, i, rc = -EINVAL; in of_irq_parse_raw()
126 ipar = of_node_get(out_irq->np); in of_irq_parse_raw()
128 /* First get the #interrupt-cells property of the current cursor in of_irq_parse_raw()
129 * that tells us how to interpret the passed-in intspec. If there in of_irq_parse_raw()
133 if (!of_property_read_u32(ipar, "#interrupt-cells", &intsize)) in of_irq_parse_raw()
140 pr_debug(" -> no parent found !\n"); in of_irq_parse_raw()
146 if (out_irq->args_count != intsize) in of_irq_parse_raw()
149 /* Look for this #address-cells. We have to implement the old linux in of_irq_parse_raw()
150 * trick of looking for the parent here as some device-trees rely on it in of_irq_parse_raw()
154 tmp = of_get_property(old, "#address-cells", NULL); in of_irq_parse_raw()
163 pr_debug(" -> addrsize=%d\n", addrsize); in of_irq_parse_raw()
167 rc = -EFAULT; in of_irq_parse_raw()
171 /* Precalculate the match array - this simplifies match loop */ in of_irq_parse_raw()
175 initial_match_array[addrsize + i] = cpu_to_be32(out_irq->args[i]); in of_irq_parse_raw()
180 * Now check if cursor is an interrupt-controller and in of_irq_parse_raw()
182 * interrupt-map which takes precedence except on one in of_irq_parse_raw()
184 * interrupt-map themselves for $reason. in of_irq_parse_raw()
186 bool intc = of_property_read_bool(ipar, "interrupt-controller"); in of_irq_parse_raw()
188 imap = of_get_property(ipar, "interrupt-map", &imaplen); in of_irq_parse_raw()
191 pr_debug(" -> got it !\n"); in of_irq_parse_raw()
196 * interrupt-map parsing does not work without a reg in of_irq_parse_raw()
197 * property when #address-cells != 0 in of_irq_parse_raw()
200 pr_debug(" -> no reg passed in when needed !\n"); in of_irq_parse_raw()
206 pr_debug(" -> no map, getting parent\n"); in of_irq_parse_raw()
213 imask = of_get_property(ipar, "interrupt-map-mask", NULL); in of_irq_parse_raw()
217 /* Parse interrupt-map */ in of_irq_parse_raw()
222 for (i = 0; i < (addrsize + intsize); i++, imaplen--) in of_irq_parse_raw()
225 pr_debug(" -> match=%d (imaplen=%d)\n", match, imaplen); in of_irq_parse_raw()
233 --imaplen; in of_irq_parse_raw()
237 pr_debug(" -> imap parent not found !\n"); in of_irq_parse_raw()
244 /* Get #interrupt-cells and #address-cells of new in of_irq_parse_raw()
247 if (of_property_read_u32(newpar, "#interrupt-cells", in of_irq_parse_raw()
249 pr_debug(" -> parent lacks #interrupt-cells!\n"); in of_irq_parse_raw()
252 if (of_property_read_u32(newpar, "#address-cells", in of_irq_parse_raw()
256 pr_debug(" -> newintsize=%d, newaddrsize=%d\n", in of_irq_parse_raw()
262 rc = -EFAULT; in of_irq_parse_raw()
267 imaplen -= newaddrsize + newintsize; in of_irq_parse_raw()
269 pr_debug(" -> imaplen=%d\n", imaplen); in of_irq_parse_raw()
278 "%pOF interrupt-map failed, using interrupt-controller\n", in of_irq_parse_raw()
287 * Successfully parsed an interrupt-map translation; copy new in of_irq_parse_raw()
290 match_array = imap - newaddrsize - newintsize; in of_irq_parse_raw()
292 out_irq->args[i] = be32_to_cpup(imap - newintsize + i); in of_irq_parse_raw()
293 out_irq->args_count = intsize = newintsize; in of_irq_parse_raw()
297 pr_debug("%pOF interrupt-map entry to self\n", ipar); in of_irq_parse_raw()
303 out_irq->np = newpar; in of_irq_parse_raw()
304 pr_debug(" -> new parent: %pOF\n", newpar); in of_irq_parse_raw()
309 rc = -ENOENT; /* No interrupt-map found */ in of_irq_parse_raw()
320 * of_irq_parse_one - Resolve an interrupt for a device
345 /* Try the new-style interrupts-extended first */ in of_irq_parse_one()
346 res = of_parse_phandle_with_args(device, "interrupts-extended", in of_irq_parse_one()
347 "#interrupt-cells", index, out_irq); in of_irq_parse_one()
354 return -EINVAL; in of_irq_parse_one()
357 if (of_property_read_u32(p, "#interrupt-cells", &intsize)) { in of_irq_parse_one()
358 res = -EINVAL; in of_irq_parse_one()
365 out_irq->np = p; in of_irq_parse_one()
366 out_irq->args_count = intsize; in of_irq_parse_one()
370 out_irq->args + i); in of_irq_parse_one()
375 pr_debug(" intspec=%d\n", *out_irq->args); in of_irq_parse_one()
378 /* Check if there are any interrupt-map translations to process */ in of_irq_parse_one()
387 * of_irq_to_resource - Decode a node's IRQ and return it as a resource
389 * @index: zero-based index of the irq
406 * Get optional "interrupt-names" property to add a name in of_irq_to_resource()
409 of_property_read_string_index(dev, "interrupt-names", index, in of_irq_to_resource()
412 r->start = r->end = irq; in of_irq_to_resource()
413 r->flags = IORESOURCE_IRQ | irqd_get_trigger_type(irq_get_irq_data(irq)); in of_irq_to_resource()
414 r->name = name ? name : of_node_full_name(dev); in of_irq_to_resource()
422 * of_irq_get - Decode a node's IRQ and return it as a Linux IRQ number
424 * @index: zero-based index of the IRQ
427 * -EPROBE_DEFER if the IRQ domain is not yet created, or error code in case
442 rc = -EPROBE_DEFER; in of_irq_get()
455 * of_irq_get_byname - Decode a node's IRQ and return it as a Linux IRQ number
460 * -EPROBE_DEFER if the IRQ domain is not yet created, or error code in case
468 return -EINVAL; in of_irq_get_byname()
470 index = of_property_match_string(dev, "interrupt-names", name); in of_irq_get_byname()
479 * of_irq_count - Count the number of IRQs a node uses
494 * of_irq_to_resource_table - Fill in resource table with node's IRQ info
522 * of_irq_init - Scan and init matching interrupt controllers in DT
539 if (!of_property_read_bool(np, "interrupt-controller") || in of_irq_init()
543 if (WARN(!match->data, "of_irq_init: no init function for %s\n", in of_irq_init()
544 match->compatible)) in of_irq_init()
549 * pointer, interrupt-parent device_node etc. in of_irq_init()
557 desc->irq_init_cb = match->data; in of_irq_init()
558 desc->dev = of_node_get(np); in of_irq_init()
560 * interrupts-extended can reference multiple parent domains. in of_irq_init()
564 desc->interrupt_parent = of_parse_phandle(np, "interrupts-extended", 0); in of_irq_init()
565 if (!desc->interrupt_parent) in of_irq_init()
566 desc->interrupt_parent = of_irq_find_parent(np); in of_irq_init()
567 if (desc->interrupt_parent == np) { in of_irq_init()
568 of_node_put(desc->interrupt_parent); in of_irq_init()
569 desc->interrupt_parent = NULL; in of_irq_init()
571 list_add_tail(&desc->list, &intc_desc_list); in of_irq_init()
575 * The root irq controller is the one without an interrupt-parent. in of_irq_init()
588 if (desc->interrupt_parent != parent) in of_irq_init()
591 list_del(&desc->list); in of_irq_init()
593 of_node_set_flag(desc->dev, OF_POPULATED); in of_irq_init()
596 desc->dev, in of_irq_init()
597 desc->dev, desc->interrupt_parent); in of_irq_init()
598 ret = desc->irq_init_cb(desc->dev, in of_irq_init()
599 desc->interrupt_parent); in of_irq_init()
602 __func__, desc->dev, desc->dev, in of_irq_init()
603 desc->interrupt_parent); in of_irq_init()
604 of_node_clear_flag(desc->dev, OF_POPULATED); in of_irq_init()
613 list_add_tail(&desc->list, &intc_parent_list); in of_irq_init()
623 list_del(&desc->list); in of_irq_init()
624 parent = desc->dev; in of_irq_init()
629 list_del(&desc->list); in of_irq_init()
634 list_del(&desc->list); in of_irq_init()
635 of_node_put(desc->dev); in of_irq_init()
648 * "msi-map" property. in __of_msi_map_id()
650 for (parent_dev = dev; parent_dev; parent_dev = parent_dev->parent) in __of_msi_map_id()
651 if (!of_map_id(parent_dev->of_node, id_in, "msi-map", in __of_msi_map_id()
652 "msi-map-mask", np, &id_out)) in __of_msi_map_id()
658 * of_msi_map_id - Map a MSI ID for a device.
663 * Walk up the device hierarchy looking for devices with a "msi-map"
674 * of_msi_map_get_device_domain - Use msi-map to find the relevant MSI domain
679 * Walk up the device hierarchy looking for devices with a "msi-map"
694 * of_msi_get_domain - Use msi-parent to find the relevant MSI domain
699 * Parse the msi-parent property (both the simple and the complex
711 /* Check for a single msi-parent property */ in of_msi_get_domain()
712 msi_np = of_parse_phandle(np, "msi-parent", 0); in of_msi_get_domain()
713 if (msi_np && !of_property_read_bool(msi_np, "#msi-cells")) { in of_msi_get_domain()
721 /* Check for the complex msi-parent version */ in of_msi_get_domain()
725 while (!of_parse_phandle_with_args(np, "msi-parent", in of_msi_get_domain()
726 "#msi-cells", in of_msi_get_domain()
742 * of_msi_configure - Set the msi_domain field of a device