aboutsummaryrefslogtreecommitdiff
path: root/arch/sparc/kernel/of_device.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-08-27 04:22:37 -0700
committerDavid S. Miller <davem@davemloft.net>2008-08-29 02:15:20 -0700
commit5059625ed8862e897760b86effff0f8a35989c0d (patch)
tree1beed269b55a0848ca9d3a5837aaffef7d6e07c2 /arch/sparc/kernel/of_device.c
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>
Diffstat (limited to 'arch/sparc/kernel/of_device.c')
-rw-r--r--arch/sparc/kernel/of_device.c22
1 files changed, 22 insertions, 0 deletions
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)
}
EXPORT_SYMBOL(irq_of_parse_and_map);
+/* Take the archdata values for IOMMU, STC, and HOSTDATA found in
+ * BUS and propagate to all child of_device objects.
+ */
+void of_propagate_archdata(struct of_device *bus)
+{
+ struct dev_archdata *bus_sd = &bus->dev.archdata;
+ struct device_node *bus_dp = bus->node;
+ struct device_node *dp;
+
+ for (dp = bus_dp->child; dp; dp = dp->sibling) {
+ struct of_device *op = of_find_device_by_node(dp);
+
+ op->dev.archdata.iommu = bus_sd->iommu;
+ op->dev.archdata.stc = bus_sd->stc;
+ op->dev.archdata.host_controller = bus_sd->host_controller;
+ op->dev.archdata.numa_node = bus_sd->numa_node;
+
+ if (dp->child)
+ of_propagate_archdata(op);
+ }
+}
+
#ifdef CONFIG_PCI
struct bus_type ebus_bus_type;
EXPORT_SYMBOL(ebus_bus_type);