sparc: Add OF archdata propagation helper.
authorDavid S. Miller <davem@davemloft.net>
Wed, 27 Aug 2008 11:22:37 +0000 (04:22 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 29 Aug 2008 09:15:20 +0000 (02:15 -0700)
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>
arch/sparc/include/asm/of_device.h
arch/sparc/kernel/of_device.c
arch/sparc64/kernel/of_device.c

index bba777a416d3bf31b7ab4b5bb5a393ea7cc2c9f7..a5d9811f9697734863510a8b1c7336d228ac45ab 100644 (file)
@@ -30,6 +30,8 @@ struct of_device
 extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name);
 extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size);
 
+extern void of_propagate_archdata(struct of_device *bus);
+
 /* This is just here during the transition */
 #include <linux/of_platform.h>
 
index aace71f7d6e59aaafdae9b8c29f582411c79995c..8fdc1b3113b9ec23093a10ffc115bc9fd66b09b3 100644 (file)
@@ -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);
index a30f2af0bf2cf8f47c3657991af9a6fed8afdcf2..b22475f85a5e751669eb0faec532ce8174d26aa5 100644 (file)
@@ -66,6 +66,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);
This page took 0.031928 seconds and 5 git commands to generate.