Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1382546 > unrolled thread

[PATCH] pinctrl: at91-pio4: fix pull-up/down logic

Started byLudovic Desroches <ludovic.desroches@atmel.com>
First post2016-04-19 16:10 +0200
Last post2016-04-19 17:20 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] pinctrl: at91-pio4: fix pull-up/down logic Ludovic Desroches <ludovic.desroches@atmel.com> - 2016-04-19 16:10 +0200
    Re: [PATCH] pinctrl: at91-pio4: fix pull-up/down logic Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-04-19 16:40 +0200
    Re: [PATCH] pinctrl: at91-pio4: fix pull-up/down logic Nicolas Ferre <nicolas.ferre@atmel.com> - 2016-04-19 17:20 +0200

#1382546 — [PATCH] pinctrl: at91-pio4: fix pull-up/down logic

FromLudovic Desroches <ludovic.desroches@atmel.com>
Date2016-04-19 16:10 +0200
Subject[PATCH] pinctrl: at91-pio4: fix pull-up/down logic
Message-ID<rpEvN-87k-21@gated-at.bofh.it>
The default configuration of a pin is often with a value in the
pull-up/down field at chip reset. So, even if the internal logic of the
controller prevents writing a configuration with pull-up and pull-down at
the same time, we must ensure explicitly this condition before writing the
register.

This was leading to a pull-down condition not taken into account for
instance.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Fixes: 776180848b57 ("pinctrl: introduce driver for Atmel PIO4 controller")
Cc: stable@vger.kernel.org #v4.4 and later
---
 drivers/pinctrl/pinctrl-at91-pio4.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
index 629b6fe..75093d7 100644
--- a/drivers/pinctrl/pinctrl-at91-pio4.c
+++ b/drivers/pinctrl/pinctrl-at91-pio4.c
@@ -722,9 +722,11 @@ static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev,
 			break;
 		case PIN_CONFIG_BIAS_PULL_UP:
 			conf |= ATMEL_PIO_PUEN_MASK;
+			conf &= (~ATMEL_PIO_PDEN_MASK);
 			break;
 		case PIN_CONFIG_BIAS_PULL_DOWN:
 			conf |= ATMEL_PIO_PDEN_MASK;
+			conf &= (~ATMEL_PIO_PUEN_MASK);
 			break;
 		case PIN_CONFIG_DRIVE_OPEN_DRAIN:
 			if (arg == 0)
-- 
2.5.0

[toc] | [next] | [standalone]


#1382579

FromAlexandre Belloni <alexandre.belloni@free-electrons.com>
Date2016-04-19 16:40 +0200
Message-ID<rpEYP-8k2-43@gated-at.bofh.it>
In reply to#1382546
On 19/04/2016 at 16:03:45 +0200, Ludovic Desroches wrote :
> The default configuration of a pin is often with a value in the
> pull-up/down field at chip reset. So, even if the internal logic of the
> controller prevents writing a configuration with pull-up and pull-down at
> the same time, we must ensure explicitly this condition before writing the
> register.
> 
> This was leading to a pull-down condition not taken into account for
> instance.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> Fixes: 776180848b57 ("pinctrl: introduce driver for Atmel PIO4 controller")
> Cc: stable@vger.kernel.org #v4.4 and later
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

> ---
>  drivers/pinctrl/pinctrl-at91-pio4.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
> index 629b6fe..75093d7 100644
> --- a/drivers/pinctrl/pinctrl-at91-pio4.c
> +++ b/drivers/pinctrl/pinctrl-at91-pio4.c
> @@ -722,9 +722,11 @@ static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev,
>  			break;
>  		case PIN_CONFIG_BIAS_PULL_UP:
>  			conf |= ATMEL_PIO_PUEN_MASK;
> +			conf &= (~ATMEL_PIO_PDEN_MASK);
>  			break;
>  		case PIN_CONFIG_BIAS_PULL_DOWN:
>  			conf |= ATMEL_PIO_PDEN_MASK;
> +			conf &= (~ATMEL_PIO_PUEN_MASK);
>  			break;
>  		case PIN_CONFIG_DRIVE_OPEN_DRAIN:
>  			if (arg == 0)
> -- 
> 2.5.0
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[toc] | [prev] | [next] | [standalone]


#1382605

FromNicolas Ferre <nicolas.ferre@atmel.com>
Date2016-04-19 17:20 +0200
Message-ID<rpFBv-s8-3@gated-at.bofh.it>
In reply to#1382546
Le 19/04/2016 16:03, Ludovic Desroches a écrit :
> The default configuration of a pin is often with a value in the
> pull-up/down field at chip reset. So, even if the internal logic of the
> controller prevents writing a configuration with pull-up and pull-down at
> the same time, we must ensure explicitly this condition before writing the
> register.
> 
> This was leading to a pull-down condition not taken into account for
> instance.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> Fixes: 776180848b57 ("pinctrl: introduce driver for Atmel PIO4 controller")
> Cc: stable@vger.kernel.org #v4.4 and later

Yes, and I can add:
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

and more important:
On a sama5d2 Xplained board:
Tested-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Thanks, bye.

> ---
>  drivers/pinctrl/pinctrl-at91-pio4.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
> index 629b6fe..75093d7 100644
> --- a/drivers/pinctrl/pinctrl-at91-pio4.c
> +++ b/drivers/pinctrl/pinctrl-at91-pio4.c
> @@ -722,9 +722,11 @@ static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev,
>  			break;
>  		case PIN_CONFIG_BIAS_PULL_UP:
>  			conf |= ATMEL_PIO_PUEN_MASK;
> +			conf &= (~ATMEL_PIO_PDEN_MASK);
>  			break;
>  		case PIN_CONFIG_BIAS_PULL_DOWN:
>  			conf |= ATMEL_PIO_PDEN_MASK;
> +			conf &= (~ATMEL_PIO_PUEN_MASK);
>  			break;
>  		case PIN_CONFIG_DRIVE_OPEN_DRAIN:
>  			if (arg == 0)
> 


-- 
Nicolas Ferre

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web