|
@@ -19,29 +19,27 @@
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
|
#if CONFIG_IS_ENABLED(PMIC_CHILDREN)
|
|
|
-int pmic_bind_children(struct udevice *pmic, int offset,
|
|
|
+int pmic_bind_children(struct udevice *pmic, ofnode parent,
|
|
|
const struct pmic_child_info *child_info)
|
|
|
{
|
|
|
const struct pmic_child_info *info;
|
|
|
- const void *blob = gd->fdt_blob;
|
|
|
struct driver *drv;
|
|
|
struct udevice *child;
|
|
|
const char *node_name;
|
|
|
int bind_count = 0;
|
|
|
- int node;
|
|
|
+ ofnode node;
|
|
|
int prefix_len;
|
|
|
int ret;
|
|
|
|
|
|
debug("%s for '%s' at node offset: %d\n", __func__, pmic->name,
|
|
|
dev_of_offset(pmic));
|
|
|
|
|
|
- for (node = fdt_first_subnode(blob, offset);
|
|
|
- node > 0;
|
|
|
- node = fdt_next_subnode(blob, node)) {
|
|
|
- node_name = fdt_get_name(blob, node, NULL);
|
|
|
+ for (node = ofnode_first_subnode(parent);
|
|
|
+ ofnode_valid(node);
|
|
|
+ node = ofnode_next_subnode(node)) {
|
|
|
+ node_name = ofnode_get_name(node);
|
|
|
|
|
|
- debug("* Found child node: '%s' at offset:%d\n", node_name,
|
|
|
- node);
|
|
|
+ debug("* Found child node: '%s'\n", node_name);
|
|
|
|
|
|
child = NULL;
|
|
|
for (info = child_info; info->prefix && info->driver; info++) {
|
|
@@ -60,8 +58,8 @@ int pmic_bind_children(struct udevice *pmic, int offset,
|
|
|
|
|
|
debug(" - found child driver: '%s'\n", drv->name);
|
|
|
|
|
|
- ret = device_bind(pmic, drv, node_name, NULL,
|
|
|
- node, &child);
|
|
|
+ ret = device_bind_with_driver_data(pmic, drv, node_name,
|
|
|
+ 0, node, &child);
|
|
|
if (ret) {
|
|
|
debug(" - child binding error: %d\n", ret);
|
|
|
continue;
|
|
@@ -82,7 +80,7 @@ int pmic_bind_children(struct udevice *pmic, int offset,
|
|
|
debug(" - compatible prefix not found\n");
|
|
|
}
|
|
|
|
|
|
- debug("Bound: %d childs for PMIC: '%s'\n", bind_count, pmic->name);
|
|
|
+ debug("Bound: %d children for PMIC: '%s'\n", bind_count, pmic->name);
|
|
|
return bind_count;
|
|
|
}
|
|
|
#endif
|