* [PATCH v2 1/4] ARM: dts: r8a7790: lager: rename i2cexio as i2cexio0
2016-06-08 7:14 [PATCH v2 0/4] ARM: dts: r8a7790: lager: use demuxer for I2C Simon Horman
@ 2016-06-08 7:14 ` Simon Horman
2016-06-08 8:03 ` Wolfram Sang
2016-06-08 7:14 ` [PATCH v2 2/4] ARM: dts: r8a7790: lager: use demuxer for IIC1/I2C1 Simon Horman
` (3 subsequent siblings)
4 siblings, 1 reply; 17+ messages in thread
From: Simon Horman @ 2016-06-08 7:14 UTC (permalink / raw)
To: linux-arm-kernel
This is in preparation for adding i2cexio1 which will use the
dmuxer for IIC1/I2C0.
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
arch/arm/boot/dts/r8a7790-lager.dts | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
index 9d20ace33b01..71d62ca282ea 100644
--- a/arch/arm/boot/dts/r8a7790-lager.dts
+++ b/arch/arm/boot/dts/r8a7790-lager.dts
@@ -50,7 +50,7 @@
aliases {
serial0 = &scif0;
serial1 = &scifa1;
- i2c8 = "i2cexio";
+ i2c8 = "i2cexio0";
};
chosen {
@@ -263,10 +263,10 @@
* instantiate the slave device at runtime according to the documentation.
* You can then communicate with the slave via IIC3.
*/
- i2cexio: i2c-8 {
+ i2cexio0: i2c-8 {
compatible = "i2c-demux-pinctrl";
i2c-parent = <&iic0>, <&i2c0>;
- i2c-bus-name = "i2c-exio";
+ i2c-bus-name = "i2c-exio0";
#address-cells = <1>;
#size-cells = <0>;
};
@@ -580,12 +580,12 @@
&i2c0 {
pinctrl-0 = <&i2c0_pins>;
- pinctrl-names = "i2c-exio";
+ pinctrl-names = "i2c-exio0";
};
&iic0 {
pinctrl-0 = <&iic0_pins>;
- pinctrl-names = "i2c-exio";
+ pinctrl-names = "i2c-exio0";
};
&iic1 {
--
2.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v2 2/4] ARM: dts: r8a7790: lager: use demuxer for IIC1/I2C1
2016-06-08 7:14 [PATCH v2 0/4] ARM: dts: r8a7790: lager: use demuxer for I2C Simon Horman
2016-06-08 7:14 ` [PATCH v2 1/4] ARM: dts: r8a7790: lager: rename i2cexio as i2cexio0 Simon Horman
@ 2016-06-08 7:14 ` Simon Horman
2016-06-13 14:33 ` Wolfram Sang
2016-06-08 7:14 ` [PATCH v2 3/4] ARM: dts: r8a7790: lager: use demuxer for IIC2/I2C2 Simon Horman
` (2 subsequent siblings)
4 siblings, 1 reply; 17+ messages in thread
From: Simon Horman @ 2016-06-08 7:14 UTC (permalink / raw)
To: linux-arm-kernel
Make it possible to select which I2C1 IP core you want to run on the
EXIO-A connector.
This is based on reference work for the I2C0 core of the lager by Wolfram Sang.
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
arch/arm/boot/dts/r8a7790-lager.dts | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
index 71d62ca282ea..20abb1470f91 100644
--- a/arch/arm/boot/dts/r8a7790-lager.dts
+++ b/arch/arm/boot/dts/r8a7790-lager.dts
@@ -51,6 +51,7 @@
serial0 = &scif0;
serial1 = &scifa1;
i2c8 = "i2cexio0";
+ i2c9 = "i2cexio1";
};
chosen {
@@ -270,6 +271,18 @@
#address-cells = <1>;
#size-cells = <0>;
};
+
+ /*
+ * IIC1/I2C1 is routed to EXIO connector A, pins 78 (SCL) + 80 (SDA).
+ * For further notes see i2cexio0.
+ */
+ i2cexio1: i2c-9 {
+ compatible = "i2c-demux-pinctrl";
+ i2c-parent = <&iic1>, <&i2c1>;
+ i2c-bus-name = "i2c-exio1";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ };
};
&du {
@@ -392,6 +405,11 @@
function = "iic0";
};
+ i2c1_pins: i2c1 {
+ groups = "i2c1";
+ function = "i2c1";
+ };
+
iic1_pins: iic1 {
groups = "iic1";
function = "iic1";
@@ -588,10 +606,14 @@
pinctrl-names = "i2c-exio0";
};
+&i2c1 {
+ pinctrl-0 = <&i2c1_pins>;
+ pinctrl-names = "i2c-exio1";
+};
+
&iic1 {
- status = "okay";
pinctrl-0 = <&iic1_pins>;
- pinctrl-names = "default";
+ pinctrl-names = "i2c-exio1";
};
&iic2 {
--
2.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v2 2/4] ARM: dts: r8a7790: lager: use demuxer for IIC1/I2C1
2016-06-08 7:14 ` [PATCH v2 2/4] ARM: dts: r8a7790: lager: use demuxer for IIC1/I2C1 Simon Horman
@ 2016-06-13 14:33 ` Wolfram Sang
2016-06-15 4:12 ` Simon Horman
0 siblings, 1 reply; 17+ messages in thread
From: Wolfram Sang @ 2016-06-13 14:33 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Jun 08, 2016 at 04:14:24PM +0900, Simon Horman wrote:
> Make it possible to select which I2C1 IP core you want to run on the
> EXIO-A connector.
>
> This is based on reference work for the I2C0 core of the lager by Wolfram Sang.
>
> Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Given the PFC problem gets solved, why can't you switch to GP1_16 and
GP1_17 for those?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160613/05e2de2d/attachment.sig>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v2 2/4] ARM: dts: r8a7790: lager: use demuxer for IIC1/I2C1
2016-06-13 14:33 ` Wolfram Sang
@ 2016-06-15 4:12 ` Simon Horman
0 siblings, 0 replies; 17+ messages in thread
From: Simon Horman @ 2016-06-15 4:12 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Jun 13, 2016 at 04:33:04PM +0200, Wolfram Sang wrote:
> On Wed, Jun 08, 2016 at 04:14:24PM +0900, Simon Horman wrote:
> > Make it possible to select which I2C1 IP core you want to run on the
> > EXIO-A connector.
> >
> > This is based on reference work for the I2C0 core of the lager by Wolfram Sang.
> >
> > Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
> > Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
>
> Given the PFC problem gets solved, why can't you switch to GP1_16 and
> GP1_17 for those?
Thanks, I missed that. I will see about making it so.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v2 3/4] ARM: dts: r8a7790: lager: use demuxer for IIC2/I2C2
2016-06-08 7:14 [PATCH v2 0/4] ARM: dts: r8a7790: lager: use demuxer for I2C Simon Horman
2016-06-08 7:14 ` [PATCH v2 1/4] ARM: dts: r8a7790: lager: rename i2cexio as i2cexio0 Simon Horman
2016-06-08 7:14 ` [PATCH v2 2/4] ARM: dts: r8a7790: lager: use demuxer for IIC1/I2C1 Simon Horman
@ 2016-06-08 7:14 ` Simon Horman
2016-06-08 7:14 ` [PATCH v2 4/4] ARM: dts: r8a7790: lager: use demuxer for IIC3/I2C3 Simon Horman
2016-06-13 14:31 ` [PATCH v2 0/4] ARM: dts: r8a7790: lager: use demuxer for I2C Wolfram Sang
4 siblings, 0 replies; 17+ messages in thread
From: Simon Horman @ 2016-06-08 7:14 UTC (permalink / raw)
To: linux-arm-kernel
Create a separate bus for HDMI related I2C slaves.
Based on work by Wolfram Sang.
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
v2
* Include GPIO fallback
---
arch/arm/boot/dts/r8a7790-lager.dts | 138 ++++++++++++++++++++++--------------
1 file changed, 85 insertions(+), 53 deletions(-)
diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
index 20abb1470f91..80b0eaa93607 100644
--- a/arch/arm/boot/dts/r8a7790-lager.dts
+++ b/arch/arm/boot/dts/r8a7790-lager.dts
@@ -52,6 +52,8 @@
serial1 = &scifa1;
i2c8 = "i2cexio0";
i2c9 = "i2cexio1";
+ i2c10 = "i2chdmi";
+ i2c11 = "gpioi2c";
};
chosen {
@@ -283,6 +285,76 @@
#address-cells = <1>;
#size-cells = <0>;
};
+
+ i2chdmi: i2c-10 {
+ compatible = "i2c-demux-pinctrl";
+ i2c-parent = <&iic2>, <&i2c2>, <&gpioi2c>;
+ i2c-bus-name = "i2c-hdmi";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ ak4643: codec at 12 {
+ compatible = "asahi-kasei,ak4643";
+ #sound-dai-cells = <0>;
+ reg = <0x12>;
+ };
+
+ composite-in at 20 {
+ compatible = "adi,adv7180";
+ reg = <0x20>;
+ remote = <&vin1>;
+
+ port {
+ adv7180: endpoint {
+ bus-width = <8>;
+ remote-endpoint = <&vin1ep0>;
+ };
+ };
+ };
+
+ hdmi at 39 {
+ compatible = "adi,adv7511w";
+ reg = <0x39>;
+ interrupt-parent = <&gpio1>;
+ interrupts = <15 IRQ_TYPE_LEVEL_LOW>;
+
+ 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 at 0 {
+ reg = <0>;
+ adv7511_in: endpoint {
+ remote-endpoint = <&du_out_lvds0>;
+ };
+ };
+
+ port at 1 {
+ reg = <1>;
+ adv7511_out: endpoint {
+ remote-endpoint = <&hdmi_con>;
+ };
+ };
+ };
+ };
+ };
+
+ gpioi2c: i2c-11 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "i2c-gpio";
+ status = "disabled";
+ gpios = <&gpio5 6 GPIO_ACTIVE_HIGH /* sda */
+ &gpio5 5 GPIO_ACTIVE_HIGH /* scl */
+ >;
+ i2c-gpio,delay-us = <5>;
+ };
};
&du {
@@ -415,6 +487,11 @@
function = "iic1";
};
+ i2c2_pins: i2c2 {
+ groups = "i2c2";
+ function = "i2c2";
+ };
+
iic2_pins: iic2 {
groups = "iic2";
function = "iic2";
@@ -616,63 +693,18 @@
pinctrl-names = "i2c-exio1";
};
-&iic2 {
- status = "okay";
- pinctrl-0 = <&iic2_pins>;
- pinctrl-names = "default";
+&i2c2 {
+ pinctrl-0 = <&i2c2_pins>;
+ pinctrl-names = "i2c-hdmi";
clock-frequency = <100000>;
+};
- ak4643: codec at 12 {
- compatible = "asahi-kasei,ak4643";
- #sound-dai-cells = <0>;
- reg = <0x12>;
- };
-
- composite-in at 20 {
- compatible = "adi,adv7180";
- reg = <0x20>;
- remote = <&vin1>;
-
- port {
- adv7180: endpoint {
- bus-width = <8>;
- remote-endpoint = <&vin1ep0>;
- };
- };
- };
-
- hdmi at 39 {
- compatible = "adi,adv7511w";
- reg = <0x39>;
- interrupt-parent = <&gpio1>;
- interrupts = <15 IRQ_TYPE_LEVEL_LOW>;
-
- 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 at 0 {
- reg = <0>;
- adv7511_in: endpoint {
- remote-endpoint = <&du_out_lvds0>;
- };
- };
+&iic2 {
+ pinctrl-0 = <&iic2_pins>;
+ pinctrl-names = "i2c-hdmi";
- port at 1 {
- reg = <1>;
- adv7511_out: endpoint {
- remote-endpoint = <&hdmi_con>;
- };
- };
- };
- };
+ clock-frequency = <100000>;
};
&iic3 {
--
2.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v2 4/4] ARM: dts: r8a7790: lager: use demuxer for IIC3/I2C3
2016-06-08 7:14 [PATCH v2 0/4] ARM: dts: r8a7790: lager: use demuxer for I2C Simon Horman
` (2 preceding siblings ...)
2016-06-08 7:14 ` [PATCH v2 3/4] ARM: dts: r8a7790: lager: use demuxer for IIC2/I2C2 Simon Horman
@ 2016-06-08 7:14 ` Simon Horman
2016-06-08 8:05 ` Wolfram Sang
2016-06-13 14:35 ` Wolfram Sang
2016-06-13 14:31 ` [PATCH v2 0/4] ARM: dts: r8a7790: lager: use demuxer for I2C Wolfram Sang
4 siblings, 2 replies; 17+ messages in thread
From: Simon Horman @ 2016-06-08 7:14 UTC (permalink / raw)
To: linux-arm-kernel
Create a separate bus for dla98063 PMIC and da9210 regulator
related I2C slaves.
Based on similar work for HDMI by Wolfram Sang.
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
arch/arm/boot/dts/r8a7790-lager.dts | 80 +++++++++++++++++++++++--------------
1 file changed, 49 insertions(+), 31 deletions(-)
diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
index 80b0eaa93607..b75501e4c56d 100644
--- a/arch/arm/boot/dts/r8a7790-lager.dts
+++ b/arch/arm/boot/dts/r8a7790-lager.dts
@@ -54,6 +54,7 @@
i2c9 = "i2cexio1";
i2c10 = "i2chdmi";
i2c11 = "gpioi2c";
+ i2c12 = "i2cpwr";
};
chosen {
@@ -355,6 +356,42 @@
>;
i2c-gpio,delay-us = <5>;
};
+
+ i2cpwr: i2c-12 {
+ compatible = "i2c-demux-pinctrl";
+ i2c-parent = <&iic3>, <&i2c3>;
+ i2c-bus-name = "i2c-pwr";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ pmic at 58 {
+ compatible = "dlg,da9063";
+ reg = <0x58>;
+ interrupt-parent = <&irqc0>;
+ interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
+ interrupt-controller;
+
+ rtc {
+ compatible = "dlg,da9063-rtc";
+ };
+
+ wdt {
+ compatible = "dlg,da9063-watchdog";
+ };
+ };
+
+ vdd_dvfs: regulator at 68 {
+ compatible = "dlg,da9210";
+ reg = <0x68>;
+ interrupt-parent = <&irqc0>;
+ interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
+
+ regulator-min-microvolt = <1000000>;
+ regulator-max-microvolt = <1000000>;
+ regulator-boot-on;
+ regulator-always-on;
+ };
+ };
};
&du {
@@ -497,6 +534,11 @@
function = "iic2";
};
+ i2c3_pins: i2c3 {
+ groups = "i2c3";
+ function = "i2c3";
+ };
+
iic3_pins: iic3 {
groups = "iic3";
function = "iic3";
@@ -707,38 +749,14 @@
clock-frequency = <100000>;
};
-&iic3 {
- pinctrl-names = "default";
- pinctrl-0 = <&iic3_pins>;
- status = "okay";
-
- pmic at 58 {
- compatible = "dlg,da9063";
- reg = <0x58>;
- interrupt-parent = <&irqc0>;
- interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
- interrupt-controller;
-
- rtc {
- compatible = "dlg,da9063-rtc";
- };
-
- wdt {
- compatible = "dlg,da9063-watchdog";
- };
- };
-
- vdd_dvfs: regulator at 68 {
- compatible = "dlg,da9210";
- reg = <0x68>;
- interrupt-parent = <&irqc0>;
- interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
+&i2c3 {
+ pinctrl-0 = <&i2c3_pins>;
+ pinctrl-names = "i2c-pwr";
+};
- regulator-min-microvolt = <1000000>;
- regulator-max-microvolt = <1000000>;
- regulator-boot-on;
- regulator-always-on;
- };
+&iic3 {
+ pinctrl-0 = <&iic3_pins>;
+ pinctrl-names = "i2c-pwr";
};
&pci0 {
--
2.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v2 4/4] ARM: dts: r8a7790: lager: use demuxer for IIC3/I2C3
2016-06-08 7:14 ` [PATCH v2 4/4] ARM: dts: r8a7790: lager: use demuxer for IIC3/I2C3 Simon Horman
@ 2016-06-08 8:05 ` Wolfram Sang
2016-06-09 0:55 ` Simon Horman
2016-06-13 14:35 ` Wolfram Sang
1 sibling, 1 reply; 17+ messages in thread
From: Wolfram Sang @ 2016-06-08 8:05 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Jun 08, 2016 at 04:14:26PM +0900, Simon Horman wrote:
> Create a separate bus for dla98063 PMIC and da9210 regulator
> related I2C slaves.
>
> Based on similar work for HDMI by Wolfram Sang.
>
> Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Maybe add a word that PFC doesn't allow I2C0/I2C3 to be muxed as GPIO?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160608/122eef7c/attachment.sig>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v2 4/4] ARM: dts: r8a7790: lager: use demuxer for IIC3/I2C3
2016-06-08 8:05 ` Wolfram Sang
@ 2016-06-09 0:55 ` Simon Horman
0 siblings, 0 replies; 17+ messages in thread
From: Simon Horman @ 2016-06-09 0:55 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Jun 08, 2016 at 10:05:16AM +0200, Wolfram Sang wrote:
> On Wed, Jun 08, 2016 at 04:14:26PM +0900, Simon Horman wrote:
> > Create a separate bus for dla98063 PMIC and da9210 regulator
> > related I2C slaves.
> >
> > Based on similar work for HDMI by Wolfram Sang.
> >
> > Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
> > Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
>
> Maybe add a word that PFC doesn't allow I2C0/I2C3 to be muxed as GPIO?
Sure, will do.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v2 4/4] ARM: dts: r8a7790: lager: use demuxer for IIC3/I2C3
2016-06-08 7:14 ` [PATCH v2 4/4] ARM: dts: r8a7790: lager: use demuxer for IIC3/I2C3 Simon Horman
2016-06-08 8:05 ` Wolfram Sang
@ 2016-06-13 14:35 ` Wolfram Sang
2016-06-15 4:29 ` Simon Horman
1 sibling, 1 reply; 17+ messages in thread
From: Wolfram Sang @ 2016-06-13 14:35 UTC (permalink / raw)
To: linux-arm-kernel
> i2c9 = "i2cexio1";
> i2c10 = "i2chdmi";
> i2c11 = "gpioi2c";
> + i2c12 = "i2cpwr";
To make it easier for users, we should maybe group them?
i2c8+9: additional gpio busses
i2c10-13: i2cexioX
?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160613/637debee/attachment-0001.sig>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v2 0/4] ARM: dts: r8a7790: lager: use demuxer for I2C
2016-06-08 7:14 [PATCH v2 0/4] ARM: dts: r8a7790: lager: use demuxer for I2C Simon Horman
` (3 preceding siblings ...)
2016-06-08 7:14 ` [PATCH v2 4/4] ARM: dts: r8a7790: lager: use demuxer for IIC3/I2C3 Simon Horman
@ 2016-06-13 14:31 ` Wolfram Sang
2016-06-14 22:09 ` Wolfram Sang
2016-06-16 1:26 ` Simon Horman
4 siblings, 2 replies; 17+ messages in thread
From: Wolfram Sang @ 2016-06-13 14:31 UTC (permalink / raw)
To: linux-arm-kernel
> # ./exercise-i2c-demux.sh
> I2C Demux: i2c-8
> Master: 1:/i2c at e650800
> [ 97.694487] i2c-rcar e6508000.i2c: probed 0 (1)
> Master: 0:/i2c at e650000
> [ 102.706365] i2c-demux-pinctrl i2c-8: failed to setup demux-adapter 0 (-19) 0 (0)
Confirmed :( Got today only this far that the ENODEV comes from the PFC
driver. CONFIG_DEBUG_PINCTRL is a good idea for further debugging
probably.
> 3.1 Unfortunately it fails for the I2C2 dmux if the GPIO fallback is
> present.
Hopefully the same issue.
> 3.2 The test also fails for the I2C3 demux but that appears to be due
> to a shortcoming in the voltage regulator code which does not
> appear to like being reinitialised. The kernel complains as follows:
Yes, the demuxer trigger re-bind cycles which are not well considered
and/or tested. E.g. for soc-camera, this patch needed to go upstream:
https://patchwork.linuxtv.org/patch/32473/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160613/096f1ecb/attachment.sig>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v2 0/4] ARM: dts: r8a7790: lager: use demuxer for I2C
2016-06-13 14:31 ` [PATCH v2 0/4] ARM: dts: r8a7790: lager: use demuxer for I2C Wolfram Sang
@ 2016-06-14 22:09 ` Wolfram Sang
2016-06-16 1:26 ` Simon Horman
1 sibling, 0 replies; 17+ messages in thread
From: Wolfram Sang @ 2016-06-14 22:09 UTC (permalink / raw)
To: linux-arm-kernel
> Confirmed :( Got today only this far that the ENODEV comes from the PFC
> driver. CONFIG_DEBUG_PINCTRL is a good idea for further debugging
> probably.
Correction, it seems the pinctrl handle gets mixed up, so the
devm_pinctrl_get_select() fails. Does that match your findings?
Pity I can't access my boards for the rest of the week :(
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160615/37e0a63e/attachment.sig>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v2 0/4] ARM: dts: r8a7790: lager: use demuxer for I2C
2016-06-13 14:31 ` [PATCH v2 0/4] ARM: dts: r8a7790: lager: use demuxer for I2C Wolfram Sang
2016-06-14 22:09 ` Wolfram Sang
@ 2016-06-16 1:26 ` Simon Horman
1 sibling, 0 replies; 17+ messages in thread
From: Simon Horman @ 2016-06-16 1:26 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Jun 13, 2016 at 04:31:34PM +0200, Wolfram Sang wrote:
>
> > # ./exercise-i2c-demux.sh
> > I2C Demux: i2c-8
> > Master: 1:/i2c at e650800
> > [ 97.694487] i2c-rcar e6508000.i2c: probed 0 (1)
> > Master: 0:/i2c at e650000
> > [ 102.706365] i2c-demux-pinctrl i2c-8: failed to setup demux-adapter 0 (-19) 0 (0)
>
> Confirmed :( Got today only this far that the ENODEV comes from the PFC
> driver. CONFIG_DEBUG_PINCTRL is a good idea for further debugging
> probably.
I tried to track this down and my findings so far are a bit puzzling.
It seems to me that the first and only item of the "pinctrl-names" property
(a.k.a. statename) retrieved for i2c at e6508000 changes from i2c-exio0 to
i2c-exio1. Perhaps it really is overwritten for some reason. Or perhaps
there is a stale pointer. Or perhaps I am chasing the wrong thing. But in
any case my observation is illustrated using the debug patch below.
I am testing using only the first two patches of the series applied on top
of renesas-devel-20160614-v4.7-rc3, that is the only demux devices are
i2c-exio0 and i2c-exio1.
I am using shmobile_defconfig, with CONFIG_DEBUG_PINCTRL enabled.
I am examining only i2c-8, i2c-exio0.
1. At probe time the first parent, 0:/i2c at e6500000
i2c-demux-pinctrl i2c-8: i2c_demux_activate_master chan:0 bus_name:i2c-exio0 np->full_name/i2c at e6500000 np:ef7db76c statename:i2c-exio0
i2c-demux-pinctrl i2c-8: i2c_demux_activate_master chan:1 bus_name:i2c-exio0 np->full_name/i2c at e6508000 np:ef7dabfc statename:i2c-exio0
2. At run time I select the second parent, 1:/i2c at e6508000.
This works. But the statename of i2c at e6500000 is already i2c-exio1.
i2c-demux-pinctrl i2c-8: i2c_demux_deactivate_master chan:0 bus_name:i2c-exio0 np->full_name:/i2c at e6500000 np:ef7db76c statename:i2c-exio1
i2c-demux-pinctrl i2c-8: i2c_demux_deactivate_master chan:1 bus_name:i2c-exio0 np->full_name:/i2c at e6508000 np:ef7dabfc statename:i2c-exio0
i2c-demux-pinctrl i2c-8: i2c_demux_activate_master chan:0 bus_name:i2c-exio0 np->full_name:/i2c at e6500000 np:ef7db76c statename:i2c-exio1
i2c-demux-pinctrl i2c-8: i2c_demux_activate_master chan:1 bus_name:i2c-exio0 np->full_name:/i2c at e6508000 np:ef7dabfc statename:i2c-exio0
3. At run time I re-select the first parent, 0:/i2c at e6500000.
This fails as described above. The new debug code shows.
i2c-demux-pinctrl i2c-8: i2c_demux_deactivate_master chan:0 bus_name:i2c-exio0 np->full_name:/i2c at e6500000 np:ef7db76c statename:i2c-exio1
34.700444] i2c-demux-pinctrl i2c-8: i2c_demux_deactivate_master chan:1 bus_name:i2c-exio0 np->full_name:/i2c at e6508000 np:ef7dabfc statename:i2c-exio0
[i2c_demux_deactivate_master exits before reaching debug code,
but I have previously observed that statename is i2c-exio1
for i2c at e6500000]
> > 3.1 Unfortunately it fails for the I2C2 dmux if the GPIO fallback is
> > present.
>
> Hopefully the same issue.
Hopefully :)
> > 3.2 The test also fails for the I2C3 demux but that appears to be due
> > to a shortcoming in the voltage regulator code which does not
> > appear to like being reinitialised. The kernel complains as follows:
>
> Yes, the demuxer trigger re-bind cycles which are not well considered
> and/or tested. E.g. for soc-camera, this patch needed to go upstream:
>
> https://patchwork.linuxtv.org/patch/32473/
Understood. It looks like there is some more work to be done but from my
point of view fixing individual drivers is less critical than resolving
the switching issue(s) above. I think the order things are described
is probably the order in which they should be addressed.
diff --git a/drivers/i2c/muxes/i2c-demux-pinctrl.c b/drivers/i2c/muxes/i2c-demux-pinctrl.c
index 8de073aed001..8a54380a9e0c 100644
--- a/drivers/i2c/muxes/i2c-demux-pinctrl.c
+++ b/drivers/i2c/muxes/i2c-demux-pinctrl.c
@@ -55,6 +55,27 @@ static u32 i2c_demux_functionality(struct i2c_adapter *adap)
return parent->algo->functionality(parent);
}
+static int dbg_show(const char *prefix, struct i2c_demux_pinctrl_priv *priv)
+{
+ int i;
+
+ for (i = 0; i < priv->num_chan; i++) {
+ struct device_node *np;
+ const char *statename;
+ int ret;
+
+ np = priv->chan[i].parent_np;
+
+ ret = of_property_read_string_index(np, "pinctrl-names",
+ 0, &statename);
+ if (ret)
+ statename = "<error>";
+ dev_err(priv->dev, "%s chan:%d bus_name:%s np->full_name:%s "
+ "np:%p statename:%s\n", prefix, i, priv->bus_name,
+ np->full_name, np, statename);
+ }
+}
+
static int i2c_demux_activate_master(struct i2c_demux_pinctrl_priv *priv, u32 new_chan)
{
struct i2c_adapter *adap;
@@ -99,6 +120,7 @@ static int i2c_demux_activate_master(struct i2c_demux_pinctrl_priv *priv, u32 ne
if (ret < 0)
goto err_with_put;
+ dbg_show(__func__, priv);
return 0;
err_with_put:
@@ -115,6 +137,8 @@ static int i2c_demux_deactivate_master(struct i2c_demux_pinctrl_priv *priv)
if (cur < 0)
return 0;
+ dbg_show(__func__, priv);
+
i2c_del_adapter(&priv->cur_adap);
i2c_put_adapter(priv->chan[cur].parent_adap);
^ permalink raw reply related [flat|nested] 17+ messages in thread