14 #include <linux/errno.h>
15 #include <linux/module.h>
17 #include <linux/device.h>
19 #include <linux/slab.h>
27 { .compatible =
"simple-bus", },
28 #ifdef CONFIG_ARM_AMBA
29 { .compatible =
"arm,amba-bus", },
54 #if defined(CONFIG_PPC_DCR)
58 #ifdef CONFIG_OF_ADDRESS
75 void of_device_make_bus_id(
struct device *
dev)
91 #ifdef CONFIG_PPC_DCR_NATIVE
94 u64 addr = of_translate_dcr_address(node, *reg,
NULL);
95 if (addr != OF_BAD_ADDR) {
97 (
unsigned long long)addr, node->
name);
114 addr = of_read_number(addrp, 1);
118 if (addr != OF_BAD_ADDR) {
120 (
unsigned long long)addr, node->
name);
144 int rc,
i, num_reg = 0, num_irq;
158 if (num_irq || num_reg) {
159 res = kzalloc(
sizeof(*res) * (num_irq + num_reg),
GFP_KERNEL);
167 for (i = 0; i < num_reg; i++, res++) {
174 dev->
dev.of_node = of_node_get(np);
175 #if defined(CONFIG_MICROBLAZE)
183 of_device_make_bus_id(&dev->
dev);
210 dev = of_device_alloc(np, bus_id, parent);
214 #if defined(CONFIG_MICROBLAZE)
219 dev->
dev.platform_data = platform_data;
247 return of_platform_device_create_pdata(np, bus_id,
NULL, parent);
251 #ifdef CONFIG_ARM_AMBA
271 dev->
dev.coherent_dma_mask = ~0;
272 dev->
dev.of_node = of_node_get(node);
273 dev->
dev.parent = parent;
274 dev->
dev.platform_data = platform_data;
278 of_device_make_bus_id(&dev->
dev);
286 dev->
periphid = of_read_ulong(prop, 1);
319 static const struct of_dev_auxdata *of_dev_lookup(
const struct of_dev_auxdata *
lookup,
327 for(; lookup->compatible !=
NULL; lookup++) {
331 if (res.
start != lookup->phys_addr)
353 const struct of_dev_auxdata *lookup,
354 struct device *parent,
bool strict)
356 const struct of_dev_auxdata *auxdata;
359 const char *bus_id =
NULL;
360 void *platform_data =
NULL;
365 pr_debug(
"%s() - skipping %s, no compatible prop\n",
370 auxdata = of_dev_lookup(lookup, bus);
372 bus_id = auxdata->name;
373 platform_data = auxdata->platform_data;
377 of_amba_device_create(bus, bus_id, platform_data, parent);
381 dev = of_platform_device_create_pdata(bus, bus_id, platform_data, parent);
387 rc = of_platform_bus_create(child, matches, lookup, &dev->
dev, strict);
405 int of_platform_bus_probe(
struct device_node *root,
416 pr_debug(
"of_platform_bus_probe()\n");
421 rc = of_platform_bus_create(root, matches,
NULL, parent,
false);
425 rc = of_platform_bus_create(child, matches,
NULL, parent,
false);
455 const struct of_dev_auxdata *lookup,
466 rc = of_platform_bus_create(child, matches, lookup, parent,
true);