This patch extends pmic_bind_children prefix matching. In addition to
the node name the property regulator-name is used while trying to match
prefixes. This allows assigning different drivers to regulator nodes
named regulator@1 and regulator@10 for example.
Signed-off-by: Felix Brack <f...@ltec.ch>
---

 drivers/power/pmic/pmic-uclass.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/power/pmic/pmic-uclass.c b/drivers/power/pmic/pmic-uclass.c
index 64964e4..5a034f0 100644
--- a/drivers/power/pmic/pmic-uclass.c
+++ b/drivers/power/pmic/pmic-uclass.c
@@ -26,6 +26,7 @@ int pmic_bind_children(struct udevice *pmic, ofnode parent,
        struct driver *drv;
        struct udevice *child;
        const char *node_name;
+       const char *reg_name;
        int bind_count = 0;
        ofnode node;
        int prefix_len;
@@ -44,8 +45,18 @@ int pmic_bind_children(struct udevice *pmic, ofnode parent,
                        debug("  - compatible prefix: '%s'\n", info->prefix);
 
                        prefix_len = strlen(info->prefix);
-                       if (strncmp(info->prefix, node_name, prefix_len))
-                               continue;
+                       if (strncmp(info->prefix, node_name, prefix_len)) {
+                               reg_name = ofnode_read_string(node,
+                                                             "regulator-name");
+                               if (reg_name) {
+                                       if (strncmp(info->prefix, reg_name,
+                                                   prefix_len)) {
+                                               continue;
+                                       }
+                               } else {
+                                       continue;
+                               }
+                       }
 
                        drv = lists_driver_lookup_name(info->driver);
                        if (!drv) {
-- 
2.7.4

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to