* 2 of the License, or (at your option) any later version.
*
*/
+
+#define pr_fmt(fmt) "OF: " fmt
+
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/amba/bus.h>
#endif /* CONFIG_ARM_AMBA */
{} /* Empty terminated list */
};
-EXPORT_SYMBOL(of_default_bus_match_table);
static int of_dev_node_match(struct device *dev, void *data)
{
return NULL;
dev = amba_device_alloc(NULL, 0, 0);
- if (!dev) {
- pr_err("%s(): amba_device_alloc() failed for %s\n",
- __func__, node->full_name);
+ if (!dev)
goto err_clear_flag;
- }
/* setup generic device info */
dev->dev.of_node = of_node_get(node);
ret = of_address_to_resource(node, 0, &dev->res);
if (ret) {
- pr_err("%s(): of_address_to_resource() failed (%d) for %s\n",
- __func__, ret, node->full_name);
+ pr_err("amba: of_address_to_resource() failed (%d) for %s\n",
+ ret, node->full_name);
goto err_free;
}
ret = amba_device_add(dev, &iomem_resource);
if (ret) {
- pr_err("%s(): amba_device_add() failed (%d) for %s\n",
- __func__, ret, node->full_name);
+ pr_err("amba_device_add() failed (%d) for %s\n",
+ ret, node->full_name);
goto err_free;
}
return 0;
}
+ if (of_node_check_flag(bus, OF_POPULATED_BUS)) {
+ pr_debug("%s() - skipping %s, already populated\n",
+ __func__, bus->full_name);
+ return 0;
+ }
+
auxdata = of_dev_lookup(lookup, bus);
if (auxdata) {
bus_id = auxdata->name;
if (!root)
return -EINVAL;
- pr_debug("of_platform_bus_probe()\n");
+ pr_debug("%s()\n", __func__);
pr_debug(" starting at: %s\n", root->full_name);
/* Do a self check of bus type, if there's a match, create children */
if (!root)
return -EINVAL;
+ pr_debug("%s()\n", __func__);
+ pr_debug(" starting at: %s\n", root->full_name);
+
for_each_child_of_node(root, child) {
rc = of_platform_bus_create(child, matches, lookup, parent, true);
if (rc) {
}
EXPORT_SYMBOL_GPL(of_platform_default_populate);
+static int __init of_platform_default_populate_init(void)
+{
+ struct device_node *node;
+
+ if (!of_have_populated_dt())
+ return -ENODEV;
+
+ /*
+ * Handle ramoops explicitly, since it is inside /reserved-memory,
+ * which lacks a "compatible" property.
+ */
+ node = of_find_node_by_path("/reserved-memory");
+ if (node) {
+ node = of_find_compatible_node(node, NULL, "ramoops");
+ if (node)
+ of_platform_device_create(node, NULL, NULL);
+ }
+
+ /* Populate everything else. */
+ of_platform_default_populate(NULL, NULL, NULL);
+
+ return 0;
+}
+arch_initcall_sync(of_platform_default_populate_init);
+
static int of_platform_device_destroy(struct device *dev, void *data)
{
/* Do not touch devices not populated from the device tree */