[PATCH 0/2] pinctrl: stm32: correction for pinmux status

This serie solve 2 issues found in output of command "pinmux status -a" when I test the serie [1].
[1] "gpio: Update and simplify the uclass API" http://patchwork.ozlabs.org/project/uboot/list/?series=225585
Patrick Delaunay (2): pinctrl: stm32: correct management pin display of OTYPE pinctrl: stm32: bind only the enabled GPIO subnode
drivers/pinctrl/pinctrl_stm32.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)

OTYPE can be used for output or for alternate function to select PP = push-pull or OP = open-drain mode, according reference manual (Table 81. Port bit configuration table).
This patch removes this indication for input pins and adds it for AF and output pins for pinmux command output.
Fixes: b305dbc08b08 ("pinctrl: stm32: display bias information for all pins")
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com ---
drivers/pinctrl/pinctrl_stm32.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/drivers/pinctrl/pinctrl_stm32.c b/drivers/pinctrl/pinctrl_stm32.c index a1f53a793b..374f76d881 100644 --- a/drivers/pinctrl/pinctrl_stm32.c +++ b/drivers/pinctrl/pinctrl_stm32.c @@ -56,7 +56,7 @@ static const char * const pinmux_bias[] = { [STM32_GPIO_PUPD_DOWN] = "pull-down", };
-static const char * const pinmux_input[] = { +static const char * const pinmux_otype[] = { [STM32_GPIO_OTYPE_PP] = "push-pull", [STM32_GPIO_OTYPE_OD] = "open-drain", }; @@ -216,7 +216,7 @@ static int stm32_pinctrl_get_pin_muxing(struct udevice *dev, selector, gpio_idx, mode); priv = dev_get_priv(gpio_dev); pupd = (readl(&priv->regs->pupdr) >> (gpio_idx * 2)) & PUPD_MASK; - + otype = (readl(&priv->regs->otyper) >> gpio_idx) & OTYPE_MSK;
switch (mode) { case GPIOF_UNKNOWN: @@ -227,18 +227,16 @@ static int stm32_pinctrl_get_pin_muxing(struct udevice *dev, break; case GPIOF_FUNC: af_num = stm32_pinctrl_get_af(gpio_dev, gpio_idx); - snprintf(buf, size, "%s %d %s", pinmux_mode[mode], af_num, - pinmux_bias[pupd]); + snprintf(buf, size, "%s %d %s %s", pinmux_mode[mode], af_num, + pinmux_otype[otype], pinmux_bias[pupd]); break; case GPIOF_OUTPUT: - snprintf(buf, size, "%s %s %s", - pinmux_mode[mode], pinmux_bias[pupd], - label ? label : ""); + snprintf(buf, size, "%s %s %s %s", + pinmux_mode[mode], pinmux_otype[otype], + pinmux_bias[pupd], label ? label : ""); break; case GPIOF_INPUT: - otype = (readl(&priv->regs->otyper) >> gpio_idx) & OTYPE_MSK; - snprintf(buf, size, "%s %s %s %s", - pinmux_mode[mode], pinmux_input[otype], + snprintf(buf, size, "%s %s %s", pinmux_mode[mode], pinmux_bias[pupd], label ? label : ""); break; }

Hi Patrick
On 1/21/21 5:39 PM, Patrick Delaunay wrote:
OTYPE can be used for output or for alternate function to select PP = push-pull or OP = open-drain mode, according reference manual (Table 81. Port bit configuration table).
This patch removes this indication for input pins and adds it for AF and output pins for pinmux command output.
Fixes: b305dbc08b08 ("pinctrl: stm32: display bias information for all pins")
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
drivers/pinctrl/pinctrl_stm32.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/drivers/pinctrl/pinctrl_stm32.c b/drivers/pinctrl/pinctrl_stm32.c index a1f53a793b..374f76d881 100644 --- a/drivers/pinctrl/pinctrl_stm32.c +++ b/drivers/pinctrl/pinctrl_stm32.c @@ -56,7 +56,7 @@ static const char * const pinmux_bias[] = { [STM32_GPIO_PUPD_DOWN] = "pull-down", };
-static const char * const pinmux_input[] = { +static const char * const pinmux_otype[] = { [STM32_GPIO_OTYPE_PP] = "push-pull", [STM32_GPIO_OTYPE_OD] = "open-drain", }; @@ -216,7 +216,7 @@ static int stm32_pinctrl_get_pin_muxing(struct udevice *dev, selector, gpio_idx, mode); priv = dev_get_priv(gpio_dev); pupd = (readl(&priv->regs->pupdr) >> (gpio_idx * 2)) & PUPD_MASK;
otype = (readl(&priv->regs->otyper) >> gpio_idx) & OTYPE_MSK;
switch (mode) { case GPIOF_UNKNOWN:
@@ -227,18 +227,16 @@ static int stm32_pinctrl_get_pin_muxing(struct udevice *dev, break; case GPIOF_FUNC: af_num = stm32_pinctrl_get_af(gpio_dev, gpio_idx);
snprintf(buf, size, "%s %d %s", pinmux_mode[mode], af_num,
pinmux_bias[pupd]);
snprintf(buf, size, "%s %d %s %s", pinmux_mode[mode], af_num,
break; case GPIOF_OUTPUT:pinmux_otype[otype], pinmux_bias[pupd]);
snprintf(buf, size, "%s %s %s",
pinmux_mode[mode], pinmux_bias[pupd],
label ? label : "");
snprintf(buf, size, "%s %s %s %s",
pinmux_mode[mode], pinmux_otype[otype],
break; case GPIOF_INPUT:pinmux_bias[pupd], label ? label : "");
otype = (readl(&priv->regs->otyper) >> gpio_idx) & OTYPE_MSK;
snprintf(buf, size, "%s %s %s %s",
pinmux_mode[mode], pinmux_input[otype],
break; }snprintf(buf, size, "%s %s %s", pinmux_mode[mode], pinmux_bias[pupd], label ? label : "");
Reviewed-by: Patrice Chotard patrice.chotard@foss.st.com
Thanks Patrice

Hi,
On 1/21/21 5:39 PM, Patrick Delaunay wrote:
OTYPE can be used for output or for alternate function to select PP = push-pull or OP = open-drain mode, according reference manual (Table 81. Port bit configuration table).
This patch removes this indication for input pins and adds it for AF and output pins for pinmux command output.
Fixes: b305dbc08b08 ("pinctrl: stm32: display bias information for all pins")
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
drivers/pinctrl/pinctrl_stm32.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
Applied to u-boot-stm/master, thanks!
Regards
Patrick

Bind only the enabled GPIO subnode, to avoid to probe the node "gpio-controller" present in SOC dtsi (disabled by default) but not enabled in the included pincontrol dtsi file.
For example, in stm32mp15xxac-pinctrl.dtsi 2 gpio bank are absent: gpioj: gpio@5000b000 gpiok: gpio@5000c000
Then these GPIO are absent in output of command "dm tree" and "gpio status -a"
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com ---
drivers/pinctrl/pinctrl_stm32.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/pinctrl/pinctrl_stm32.c b/drivers/pinctrl/pinctrl_stm32.c index 374f76d881..6c98538f56 100644 --- a/drivers/pinctrl/pinctrl_stm32.c +++ b/drivers/pinctrl/pinctrl_stm32.c @@ -409,6 +409,9 @@ static int stm32_pinctrl_bind(struct udevice *dev) dev_for_each_subnode(node, dev) { dev_dbg(dev, "bind %s\n", ofnode_get_name(node));
+ if (!ofnode_is_enabled(node)) + continue; + ofnode_get_property(node, "gpio-controller", &ret); if (ret < 0) continue;

Hi Patrick
On 1/21/21 5:39 PM, Patrick Delaunay wrote:
Bind only the enabled GPIO subnode, to avoid to probe the node "gpio-controller" present in SOC dtsi (disabled by default) but not enabled in the included pincontrol dtsi file.
For example, in stm32mp15xxac-pinctrl.dtsi 2 gpio bank are absent: gpioj: gpio@5000b000 gpiok: gpio@5000c000
Then these GPIO are absent in output of command "dm tree" and "gpio status -a"
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
drivers/pinctrl/pinctrl_stm32.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/pinctrl/pinctrl_stm32.c b/drivers/pinctrl/pinctrl_stm32.c index 374f76d881..6c98538f56 100644 --- a/drivers/pinctrl/pinctrl_stm32.c +++ b/drivers/pinctrl/pinctrl_stm32.c @@ -409,6 +409,9 @@ static int stm32_pinctrl_bind(struct udevice *dev) dev_for_each_subnode(node, dev) { dev_dbg(dev, "bind %s\n", ofnode_get_name(node));
if (!ofnode_is_enabled(node))
continue;
- ofnode_get_property(node, "gpio-controller", &ret); if (ret < 0) continue;
Reviewed-by: Patrice Chotard patrice.chotard@foss.st.com
Thanks Patrice

Hi,
On 1/21/21 5:39 PM, Patrick Delaunay wrote:
Bind only the enabled GPIO subnode, to avoid to probe the node "gpio-controller" present in SOC dtsi (disabled by default) but not enabled in the included pincontrol dtsi file.
For example, in stm32mp15xxac-pinctrl.dtsi 2 gpio bank are absent: gpioj: gpio@5000b000 gpiok: gpio@5000c000
Then these GPIO are absent in output of command "dm tree" and "gpio status -a"
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
drivers/pinctrl/pinctrl_stm32.c | 3 +++ 1 file changed, 3 insertions(+)
Applied to u-boot-stm/master, thanks!
Regards
Patrick
participants (3)
-
Patrice CHOTARD
-
Patrick DELAUNAY
-
Patrick Delaunay