pinctrl: stm32: display bias information for all pins
Subsystems (3)
PATCH 1/2 pinctrl: stm32: display bias information for all pins
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).
---
drivers/pinctrl/pinctrl_stm32.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/pinctrl/pinctrl_stm32.c +12 -12
@@ -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 ; }
Signature · 1 line
2.17.1
PATCH 1/2 pinctrl: stm32: display bias information for all pins
Hi,
Quoted 7 lines
From: Patrick DELAUNAY <[email protected]>
Sent: mercredi 28 octobre 2020 10:49Display 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).
Quoted 7 lines
Fixes da7a0bb1f279 ("pinctrl: stm32: add information on pin configuration")Signed-off-by Patrick Delaunay <[email protected]>---
drivers/pinctrl/pinctrl_stm32.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
Applied to u-boot-stm/master, thanks!
Regards
Patrick
PATCH 1/2 pinctrl: stm32: display bias information for all pins
In reply to Patrick DelaunayHi Patrick
Quoted 61 lines · Patrick Delaunay
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 <[email protected]>---
drivers/pinctrl/pinctrl_stm32.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)drivers/pinctrl/pinctrl_stm32.c +10
-10@@ -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 ;
drivers/pinctrl/pinctrl_stm32.c static int stm32_pinctrl_get_pin_muxing(struct udevice *dev, · line 243
Quoted 10 lines
drivers/pinctrl/pinctrl_stm32.c +2
-2case 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 ; }
Thanks
Patrice
PATCH 2/2 gpio: stm32: correct the bias management
In reply to Patrick DelaunayUse the bias configuration for all the GPIO configurations and not only for input GPIO, as indicated in Reference manual (Table 81. Port bit configuration table).
---
drivers/gpio/stm32_gpio.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/gpio/stm32_gpio.c +14 -14
@@ -212,11 +212,11 @@ static int stm32_gpio_set_dir_flags(struct udevice *dev, unsigned int offset, }else if (flags &GPIOD_IS_IN ) {stm32_gpio_set_moder (regs, idx,STM32_GPIO_MODE_IN ); -if (flags &GPIOD_PULL_UP ) -stm32_gpio_set_pupd (regs, idx,STM32_GPIO_PUPD_UP ); -else if (flags &GPIOD_PULL_DOWN ) -stm32_gpio_set_pupd (regs, idx,STM32_GPIO_PUPD_DOWN ); } +if (flags &GPIOD_PULL_UP ) +stm32_gpio_set_pupd (regs, idx,STM32_GPIO_PUPD_UP ); +else if (flags &GPIOD_PULL_DOWN ) +stm32_gpio_set_pupd (regs, idx,STM32_GPIO_PUPD_DOWN );return 0 ; }
@@ -243,16 +243,16 @@ static int stm32_gpio_get_dir_flags(struct udevice *dev, unsigned int offset,break ;case STM32_GPIO_MODE_IN : dir_flags |=GPIOD_IS_IN ; -switch (stm32_gpio_get_pupd (regs, idx)) { -case STM32_GPIO_PUPD_UP : - dir_flags |=GPIOD_PULL_UP ; -break ; -case STM32_GPIO_PUPD_DOWN : - dir_flags |=GPIOD_PULL_DOWN ; -break ; -default : -break ; - } +break ; +default : +break ; + } +switch (stm32_gpio_get_pupd (regs, idx)) { +case STM32_GPIO_PUPD_UP : + dir_flags |=GPIOD_PULL_UP ; +break ; +case STM32_GPIO_PUPD_DOWN : + dir_flags |=GPIOD_PULL_DOWN ;break ;default :break ;
Signature · 1 line
2.17.1
PATCH 2/2 gpio: stm32: correct the bias management
Hi Marek,
Quoted 7 lines
From: Patrick DELAUNAY <[email protected]>
Sent: mercredi 28 octobre 2020 10:49Use the bias configuration for all the GPIO configurations and not only for input GPIO, as indicated in Reference manual (Table 81. Port bit configuration table).
Fixes 43efbb6a3ebf0223f9eab8d45916f602d876319f ("gpio: stm32: add ops
Quoted 9 lines
get_dir_flags")Fixes f13ff88b61c32ac8f0e9068c41328b265ef619eb ("gpio: stm32: add ops
set_dir_flags")Signed-off-by Patrick Delaunay <[email protected]>---
drivers/gpio/stm32_gpio.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
(...)
Can you test this patch on avenger board,
I expect it correct the SD card detect issue (pull-up not configurated).
Thanks.
Patrick
PATCH 2/2 gpio: stm32: correct the bias management
In reply to Patrick DelaunayHi Patrick
Quoted 49 lines · Patrick Delaunay
Use the bias configuration for all the GPIO configurations and not only for input GPIO, as indicated in Reference manual (Table 81. Port bit configuration table).
Fixes 43efbb6a3ebf0223f9eab8d45916f602d876319f ("gpio: stm32: add ops get_dir_flags")Fixes f13ff88b61c32ac8f0e9068c41328b265ef619eb ("gpio: stm32: add ops set_dir_flags")Signed-off-by Patrick Delaunay <[email protected]>---
drivers/gpio/stm32_gpio.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)drivers/gpio/stm32_gpio.c +7
-14@@ -212,11 +212,11 @@ static int stm32_gpio_set_dir_flags(struct udevice *dev, unsigned int offset, }else if (flags &GPIOD_IS_IN ) {stm32_gpio_set_moder (regs, idx,STM32_GPIO_MODE_IN ); -if (flags &GPIOD_PULL_UP ) -stm32_gpio_set_pupd (regs, idx,STM32_GPIO_PUPD_UP ); -else if (flags &GPIOD_PULL_DOWN ) -stm32_gpio_set_pupd (regs, idx,STM32_GPIO_PUPD_DOWN ); } +if (flags &GPIOD_PULL_UP ) +stm32_gpio_set_pupd (regs, idx,STM32_GPIO_PUPD_UP ); +else if (flags &GPIOD_PULL_DOWN ) +stm32_gpio_set_pupd (regs, idx,STM32_GPIO_PUPD_DOWN );return 0 ; }@@ -243,16 +243,16 @@ static int stm32_gpio_get_dir_flags(struct udevice *dev, unsigned int offset,break ;case STM32_GPIO_MODE_IN : dir_flags |=GPIOD_IS_IN ; -switch (stm32_gpio_get_pupd (regs, idx)) { -case STM32_GPIO_PUPD_UP : - dir_flags |=GPIOD_PULL_UP ; -break ; -case STM32_GPIO_PUPD_DOWN : - dir_flags |=GPIOD_PULL_DOWN ; -break ; -default : -break ; - } +break ; +default : +break ;
drivers/gpio/stm32_gpio.c static int stm32_gpio_get_dir_flags(struct udevice *dev, unsigned int offset, · line 258
Quoted 10 lines
drivers/gpio/stm32_gpio.c +7
-0+ } +switch (stm32_gpio_get_pupd (regs, idx)) { +case STM32_GPIO_PUPD_UP : + dir_flags |=GPIOD_PULL_UP ; +break ; +case STM32_GPIO_PUPD_DOWN : + dir_flags |=GPIOD_PULL_DOWN ;break ;default :break ;
Thanks
Patrice
PATCH 2/2 gpio: stm32: correct the bias management
In reply to Patrick DelaunayHi,
Quoted 7 lines
From: Patrick DELAUNAY <[email protected]>
Sent: mercredi 28 octobre 2020 10:49Use the bias configuration for all the GPIO configurations and not only for input GPIO, as indicated in Reference manual (Table 81. Port bit configuration table).
Fixes 43efbb6a3ebf0223f9eab8d45916f602d876319f ("gpio: stm32: add ops
Quoted 9 lines
get_dir_flags")Fixes f13ff88b61c32ac8f0e9068c41328b265ef619eb ("gpio: stm32: add ops
set_dir_flags")Signed-off-by Patrick Delaunay <[email protected]>---
drivers/gpio/stm32_gpio.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
Applied to u-boot-stm/master, thanks!
Regards
Patrick