On 28.06.22 22:38, Sam Ravnborg wrote:
> Lowlevel init code may wish the ability to configure pins, e.g. for low
> level debug UART. The pinctrl-at91 driver already exports an
> at91_mux_pin function, but that one is only usable after driver
> probe. Instead, provide an at91_mux_pio_pin function, which can be used
> at all times.
> 
> This is similar to the already existing at91_mux_pio3_pin function
> 
> Signed-off-by: Sam Ravnborg <[email protected]>

Reviewed-by: Ahmad Fatoum <[email protected]>

> ---
>  arch/arm/mach-at91/include/mach/gpio.h | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/arch/arm/mach-at91/include/mach/gpio.h 
> b/arch/arm/mach-at91/include/mach/gpio.h
> index ddd6971e3..7f84f41e5 100644
> --- a/arch/arm/mach-at91/include/mach/gpio.h
> +++ b/arch/arm/mach-at91/include/mach/gpio.h
> @@ -151,6 +151,31 @@ static inline int at91_mux_gpio_get(void __iomem *pio, 
> unsigned mask)
>       return (pdsr & mask) != 0;
>  }
>  
> +static inline void at91_mux_pio_pin(void __iomem *pio, unsigned mask,
> +                                 enum at91_mux mux, int gpio_state)
> +{
> +     at91_mux_disable_interrupt(pio, mask);
> +
> +     switch(mux) {
> +     case AT91_MUX_GPIO:
> +             at91_mux_gpio_enable(pio, mask);
> +             break;
> +     case AT91_MUX_PERIPH_A:
> +             at91_mux_set_A_periph(pio, mask);
> +             break;
> +     case AT91_MUX_PERIPH_B:
> +             at91_mux_set_B_periph(pio, mask);
> +             break;
> +     default:
> +             /* ignore everything else */
> +             break;
> +     }
> +     if (mux != AT91_MUX_GPIO)
> +             at91_mux_gpio_disable(pio, mask);
> +
> +     at91_mux_set_pullup(pio, mask, gpio_state & GPIO_PULL_UP);
> +}
> +
>  static inline void at91_mux_pio3_pin(void __iomem *pio, unsigned mask,
>                                    enum at91_mux mux, int gpio_state)
>  {


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

Reply via email to