Lines Matching +full:a +full:- +full:child +full:- +full:node +full:- +full:property

18 #include <linux/dma-mapping.h>
27 { .compatible = "simple-bus", },
29 { .compatible = "arm,amba-bus", },
36 return dev->of_node == data; in of_dev_node_match()
40 * of_find_device_by_node - Find the platform_device associated with a node
41 * @np: Pointer to device tree node
60 * The following routines scan a subtree and registers a device for
61 * each applicable node.
63 * Note: sparc doesn't use these routines because it has a different
68 * of_device_make_bus_id - Use the device node data to assign a unique name
69 * @dev: pointer to device structure that is linked to a device tree node
71 * This routine will first try using either the dcr-reg or the reg property
72 * value to derive a unique name. As a last resort it will use the node
73 * name followed by a unique number.
78 struct device_node *node = dev->of_node; in of_device_make_bus_id() local
85 * If it's a DCR based device, use 'd' for native DCRs in of_device_make_bus_id()
88 reg = of_get_property(node, "dcr-reg", NULL); in of_device_make_bus_id()
91 dev_set_name(dev, "d%x.%s", *reg, node->name); in of_device_make_bus_id()
93 u64 addr = of_translate_dcr_address(node, *reg, NULL); in of_device_make_bus_id()
96 (unsigned long long)addr, node->name); in of_device_make_bus_id()
106 reg = of_get_property(node, "reg", NULL); in of_device_make_bus_id()
108 addr = of_translate_address(node, reg); in of_device_make_bus_id()
111 (unsigned long long)addr, node->name); in of_device_make_bus_id()
117 * No BusID, use the node name and add a globally incremented in of_device_make_bus_id()
121 dev_set_name(dev, "%s.%d", node->name, magic - 1); in of_device_make_bus_id()
125 * of_device_alloc - Allocate and initialize an of_device
126 * @np: device node to assign to device
138 dev = platform_device_alloc("", -1); in of_device_alloc()
155 dev->num_resources = num_reg + num_irq; in of_device_alloc()
156 dev->resource = res; in of_device_alloc()
164 dev->dev.of_node = of_node_get(np); in of_device_alloc()
166 dev->dev.dma_mask = &dev->archdata.dma_mask; in of_device_alloc()
168 dev->dev.parent = parent; in of_device_alloc()
171 dev_set_name(&dev->dev, "%s", bus_id); in of_device_alloc()
173 of_device_make_bus_id(&dev->dev); in of_device_alloc()
180 * of_platform_device_create_pdata - Alloc, initialize and register an of_device
181 * @np: pointer to node to create device for
186 * Returns pointer to created platform device, or NULL if a device was not
205 dev->archdata.dma_mask = 0xffffffffUL; in of_platform_device_create_pdata()
207 dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); in of_platform_device_create_pdata()
208 dev->dev.bus = &platform_bus_type; in of_platform_device_create_pdata()
209 dev->dev.platform_data = platform_data; in of_platform_device_create_pdata()
213 * to do such, possibly using a device notifier in of_platform_device_create_pdata()
225 * of_platform_device_create - Alloc, initialize and register an of_device
226 * @np: pointer to node to create device for
230 * Returns pointer to created platform device, or NULL if a device was not
242 static struct amba_device *of_amba_device_create(struct device_node *node, in of_amba_device_create() argument
251 pr_debug("Creating amba device %s\n", node->full_name); in of_amba_device_create()
253 if (!of_device_is_available(node)) in of_amba_device_create()
261 dev->dev.coherent_dma_mask = ~0; in of_amba_device_create()
262 dev->dev.of_node = of_node_get(node); in of_amba_device_create()
263 dev->dev.parent = parent; in of_amba_device_create()
264 dev->dev.platform_data = platform_data; in of_amba_device_create()
266 dev_set_name(&dev->dev, "%s", bus_id); in of_amba_device_create()
268 of_device_make_bus_id(&dev->dev); in of_amba_device_create()
270 /* setup amba-specific device info */ in of_amba_device_create()
271 dev->dma_mask = ~0; in of_amba_device_create()
274 prop = of_get_property(node, "arm,primecell-periphid", NULL); in of_amba_device_create()
276 dev->periphid = of_read_ulong(prop, 1); in of_amba_device_create()
280 dev->irq[i] = irq_of_parse_and_map(node, i); in of_amba_device_create()
282 ret = of_address_to_resource(node, 0, &dev->res); in of_amba_device_create()
297 static struct amba_device *of_amba_device_create(struct device_node *node, in of_amba_device_create() argument
307 * of_devname_lookup() - Given a device node, lookup the preferred Linux name
317 for(; lookup->compatible != NULL; lookup++) { in of_dev_lookup()
318 if (!of_device_is_compatible(np, lookup->compatible)) in of_dev_lookup()
322 if (res.start != lookup->phys_addr) in of_dev_lookup()
324 pr_debug("%s: devname=%s\n", np->full_name, lookup->name); in of_dev_lookup()
332 * of_platform_bus_create() - Create a device for a node and its children.
333 * @bus: device node of the bus to instantiate
337 * @strict: require compatible property
339 * Creates a platform_device for the provided device_node, and optionally
340 * recursively create devices for all the child nodes.
348 struct device_node *child; in of_platform_bus_create() local
354 /* Make sure it has a compatible property */ in of_platform_bus_create()
356 pr_debug("%s() - skipping %s, no compatible prop\n", in of_platform_bus_create()
357 __func__, bus->full_name); in of_platform_bus_create()
363 bus_id = auxdata->name; in of_platform_bus_create()
364 platform_data = auxdata->platform_data; in of_platform_bus_create()
376 for_each_child_of_node(bus, child) { in of_platform_bus_create()
377 pr_debug(" create child: %s\n", child->full_name); in of_platform_bus_create()
378 rc = of_platform_bus_create(child, matches, lookup, &dev->dev, strict); in of_platform_bus_create()
380 of_node_put(child); in of_platform_bus_create()
388 * of_platform_bus_probe() - Probe the device-tree for platform buses
400 struct device_node *child; in of_platform_bus_probe() local
405 return -EINVAL; in of_platform_bus_probe()
408 pr_debug(" starting at: %s\n", root->full_name); in of_platform_bus_probe()
410 /* Do a self check of bus type, if there's a match, create children */ in of_platform_bus_probe()
413 } else for_each_child_of_node(root, child) { in of_platform_bus_probe()
414 if (!of_match_node(matches, child)) in of_platform_bus_probe()
416 rc = of_platform_bus_create(child, matches, NULL, parent, false); in of_platform_bus_probe()
427 * of_platform_populate() - Populate platform_devices from device tree data
434 * convention of requiring all device nodes to have a 'compatible' property,
436 * node (of_platform_bus_probe will only create children of the root which
449 struct device_node *child; in of_platform_populate() local
454 return -EINVAL; in of_platform_populate()
456 for_each_child_of_node(root, child) { in of_platform_populate()
457 rc = of_platform_bus_create(child, matches, lookup, parent, true); in of_platform_populate()