diff mbox

[4/9] ARM: dts: koelsch: use demuxer for I2C4

Message ID 20171214223101.16450-5-wsa+renesas@sang-engineering.com (mailing list archive)
State Superseded
Delegated to: Simon Horman
Headers show

Commit Message

Wolfram Sang Dec. 14, 2017, 10:30 p.m. UTC
Make it possible to fallback to GPIO for I2C4 on the EXIO-E connector.

This is based on reference work for the I2C0 core of the lager/r8a7790
by Wolfram Sang.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
[wsa: rebased, fixed aliases, switched to named GPIOS]
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 arch/arm/boot/dts/r8a7791-koelsch.dts | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

Comments

Geert Uytterhoeven Dec. 26, 2017, 10:11 a.m. UTC | #1
Hi Wolfram,

On Thu, Dec 14, 2017 at 11:30 PM, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> Make it possible to fallback to GPIO for I2C4 on the EXIO-E connector.
>
> This is based on reference work for the I2C0 core of the lager/r8a7790
> by Wolfram Sang.
>
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> [wsa: rebased, fixed aliases, switched to named GPIOS]
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

> --- a/arch/arm/boot/dts/r8a7791-koelsch.dts
> +++ b/arch/arm/boot/dts/r8a7791-koelsch.dts

> @@ -480,6 +504,11 @@
>                 function = "i2c2";
>         };
>
> +       i2c4_pins: i2c4 {
> +               groups = "i2c4";
> +               function = "i2c4";
> +       };

This change breaks VIN:

-rcar-vin e6ef0000.video: Device registered as video25
+sh-pfc e6060000.pin-controller: pin GP_4_13 already requested by
e6520000.i2c; cannot claim for e6ef0000.video
+sh-pfc e6060000.pin-controller: pin-141 (e6ef0000.video) status -22
+sh-pfc e6060000.pin-controller: could not request pin 141 (GP_4_13)
from group vin0_data24  on device sh-pfc
+rcar-vin e6ef0000.video: Error applying setting, reverse things back
+rcar-vin: probe of e6ef0000.video failed with error -22

I2C4 on Koelsch uses pins GP7_13/14 (group "i2c4_c"), not GP4_13/14
(group "i2c4").

Fixing it up in today's renesas-drivers release.

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
Wolfram Sang Dec. 31, 2017, 10:04 a.m. UTC | #2
> I2C4 on Koelsch uses pins GP7_13/14 (group "i2c4_c"), not GP4_13/14
> (group "i2c4").

Confirmed and fixed, thanks Geert! I updated my error catching scripts
and will redo the other tests, too.

BTW, we also have this on Koelsch:

sh-pfc e6060000.pin-controller: pin GP_7_23 already requested by ee090000.pci; cannot claim for e6590000.usb

because pci0 and hsusb use the same pinctrl-0. Known issue?
Geert Uytterhoeven Jan. 2, 2018, 8:35 a.m. UTC | #3
Hi Wolfram,

On Sun, Dec 31, 2017 at 11:04 AM, Wolfram Sang <wsa@the-dreams.de> wrote:
> BTW, we also have this on Koelsch:
>
> sh-pfc e6060000.pin-controller: pin GP_7_23 already requested by ee090000.pci; cannot claim for e6590000.usb
>
> because pci0 and hsusb use the same pinctrl-0. Known issue?

commit fc4a00b78c7f8a770b9608164c0c9cdd0e4e68c2
Author: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Date:   Fri Oct 24 19:45:07 2014 +0900

    ARM: shmobile: koelsch: enable HS-USB

    Enable HS-USB device for the Koelsch board, defining the GPIO that
the driver
    should check when probing (which is the ID output from MAX3355 OTG chip).

    Note that there will be pinctrl-related error messages if both internal PCI
    and HS-USB drivers are enabled but they should be just ignored.

    Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
    [Sergei: added pin function/group and prop, moved device node, fixed summary
,
    added changelog]
    Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
    Signed-off-by: Simon Horman <horms+renesas@verge.net.au>

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
diff mbox

Patch

diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts b/arch/arm/boot/dts/r8a7791-koelsch.dts
index 4b20db197de629..8319eff0190ecd 100644
--- a/arch/arm/boot/dts/r8a7791-koelsch.dts
+++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
@@ -52,8 +52,10 @@ 
 		serial1 = &scif1;
 		i2c9 = &gpioi2c1;
 		i2c10 = &gpioi2c2;
+		i2c11 = &gpioi2c4;
 		i2c12 = &i2cexio1;
 		i2c13 = &i2chdmi;
+		i2c14 = &i2cexio4;
 	};
 
 	chosen {
@@ -329,6 +331,16 @@ 
 		i2c-gpio,delay-us = <5>;
 	};
 
+	gpioi2c4: i2c-11 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "i2c-gpio";
+		status = "disabled";
+		scl-gpios = <&gpio7 13 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+		sda-gpios = <&gpio7 14 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+		i2c-gpio,delay-us = <5>;
+	};
+
 	/*
 	 * I2C1 is routed to EXIO connector B, pins 64 (SCL) + 66 (SDA).
 	 * A fallback to GPIO is provided.
@@ -437,6 +449,18 @@ 
 			pagesize = <16>;
 		};
 	};
+
+	/*
+	 * I2C4 is routed to EXIO connector E, pins 37 (SCL) + 39 (SDA).
+	 * A fallback to GPIO is provided.
+	 */
+	i2cexio4: i2c-14 {
+		compatible = "i2c-demux-pinctrl";
+		i2c-parent = <&i2c4>, <&gpioi2c4>;
+		i2c-bus-name = "i2c-exio4";
+		#address-cells = <1>;
+		#size-cells = <0>;
+	};
 };
 
 &du {
@@ -480,6 +504,11 @@ 
 		function = "i2c2";
 	};
 
+	i2c4_pins: i2c4 {
+		groups = "i2c4";
+		function = "i2c4";
+	};
+
 	du_pins: du {
 		groups = "du_rgb888", "du_sync", "du_disp", "du_clk_out_0";
 		function = "du";
@@ -735,6 +764,11 @@ 
 	clock-frequency = <100000>;
 };
 
+&i2c4 {
+	pinctrl-0 = <&i2c4_pins>;
+	pinctrl-names = "i2c-exio4";
+};
+
 &i2c6 {
 	status = "okay";
 	clock-frequency = <100000>;