mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Sam Ravnborg <sam@ravnborg.org>, barebox@lists.infradead.org
Subject: Re: [PATCH v2 04/11] ARM: at91: Provide at91_mux_pio_pin for use in lowlevel
Date: Wed, 29 Jun 2022 08:50:40 +0200	[thread overview]
Message-ID: <dfceb090-1658-d38b-d589-86cafbb36119@pengutronix.de> (raw)
In-Reply-To: <20220628203849.2785611-5-sam@ravnborg.org>

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 <sam@ravnborg.org>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

> ---
>  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	other threads:[~2022-06-29  6:52 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-28 20:38 [PATCH 0/11] ARM: at91: Add pbl support to skov-arm9cpu Sam Ravnborg
2022-06-28 20:38 ` [PATCH v2 01/11] pwm: atmel: Fix build and update Sam Ravnborg
2022-06-28 20:38 ` [PATCH v2 02/11] ARM: at91: Make sdramc.h useable in multi image builds Sam Ravnborg
2022-06-29  6:50   ` Ahmad Fatoum
2022-06-28 20:38 ` [PATCH v2 03/11] ARM: at91: Add initialize function to sdramc Sam Ravnborg
2022-06-29  6:50   ` Ahmad Fatoum
2022-06-28 20:38 ` [PATCH v2 04/11] ARM: at91: Provide at91_mux_pio_pin for use in lowlevel Sam Ravnborg
2022-06-29  6:50   ` Ahmad Fatoum [this message]
2022-06-28 20:38 ` [PATCH v2 05/11] mci: atmel_mci: Add PBL helper to configure highcapacity Sam Ravnborg
2022-06-29  6:50   ` Ahmad Fatoum
2022-06-28 20:38 ` [PATCH v2 06/11] ARM: at91: Add at91sam9 xload_mmc for PBL use Sam Ravnborg
2022-06-29  6:50   ` Ahmad Fatoum
2022-06-28 20:38 ` [PATCH v2 07/11] ARM: at91: Add extra register definitions Sam Ravnborg
2022-06-29  6:49   ` Ahmad Fatoum
2022-06-28 20:38 ` [PATCH v2 08/11] ARM: at91: Add lowlevel helpers for at91sam9263 Sam Ravnborg
2022-06-29  6:50   ` Ahmad Fatoum
2022-06-28 20:38 ` [WIP PATCH v2 09/11] atmel_lcdfb: add support for updated DT bindings Sam Ravnborg
2022-06-28 20:38 ` [PATCH v2 10/11] ARM: at91: Add xload support to skov-arm9cpu Sam Ravnborg
2022-06-28 20:47   ` Sam Ravnborg
2022-06-28 20:38 ` [WIP PATCH v2 11/11] ARM: at91: Update DTS for skov-arm9cpu Sam Ravnborg
2022-06-30 12:19 ` [PATCH 0/11] ARM: at91: Add pbl support to skov-arm9cpu Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dfceb090-1658-d38b-d589-86cafbb36119@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=sam@ravnborg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox