aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-08-27 07:22:37 -0400
committerDavid S. Miller <davem@davemloft.net>2008-08-29 05:15:20 -0400
commit5059625ed8862e897760b86effff0f8a35989c0d (patch)
tree1beed269b55a0848ca9d3a5837aaffef7d6e07c2
parentf8e4d32cb5153a9d6a8e8864e357dad1349f3b85 (diff)
sparc: Add OF archdata propagation helper.
Add a helper function that, given a bus of_device node, propagates all iommu, stc, and host_controller values down to the child nodes. Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--arch/sparc/include/asm/of_device.h2
-rw-r--r--arch/sparc/kernel/of_device.c22
-rw-r--r--arch/sparc64/kernel/of_device.c22
3 files changed, 46 insertions, 0 deletions
diff --git a/arch/sparc/include/asm/of_device.h b/arch/sparc/include/asm/of_device.h
index bba777a416d..a5d9811f969 100644
--- a/arch/sparc/include/asm/of_device.h
+++ b/arch/sparc/include/asm/of_device.h
@@ -30,6 +30,8 @@ struct of_device
30extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name); 30extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name);
31extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size); 31extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size);
32 32
33extern void of_propagate_archdata(struct of_device *bus);
34
33/* This is just here during the transition */ 35/* This is just here during the transition */
34#include <linux/of_platform.h> 36#include <linux/of_platform.h>
35 37
diff --git a/arch/sparc/kernel/of_device.c b/arch/sparc/kernel/of_device.c
index aace71f7d6e..8fdc1b3113b 100644
--- a/arch/sparc/kernel/of_device.c
+++ b/arch/sparc/kernel/of_device.c
@@ -40,6 +40,28 @@ unsigned int irq_of_parse_and_map(struct device_node *node, int index)
40} 40}
41EXPORT_SYMBOL(irq_of_parse_and_map); 41EXPORT_SYMBOL(irq_of_parse_and_map);
42 42
43/* Take the archdata values for IOMMU, STC, and HOSTDATA found in
44 * BUS and propagate to all child of_device objects.
45 */
46void of_propagate_archdata(struct of_device *bus)
47{
48 struct dev_archdata *bus_sd = &bus->dev.archdata;
49 struct device_node *bus_dp = bus->node;
50 struct device_node *dp;
51
52 for (dp = bus_dp->child; dp; dp = dp->sibling) {
53 struct of_device *op = of_find_device_by_node(dp);
54
55 op->dev.archdata.iommu = bus_sd->iommu;
56 op->dev.archdata.stc = bus_sd->stc;
57 op->dev.archdata.host_controller = bus_sd->host_controller;
58 op->dev.archdata.numa_node = bus_sd->numa_node;
59
60 if (dp->child)
61 of_propagate_archdata(op);
62 }
63}
64
43#ifdef CONFIG_PCI 65#ifdef CONFIG_PCI
44struct bus_type ebus_bus_type; 66struct bus_type ebus_bus_type;
45EXPORT_SYMBOL(ebus_bus_type); 67EXPORT_SYMBOL(ebus_bus_type);
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c
index a30f2af0bf2..b22475f85a5 100644
--- a/arch/sparc64/kernel/of_device.c
+++ b/arch/sparc64/kernel/of_device.c
@@ -66,6 +66,28 @@ unsigned int irq_of_parse_and_map(struct device_node *node, int index)
66} 66}
67EXPORT_SYMBOL(irq_of_parse_and_map); 67EXPORT_SYMBOL(irq_of_parse_and_map);
68 68
69/* Take the archdata values for IOMMU, STC, and HOSTDATA found in
70 * BUS and propagate to all child of_device objects.
71 */
72void of_propagate_archdata(struct of_device *bus)
73{
74 struct dev_archdata *bus_sd = &bus->dev.archdata;
75 struct device_node *bus_dp = bus->node;
76 struct device_node *dp;
77
78 for (dp = bus_dp->child; dp; dp = dp->sibling) {
79 struct of_device *op = of_find_device_by_node(dp);
80
81 op->dev.archdata.iommu = bus_sd->iommu;
82 op->dev.archdata.stc = bus_sd->stc;
83 op->dev.archdata.host_controller = bus_sd->host_controller;
84 op->dev.archdata.numa_node = bus_sd->numa_node;
85
86 if (dp->child)
87 of_propagate_archdata(op);
88 }
89}
90
69#ifdef CONFIG_PCI 91#ifdef CONFIG_PCI
70struct bus_type ebus_bus_type; 92struct bus_type ebus_bus_type;
71EXPORT_SYMBOL(ebus_bus_type); 93EXPORT_SYMBOL(ebus_bus_type);