pinctrl: generic: scan for "pins" and "groups" properties in sub-nodes
authorBeniamino Galvani <b.galvani@gmail.com>
Tue, 16 Aug 2016 09:49:47 +0000 (11:49 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 6 Sep 2016 17:18:19 +0000 (13:18 -0400)
In cases where the pins and groups definitions are in a sub-node, as:

uart_a {
mux {
groups = "uart_tx_a", "uart_rx_a";
function = "uart_a";
};
};

pinctrl_generic_set_state_subnode() returns an error for the top-level
node and pinctrl_generic_set_state() fails. Instead, return success so
that the child nodes are tried.

Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>
drivers/pinctrl/pinctrl-generic.c

index e86b72a8deeac36faa457b048a6fa5a1165a61d9..baff40f1f0d4141c6af80718009e22453855d733 100644 (file)
@@ -312,8 +312,10 @@ static int pinctrl_generic_set_state_subnode(struct udevice *dev,
                is_group = true;
                strings_count = fdt_count_strings(fdt, node,
                                                  subnode_target_type);
-               if (strings_count < 0)
-                       return -EINVAL;
+               if (strings_count < 0) {
+                       /* skip this node; may contain config child nodes */
+                       return 0;
+               }
        }
 
        for (i = 0; i < strings_count; i++) {