Skip to contentSkip to conversation

Remove non-existing GPIO pins for R8A7790/1

PATCH In review Sergei Shtylyov 4 participants 14 messages Jun 25, 2015 – Jul 13, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 cover Remove non-existing GPIO pins for R8A7790/1

Hello.

Here's the set of 3 patches against the 'fixes' branch of Linus Walleij's
'linux-pinctrl.git' repo. Here we eliminate the pin array "holes" on R-Car SoCs and then remove unused GPIO pins for R8A7790/1.

[1/3] sh-pfc: fix sparse GPIOs for R-Car SoCs [2/3] sh-pfc: r8a7790 remove non-existing GPIO pins [3/3] sh-pfc: r8a7791 remove non-existing GPIO pins

WBR, Sergei

#1 lore raw

PATCH v3 1/3 sh-pfc: fix sparse GPIOs for R-Car SoCs

The PFC driver causes the kernel to hang on the R-Car gen2 SoC based boards when the CPU_ALL_PORT() macro is fixed to reflect the reality, i.e. when the GPIO space becomes actually sparse. This happens because the _GP_GPIO() macro includes an indexed initializer which causes the "holes" (array entries filled with all 0s) between the groups of the existing GPIOs; and the driver can't cope with that. There seems to be no reason to use the indexed initializer, so we can remove the index specifier and so avoid the "holes".

---
Changes in version 3:
- new patch.

 drivers/pinctrl/sh-pfc/sh_pfc.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-pinctrl/drivers/pinctrl/sh-pfc/sh_pfc.h =================================--- linux-pinctrl.orig/drivers/pinctrl/sh-pfc/sh_pfc.h +++ linux-pinctrl/drivers/pinctrl/sh-pfc/sh_pfc.h
@@ -224,7 +224,7 @@ struct sh_pfc_soc_info {

/* PINMUX_GPIO_GP_ALL - Expand to a list of sh_pfc_pin entries */
#define _GP_GPIO(bank, _pin, _name, sfx) \
- [(bank * 32) + _pin] = { \
+ { \
.pin = (bank * 32) + _pin, \
.name = __stringify(_name), \
.enum_id = _name##_DATA, \

Acked-by on v3 1/3
#2 lore raw

Re: [PATCH v3 1/3] sh-pfc: fix sparse GPIOs for R-Car SoCs

Hi Sergei,

Thank you for the patch.

Quoted 10 lines · On Friday 26 June 2015 01:40:56 Sergei Shtylyov wrote:

The PFC driver causes the kernel to hang on the R-Car gen2 SoC based boards when the CPU_ALL_PORT() macro is fixed to reflect the reality, i.e. when the GPIO space becomes actually sparse. This happens because the _GP_GPIO() macro includes an indexed initializer which causes the "holes" (array entries filled with all 0s) between the groups of the existing GPIOs; and the driver can't cope with that. There seems to be no reason to use the indexed initializer, so we can remove the index specifier and so avoid the "holes".

I initially thought that this patch looked too good to be true. The fix is so simple, there must have been a reason why _GP_GPIO used indexed initializers. I then tried to find that reason and failed.

I still feel that this is too simple to be true, but I have no objective reason to push back, so

for the whole series, provided you have tested it, and paid attention to pins after the holes.

Quoted 20 lines

---
Changes in version 3:
- new patch.

 drivers/pinctrl/sh-pfc/sh_pfc.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-pinctrl/drivers/pinctrl/sh-pfc/sh_pfc.h
===================================================================

drivers/pinctrl/sh-pfc/sh_pfc.h +1 -1
@@ -224,7 +224,7 @@ struct sh_pfc_soc_info {
 
 /* PINMUX_GPIO_GP_ALL - Expand to a list of sh_pfc_pin entries */
 #define _GP_GPIO(bank, _pin, _name, sfx)				\
-	[(bank * 32) + _pin] = {					\
+	{								\
 		.pin = (bank * 32) + _pin,				\
 		.name = __stringify(_name),				\
 		.enum_id = _name##_DATA,				\
Signature · 3 lines
Regards,

Laurent Pinchart
#3 lore raw

Re: [PATCH v3 1/3] sh-pfc: fix sparse GPIOs for R-Car SoCs

Quoted 10 lines · Laurent Pinchart
Quoted 9 lines · On Friday 26 June 2015 01:40:56 Sergei Shtylyov wrote:

The PFC driver causes the kernel to hang on the R-Car gen2 SoC based boards when the CPU_ALL_PORT() macro is fixed to reflect the reality, i.e. when the GPIO space becomes actually sparse. This happens because the _GP_GPIO() macro includes an indexed initializer which causes the "holes" (array entries filled with all 0s) between the groups of the existing GPIOs; and the driver can't cope with that. There seems to be no reason to use the indexed initializer, so we can remove the index specifier and so avoid the "holes".

Quoted 8 lines
Quoted 1 line

I initially thought that this patch looked too good to be true. The fix is so simple, there must have been a reason why _GP_GPIO used indexed initializers. I then tried to find that reason and failed.

I still feel that this is too simple to be true, but I have no objective reason to push back, so

:-)

Quoted 4 lines

for the whole series, provided you have tested it, and paid attention to pins after the holes.

On r8a7791/koelsch, the switches (gpio banks 5 and 7) and LEDs (gpio bank 2) still work, so

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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

#4 lore raw

Re: [PATCH v3 1/3] sh-pfc: fix sparse GPIOs for R-Car SoCs

In reply to Sergei Shtylyov
Quoted 9 lines · Sergei Shtylyov

The PFC driver causes the kernel to hang on the R-Car gen2 SoC based boards when the CPU_ALL_PORT() macro is fixed to reflect the reality, i.e. when the GPIO space becomes actually sparse. This happens because the _GP_GPIO() macro includes an indexed initializer which causes the "holes" (array entries filled with all 0s) between the groups of the existing GPIOs; and the driver can't cope with that. There seems to be no reason to use the indexed initializer, so we can remove the index specifier and so avoid the "holes".

Patch applied for fixes.

Yours,
Linus Walleij

#5 lore raw

PATCH v3 2/3 sh-pfc: r8a7790: remove non-existing GPIO pins

In reply to Sergei Shtylyov

From: Laurent Pinchart <[email protected]>

GPIO banks 1 and 2 are missing pins 30 and 31. Remove them.

---
Changes in version 2:
- renamed the patch.

 drivers/pinctrl/sh-pfc/pfc-r8a7790.c |   21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/pinctrl/sh-pfc/pfc-r8a7790.c +19 -2
Index: linux-pinctrl/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
===================================================================
@@ -27,10 +27,27 @@
 #include "core.h"
 #include "sh_pfc.h"
 
+#define PORT_GP_30(bank, fn, sfx)					\
+	PORT_GP_1(bank, 0,  fn, sfx), PORT_GP_1(bank, 1,  fn, sfx),	\
+	PORT_GP_1(bank, 2,  fn, sfx), PORT_GP_1(bank, 3,  fn, sfx),	\
+	PORT_GP_1(bank, 4,  fn, sfx), PORT_GP_1(bank, 5,  fn, sfx),	\
+	PORT_GP_1(bank, 6,  fn, sfx), PORT_GP_1(bank, 7,  fn, sfx),	\
+	PORT_GP_1(bank, 8,  fn, sfx), PORT_GP_1(bank, 9,  fn, sfx),	\
+	PORT_GP_1(bank, 10, fn, sfx), PORT_GP_1(bank, 11, fn, sfx),	\
+	PORT_GP_1(bank, 12, fn, sfx), PORT_GP_1(bank, 13, fn, sfx),	\
+	PORT_GP_1(bank, 14, fn, sfx), PORT_GP_1(bank, 15, fn, sfx),	\
+	PORT_GP_1(bank, 16, fn, sfx), PORT_GP_1(bank, 17, fn, sfx),	\
+	PORT_GP_1(bank, 18, fn, sfx), PORT_GP_1(bank, 19, fn, sfx),	\
+	PORT_GP_1(bank, 20, fn, sfx), PORT_GP_1(bank, 21, fn, sfx),	\
+	PORT_GP_1(bank, 22, fn, sfx), PORT_GP_1(bank, 23, fn, sfx),	\
+	PORT_GP_1(bank, 24, fn, sfx), PORT_GP_1(bank, 25, fn, sfx),	\
+	PORT_GP_1(bank, 26, fn, sfx), PORT_GP_1(bank, 27, fn, sfx),	\
+	PORT_GP_1(bank, 28, fn, sfx), PORT_GP_1(bank, 29, fn, sfx)
+
 #define CPU_ALL_PORT(fn, sfx)						\
 	PORT_GP_32(0, fn, sfx),						\
-	PORT_GP_32(1, fn, sfx),						\
-	PORT_GP_32(2, fn, sfx),						\
+	PORT_GP_30(1, fn, sfx),						\
+	PORT_GP_30(2, fn, sfx),						\
 	PORT_GP_32(3, fn, sfx),						\
 	PORT_GP_32(4, fn, sfx),						\
 	PORT_GP_32(5, fn, sfx)
#7 lore raw

PATCH v3 3/3 sh-pfc: r8a7791: remove non-existing GPIO pins

In reply to Sergei Shtylyov

From: Laurent Pinchart <[email protected]>

GPIO banks 1 and 7 are missing pins 26 to 31. Remove them.

---
Changes in version 2:
- renamed the patch.

 drivers/pinctrl/sh-pfc/pfc-r8a7791.c |   19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/pinctrl/sh-pfc/pfc-r8a7791.c +17 -2
Index: linux-pinctrl/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
===================================================================
@@ -14,15 +14,30 @@
 #include "core.h"
 #include "sh_pfc.h"
 
+#define PORT_GP_26(bank, fn, sfx)					\
+	PORT_GP_1(bank, 0,  fn, sfx), PORT_GP_1(bank, 1,  fn, sfx),	\
+	PORT_GP_1(bank, 2,  fn, sfx), PORT_GP_1(bank, 3,  fn, sfx),	\
+	PORT_GP_1(bank, 4,  fn, sfx), PORT_GP_1(bank, 5,  fn, sfx),	\
+	PORT_GP_1(bank, 6,  fn, sfx), PORT_GP_1(bank, 7,  fn, sfx),	\
+	PORT_GP_1(bank, 8,  fn, sfx), PORT_GP_1(bank, 9,  fn, sfx),	\
+	PORT_GP_1(bank, 10, fn, sfx), PORT_GP_1(bank, 11, fn, sfx),	\
+	PORT_GP_1(bank, 12, fn, sfx), PORT_GP_1(bank, 13, fn, sfx),	\
+	PORT_GP_1(bank, 14, fn, sfx), PORT_GP_1(bank, 15, fn, sfx),	\
+	PORT_GP_1(bank, 16, fn, sfx), PORT_GP_1(bank, 17, fn, sfx),	\
+	PORT_GP_1(bank, 18, fn, sfx), PORT_GP_1(bank, 19, fn, sfx),	\
+	PORT_GP_1(bank, 20, fn, sfx), PORT_GP_1(bank, 21, fn, sfx),	\
+	PORT_GP_1(bank, 22, fn, sfx), PORT_GP_1(bank, 23, fn, sfx),	\
+	PORT_GP_1(bank, 24, fn, sfx), PORT_GP_1(bank, 25, fn, sfx)
+
 #define CPU_ALL_PORT(fn, sfx)						\
 	PORT_GP_32(0, fn, sfx),						\
-	PORT_GP_32(1, fn, sfx),						\
+	PORT_GP_26(1, fn, sfx),						\
 	PORT_GP_32(2, fn, sfx),						\
 	PORT_GP_32(3, fn, sfx),						\
 	PORT_GP_32(4, fn, sfx),						\
 	PORT_GP_32(5, fn, sfx),						\
 	PORT_GP_32(6, fn, sfx),						\
-	PORT_GP_32(7, fn, sfx)
+	PORT_GP_26(7, fn, sfx)
 
 enum {
 	PINMUX_RESERVED = 0,
Tested-by on v3 3/3
#8 lore raw

Re: [PATCH v3 3/3] sh-pfc: r8a7791: remove non-existing GPIO pins

Quoted 6 lines · Sergei Shtylyov

From: Laurent Pinchart <[email protected]>

GPIO banks 1 and 7 are missing pins 26 to 31. Remove them.

On r8a7791/koelsch, the switches (gpio banks 5 and 7) and LEDs (gpio bank 2) still work, so

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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

#10 lore raw
In reply to Sergei Shtylyov
Quoted 5 lines · Sergei Shtylyov

Here's the set of 3 patches against the 'fixes' branch of Linus Walleij's
'linux-pinctrl.git' repo. Here we eliminate the pin array "holes" on R-Car SoCs and then remove unused GPIO pins for R8A7790/1.

[1/3] sh-pfc: fix sparse GPIOs for R-Car SoCs

Note that this patch is necessary for the R8A7794 driver (already in
Linus' tree to work correctly.

WBR, Sergei

#11 lore raw
Quoted 9 lines · Sergei Shtylyov
Quoted 5 lines · Sergei Shtylyov

Here's the set of 3 patches against the 'fixes' branch of Linus
Walleij's
'linux-pinctrl.git' repo. Here we eliminate the pin array "holes" on R-Car SoCs
and then remove unused GPIO pins for R8A7790/1.

Quoted 5 lines
Quoted 1 line

[1/3] sh-pfc: fix sparse GPIOs for R-Car SoCs

Note that this patch is necessary for the R8A7794 driver (already in
Linus' tree to work correctly.

Laurent is it OK to apply these three for fixes?

Yours,
Linus Walleij

#12 lore raw

Hello,

Quoted 8 lines · On Monday 29 June 2015 12:43:09 Linus Walleij wrote:
Quoted 7 lines · Sergei Shtylyov
Quoted 6 lines · Sergei Shtylyov

Here's the set of 3 patches against the 'fixes' branch of Linus Walleij's
'linux-pinctrl.git' repo. Here we eliminate the pin array "holes" on R-Car SoCs and then remove unused GPIO pins for R8A7790/1.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

[1/3] sh-pfc: fix sparse GPIOs for R-Car SoCs

Note that this patch is necessary for the R8A7794 driver (already in

Linus' tree to work correctly.

Laurent is it OK to apply these three for fixes?

Sorry for the delay. I'll try to review this patch set on Monday.

Signature · 3 lines
Regards,

Laurent Pinchart
#13 lore raw
In reply to Linus Walleij

Hi Linus,

Quoted 6 lines · On Monday 29 June 2015 12:43:09 Linus Walleij wrote:
Quoted 5 lines · Sergei Shtylyov
Quoted 4 lines · Sergei Shtylyov

Here's the set of 3 patches against the 'fixes' branch of Linus Walleij's 'linux-pinctrl.git' repo. Here we eliminate the pin array "holes" on R-Car SoCs and then remove unused GPIO pins for R8A7790/1.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

[1/3] sh-pfc: fix sparse GPIOs for R-Car SoCs

Note that this patch is necessary for the R8A7794 driver (already in Linus' tree to work correctly.

Laurent is it OK to apply these three for fixes?

You can apply 1/3 as a v4.2-rc fix, as pfc-r8a7794 merged in v4.2-rc1 is broken without it. I would prefer delaying 2/3 and 3/3 to v4.3.

Signature · 3 lines
Regards,

Laurent Pinchart