Lines Matching +full:a +full:- +full:child +full:- +full:node +full:- +full:property
5 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
7 * Copyright (C) 1996-2001 Cort Dougan
30 * irq_of_parse_and_map - Parse and map an interrupt into linux virq space
31 * @device: Device node of the device whose interrupt is to be mapped
34 * This function is a wrapper that chains of_irq_map_one() and
50 * of_irq_find_parent - Given a device node, find its interrupt parent node
51 * @child: pointer to device node
53 * Returns a pointer to the interrupt parent node, or NULL if the interrupt
56 struct device_node *of_irq_find_parent(struct device_node *child) in of_irq_find_parent() argument
61 if (!of_node_get(child)) in of_irq_find_parent()
65 parp = of_get_property(child, "interrupt-parent", NULL); in of_irq_find_parent()
67 p = of_get_parent(child); in of_irq_find_parent()
74 of_node_put(child); in of_irq_find_parent()
75 child = p; in of_irq_find_parent()
76 } while (p && of_get_property(p, "#interrupt-cells", NULL) == NULL); in of_irq_find_parent()
82 * of_irq_map_raw - Low level interrupt tree parsing
84 * @intspec: interrupt specifier ("interrupts" property of the device)
86 * @addr: address specifier (start of "reg" property of the device)
89 * Returns 0 on success and a negative number on error
91 * This function is a low-level interrupt tree walking function. It
92 * can be used to do a partial walk with synthetized reg and interrupts
94 * node exist for the parent.
105 parent->full_name, be32_to_cpup(intspec), in of_irq_map_raw()
110 /* First get the #interrupt-cells property of the current cursor in of_irq_map_raw()
111 * that tells us how to interpret the passed-in intspec. If there in of_irq_map_raw()
115 tmp = of_get_property(ipar, "#interrupt-cells", NULL); in of_irq_map_raw()
125 pr_debug(" -> no parent found !\n"); in of_irq_map_raw()
129 pr_debug("of_irq_map_raw: ipar=%s, size=%d\n", ipar->full_name, intsize); in of_irq_map_raw()
132 return -EINVAL; in of_irq_map_raw()
134 /* Look for this #address-cells. We have to implement the old linux in of_irq_map_raw()
135 * trick of looking for the parent here as some device-trees rely on it in of_irq_map_raw()
139 tmp = of_get_property(old, "#address-cells", NULL); in of_irq_map_raw()
148 pr_debug(" -> addrsize=%d\n", addrsize); in of_irq_map_raw()
152 /* Now check if cursor is an interrupt-controller and if it is in of_irq_map_raw()
155 if (of_get_property(ipar, "interrupt-controller", NULL) != in of_irq_map_raw()
157 pr_debug(" -> got it !\n"); in of_irq_map_raw()
159 out_irq->specifier[i] = in of_irq_map_raw()
161 out_irq->size = intsize; in of_irq_map_raw()
162 out_irq->controller = ipar; in of_irq_map_raw()
167 /* Now look for an interrupt-map */ in of_irq_map_raw()
168 imap = of_get_property(ipar, "interrupt-map", &imaplen); in of_irq_map_raw()
171 pr_debug(" -> no map, getting parent\n"); in of_irq_map_raw()
177 /* Look for a mask */ in of_irq_map_raw()
178 imask = of_get_property(ipar, "interrupt-map-mask", NULL); in of_irq_map_raw()
180 /* If we were passed no "reg" property and we attempt to parse in of_irq_map_raw()
181 * an interrupt-map, then #address-cells must be 0. in of_irq_map_raw()
185 pr_debug(" -> no reg passed in when needed !\n"); in of_irq_map_raw()
189 /* Parse interrupt-map */ in of_irq_map_raw()
201 ((intspec[i-addrsize] ^ imap[i]) & mask) == 0; in of_irq_map_raw()
204 imaplen -= addrsize + intsize; in of_irq_map_raw()
206 pr_debug(" -> match=%d (imaplen=%d)\n", match, imaplen); in of_irq_map_raw()
214 --imaplen; in of_irq_map_raw()
218 pr_debug(" -> imap parent not found !\n"); in of_irq_map_raw()
222 /* Get #interrupt-cells and #address-cells of new in of_irq_map_raw()
225 tmp = of_get_property(newpar, "#interrupt-cells", NULL); in of_irq_map_raw()
227 pr_debug(" -> parent lacks #interrupt-cells!\n"); in of_irq_map_raw()
231 tmp = of_get_property(newpar, "#address-cells", NULL); in of_irq_map_raw()
234 pr_debug(" -> newintsize=%d, newaddrsize=%d\n", in of_irq_map_raw()
242 imaplen -= newaddrsize + newintsize; in of_irq_map_raw()
244 pr_debug(" -> imaplen=%d\n", imaplen); in of_irq_map_raw()
253 intspec = imap - intsize; in of_irq_map_raw()
254 addr = intspec - addrsize; in of_irq_map_raw()
258 pr_debug(" -> new parent: %s\n", newpar ? newpar->full_name : "<>"); in of_irq_map_raw()
268 return -EINVAL; in of_irq_map_raw()
273 * of_irq_map_one - Resolve an interrupt for a device
278 * This function resolves an interrupt, walking the tree, for a given
279 * device-tree node. It's the high level pendant to of_irq_map_raw().
286 int res = -EINVAL; in of_irq_map_one()
288 pr_debug("of_irq_map_one: dev=%s, index=%d\n", device->full_name, index); in of_irq_map_one()
294 /* Get the interrupts property */ in of_irq_map_one()
297 return -EINVAL; in of_irq_map_one()
302 /* Get the reg property (if any) */ in of_irq_map_one()
308 return -EINVAL; in of_irq_map_one()
311 tmp = of_get_property(p, "#interrupt-cells", NULL); in of_irq_map_one()
332 * of_irq_to_resource - Decode a node's IRQ and return it as a resource
333 * @dev: pointer to device tree node
334 * @index: zero-based index of the irq
347 * Get optional "interrupts-names" property to add a name in of_irq_to_resource()
350 of_property_read_string_index(dev, "interrupt-names", index, in of_irq_to_resource()
353 r->start = r->end = irq; in of_irq_to_resource()
354 r->flags = IORESOURCE_IRQ; in of_irq_to_resource()
355 r->name = name ? name : dev->full_name; in of_irq_to_resource()
363 * of_irq_count - Count the number of IRQs a node uses
364 * @dev: pointer to device tree node
377 * of_irq_to_resource_table - Fill in resource table with node's IRQ info
378 * @dev: pointer to device tree node
403 * of_irq_init - Scan and init matching interrupt controllers in DT
419 if (!of_find_property(np, "interrupt-controller", NULL)) in of_irq_init()
422 * Here, we allocate and populate an intc_desc with the node in of_irq_init()
423 * pointer, interrupt-parent device_node etc. in of_irq_init()
429 desc->dev = np; in of_irq_init()
430 desc->interrupt_parent = of_irq_find_parent(np); in of_irq_init()
431 if (desc->interrupt_parent == np) in of_irq_init()
432 desc->interrupt_parent = NULL; in of_irq_init()
433 list_add_tail(&desc->list, &intc_desc_list); in of_irq_init()
437 * The root irq controller is the one without an interrupt-parent. in of_irq_init()
445 * The assumption is that NULL parent means a root controller. in of_irq_init()
452 if (desc->interrupt_parent != parent) in of_irq_init()
455 list_del(&desc->list); in of_irq_init()
456 match = of_match_node(matches, desc->dev); in of_irq_init()
457 if (WARN(!match->data, in of_irq_init()
459 match->compatible)) { in of_irq_init()
465 match->compatible, in of_irq_init()
466 desc->dev, desc->interrupt_parent); in of_irq_init()
467 irq_init_cb = match->data; in of_irq_init()
468 ret = irq_init_cb(desc->dev, desc->interrupt_parent); in of_irq_init()
476 * its children can get processed in a subsequent pass. in of_irq_init()
478 list_add_tail(&desc->list, &intc_parent_list); in of_irq_init()
487 list_del(&desc->list); in of_irq_init()
488 parent = desc->dev; in of_irq_init()
493 list_del(&desc->list); in of_irq_init()
498 list_del(&desc->list); in of_irq_init()