summaryrefslogtreecommitdiff
path: root/drivers/power/pmic/palmas.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2017-05-19 05:09:32 +0300
committerSimon Glass <sjg@chromium.org>2017-06-01 16:03:12 +0300
commit7a869e6cd15e012c7b5cde9b8bd5ea7691546a08 (patch)
tree0bbf1a2d95e7468f2de900cd4ebd15a033790d30 /drivers/power/pmic/palmas.c
parentf6e76202d4f11c8e38e2cec6111a8e2f99e83fcc (diff)
downloadu-boot-7a869e6cd15e012c7b5cde9b8bd5ea7691546a08.tar.xz
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/palmas.c')
-rw-r--r--drivers/power/pmic/palmas.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/power/pmic/palmas.c b/drivers/power/pmic/palmas.c
index f5a23073c4..804c0d13a0 100644
--- a/drivers/power/pmic/palmas.c
+++ b/drivers/power/pmic/palmas.c
@@ -46,17 +46,15 @@ static int palmas_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
static int palmas_bind(struct udevice *dev)
{
- int pmic_node = -1, regulators_node;
- const void *blob = gd->fdt_blob;
+ ofnode pmic_node = ofnode_null(), regulators_node;
+ ofnode subnode;
int children;
- int node = dev_of_offset(dev);
- int subnode, len;
- fdt_for_each_subnode(subnode, blob, node) {
+ dev_for_each_subnode(subnode, dev) {
const char *name;
char *temp;
- name = fdt_get_name(blob, subnode, &len);
+ name = ofnode_get_name(subnode);
temp = strstr(name, "pmic");
if (temp) {
pmic_node = subnode;
@@ -64,14 +62,14 @@ static int palmas_bind(struct udevice *dev)
}
}
- if (pmic_node <= 0) {
+ if (!ofnode_valid(pmic_node)) {
debug("%s: %s pmic subnode not found!", __func__, dev->name);
return -ENXIO;
}
- regulators_node = fdt_subnode_offset(blob, pmic_node, "regulators");
+ regulators_node = ofnode_find_subnode(pmic_node, "regulators");
- if (regulators_node <= 0) {
+ if (!ofnode_valid(regulators_node)) {
debug("%s: %s reg subnode not found!", __func__, dev->name);
return -ENXIO;
}