aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@foss.st.com>2021-01-21 17:39:07 +0100
committerPatrick Delaunay <patrick.delaunay@foss.st.com>2021-02-09 10:31:04 +0100
commit1da426919dedc2ece25e05f5d8ca131142c7348c (patch)
treeb72ccd61dbdbd1ec971cf40930bff2401bb69c07
parentca5cc312d4bea03a106dd36026ae637b19fa5599 (diff)
downloadu-boot-1da426919dedc2ece25e05f5d8ca131142c7348c.zip
u-boot-1da426919dedc2ece25e05f5d8ca131142c7348c.tar.gz
u-boot-1da426919dedc2ece25e05f5d8ca131142c7348c.tar.bz2
pinctrl: stm32: correct management pin display of OTYPE
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> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
-rw-r--r--drivers/pinctrl/pinctrl_stm32.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/pinctrl/pinctrl_stm32.c b/drivers/pinctrl/pinctrl_stm32.c
index a1f53a7..374f76d 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;
}