summaryrefslogtreecommitdiff
path: root/drivers/power/pmic/pmic-uclass.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2017-05-18 20:09:32 -0600
committerSimon Glass <sjg@chromium.org>2017-06-01 07:03:12 -0600
commit7a869e6cd15e012c7b5cde9b8bd5ea7691546a08 (patch)
tree0bbf1a2d95e7468f2de900cd4ebd15a033790d30 /drivers/power/pmic/pmic-uclass.c
parentf6e76202d4f11c8e38e2cec6111a8e2f99e83fcc (diff)
dm: pmic: Convert uclass to livetree
Update the pmic uclass and all pmics to support a live device tree. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/power/pmic/pmic-uclass.c')
-rw-r--r--drivers/power/pmic/pmic-uclass.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/power/pmic/pmic-uclass.c b/drivers/power/pmic/pmic-uclass.c
index 0f7fa517f9..953bbe5026 100644
--- a/drivers/power/pmic/pmic-uclass.c
+++ b/drivers/power/pmic/pmic-uclass.c
@@ -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