aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/of_device_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc/kernel/of_device_common.c')
-rw-r--r--arch/sparc/kernel/of_device_common.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/arch/sparc/kernel/of_device_common.c b/arch/sparc/kernel/of_device_common.c
index 49ddff56cb04..cb15bbf8a201 100644
--- a/arch/sparc/kernel/of_device_common.c
+++ b/arch/sparc/kernel/of_device_common.c
@@ -22,6 +22,33 @@ unsigned int irq_of_parse_and_map(struct device_node *node, int index)
22} 22}
23EXPORT_SYMBOL(irq_of_parse_and_map); 23EXPORT_SYMBOL(irq_of_parse_and_map);
24 24
25int of_address_to_resource(struct device_node *node, int index,
26 struct resource *r)
27{
28 struct platform_device *op = of_find_device_by_node(node);
29
30 if (!op || index >= op->num_resources)
31 return -EINVAL;
32
33 memcpy(r, &op->archdata.resource[index], sizeof(*r));
34 return 0;
35}
36EXPORT_SYMBOL_GPL(of_address_to_resource);
37
38void __iomem *of_iomap(struct device_node *node, int index)
39{
40 struct platform_device *op = of_find_device_by_node(node);
41 struct resource *r;
42
43 if (!op || index >= op->num_resources)
44 return NULL;
45
46 r = &op->archdata.resource[index];
47
48 return of_ioremap(r, 0, resource_size(r), (char *) r->name);
49}
50EXPORT_SYMBOL(of_iomap);
51
25/* Take the archdata values for IOMMU, STC, and HOSTDATA found in 52/* Take the archdata values for IOMMU, STC, and HOSTDATA found in
26 * BUS and propagate to all child platform_device objects. 53 * BUS and propagate to all child platform_device objects.
27 */ 54 */