Lines Matching +full:reg +full:- +full:names
1 // SPDX-License-Identifier: GPL-2.0+
16 #include <linux/dma-mapping.h>
26 { .compatible = "simple-bus", },
27 { .compatible = "simple-mfd", },
30 { .compatible = "arm,amba-bus", },
36 { .compatible = "operating-points-v2", },
41 * of_find_device_by_node - Find the platform_device associated with a node
68 * of_device_make_bus_id - Use the device node data to assign a unique name
72 * derive a unique name. If it cannot, then it will prepend names from
77 struct device_node *node = dev->of_node; in of_device_make_bus_id()
78 const __be32 *reg; in of_device_make_bus_id() local
82 while (node->parent) { in of_device_make_bus_id()
87 reg = of_get_property(node, "reg", NULL); in of_device_make_bus_id()
88 if (reg && (addr = of_translate_address(node, reg)) != OF_BAD_ADDR) { in of_device_make_bus_id()
96 kbasename(node->full_name), dev_name(dev)); in of_device_make_bus_id()
97 node = node->parent; in of_device_make_bus_id()
102 * of_device_alloc - Allocate and initialize an of_device
132 dev->num_resources = num_reg + num_irq; in of_device_alloc()
133 dev->resource = res; in of_device_alloc()
143 dev->dev.of_node = of_node_get(np); in of_device_alloc()
144 dev->dev.fwnode = &np->fwnode; in of_device_alloc()
145 dev->dev.parent = parent ? : &platform_bus; in of_device_alloc()
148 dev_set_name(&dev->dev, "%s", bus_id); in of_device_alloc()
150 of_device_make_bus_id(&dev->dev); in of_device_alloc()
157 * of_platform_device_create_pdata - Alloc, initialize and register an of_device
182 dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); in of_platform_device_create_pdata()
183 if (!dev->dev.dma_mask) in of_platform_device_create_pdata()
184 dev->dev.dma_mask = &dev->dev.coherent_dma_mask; in of_platform_device_create_pdata()
185 dev->dev.bus = &platform_bus_type; in of_platform_device_create_pdata()
186 dev->dev.platform_data = platform_data; in of_platform_device_create_pdata()
187 of_msi_configure(&dev->dev, dev->dev.of_node); in of_platform_device_create_pdata()
202 * of_platform_device_create - Alloc, initialize and register an of_device
239 dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); in of_amba_device_create()
240 dev->dev.dma_mask = &dev->dev.coherent_dma_mask; in of_amba_device_create()
243 dev->dev.of_node = of_node_get(node); in of_amba_device_create()
244 dev->dev.fwnode = &node->fwnode; in of_amba_device_create()
245 dev->dev.parent = parent ? : &platform_bus; in of_amba_device_create()
246 dev->dev.platform_data = platform_data; in of_amba_device_create()
248 dev_set_name(&dev->dev, "%s", bus_id); in of_amba_device_create()
250 of_device_make_bus_id(&dev->dev); in of_amba_device_create()
253 prop = of_get_property(node, "arm,primecell-periphid", NULL); in of_amba_device_create()
255 dev->periphid = of_read_ulong(prop, 1); in of_amba_device_create()
259 dev->irq[i] = irq_of_parse_and_map(node, i); in of_amba_device_create()
261 ret = of_address_to_resource(node, 0, &dev->res); in of_amba_device_create()
294 * of_dev_lookup() - Given a device node, lookup the preferred Linux name
307 for (; auxdata->compatible; auxdata++) { in of_dev_lookup()
308 if (!of_device_is_compatible(np, auxdata->compatible)) in of_dev_lookup()
312 if (res.start != auxdata->phys_addr) in of_dev_lookup()
314 pr_debug("%pOF: devname=%s\n", np, auxdata->name); in of_dev_lookup()
323 for (; auxdata->compatible; auxdata++) { in of_dev_lookup()
324 if (!of_device_is_compatible(np, auxdata->compatible)) in of_dev_lookup()
326 if (!auxdata->phys_addr && !auxdata->name) { in of_dev_lookup()
336 * of_platform_bus_create() - Create a device for a node and its children.
360 pr_debug("%s() - skipping %pOF, no compatible prop\n", in of_platform_bus_create()
367 pr_debug("%s() - skipping %pOF node\n", __func__, bus); in of_platform_bus_create()
372 pr_debug("%s() - skipping %pOF, already populated\n", in of_platform_bus_create()
379 bus_id = auxdata->name; in of_platform_bus_create()
380 platform_data = auxdata->platform_data; in of_platform_bus_create()
398 rc = of_platform_bus_create(child, matches, lookup, &dev->dev, strict); in of_platform_bus_create()
409 * of_platform_bus_probe() - Probe the device-tree for platform buses
426 return -EINVAL; in of_platform_bus_probe()
450 * of_platform_populate() - Populate platform_devices from device tree data
478 return -EINVAL; in of_platform_populate()
511 { .compatible = "qcom,rmtfs-mem" },
512 { .compatible = "qcom,cmd-db" },
524 return -ENODEV; in of_platform_default_populate_init()
528 * platform_devices for every node in /reserved-memory with a in of_platform_default_populate_init()
560 if (!dev->of_node || !of_node_check_flag(dev->of_node, OF_POPULATED)) in of_platform_device_destroy()
564 if (of_node_check_flag(dev->of_node, OF_POPULATED_BUS)) in of_platform_device_destroy()
567 of_node_clear_flag(dev->of_node, OF_POPULATED); in of_platform_device_destroy()
568 of_node_clear_flag(dev->of_node, OF_POPULATED_BUS); in of_platform_device_destroy()
570 if (dev->bus == &platform_bus_type) in of_platform_device_destroy()
573 else if (dev->bus == &amba_bustype) in of_platform_device_destroy()
582 * of_platform_depopulate() - Remove devices populated from device tree
588 * leaving others - eg. manually created - unharmed).
592 if (parent->of_node && of_node_check_flag(parent->of_node, OF_POPULATED_BUS)) { in of_platform_depopulate()
594 of_node_clear_flag(parent->of_node, OF_POPULATED_BUS); in of_platform_depopulate()
605 * devm_of_platform_populate() - Populate platform_devices from device tree data
619 return -EINVAL; in devm_of_platform_populate()
624 return -ENOMEM; in devm_of_platform_populate()
626 ret = of_platform_populate(dev->of_node, NULL, NULL, dev); in devm_of_platform_populate()
651 * devm_of_platform_depopulate() - Remove devices populated from device tree
657 * leaving others - eg. manually created - unharmed).
681 if (!of_node_check_flag(rd->dn->parent, OF_POPULATED_BUS)) in of_platform_notify()
685 if (of_node_check_flag(rd->dn, OF_POPULATED)) in of_platform_notify()
689 pdev_parent = of_find_device_by_node(rd->dn->parent); in of_platform_notify()
690 pdev = of_platform_device_create(rd->dn, NULL, in of_platform_notify()
691 pdev_parent ? &pdev_parent->dev : NULL); in of_platform_notify()
696 __func__, rd->dn); in of_platform_notify()
698 return notifier_from_errno(-EINVAL); in of_platform_notify()
705 if (!of_node_check_flag(rd->dn, OF_POPULATED)) in of_platform_notify()
709 pdev = of_find_device_by_node(rd->dn); in of_platform_notify()
714 of_platform_device_destroy(&pdev->dev, &children_left); in of_platform_notify()