* [PATCH] pinctrl: at91-pio4: fix pull-up/down logic
@ 2016-04-19 14:03 Ludovic Desroches
2016-04-19 14:37 ` Alexandre Belloni
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ludovic Desroches @ 2016-04-19 14:03 UTC (permalink / raw)
To: linus.walleij
Cc: nicolas.ferre, alexandre.belloni, linux-arm-kernel, linux-gpio,
linux-kernel, Ludovic Desroches
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] pinctrl: at91-pio4: fix pull-up/down logic
2016-04-19 14:03 [PATCH] pinctrl: at91-pio4: fix pull-up/down logic Ludovic Desroches
@ 2016-04-19 14:37 ` Alexandre Belloni
2016-04-19 15:15 ` Nicolas Ferre
2016-04-29 9:17 ` Linus Walleij
2 siblings, 0 replies; 4+ messages in thread
From: Alexandre Belloni @ 2016-04-19 14:37 UTC (permalink / raw)
To: Ludovic Desroches
Cc: linus.walleij, nicolas.ferre, linux-arm-kernel, linux-gpio, linux-kernel
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] pinctrl: at91-pio4: fix pull-up/down logic
2016-04-19 14:03 [PATCH] pinctrl: at91-pio4: fix pull-up/down logic Ludovic Desroches
2016-04-19 14:37 ` Alexandre Belloni
@ 2016-04-19 15:15 ` Nicolas Ferre
2016-04-29 9:17 ` Linus Walleij
2 siblings, 0 replies; 4+ messages in thread
From: Nicolas Ferre @ 2016-04-19 15:15 UTC (permalink / raw)
To: Ludovic Desroches, linus.walleij
Cc: alexandre.belloni, linux-arm-kernel, linux-gpio, linux-kernel
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] pinctrl: at91-pio4: fix pull-up/down logic
2016-04-19 14:03 [PATCH] pinctrl: at91-pio4: fix pull-up/down logic Ludovic Desroches
2016-04-19 14:37 ` Alexandre Belloni
2016-04-19 15:15 ` Nicolas Ferre
@ 2016-04-29 9:17 ` Linus Walleij
2 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2016-04-29 9:17 UTC (permalink / raw)
To: Ludovic Desroches
Cc: Nicolas Ferre, Alexandre Belloni, linux-arm-kernel, linux-gpio,
linux-kernel
On Tue, Apr 19, 2016 at 4:03 PM, Ludovic Desroches
<ludovic.desroches@atmel.com> 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
Patch applied for fixes with the ACKs.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-04-29 9:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-19 14:03 [PATCH] pinctrl: at91-pio4: fix pull-up/down logic Ludovic Desroches
2016-04-19 14:37 ` Alexandre Belloni
2016-04-19 15:15 ` Nicolas Ferre
2016-04-29 9:17 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).