Linux-Renesas-SoC Archive on lore.kernel.org
 help / Atom feed
* [PATCH 0/2] pinctrl: sh-pfc: r8a77990: Rework GP6_9 no pull down handling
@ 2019-01-11 11:57 Geert Uytterhoeven
  2019-01-11 11:57 ` [PATCH 1/2] pinctrl: sh-pfc: r8a77990: GP6_9 does not have pull-down capability Geert Uytterhoeven
  2019-01-11 11:57 ` [PATCH 2/2] Revert "pinctrl: sh-pfc: r8a77990: Add support for pull-up only pins" Geert Uytterhoeven
  0 siblings, 2 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2019-01-11 11:57 UTC (permalink / raw)
  To: Linus Walleij, Yoshihiro Shimoda
  Cc: linux-renesas-soc, linux-gpio, Geert Uytterhoeven

	Hi,

Commit f4caa6ee736fa8a4 ("pinctrl: sh-pfc: r8a77990: Add support for pull-up
only pins") added an explicit check for the GP6_9 pin on R-Car E3, which
supports pull-up, but not pull-down.

However, I had forgotten this limitation can be expressed better by
dropping the SH_PFC_PIN_CFG_PULL_DOWN flag from the GPIO description, as
it includes returning an error to the caller when trying to configure
the pin for pull-down.

Hence this patch series drops the SH_PFC_PIN_CFG_PULL_DOWN flag, and
reverts the previous solution.

This has been tested on by adding the following to the pfc node in
arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts:

	pinctrl-0 = <&test6_9>;
	pinctrl-names = "default";

	test6_9: test6_9 {
		pins = "GP_6_9";
		bias-pull-down;
	};

I plan to queue this up in sh-pfc-for-v5.1.

Thanks!

Geert Uytterhoeven (2):
  pinctrl: sh-pfc: r8a77990: GP6_9 does not have pull-down capability
  Revert "pinctrl: sh-pfc: r8a77990: Add support for pull-up only pins"

 drivers/pinctrl/sh-pfc/pfc-r8a77990.c | 34 ++++++++++++---------------
 1 file changed, 15 insertions(+), 19 deletions(-)

-- 
2.17.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] pinctrl: sh-pfc: r8a77990: GP6_9 does not have pull-down capability
  2019-01-11 11:57 [PATCH 0/2] pinctrl: sh-pfc: r8a77990: Rework GP6_9 no pull down handling Geert Uytterhoeven
@ 2019-01-11 11:57 ` Geert Uytterhoeven
  2019-01-11 12:49   ` Simon Horman
  2019-01-11 11:57 ` [PATCH 2/2] Revert "pinctrl: sh-pfc: r8a77990: Add support for pull-up only pins" Geert Uytterhoeven
  1 sibling, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2019-01-11 11:57 UTC (permalink / raw)
  To: Linus Walleij, Yoshihiro Shimoda
  Cc: linux-renesas-soc, linux-gpio, Geert Uytterhoeven

Hence remove the SH_PFC_PIN_CFG_PULL_DOWN flag from the GP6_9 GPIO
description.

Fixes: 83f6941a42a5e773 ("pinctrl: sh-pfc: r8a77990: Add bias pinconf support")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/pinctrl/sh-pfc/pfc-r8a77990.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a77990.c b/drivers/pinctrl/sh-pfc/pfc-r8a77990.c
index 1ce286f7b286dde7..a1d99980788ac1cb 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a77990.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a77990.c
@@ -30,7 +30,16 @@
 	PORT_GP_CFG_1(3, 15, fn, sfx, CFG_FLAGS), \
 	PORT_GP_CFG_11(4, fn, sfx, CFG_FLAGS | SH_PFC_PIN_CFG_IO_VOLTAGE), \
 	PORT_GP_CFG_20(5, fn, sfx, CFG_FLAGS), \
-	PORT_GP_CFG_18(6, fn, sfx, CFG_FLAGS)
+	PORT_GP_CFG_9(6, fn, sfx, CFG_FLAGS), \
+	PORT_GP_CFG_1(6, 9, fn, sfx, SH_PFC_PIN_CFG_PULL_UP), \
+	PORT_GP_CFG_1(6, 10, fn, sfx, CFG_FLAGS), \
+	PORT_GP_CFG_1(6, 11, fn, sfx, CFG_FLAGS), \
+	PORT_GP_CFG_1(6, 12, fn, sfx, CFG_FLAGS), \
+	PORT_GP_CFG_1(6, 13, fn, sfx, CFG_FLAGS), \
+	PORT_GP_CFG_1(6, 14, fn, sfx, CFG_FLAGS), \
+	PORT_GP_CFG_1(6, 15, fn, sfx, CFG_FLAGS), \
+	PORT_GP_CFG_1(6, 16, fn, sfx, CFG_FLAGS), \
+	PORT_GP_CFG_1(6, 17, fn, sfx, CFG_FLAGS)
 /*
  * F_() : just information
  * FM() : macro for FN_xxx / xxx_MARK
-- 
2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] Revert "pinctrl: sh-pfc: r8a77990: Add support for pull-up only pins"
  2019-01-11 11:57 [PATCH 0/2] pinctrl: sh-pfc: r8a77990: Rework GP6_9 no pull down handling Geert Uytterhoeven
  2019-01-11 11:57 ` [PATCH 1/2] pinctrl: sh-pfc: r8a77990: GP6_9 does not have pull-down capability Geert Uytterhoeven
@ 2019-01-11 11:57 ` Geert Uytterhoeven
  2019-01-11 12:49   ` Simon Horman
  1 sibling, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2019-01-11 11:57 UTC (permalink / raw)
  To: Linus Walleij, Yoshihiro Shimoda
  Cc: linux-renesas-soc, linux-gpio, Geert Uytterhoeven

This reverts commit f4caa6ee736fa8a46c806ba4382c16f7e5a20248.

The same can be expressed better by dropping the
SH_PFC_PIN_CFG_PULL_DOWN flag from the GPIO description, as it includes
returning an error to the caller when trying to configure the pin for
pull-down, causing:

    sh-pfc e6060000.pin-controller: pin_config_set op failed for pin 201
    sh-pfc e6060000.pin-controller: Error applying setting, reverse things back
    sh-pfc e6060000.pin-controller: failed to select default state

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/pinctrl/sh-pfc/pfc-r8a77990.c | 23 +++++------------------
 1 file changed, 5 insertions(+), 18 deletions(-)

diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a77990.c b/drivers/pinctrl/sh-pfc/pfc-r8a77990.c
index a1d99980788ac1cb..967b3fec45f516d1 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a77990.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a77990.c
@@ -4927,17 +4927,6 @@ static const struct pinmux_bias_reg pinmux_bias_regs[] = {
 	{ /* sentinel */ },
 };
 
-static bool pin_has_pud(unsigned int pin)
-{
-	/* Some pins are pull-up only */
-	switch (pin) {
-	case RCAR_GP_PIN(6, 9):	/* USB30_OVC  */
-		return false;
-	}
-
-	return true;
-}
-
 static unsigned int r8a77990_pinmux_get_bias(struct sh_pfc *pfc,
 					     unsigned int pin)
 {
@@ -4950,7 +4939,7 @@ static unsigned int r8a77990_pinmux_get_bias(struct sh_pfc *pfc,
 
 	if (!(sh_pfc_read(pfc, reg->puen) & BIT(bit)))
 		return PIN_CONFIG_BIAS_DISABLE;
-	else if (!pin_has_pud(pin) || (sh_pfc_read(pfc, reg->pud) & BIT(bit)))
+	else if (sh_pfc_read(pfc, reg->pud) & BIT(bit))
 		return PIN_CONFIG_BIAS_PULL_UP;
 	else
 		return PIN_CONFIG_BIAS_PULL_DOWN;
@@ -4971,13 +4960,11 @@ static void r8a77990_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin,
 	if (bias != PIN_CONFIG_BIAS_DISABLE)
 		enable |= BIT(bit);
 
-	if (pin_has_pud(pin)) {
-		updown = sh_pfc_read(pfc, reg->pud) & ~BIT(bit);
-		if (bias == PIN_CONFIG_BIAS_PULL_UP)
-			updown |= BIT(bit);
+	updown = sh_pfc_read(pfc, reg->pud) & ~BIT(bit);
+	if (bias == PIN_CONFIG_BIAS_PULL_UP)
+		updown |= BIT(bit);
 
-		sh_pfc_write(pfc, reg->pud, updown);
-	}
+	sh_pfc_write(pfc, reg->pud, updown);
 	sh_pfc_write(pfc, reg->puen, enable);
 }
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] pinctrl: sh-pfc: r8a77990: GP6_9 does not have pull-down capability
  2019-01-11 11:57 ` [PATCH 1/2] pinctrl: sh-pfc: r8a77990: GP6_9 does not have pull-down capability Geert Uytterhoeven
@ 2019-01-11 12:49   ` Simon Horman
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2019-01-11 12:49 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Linus Walleij, Yoshihiro Shimoda, linux-renesas-soc, linux-gpio

On Fri, Jan 11, 2019 at 12:57:43PM +0100, Geert Uytterhoeven wrote:
> Hence remove the SH_PFC_PIN_CFG_PULL_DOWN flag from the GP6_9 GPIO
> description.
> 
> Fixes: 83f6941a42a5e773 ("pinctrl: sh-pfc: r8a77990: Add bias pinconf support")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] Revert "pinctrl: sh-pfc: r8a77990: Add support for pull-up only pins"
  2019-01-11 11:57 ` [PATCH 2/2] Revert "pinctrl: sh-pfc: r8a77990: Add support for pull-up only pins" Geert Uytterhoeven
@ 2019-01-11 12:49   ` Simon Horman
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2019-01-11 12:49 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Linus Walleij, Yoshihiro Shimoda, linux-renesas-soc, linux-gpio

On Fri, Jan 11, 2019 at 12:57:44PM +0100, Geert Uytterhoeven wrote:
> This reverts commit f4caa6ee736fa8a46c806ba4382c16f7e5a20248.
> 
> The same can be expressed better by dropping the
> SH_PFC_PIN_CFG_PULL_DOWN flag from the GPIO description, as it includes
> returning an error to the caller when trying to configure the pin for
> pull-down, causing:
> 
>     sh-pfc e6060000.pin-controller: pin_config_set op failed for pin 201
>     sh-pfc e6060000.pin-controller: Error applying setting, reverse things back
>     sh-pfc e6060000.pin-controller: failed to select default state
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-11 11:57 [PATCH 0/2] pinctrl: sh-pfc: r8a77990: Rework GP6_9 no pull down handling Geert Uytterhoeven
2019-01-11 11:57 ` [PATCH 1/2] pinctrl: sh-pfc: r8a77990: GP6_9 does not have pull-down capability Geert Uytterhoeven
2019-01-11 12:49   ` Simon Horman
2019-01-11 11:57 ` [PATCH 2/2] Revert "pinctrl: sh-pfc: r8a77990: Add support for pull-up only pins" Geert Uytterhoeven
2019-01-11 12:49   ` Simon Horman

Linux-Renesas-SoC Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-renesas-soc/0 linux-renesas-soc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-renesas-soc linux-renesas-soc/ https://lore.kernel.org/linux-renesas-soc \
		linux-renesas-soc@vger.kernel.org linux-renesas-soc@archiver.kernel.org
	public-inbox-index linux-renesas-soc


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-renesas-soc


AGPL code for this site: git clone https://public-inbox.org/ public-inbox