diff options
author | Rob Herring <robh@kernel.org> | 2018-07-09 09:41:50 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-07-10 17:22:35 +0200 |
commit | d19c5e79d46efdf89306be99f3c8824cf58e35f6 (patch) | |
tree | c264ec79e263828ad363e8658bc516aebf5aea04 /drivers/pinctrl/devicetree.c | |
parent | 7930eb919feb59b8c799cb3085d0e9f7b5ae34d1 (diff) | |
download | linux-d19c5e79d46efdf89306be99f3c8824cf58e35f6.tar.gz linux-d19c5e79d46efdf89306be99f3c8824cf58e35f6.tar.bz2 linux-d19c5e79d46efdf89306be99f3c8824cf58e35f6.zip |
pinctrl: Support stopping deferred probe after initcalls
Pinctrl drivers are a common dependency which can prevent a system
booting even if the default or bootloader configured settings can work.
If a pinctrl node in DT indicates that the default pin setup can be used
with the 'pinctrl-use-default' property, then only defer probe until
initcalls are done. If the deferred probe timeout is enabled or loadable
modules are disabled, then we'll stop deferring probe regardless of the
DT property. This gives platforms the option to work without their
pinctrl driver being enabled.
Dropped the pinctrl specific deferring probe message as the driver core
can print deferred probe related messages if needed.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/pinctrl/devicetree.c')
-rw-r--r-- | drivers/pinctrl/devicetree.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/pinctrl/devicetree.c b/drivers/pinctrl/devicetree.c index c4aa411f5935..2969ff3162c3 100644 --- a/drivers/pinctrl/devicetree.c +++ b/drivers/pinctrl/devicetree.c @@ -111,17 +111,24 @@ static int dt_to_map_one_config(struct pinctrl *p, int ret; struct pinctrl_map *map; unsigned num_maps; + bool allow_default = false; /* Find the pin controller containing np_config */ np_pctldev = of_node_get(np_config); for (;;) { + if (!allow_default) + allow_default = of_property_read_bool(np_pctldev, + "pinctrl-use-default"); + np_pctldev = of_get_next_parent(np_pctldev); if (!np_pctldev || of_node_is_root(np_pctldev)) { - dev_info(p->dev, "could not find pctldev for node %pOF, deferring probe\n", - np_config); of_node_put(np_pctldev); - /* OK let's just assume this will appear later then */ - return -EPROBE_DEFER; + ret = driver_deferred_probe_check_state(p->dev); + /* keep deferring if modules are enabled unless we've timed out */ + if (IS_ENABLED(CONFIG_MODULES) && !allow_default && ret == -ENODEV) + ret = -EPROBE_DEFER; + + return ret; } /* If we're creating a hog we can use the passed pctldev */ if (hog_pctldev && (np_pctldev == p->dev->of_node)) { |