dm: pinctrl: introduce PINCONF_RECURSIVE option
authorPatrick Delaunay <patrick.delaunay@st.com>
Fri, 2 Aug 2019 12:48:00 +0000 (14:48 +0200)
committerSimon Glass <sjg@chromium.org>
Tue, 15 Oct 2019 14:40:02 +0000 (08:40 -0600)
In the Linux pinctrl binding, the pin configuration nodes don't need to
be direct children of the pin controller device (may be grandchildren for
example). This behavior is managed with the pinconfig u-class which
recursively bind all the sub-node of the pin controller.

But for some binding (when pin configuration is only children of pin
controller) that is not necessary. U-Boot can save memory and reduce
the number of pinconf instance when this feature is deactivated
(for arch stm32mp for example for SPL).

This patch allows to control this feature with a new option
CONFIG_PINCONF_RECURSIVE when it is possible for each individual
pin controller device.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/pinctrl/Kconfig
drivers/pinctrl/pinctrl-uclass.c

index a0ac167..deee924 100644 (file)
@@ -59,6 +59,22 @@ config PINCONF
          This option enables pin configuration through the generic pinctrl
          framework.
 
+config PINCONF_RECURSIVE
+       bool "Support recursive binding for pin configuration nodes"
+       depends on PINCTRL_FULL
+       default n if ARCH_STM32MP
+       default y
+       help
+         In the Linux pinctrl binding, the pin configuration nodes need not be
+         direct children of the pin controller device (may be grandchildren for
+         example). It is define is each individual pin controller device.
+         Say Y here if you want to keep this behavior with the pinconfig
+         u-class: all sub are recursivelly bounded.
+         If the option is disabled, this behavior is deactivated and only
+         the direct children of pin controller will be assumed as pin
+         configuration; you can save memory footprint when this feature is
+         no needed.
+
 config SPL_PINCTRL
        bool "Support pin controllers in SPL"
        depends on SPL && SPL_DM
@@ -104,6 +120,15 @@ config SPL_PINCONF
          This option is an SPL-variant of the PINCONF option.
          See the help of PINCONF for details.
 
+config SPL_PINCONF_RECURSIVE
+       bool "Support recursive binding for pin configuration nodes in SPL"
+       depends on SPL_PINCTRL_FULL
+       default n if ARCH_STM32MP
+       default y
+       help
+         This option is an SPL-variant of the PINCONF_RECURSIVE option.
+         See the help of PINCONF_RECURSIVE for details.
+
 if PINCTRL || SPL_PINCTRL
 
 config PINCTRL_AR933X
index 5b1cd29..bf799a7 100644 (file)
@@ -151,7 +151,9 @@ static int pinconfig_post_bind(struct udevice *dev)
 
 UCLASS_DRIVER(pinconfig) = {
        .id = UCLASS_PINCONFIG,
+#if CONFIG_IS_ENABLED(PINCONFIG_RECURSIVE)
        .post_bind = pinconfig_post_bind,
+#endif
        .name = "pinconfig",
 };