devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Use demuxer for i2c1 and i2c5
@ 2018-01-22 11:29 Biju Das
  2018-01-22 11:29 ` [PATCH vY 1/2] ARM: dts: iwg22d-sodimm-dbhd-ca: use demuxer for I2C1 Biju Das
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Biju Das @ 2018-01-22 11:29 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland
  Cc: Wolfram Sang, Simon Horman, Magnus Damm, Chris Paterson,
	devicetree, linux-renesas-soc, linux-i2c, Biju Das

We have observed that on iWave RZ/G1E boards, randomly HDMI slave device
is holding data line after a soft reboot.

We applied demuxer patch for i2c1 and using an oscilloscope verified that
i2c recovery works on the failure condition.

This patch depends on the below patch set

https://patchwork.ozlabs.org/cover/857505/

it is tested against renesas-devel-20180122-v4.15-rc9

Biju Das (2):
  ARM: dts: iwg22d-sodimm-dbhd-ca: use demuxer for I2C1
  ARM: dts: iwg22d-sodimm: use demuxer for I2C5

 .../arm/boot/dts/r8a7745-iwg22d-sodimm-dbhd-ca.dts | 96 +++++++++++++---------
 arch/arm/boot/dts/r8a7745-iwg22d-sodimm.dts        | 44 +++++++---
 2 files changed, 92 insertions(+), 48 deletions(-)

-- 
2.7.4

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

* [PATCH vY 1/2] ARM: dts: iwg22d-sodimm-dbhd-ca: use demuxer for I2C1
  2018-01-22 11:29 [PATCH 0/2] Use demuxer for i2c1 and i2c5 Biju Das
@ 2018-01-22 11:29 ` Biju Das
  2018-01-22 11:29 ` [PATCH vY 2/2] ARM: dts: iwg22d-sodimm: use demuxer for I2C5 Biju Das
  2018-01-22 11:40 ` [PATCH 0/2] Use demuxer for i2c1 and i2c5 Wolfram Sang
  2 siblings, 0 replies; 9+ messages in thread
From: Biju Das @ 2018-01-22 11:29 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland
  Cc: Wolfram Sang, Simon Horman, Magnus Damm, Chris Paterson,
	devicetree, linux-renesas-soc, linux-i2c, Biju Das

Create a separate bus for HDMI related I2C1 and provide fallback to GPIO.

Based on work for r8a7794/Alt by Wolfram Sang: "ARM: dts: alt: use demuxer
 for I2C1"

Add Fixes: 97b94d256d432ba9 ("ARM: dts: iwg22d-sodimm-dbhd-ca: Add HDMI
video output")
Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Reviewed-by: Chris Paterson <chris.paterson2@renesas.com>
---
We have observed that randomly HDMI slave device is holding data line after a soft reboot.

We applied this patch and using an oscilloscope verified that i2c recovery works on the
failure condition.

 .../arm/boot/dts/r8a7745-iwg22d-sodimm-dbhd-ca.dts | 96 +++++++++++++---------
 1 file changed, 59 insertions(+), 37 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7745-iwg22d-sodimm-dbhd-ca.dts b/arch/arm/boot/dts/r8a7745-iwg22d-sodimm-dbhd-ca.dts
index d34de82..de120a3 100644
--- a/arch/arm/boot/dts/r8a7745-iwg22d-sodimm-dbhd-ca.dts
+++ b/arch/arm/boot/dts/r8a7745-iwg22d-sodimm-dbhd-ca.dts
@@ -19,6 +19,8 @@
 		serial0 = &scif1;
 		serial4 = &scif5;
 		serial6 = &hscif2;
+		i2c8 = &gpioi2c1;
+		i2c10 = &i2chdmi;
 	};
 
 	cec_clock: cec-clock {
@@ -27,6 +29,16 @@
 		clock-frequency = <12000000>;
 	};
 
+	gpioi2c1: i2c-8 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "i2c-gpio";
+		status = "disabled";
+		scl-gpios = <&gpio0 11 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+		sda-gpios = <&gpio0 12 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+		i2c-gpio,delay-us = <5>;
+	};
+
 	hdmi-out {
 		compatible = "hdmi-connector";
 		type = "a";
@@ -37,6 +49,52 @@
 			};
 		};
 	};
+
+	/*
+	 * A fallback to GPIO is provided for I2C1.
+	 */
+	i2chdmi: i2c-10 {
+		compatible = "i2c-demux-pinctrl";
+		i2c-parent = <&i2c1>, <&gpioi2c1>;
+		i2c-bus-name = "i2c-hdmi";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		hdmi@39 {
+			compatible = "adi,adv7511w";
+			reg = <0x39>;
+			interrupt-parent = <&gpio1>;
+			interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+			clocks = <&cec_clock>;
+			clock-names = "cec";
+			pd-gpios = <&gpio2 24 GPIO_ACTIVE_HIGH>;
+
+			adi,input-depth = <8>;
+			adi,input-colorspace = "rgb";
+			adi,input-clock = "1x";
+			adi,input-style = <1>;
+			adi,input-justification = "evenly";
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				port@0 {
+					reg = <0>;
+					adv7511_in: endpoint {
+						remote-endpoint = <&du_out_rgb0>;
+					};
+				};
+
+				port@1 {
+					reg = <1>;
+					adv7511_out: endpoint {
+						remote-endpoint = <&hdmi_con>;
+					};
+				};
+			};
+		};
+	};
 };
 
 &du {
@@ -70,45 +128,9 @@
 
 &i2c1 {
 	pinctrl-0 = <&i2c1_pins>;
-	pinctrl-names = "default";
+	pinctrl-names = "i2c-hdmi";
 
-	status = "okay";
 	clock-frequency = <400000>;
-
-	hdmi@39 {
-		compatible = "adi,adv7511w";
-		reg = <0x39>;
-		interrupt-parent = <&gpio1>;
-		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
-		clocks = <&cec_clock>;
-		clock-names = "cec";
-		pd-gpios = <&gpio2 24 GPIO_ACTIVE_HIGH>;
-
-		adi,input-depth = <8>;
-		adi,input-colorspace = "rgb";
-		adi,input-clock = "1x";
-		adi,input-style = <1>;
-		adi,input-justification = "evenly";
-
-		ports {
-			#address-cells = <1>;
-			#size-cells = <0>;
-
-			port@0 {
-				reg = <0>;
-				adv7511_in: endpoint {
-					remote-endpoint = <&du_out_rgb0>;
-				};
-			};
-
-			port@1 {
-				reg = <1>;
-				adv7511_out: endpoint {
-					remote-endpoint = <&hdmi_con>;
-				};
-			};
-		};
-	};
 };
 
 &pfc {
-- 
2.7.4

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

* [PATCH vY 2/2] ARM: dts: iwg22d-sodimm: use demuxer for I2C5
  2018-01-22 11:29 [PATCH 0/2] Use demuxer for i2c1 and i2c5 Biju Das
  2018-01-22 11:29 ` [PATCH vY 1/2] ARM: dts: iwg22d-sodimm-dbhd-ca: use demuxer for I2C1 Biju Das
@ 2018-01-22 11:29 ` Biju Das
  2018-01-22 11:40 ` [PATCH 0/2] Use demuxer for i2c1 and i2c5 Wolfram Sang
  2 siblings, 0 replies; 9+ messages in thread
From: Biju Das @ 2018-01-22 11:29 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland
  Cc: Wolfram Sang, Simon Horman, Magnus Damm, Chris Paterson,
	devicetree, linux-renesas-soc, linux-i2c, Biju Das

Create a separate bus for audiocodec related I2C5 and provide fallback to GPIO.

Based on work for r8a7794/Alt by Wolfram Sang: "ARM: dts: alt: use demuxer
for I2C1"

Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Reviewed-by: Chris Paterson <chris.paterson2@renesas.com>
---
 arch/arm/boot/dts/r8a7745-iwg22d-sodimm.dts | 44 +++++++++++++++++++++--------
 1 file changed, 33 insertions(+), 11 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7745-iwg22d-sodimm.dts b/arch/arm/boot/dts/r8a7745-iwg22d-sodimm.dts
index a4058f4..b2ea43f 100644
--- a/arch/arm/boot/dts/r8a7745-iwg22d-sodimm.dts
+++ b/arch/arm/boot/dts/r8a7745-iwg22d-sodimm.dts
@@ -42,6 +42,8 @@
 		ethernet0 = &avb;
 		serial3 = &scif4;
 		serial5 = &hscif1;
+		i2c9 = &gpioi2c5;
+		i2c11 = &i2caudiocodec;
 	};
 
 	chosen {
@@ -55,6 +57,36 @@
 		clock-frequency = <26000000>;
 	};
 
+	gpioi2c5: i2c-9 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "i2c-gpio";
+		status = "disabled";
+		scl-gpios = <&gpio0 14 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+		sda-gpios = <&gpio0 15 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+		i2c-gpio,delay-us = <5>;
+	};
+
+	/*
+	 * A fallback to GPIO is provided for I2C5.
+	 */
+	i2caudiocodec: i2c-11 {
+		compatible = "i2c-demux-pinctrl";
+		i2c-parent = <&i2c5>, <&gpioi2c5>;
+		i2c-bus-name = "i2c-audiocodec";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		sgtl5000: codec@a {
+			compatible = "fsl,sgtl5000";
+			#sound-dai-cells = <0>;
+			reg = <0x0a>;
+			clocks = <&audio_clock>;
+			VDDA-supply = <&reg_3p3v>;
+			VDDIO-supply = <&reg_3p3v>;
+		};
+	};
+
 	rsnd_sgtl5000: sound {
 		compatible = "simple-audio-card";
 		simple-audio-card,format = "i2s";
@@ -126,19 +158,9 @@
 
 &i2c5 {
 	pinctrl-0 = <&i2c5_pins>;
-	pinctrl-names = "default";
+	pinctrl-names = "i2c-audiocodec";
 
-	status = "okay";
 	clock-frequency = <400000>;
-
-	sgtl5000: codec@a {
-		compatible = "fsl,sgtl5000";
-		#sound-dai-cells = <0>;
-		reg = <0x0a>;
-		clocks = <&audio_clock>;
-		VDDA-supply = <&reg_3p3v>;
-		VDDIO-supply = <&reg_3p3v>;
-	};
 };
 
 &pci1 {
-- 
2.7.4

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

* Re: [PATCH 0/2] Use demuxer for i2c1 and i2c5
  2018-01-22 11:29 [PATCH 0/2] Use demuxer for i2c1 and i2c5 Biju Das
  2018-01-22 11:29 ` [PATCH vY 1/2] ARM: dts: iwg22d-sodimm-dbhd-ca: use demuxer for I2C1 Biju Das
  2018-01-22 11:29 ` [PATCH vY 2/2] ARM: dts: iwg22d-sodimm: use demuxer for I2C5 Biju Das
@ 2018-01-22 11:40 ` Wolfram Sang
  2018-01-22 11:55   ` Biju Das
  2 siblings, 1 reply; 9+ messages in thread
From: Wolfram Sang @ 2018-01-22 11:40 UTC (permalink / raw)
  To: Biju Das
  Cc: Rob Herring, Mark Rutland, Simon Horman, Magnus Damm,
	Chris Paterson, devicetree, linux-renesas-soc, linux-i2c

[-- Attachment #1: Type: text/plain, Size: 474 bytes --]

On Mon, Jan 22, 2018 at 11:29:21AM +0000, Biju Das wrote:
> We have observed that on iWave RZ/G1E boards, randomly HDMI slave device
> is holding data line after a soft reboot.
> 
> We applied demuxer patch for i2c1 and using an oscilloscope verified that
> i2c recovery works on the failure condition.

Do you really need the demuxer for that?

I posted and just merged bus recovery to the i2c-rcar driver. Did you
test that? In theory, this should be enough.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* RE: [PATCH 0/2] Use demuxer for i2c1 and i2c5
  2018-01-22 11:40 ` [PATCH 0/2] Use demuxer for i2c1 and i2c5 Wolfram Sang
@ 2018-01-22 11:55   ` Biju Das
  2018-01-22 12:22     ` Wolfram Sang
  0 siblings, 1 reply; 9+ messages in thread
From: Biju Das @ 2018-01-22 11:55 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Rob Herring, Mark Rutland, Simon Horman, Magnus Damm,
	Chris Paterson, devicetree, linux-renesas-soc, linux-i2c

> Subject: Re: [PATCH 0/2] Use demuxer for i2c1 and i2c5
>
> On Mon, Jan 22, 2018 at 11:29:21AM +0000, Biju Das wrote:
> > We have observed that on iWave RZ/G1E boards, randomly HDMI slave
> > device is holding data line after a soft reboot.
> >
> > We applied demuxer patch for i2c1 and using an oscilloscope verified
> > that i2c recovery works on the failure condition.
>
> Do you really need the demuxer for that?

How do i2c-bus gets details of gpio lines associated with i2c bus for bus recovery?

For eg:- i2c1 scl line --> gpio0 11
                I2c1 sda line --> gpio0 12

> I posted and just merged bus recovery to the i2c-rcar driver. Did you test that?
> In theory, this should be enough.

On top of renesas-dev branch, I am using the below i2c-rcar driver related patches.

https://www.mail-archive.com/linux-renesas-soc@vger.kernel.org/msg22278.html






Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.

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

* Re: [PATCH 0/2] Use demuxer for i2c1 and i2c5
  2018-01-22 11:55   ` Biju Das
@ 2018-01-22 12:22     ` Wolfram Sang
  2018-01-22 14:03       ` Biju Das
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfram Sang @ 2018-01-22 12:22 UTC (permalink / raw)
  To: Biju Das
  Cc: Rob Herring, Mark Rutland, Simon Horman, Magnus Damm,
	Chris Paterson, devicetree, linux-renesas-soc, linux-i2c

[-- Attachment #1: Type: text/plain, Size: 423 bytes --]


> How do i2c-bus gets details of gpio lines associated with i2c bus for bus recovery?

As you can see in the code, you don't need GPIOs if you can control SDA
and SCL directly. The I2C IP can do this.

> On top of renesas-dev branch, I am using the below i2c-rcar driver related patches.
> 
> https://www.mail-archive.com/linux-renesas-soc@vger.kernel.org/msg22278.html

Those should be enough. They are not?


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* RE: [PATCH 0/2] Use demuxer for i2c1 and i2c5
  2018-01-22 12:22     ` Wolfram Sang
@ 2018-01-22 14:03       ` Biju Das
  2018-01-22 14:08         ` Wolfram Sang
  0 siblings, 1 reply; 9+ messages in thread
From: Biju Das @ 2018-01-22 14:03 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Rob Herring, Mark Rutland, Simon Horman, Magnus Damm,
	Chris Paterson, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

> Subject: Re: [PATCH 0/2] Use demuxer for i2c1 and i2c5

[>]
> > How do i2c-bus gets details of gpio lines associated with i2c bus for bus
> recovery?
>
> As you can see in the code, you don't need GPIOs if you can control SDA and SCL
> directly. The I2C IP can do this.

I agree. Thanks for correcting me.

> > On top of renesas-dev branch, I am using the below i2c-rcar driver related
> patches.
> >
> > https://www.mail-archive.com/linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org/msg2227
> > 8.html
>
> Those should be enough. They are not?

Yes. I have tested without demuxer patches, I confirm, it can recover the bus.




Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 0/2] Use demuxer for i2c1 and i2c5
  2018-01-22 14:03       ` Biju Das
@ 2018-01-22 14:08         ` Wolfram Sang
  2018-01-23 13:39           ` Biju Das
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfram Sang @ 2018-01-22 14:08 UTC (permalink / raw)
  To: Biju Das
  Cc: Rob Herring, Mark Rutland, Simon Horman, Magnus Damm,
	Chris Paterson, devicetree, linux-renesas-soc, linux-i2c

[-- Attachment #1: Type: text/plain, Size: 779 bytes --]


> > > On top of renesas-dev branch, I am using the below i2c-rcar driver related
> > patches.
> > >
> > > https://www.mail-archive.com/linux-renesas-soc@vger.kernel.org/msg2227
> > > 8.html
> >
> > Those should be enough. They are not?
> 
> Yes. I have tested without demuxer patches, I confirm, it can recover the bus.

That is great news! Thanks for the additional testing. I was a little
worried that the 'bus stalled' detection might have failed for you, but
it seems it works for your case as well.

With that put aside, it is still valid, to add the demuxer to the DTS
file in case you want to switch to bitbanged GPIO at runtime for some
reason. Only the commit message would need updating then, however,
because it is not relevant for bus recovery.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* RE: [PATCH 0/2] Use demuxer for i2c1 and i2c5
  2018-01-22 14:08         ` Wolfram Sang
@ 2018-01-23 13:39           ` Biju Das
  0 siblings, 0 replies; 9+ messages in thread
From: Biju Das @ 2018-01-23 13:39 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Rob Herring, Mark Rutland, Simon Horman, Magnus Damm,
	Chris Paterson, devicetree, linux-renesas-soc, linux-i2c

Hi,

> Subject: Re: [PATCH 0/2] Use demuxer for i2c1 and i2c5
>
>
> > > > On top of renesas-dev branch, I am using the below i2c-rcar driver
> > > > related
> > > patches.
> > > >
> > > > https://www.mail-archive.com/linux-renesas-soc@vger.kernel.org/msg
> > > > 2227
> > > > 8.html
> > >
> > > Those should be enough. They are not?
> >
> > Yes. I have tested without demuxer patches, I confirm, it can recover the bus.
>
> That is great news! Thanks for the additional testing. I was a little worried that
> the 'bus stalled' detection might have failed for you, but it seems it works for
> your case as well.
>
> With that put aside, it is still valid, to add the demuxer to the DTS file in case you
> want to switch to bitbanged GPIO at runtime for some reason. Only the commit
> message would need updating then, however, because it is not relevant for bus
> recovery.

Ok. I will fix the commit message and send v2.

Regards,
Biju



Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.

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

end of thread, other threads:[~2018-01-23 13:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-22 11:29 [PATCH 0/2] Use demuxer for i2c1 and i2c5 Biju Das
2018-01-22 11:29 ` [PATCH vY 1/2] ARM: dts: iwg22d-sodimm-dbhd-ca: use demuxer for I2C1 Biju Das
2018-01-22 11:29 ` [PATCH vY 2/2] ARM: dts: iwg22d-sodimm: use demuxer for I2C5 Biju Das
2018-01-22 11:40 ` [PATCH 0/2] Use demuxer for i2c1 and i2c5 Wolfram Sang
2018-01-22 11:55   ` Biju Das
2018-01-22 12:22     ` Wolfram Sang
2018-01-22 14:03       ` Biju Das
2018-01-22 14:08         ` Wolfram Sang
2018-01-23 13:39           ` Biju Das

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).