dm: pmic: add "addr" field for binding children

If some child info->prefix are the same, try to
distinguish them by parent addr.

Example:
	pmic@20, pmic@1a...

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I504cd887e232bb309d8e1790f6d55910172d08b5
This commit is contained in:
Joseph Chen 2020-06-23 17:42:52 +08:00
parent d3f5f12c3c
commit 50454a094f
2 changed files with 12 additions and 0 deletions

View File

@ -64,6 +64,17 @@ int pmic_bind_children(struct udevice *pmic, ofnode parent,
continue; continue;
} }
/*
* If some child info->prefix are the same, try to
* distinguish them by parent addr.
*
* Example: pmic@20, pmic@1a...
*/
if (info->addr) {
if (!strstr(dev_read_name(pmic), info->addr))
continue;
}
drv = lists_driver_lookup_name(info->driver); drv = lists_driver_lookup_name(info->driver);
if (!drv) { if (!drv) {
debug(" - driver: '%s' not found!\n", debug(" - driver: '%s' not found!\n",

View File

@ -189,6 +189,7 @@ enum pmic_op_type {
* @driver - driver name for the sub-node with prefix * @driver - driver name for the sub-node with prefix
*/ */
struct pmic_child_info { struct pmic_child_info {
const char *addr;
const char *prefix; const char *prefix;
const char *driver; const char *driver;
}; };