dm: pmic: add child node status verify

Ignore disabled child node when bind driver

Change-Id: Ib817bf643efa6c8511d4619993444dddaac7d6bd
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This commit is contained in:
Joseph Chen 2018-04-02 15:13:54 +08:00 committed by Kever Yang
parent ad3a6a1573
commit 3929c02703
1 changed files with 12 additions and 0 deletions

View File

@ -13,6 +13,7 @@
#include <dm/lists.h>
#include <dm/device-internal.h>
#include <dm/uclass-internal.h>
#include <dm/of_access.h>
#include <power/pmic.h>
#include <linux/ctype.h>
@ -31,6 +32,7 @@ int pmic_bind_children(struct udevice *pmic, ofnode parent,
ofnode node;
int prefix_len;
int ret;
bool enable;
debug("%s for '%s' at node offset: %d\n", __func__, pmic->name,
dev_of_offset(pmic));
@ -40,6 +42,16 @@ int pmic_bind_children(struct udevice *pmic, ofnode parent,
debug("* Found child node: '%s'\n", node_name);
if (ofnode_is_np(node))
enable = of_device_is_available(ofnode_to_np(node));
else
enable = fdtdec_get_is_enabled(gd->fdt_blob,
ofnode_to_offset(node));
if (!enable) {
debug("* But '%s' is disabled\n", node_name);
continue;
}
child = NULL;
for (info = child_info; info->prefix && info->driver; info++) {
debug(" - compatible prefix: '%s'\n", info->prefix);