Message ID | 20201028094908.11031-1-patrick.delaunay@st.com |
---|---|
State | Accepted |
Commit | b305dbc08b08ab6681bfae8d33adc4f90fd3b9ad |
Delegated to: | Patrick Delaunay |
Headers | show |
Series | [1/2] pinctrl: stm32: display bias information for all pins | expand |
Hi Patrick On 10/28/20 10:49 AM, Patrick Delaunay wrote: > Display the bias information for input gpios or AF configuration, > and not only for output pin, as described in Reference manual > (Table 81. Port bit configuration table). > > Fixes: da7a0bb1f279 ("pinctrl: stm32: add information on pin configuration") > Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> > --- > > drivers/pinctrl/pinctrl_stm32.c | 24 ++++++++++++------------ > 1 file changed, 12 insertions(+), 12 deletions(-) > > diff --git a/drivers/pinctrl/pinctrl_stm32.c b/drivers/pinctrl/pinctrl_stm32.c > index dbea99532c..262b2c3d7e 100644 > --- a/drivers/pinctrl/pinctrl_stm32.c > +++ b/drivers/pinctrl/pinctrl_stm32.c > @@ -48,15 +48,15 @@ static const char * const pinmux_mode[PINMUX_MODE_COUNT] = { > "alt function", > }; > > -static const char * const pinmux_output[] = { > - [STM32_GPIO_PUPD_NO] = "bias-disable", > - [STM32_GPIO_PUPD_UP] = "bias-pull-up", > - [STM32_GPIO_PUPD_DOWN] = "bias-pull-down", > +static const char * const pinmux_bias[] = { > + [STM32_GPIO_PUPD_NO] = "", > + [STM32_GPIO_PUPD_UP] = "pull-up", > + [STM32_GPIO_PUPD_DOWN] = "pull-down", > }; > > static const char * const pinmux_input[] = { > - [STM32_GPIO_OTYPE_PP] = "drive-push-pull", > - [STM32_GPIO_OTYPE_OD] = "drive-open-drain", > + [STM32_GPIO_OTYPE_PP] = "push-pull", > + [STM32_GPIO_OTYPE_OD] = "open-drain", > }; > > static int stm32_pinctrl_get_af(struct udevice *dev, unsigned int offset) > @@ -213,6 +213,7 @@ static int stm32_pinctrl_get_pin_muxing(struct udevice *dev, > dev_dbg(dev, "selector = %d gpio_idx = %d mode = %d\n", > selector, gpio_idx, mode); > priv = dev_get_priv(gpio_dev); > + pupd = (readl(&priv->regs->pupdr) >> (gpio_idx * 2)) & PUPD_MASK; > > > switch (mode) { > @@ -224,20 +225,19 @@ 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", pinmux_mode[mode], af_num); > + snprintf(buf, size, "%s %d %s", pinmux_mode[mode], af_num, > + pinmux_bias[pupd]); > break; > case GPIOF_OUTPUT: > - pupd = (readl(&priv->regs->pupdr) >> (gpio_idx * 2)) & > - PUPD_MASK; > snprintf(buf, size, "%s %s %s", > - pinmux_mode[mode], pinmux_output[pupd], > + pinmux_mode[mode], pinmux_bias[pupd], > label ? label : ""); > break; > case GPIOF_INPUT: > otype = (readl(&priv->regs->otyper) >> gpio_idx) & OTYPE_MSK; > - snprintf(buf, size, "%s %s %s", > + snprintf(buf, size, "%s %s %s %s", > pinmux_mode[mode], pinmux_input[otype], > - label ? label : ""); > + pinmux_bias[pupd], label ? label : ""); > break; > } > Reviewed-by: Patrice Chotard <patrice.chotard@st.com> Thanks Patrice
Hi, > From: Patrick DELAUNAY <patrick.delaunay@st.com> > Sent: mercredi 28 octobre 2020 10:49 > > Display the bias information for input gpios or AF configuration, and not only for > output pin, as described in Reference manual (Table 81. Port bit configuration > table). > > Fixes: da7a0bb1f279 ("pinctrl: stm32: add information on pin configuration") > Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> > --- > > drivers/pinctrl/pinctrl_stm32.c | 24 ++++++++++++------------ > 1 file changed, 12 insertions(+), 12 deletions(-) > Applied to u-boot-stm/master, thanks! Regards Patrick
diff --git a/drivers/pinctrl/pinctrl_stm32.c b/drivers/pinctrl/pinctrl_stm32.c index dbea99532c..262b2c3d7e 100644 --- a/drivers/pinctrl/pinctrl_stm32.c +++ b/drivers/pinctrl/pinctrl_stm32.c @@ -48,15 +48,15 @@ static const char * const pinmux_mode[PINMUX_MODE_COUNT] = { "alt function", }; -static const char * const pinmux_output[] = { - [STM32_GPIO_PUPD_NO] = "bias-disable", - [STM32_GPIO_PUPD_UP] = "bias-pull-up", - [STM32_GPIO_PUPD_DOWN] = "bias-pull-down", +static const char * const pinmux_bias[] = { + [STM32_GPIO_PUPD_NO] = "", + [STM32_GPIO_PUPD_UP] = "pull-up", + [STM32_GPIO_PUPD_DOWN] = "pull-down", }; static const char * const pinmux_input[] = { - [STM32_GPIO_OTYPE_PP] = "drive-push-pull", - [STM32_GPIO_OTYPE_OD] = "drive-open-drain", + [STM32_GPIO_OTYPE_PP] = "push-pull", + [STM32_GPIO_OTYPE_OD] = "open-drain", }; static int stm32_pinctrl_get_af(struct udevice *dev, unsigned int offset) @@ -213,6 +213,7 @@ static int stm32_pinctrl_get_pin_muxing(struct udevice *dev, dev_dbg(dev, "selector = %d gpio_idx = %d mode = %d\n", selector, gpio_idx, mode); priv = dev_get_priv(gpio_dev); + pupd = (readl(&priv->regs->pupdr) >> (gpio_idx * 2)) & PUPD_MASK; switch (mode) { @@ -224,20 +225,19 @@ 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", pinmux_mode[mode], af_num); + snprintf(buf, size, "%s %d %s", pinmux_mode[mode], af_num, + pinmux_bias[pupd]); break; case GPIOF_OUTPUT: - pupd = (readl(&priv->regs->pupdr) >> (gpio_idx * 2)) & - PUPD_MASK; snprintf(buf, size, "%s %s %s", - pinmux_mode[mode], pinmux_output[pupd], + pinmux_mode[mode], pinmux_bias[pupd], label ? label : ""); break; case GPIOF_INPUT: otype = (readl(&priv->regs->otyper) >> gpio_idx) & OTYPE_MSK; - snprintf(buf, size, "%s %s %s", + snprintf(buf, size, "%s %s %s %s", pinmux_mode[mode], pinmux_input[otype], - label ? label : ""); + pinmux_bias[pupd], label ? label : ""); break; }
Display the bias information for input gpios or AF configuration, and not only for output pin, as described in Reference manual (Table 81. Port bit configuration table). Fixes: da7a0bb1f279 ("pinctrl: stm32: add information on pin configuration") Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> --- drivers/pinctrl/pinctrl_stm32.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)