Skip to contentSkip to conversation

ARM: shmobile: r7s72100 and Genmai GPIO / PINCTRL support

PATCH Superseded Magnus Damm 4 participants 15 messages Nov 27, 2013 – Nov 28, 2013

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover ARM: shmobile: r7s72100 and Genmai GPIO / PINCTRL support

ARM: shmobile: r7s72100 and Genmai GPIO / PINCTRL support

[PATCH 01/04] ARM: shmobile: r7s72100 GPIO and PINCTRL device nodes [PATCH 02/04] ARM: shmobile: Genmai LED1 and LED2 support [PATCH 03/04] ARM: shmobile: Genmai I2C-over-GPIO support [PATCH 04/04] ARM: shmobile: Genmai SCIF2 PINCTRL configuration

Add various device nodes to the r7s72100 SoC and the Genmai board, nothing special just basic support for LEDs and I2C-over-GPIO.

Patch 4/4 depends on the r7s72100 PINCTRL pin grouping, but 1-3 depends on the GPIO driver.

---

Written against renesas.git tag renesas-devel-v3.13-rc1-20131125 and [PATCH] pinctrl: sh-pfc: Initial r7s72100 support
[PATCH v3] gpio: Renesas RZ GPIO driver V3

The following patches are needed for 4/4:
[PATCH 00/03] pinctrl: sh-pfc: r7s72100 SCIF2 support [PATCH 01/03] pinctrl: sh-pfc: r7s72100 SCIF2 port3 support [PATCH 02/03] pinctrl: sh-pfc: r7s72100 SCIF2 macro conversion [PATCH 03/03] pinctrl: sh-pfc: r7s72100 SCIF2 port4, 6 and 8 support

 arch/arm/boot/dts/r7s72100-genmai-reference.dts |   41 +++++-
 arch/arm/boot/dts/r7s72100.dtsi                 |  154 +++++++++++++++++++++++
 2 files changed, 194 insertions(+), 1 deletion(-)
#1 lore raw

PATCH 1/4 ARM: shmobile: r7s72100 GPIO and PINCTRL device nodes

From: Magnus Damm <[email protected]>

Add support for r7s72100 PFC and GPIO device nodes port0 -> port11 and jtagport0.

---

 arch/arm/boot/dts/r7s72100.dtsi |  154 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 154 insertions(+)
arch/arm/boot/dts/r7s72100.dtsi +154 -0
@@ -14,6 +14,22 @@
 	#address-cells = <1>;
 	#size-cells = <1>;
 
+	aliases {
+		gpio0 = &port0;
+		gpio1 = &port1;
+		gpio2 = &port2;
+		gpio3 = &port3;
+		gpio4 = &port4;
+		gpio5 = &port5;
+		gpio6 = &port6;
+		gpio7 = &port7;
+		gpio8 = &port8;
+		gpio9 = &port9;
+		gpio10 = &port10;
+		gpio11 = &port11;
+		gpio12 = &jtagport0;
+	};
+
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
@@ -33,4 +49,142 @@
 		reg = <0xe8201000 0x1000>,
 			<0xe8202000 0x1000>;
 	};
+
+	pfc: pfc at fcfe3300 {
+		compatible = "renesas,pfc-r7s72100";
+		reg = <0xfcfe3300 0x400>, /* PM, PMC, PFC, PFCE */
+		  	  <0xfcfe3a00 0x100>, /* PFCAE */
+			  <0xfcfe7000 0x300>, /* PIBC, PBDC, PIPC */
+			  <0xfcfe7b40 0x04>, /* JPMC */
+			  <0xfcfe7b90 0x04>, /* JPMCSR */
+			  <0xfcfe7f00 0x04>; /* JPIBC */
+	};
+
+	port0: gpio at fcfe3100 {
+		compatible = "renesas,gpio-r7s72100", "renesas,gpio-rz";
+		reg = <0xfcfe3100 0x4>, /* PSR */
+		  	  <0xfcfe3200 0x2>, /* PPR */
+			  <0xfcfe3800 0x4>; /* PMSR */
+		#gpio-cells = <2>;
+		gpio-controller;
+		gpio-ranges = <&pfc 0 0 6>;
+	};
+
+	port1: gpio at fcfe3104 {
+		compatible = "renesas,gpio-r7s72100", "renesas,gpio-rz";
+		reg = <0xfcfe3104 0x4>, /* PSR */
+		  	  <0xfcfe3204 0x2>, /* PPR */
+			  <0xfcfe3804 0x4>; /* PMSR */
+		#gpio-cells = <2>;
+		gpio-controller;
+		gpio-ranges = <&pfc 0 16 16>;
+	};
+
+	port2: gpio at fcfe3108 {
+		compatible = "renesas,gpio-r7s72100", "renesas,gpio-rz";
+		reg = <0xfcfe3108 0x4>, /* PSR */
+		  	  <0xfcfe3208 0x2>, /* PPR */
+			  <0xfcfe3808 0x4>; /* PMSR */
+		#gpio-cells = <2>;
+		gpio-controller;
+		gpio-ranges = <&pfc 0 32 16>;
+	};
+
+	port3: gpio at fcfe310c {
+		compatible = "renesas,gpio-r7s72100", "renesas,gpio-rz";
+		reg = <0xfcfe310c 0x4>, /* PSR */
+		  	  <0xfcfe320c 0x2>, /* PPR */
+			  <0xfcfe380c 0x4>; /* PMSR */
+		#gpio-cells = <2>;
+		gpio-controller;
+		gpio-ranges = <&pfc 0 48 16>;
+	};
+
+	port4: gpio at fcfe3110 {
+		compatible = "renesas,gpio-r7s72100", "renesas,gpio-rz";
+		reg = <0xfcfe3110 0x4>, /* PSR */
+		  	  <0xfcfe3210 0x2>, /* PPR */
+			  <0xfcfe3810 0x4>; /* PMSR */
+		#gpio-cells = <2>;
+		gpio-controller;
+		gpio-ranges = <&pfc 0 64 16>;
+	};
+
+	port5: gpio at fcfe3114 {
+		compatible = "renesas,gpio-r7s72100", "renesas,gpio-rz";
+		reg = <0xfcfe3114 0x4>, /* PSR */
+		  	  <0xfcfe3214 0x2>, /* PPR */
+			  <0xfcfe3814 0x4>; /* PMSR */
+		#gpio-cells = <2>;
+		gpio-controller;
+		gpio-ranges = <&pfc 0 80 11>;
+	};
+
+	port6: gpio at fcfe3118 {
+		compatible = "renesas,gpio-r7s72100", "renesas,gpio-rz";
+		reg = <0xfcfe3118 0x4>, /* PSR */
+		  	  <0xfcfe3218 0x2>, /* PPR */
+			  <0xfcfe3818 0x4>; /* PMSR */
+		#gpio-cells = <2>;
+		gpio-controller;
+		gpio-ranges = <&pfc 0 96 16>;
+	};
+
+	port7: gpio at fcfe311c {
+		compatible = "renesas,gpio-r7s72100", "renesas,gpio-rz";
+		reg = <0xfcfe311c 0x4>, /* PSR */
+		  	  <0xfcfe321c 0x2>, /* PPR */
+			  <0xfcfe381c 0x4>; /* PMSR */
+		#gpio-cells = <2>;
+		gpio-controller;
+		gpio-ranges = <&pfc 0 112 16>;
+	};
+
+	port8: gpio at fcfe3120 {
+		compatible = "renesas,gpio-r7s72100", "renesas,gpio-rz";
+		reg = <0xfcfe3120 0x4>, /* PSR */
+		  	  <0xfcfe3220 0x2>, /* PPR */
+			  <0xfcfe3820 0x4>; /* PMSR */
+		#gpio-cells = <2>;
+		gpio-controller;
+		gpio-ranges = <&pfc 0 128 16>;
+	};
+
+	port9: gpio at fcfe3124 {
+		compatible = "renesas,gpio-r7s72100", "renesas,gpio-rz";
+		reg = <0xfcfe3124 0x4>, /* PSR */
+		  	  <0xfcfe3224 0x2>, /* PPR */
+			  <0xfcfe3824 0x4>; /* PMSR */
+		#gpio-cells = <2>;
+		gpio-controller;
+		gpio-ranges = <&pfc 0 144 8>;
+	};
+
+	port10: gpio at fcfe3128 {
+		compatible = "renesas,gpio-r7s72100", "renesas,gpio-rz";
+		reg = <0xfcfe3128 0x4>, /* PSR */
+		  	  <0xfcfe3228 0x2>, /* PPR */
+			  <0xfcfe3828 0x4>; /* PMSR */
+		#gpio-cells = <2>;
+		gpio-controller;
+		gpio-ranges = <&pfc 0 160 16>;
+	};
+
+	port11: gpio at fcfe312c {
+		compatible = "renesas,gpio-r7s72100", "renesas,gpio-rz";
+		reg = <0xfcfe312c 0x4>, /* PSR */
+		  	  <0xfcfe322c 0x2>, /* PPR */
+			  <0xfcfe382c 0x4>; /* PMSR */
+		#gpio-cells = <2>;
+		gpio-controller;
+		gpio-ranges = <&pfc 0 176 16>;
+	};
+
+	jtagport0: gpio at fcfe7b20 {
+		compatible = "renesas,gpio-r7s72100", "renesas,gpio-rz";
+		reg = <0xfcfe7b20 0x2>; /* JPPR */
+		#gpio-cells = <2>;
+		gpio-controller;
+		gpio-ranges = <&pfc 0 192 2>;
+	};
 };
#2 lore raw

PATCH 2/4 ARM: shmobile: Genmai LED1 and LED2 support

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Add support for Genmai board LED1 and LED2 via gpio-leds.

---

 arch/arm/boot/dts/r7s72100-genmai-reference.dts |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm/boot/dts/r7s72100-genmai-reference.dts +12 -1
@@ -9,7 +9,8 @@
  */
 
 /dts-v1/;
-/include/ "r7s72100.dtsi"
+#include "r7s72100.dtsi"
+#include <dt-bindings/gpio/gpio.h>
 
 / {
 	model = "Genmai";
@@ -28,4 +29,14 @@
 		#address-cells = <1>;
 		#size-cells = <1>;
 	};
+
+	leds {
+		compatible = "gpio-leds";
+		led1 {
+			gpios = <&port4 10 GPIO_ACTIVE_LOW>;
+		};
+		led2 {
+			gpios = <&port4 11 GPIO_ACTIVE_LOW>;
+		};
+	};
 };
#3 lore raw

PATCH 2/4 ARM: shmobile: Genmai LED1 and LED2 support

Hi Magnus,

Thank you for the patch.

Quoted 5 lines · On Wednesday 27 November 2013 17:27:55 Magnus Damm wrote:

From: Magnus Damm <[email protected]>

Add support for Genmai board LED1 and LED2 via gpio-leds.

Quoted 32 lines

---

 arch/arm/boot/dts/r7s72100-genmai-reference.dts |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm/boot/dts/r7s72100-genmai-reference.dts +0 -0

15:49:27.000000000 +0900 @@ -9,7 +9,8 @@
*/

/dts-v1/;

arch/arm/boot/dts/r7s72100-genmai-reference.dts +12 -1
-/include/ "r7s72100.dtsi"
+#include "r7s72100.dtsi"
+#include <dt-bindings/gpio/gpio.h>
 
 / {
 	model = "Genmai";
@@ -28,4 +29,14 @@
 		#address-cells = <1>;
 		#size-cells = <1>;
 	};
+
+	leds {
+		compatible = "gpio-leds";
+		led1 {
+			gpios = <&port4 10 GPIO_ACTIVE_LOW>;
+		};
+		led2 {
+			gpios = <&port4 11 GPIO_ACTIVE_LOW>;
+		};
+	};
 };
Signature · 3 lines
Regards,

Laurent Pinchart
#4 lore raw

PATCH 3/4 ARM: shmobile: Genmai I2C-over-GPIO support

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Add support for the Genmai I2C bus hooked up to P1_5 and P1_4 using the i2c-gpio driver. On the bus sits a 24c128 EEPRROM.

---

 arch/arm/boot/dts/r7s72100-genmai-reference.dts |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
arch/arm/boot/dts/r7s72100-genmai-reference.dts +18 -0
@@ -39,4 +39,22 @@
 			gpios = <&port4 11 GPIO_ACTIVE_LOW>;
 		};
 	};
+
+	i2c at 0 {
+		compatible = "i2c-gpio";
+		gpios = <&port1 5 GPIO_ACTIVE_HIGH /* sda */
+			 &port1 4 GPIO_ACTIVE_HIGH /* scl */
+			>;
+		i2c-gpio,sda-open-drain;
+		i2c-gpio,scl-open-drain;
+		i2c-gpio,delay-us = <5>;	/* ~100 kHz */
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		eeprom: 24c128 at 50 {
+			compatible = "at,24c128";
+			reg = <0x50>;
+		};
+	};
+
 };
#5 lore raw

PATCH 3/4 ARM: shmobile: Genmai I2C-over-GPIO support

arch/arm/boot/dts/r7s72100-genmai-reference.dts line 55

Quoted 6 lines
arch/arm/boot/dts/r7s72100-genmai-reference.dts +5 -0
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		eeprom: 24c128 at 50 {
+			compatible = "at,24c128";

Minor nit: Should be a vendor name, not the name of the driver

arch/arm/boot/dts/r7s72100-genmai-reference.dts line 60

Quoted 5 lines
arch/arm/boot/dts/r7s72100-genmai-reference.dts +4 -0
+			reg = <0x50>;
+		};
+	};
+
 };

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131127/0fa420d3/attachment.sig>

#6 lore raw

PATCH 3/4 ARM: shmobile: Genmai I2C-over-GPIO support

Hello.

Quoted 7 lines · Wolfram Sang

arch/arm/boot/dts/r7s72100-genmai-reference.dts line 55

Quoted 5 lines
arch/arm/boot/dts/r7s72100-genmai-reference.dts +5 -0
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		eeprom: 24c128 at 50 {
+			compatible = "at,24c128";

Minor nit: Should be a vendor name, not the name of the driver

Moreover, the node should be named generically, like "flash at 50", not
"24c128 at 50".

WBR, Sergei

#7 lore raw

PATCH 3/4 ARM: shmobile: Genmai I2C-over-GPIO support

Quoted 11 lines · On Thursday 28 November 2013 21:11:48 Sergei Shtylyov wrote:
Quoted 7 lines · Wolfram Sang

arch/arm/boot/dts/r7s72100-genmai-reference.dts line 55

Quoted 5 lines
arch/arm/boot/dts/r7s72100-genmai-reference.dts +5 -0
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		eeprom: 24c128 at 50 {
+			compatible = "at,24c128";

Minor nit: Should be a vendor name, not the name of the driver

Moreover, the node should be named generically, like "flash at 50", not "24c128 at 50".

Or, given that it's an eeprom, "eeprom at 50" ? :-)

Signature · 3 lines
Regards,

Laurent Pinchart
#8 lore raw

PATCH 3/4 ARM: shmobile: Genmai I2C-over-GPIO support

Hello.

Quoted 8 lines · Laurent Pinchart
Quoted 7 lines
Quoted 7 lines

arch/arm/boot/dts/r7s72100-genmai-reference.dts line 55

Quoted 5 lines
arch/arm/boot/dts/r7s72100-genmai-reference.dts +5 -0
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		eeprom: 24c128 at 50 {
+			compatible = "at,24c128";

Minor nit: Should be a vendor name, not the name of the driver

Quoted 4 lines
Quoted 2 lines

Moreover, the node should be named generically, like "flash at 50", not "24c128 at 50".

Or, given that it's an eeprom, "eeprom at 50" ? :-)

At least ePAPR spec. only has "flash".

WBR, Sergei

#9 lore raw

PATCH 3/4 ARM: shmobile: Genmai I2C-over-GPIO support

In reply to Magnus Damm

Hi Magnus,

Thank you for the patch.

Quoted 4 lines · On Wednesday 27 November 2013 17:28:05 Magnus Damm wrote:

From: Magnus Damm <[email protected]>

Add support for the Genmai I2C bus hooked up to P1_5 and P1_4 using the i2c-gpio driver. On the bus sits a 24c128 EEPRROM.

Is this a temporary workaround until we get a proper I2C controller driver, or is the EEPROM really hooked up to pins that are not wired to a hardware I2C controller ?

Quoted 31 lines

---

 arch/arm/boot/dts/r7s72100-genmai-reference.dts |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
arch/arm/boot/dts/r7s72100-genmai-reference.dts +0 -0

15:51:31.000000000 +0900 @@ -39,4 +39,22 @@

arch/arm/boot/dts/r7s72100-genmai-reference.dts +18 -0
 			gpios = <&port4 11 GPIO_ACTIVE_LOW>;
 		};
 	};
+
+	i2c at 0 {
+		compatible = "i2c-gpio";
+		gpios = <&port1 5 GPIO_ACTIVE_HIGH /* sda */
+			 &port1 4 GPIO_ACTIVE_HIGH /* scl */
+			>;
+		i2c-gpio,sda-open-drain;
+		i2c-gpio,scl-open-drain;
+		i2c-gpio,delay-us = <5>;	/* ~100 kHz */
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		eeprom: 24c128 at 50 {
+			compatible = "at,24c128";
+			reg = <0x50>;
+		};
+	};
+
 };
Signature · 3 lines
Regards,

Laurent Pinchart
#10 lore raw

PATCH 3/4 ARM: shmobile: Genmai I2C-over-GPIO support

Hi Laurent,

Quoted 5 lines · Laurent Pinchart

Hi Magnus,

Thank you for the patch.

On Wednesday 27 November 2013 17:28:05 Magnus Damm wrote:

Quoted 8 lines
Quoted 4 lines

From: Magnus Damm <[email protected]>

Add support for the Genmai I2C bus hooked up to P1_5 and P1_4 using the i2c-gpio driver. On the bus sits a 24c128 EEPRROM.

Is this a temporary workaround until we get a proper I2C controller driver, or is the EEPROM really hooked up to pins that are not wired to a hardware I2C controller ?

This is a stop-gap solution until we have upstream driver support for the I2C master hardware. The pins used for the I2C bus can be configured in GPIO mode or a zillion other pin functions including SCL and SDA.

Cheers,

/ magnus

#11 lore raw

PATCH 3/4 ARM: shmobile: Genmai I2C-over-GPIO support

Hi Magnus,

Quoted 7 lines · On Thursday 28 November 2013 09:44:31 Magnus Damm wrote:
Quoted 6 lines · Laurent Pinchart
Quoted 4 lines · On Wednesday 27 November 2013 17:28:05 Magnus Damm wrote:

From: Magnus Damm <[email protected]>

Add support for the Genmai I2C bus hooked up to P1_5 and P1_4 using the i2c-gpio driver. On the bus sits a 24c128 EEPRROM.

Quoted 6 lines
Quoted 3 lines

Is this a temporary workaround until we get a proper I2C controller driver, or is the EEPROM really hooked up to pins that are not wired to a hardware I2C controller ?

This is a stop-gap solution until we have upstream driver support for the I2C master hardware.

OK, no problem. Is there a timeline for that ?

Quoted 2 lines

The pins used for the I2C bus can be configured in GPIO mode or a zillion other pin functions including SCL and SDA.

Signature · 3 lines
Regards,

Laurent Pinchart
#12 lore raw

PATCH 4/4 ARM: shmobile: Genmai SCIF2 PINCTRL configuration

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Configure the r7s72100 PINCTRL hardware and select pin function for the SCIF2 serial console.

---

 arch/arm/boot/dts/r7s72100-genmai-reference.dts |   10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm/boot/dts/r7s72100-genmai-reference.dts +10 -0
@@ -58,3 +58,13 @@
 	};
 
 };
+
+&pfc {
+	pinctrl-0 = <&scif2_pins>;
+	pinctrl-names = "default";
+
+	scif2_pins: serial2 {
+		renesas,groups = "scif2_txd_p3_0", "scif2_rxd_p3_2";
+		renesas,function = "scif2";
+	};
+};
#13 lore raw

PATCH 4/4 ARM: shmobile: Genmai SCIF2 PINCTRL configuration

Hi Magnus,

Thank you for the patch.

Quoted 6 lines · On Wednesday 27 November 2013 17:28:14 Magnus Damm wrote:

From: Magnus Damm <[email protected]>

Configure the r7s72100 PINCTRL hardware and select pin function for the SCIF2 serial console.

Quoted 21 lines

---

 arch/arm/boot/dts/r7s72100-genmai-reference.dts |   10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm/boot/dts/r7s72100-genmai-reference.dts +0 -0

17:13:43.000000000 +0900 @@ -58,3 +58,13 @@

arch/arm/boot/dts/r7s72100-genmai-reference.dts +10 -0
 	};
 
 };
+
+&pfc {
+	pinctrl-0 = <&scif2_pins>;
+	pinctrl-names = "default";
+
+	scif2_pins: serial2 {
+		renesas,groups = "scif2_txd_p3_0", "scif2_rxd_p3_2";
+		renesas,function = "scif2";
+	};
+};
Signature · 3 lines
Regards,

Laurent Pinchart
#14 lore raw

cover ARM: shmobile: r7s72100 and Genmai GPIO / PINCTRL support

In reply to Magnus Damm

Hi Magnus,

Thank you for the patches.

Looking at how the PFC and GPIO registers are interleaved I'll really need the datasheet to properly review this and the previous PFC and GPIO patches.

Quoted 29 lines · On Wednesday 27 November 2013 17:27:36 Magnus Damm wrote:

ARM: shmobile: r7s72100 and Genmai GPIO / PINCTRL support

[PATCH 01/04] ARM: shmobile: r7s72100 GPIO and PINCTRL device nodes [PATCH 02/04] ARM: shmobile: Genmai LED1 and LED2 support [PATCH 03/04] ARM: shmobile: Genmai I2C-over-GPIO support [PATCH 04/04] ARM: shmobile: Genmai SCIF2 PINCTRL configuration

Add various device nodes to the r7s72100 SoC and the Genmai board, nothing special just basic support for LEDs and I2C-over-GPIO.

Patch 4/4 depends on the r7s72100 PINCTRL pin grouping, but 1-3 depends on the GPIO driver.

---

Written against renesas.git tag renesas-devel-v3.13-rc1-20131125 and [PATCH] pinctrl: sh-pfc: Initial r7s72100 support
[PATCH v3] gpio: Renesas RZ GPIO driver V3

The following patches are needed for 4/4:
[PATCH 00/03] pinctrl: sh-pfc: r7s72100 SCIF2 support [PATCH 01/03] pinctrl: sh-pfc: r7s72100 SCIF2 port3 support [PATCH 02/03] pinctrl: sh-pfc: r7s72100 SCIF2 macro conversion [PATCH 03/03] pinctrl: sh-pfc: r7s72100 SCIF2 port4, 6 and 8 support

 arch/arm/boot/dts/r7s72100-genmai-reference.dts |   41 +++++-
 arch/arm/boot/dts/r7s72100.dtsi                 |  154

+++++++++++++++++++++++ 2 files changed, 194 insertions(+), 1 deletion(-)

Signature · 3 lines
Regards,

Laurent Pinchart