[PATCH] pinctrl: pinctrl_stm32: Add slew rate support for stm32_pinctrl_get_pin_muxing()

Patrick DELAUNAY patrick.delaunay at foss.st.com
Thu Mar 30 13:29:18 CEST 2023


Hi,

On 3/27/23 09:46, Patrice Chotard wrote:
> For debug purpose, it should be useful to indicate the slew rate for
> each pins.
> Add ospeed register information for pins which are configured in
> either alternate function or gpio output.
>
> Signed-off-by: Patrice Chotard <patrice.chotard at foss.st.com>
> ---
>
>   drivers/pinctrl/pinctrl_stm32.c | 19 +++++++++++++++----
>   1 file changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl_stm32.c b/drivers/pinctrl/pinctrl_stm32.c
> index b755fa42b4f..b06da50b2cd 100644
> --- a/drivers/pinctrl/pinctrl_stm32.c
> +++ b/drivers/pinctrl/pinctrl_stm32.c
> @@ -61,6 +61,13 @@ static const char * const pinmux_otype[] = {
>   	[STM32_GPIO_OTYPE_OD] = "open-drain",
>   };
>   
> +static const char * const pinmux_speed[] = {
> +	[STM32_GPIO_SPEED_2M] = "Low speed",
> +	[STM32_GPIO_SPEED_25M] = "Medium speed",
> +	[STM32_GPIO_SPEED_50M] = "High speed",
> +	[STM32_GPIO_SPEED_100M] = "Very-high speed",
> +};
> +
>   static int stm32_pinctrl_get_af(struct udevice *dev, unsigned int offset)
>   {
>   	struct stm32_gpio_priv *priv = dev_get_priv(dev);
> @@ -201,6 +208,7 @@ static int stm32_pinctrl_get_pin_muxing(struct udevice *dev,
>   	int af_num;
>   	unsigned int gpio_idx;
>   	u32 pupd, otype;
> +	u8 speed;
>   
>   	/* look up for the bank which owns the requested pin */
>   	gpio_dev = stm32_pinctrl_get_gpio_dev(dev, selector, &gpio_idx);
> @@ -214,6 +222,7 @@ static int stm32_pinctrl_get_pin_muxing(struct udevice *dev,
>   	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;
> +	speed = (readl(&priv->regs->ospeedr) >> gpio_idx * 2) & OSPEED_MASK;
>   
>   	switch (mode) {
>   	case GPIOF_UNKNOWN:
> @@ -222,13 +231,15 @@ 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 %s", pinmux_mode[mode], af_num,
> -			 pinmux_otype[otype], pinmux_bias[pupd]);
> +		snprintf(buf, size, "%s %d %s %s %s", pinmux_mode[mode], af_num,
> +			 pinmux_otype[otype], pinmux_bias[pupd],
> +			 pinmux_speed[speed]);
>   		break;
>   	case GPIOF_OUTPUT:
> -		snprintf(buf, size, "%s %s %s %s",
> +		snprintf(buf, size, "%s %s %s %s %s",
>   			 pinmux_mode[mode], pinmux_otype[otype],
> -			 pinmux_bias[pupd], label ? label : "");
> +			 pinmux_bias[pupd], label ? label : "",
> +			 pinmux_speed[speed]);
>   		break;
>   	case GPIOF_INPUT:
>   		snprintf(buf, size, "%s %s %s", pinmux_mode[mode],



Reviewed-by: Patrick Delaunay <patrick.delaunay at foss.st.com>

Thanks
Patrick



More information about the U-Boot mailing list