All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] ARM: dts: r8a7790: lager: use demuxer for I2C
@ 2016-06-08  7:14 ` Simon Horman
  0 siblings, 0 replies; 34+ messages in thread
From: Simon Horman @ 2016-06-08  7:14 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: linux-arm-kernel, Magnus Damm, Wolfram Sang, Simon Horman

Hi,

the intention of this series is to extend use of the demuxer for I2C
on the lager/r8a7790 to cover all I2C IP blocks.

* This is based on work by Wolfram Sang.
* Testing is discussed below
* This series is based on renesas-devel-20160530-v4.7-rc1.
* To aid review it is provided in git at:
  git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git topic/i2c-demux-v2 
* I also intend to add demux for I2C to other R-Car Gen2 boards as a follow-up.

Changes since v1
* Provide GPIO fallback for I2C2,
  this does not seem appropriate for other I2C blocks on the lager board

Simon Horman (4):
  ARM: dts: r8a7790: lager: rename i2cexio as i2cexio0
  ARM: dts: r8a7790: lager: use demuxer for IIC1/I2C1
  ARM: dts: r8a7790: lager: use demuxer for IIC2/I2C2
  ARM: dts: r8a7790: lager: use demuxer for IIC3/I2C3

 arch/arm/boot/dts/r8a7790-lager.dts | 252 +++++++++++++++++++++++-------------
 1 file changed, 162 insertions(+), 90 deletions(-)

-- 
2.1.4

Discussion of Testing
=====================

My test case iterates through each available master of each demux that
is available and tries to select the masters in reverse. All relevant
drivers are present as per the shmobile_defconfig. The test fails when
the first error occurs. If there are no errors, that is all masters can
be initialises for all demuxes then the test passes.

My test script, which implements the above, is as follows:

--- begin ---
#!/bin/sh

set -e

cd /sys/devices/platform/

sleep 5 

for i in i2c-*; do
        [ "$i" != 'i2c-*' ] || break
        [ -e "$i/current_master" -a -e "$i/available_masters" ] || continue
        echo "I2C Demux: $i"
        for j in $(< "$i/available_masters" tr ' ' '\n' | tac); do
                idx=${j%:*}
                echo "  Master: $j ($idx)"
                echo "$idx" > "$i/current_master"
                sleep 5
        done
done
--- end ---


Results
-------

1. With no patches applied - that is only the demux for I2C0 present -
   the test passes. Excellent!

   # .  /exercise-i2c-demux.sh
   I2C Demux: i2c-8
     Master: 1:/i2c@e6508000 (1)
   [   22.532192] i2c-rcar e6508000.i2c: probed
     Master: 0:/i2c@e6500000 (0)
   [   27.549555] i2c-sh_mobile e6500000.i2c: I2C adapter 4, bus speed 100000 Hz

   Unfortunately from there things are a little less rosy.

2. In general it seems that if more than one demux is present then the
   test fails when iterating through the masters for the first demux
   (that of I2C). E.g. with the first two patches of this series applied
   there is a demux present for I2C0 and I2C1 and the test run is as
   follows. Logs are from the kernel, displayed on the system console where
   the test is also run.

   # ./exercise-i2c-demux.sh
   I2C Demux: i2c-8
     Master: 1:/i2c@e650800
   [   97.694487] i2c-rcar e6508000.i2c: probed 0 (1)
     Master: 0:/i2c@e650000
   [  102.706365] i2c-demux-pinctrl i2c-8: failed to setup demux-adapter 0 (-19) 0 (0)

3. With some manual hacks so that only one demux is present in DT the test
   pasts for the I2C0 (as per 1, above) and I2C2 demux.

   For the I2C2 demux the result is as follows:
   # ./exercise-i2c-demux.sh
   I2C Demux: i2c-9
     Master: 1:/i2c@e6518000 (1)
   [   22.430321] i2c-rcar e6518000.i2c: probed
     Master: 0:/i2c@e6510000 (0)
   [   27.447884] i2c-sh_mobile e6510000.i2c: I2C adapter 5, bus speed 100000 Hz

   3.1 Unfortunately it fails for the I2C2 dmux if the GPIO fallback is
       present.

       # ./exercise-i2c-demux.sh
       I2C Demux: i2c-10
         Master: 2:/i2c-11 (2)
       [   22.347864] i2c-gpio i2c-11: using pins 842 (SDA) and 841 (SCL)
       [   22.358210] i2c-demux-pinctrl i2c-10: failed to setup demux-adapter 2 (-19)
       With gpio fallback removed the test passes:

       # ./exercise-i2c-demux.sh
       I2C Demux: i2c-10
         Master: 1:/i2c@e6530000 (1)
       [  120.307738] i2c-rcar e6530000.i2c: probed
       [  120.313186] adv7180 8-0020: chip found @ 0x20 (i2c-demux (master i2c-2))
       [  120.337700] soc-camera-pdrv soc-camera-pdrv.0: Probing soc-camera-pdrv.0
         Master: 0:/i2c@e6520000 (0)
       [  125.359197] i2c-sh_mobile e6520000.i2c: I2C adapter 6, bus speed 100000 Hz
       [  125.367702] adv7180 8-0020: chip found @ 0x20 (i2c-demux (master i2c-6))
       [  125.387803] soc-camera-pdrv soc-camera-pdrv.0: Probing soc-camera-pdrv.0

   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:

       [   22.365156] ------------[ cut here ]------------
       [   22.374061] WARNING: CPU: 2 PID: 1959 at drivers/regulator/core.c:4099 regulator_unregister+0x6c/0xb8
       [   22.387730] CPU: 2 PID: 1959 Comm: exercise-i2c-de Not tainted 4.7.0-rc1-00006-g05ba3a31af73-dirty #200
       [   22.401620] Hardware name: Generic R8A7790 (Flattened Device Tree)
       [   22.412295] Backtrace:
       [   22.419217] [<c010a070>] (dump_backtrace) from [<c010a210>] (show_stack+0x18/0x1c)
       [   22.431344]  r6:c08271e6 r5:00000000 r4:60000013 r3:00404000
       [   22.441729] [<c010a1f8>] (show_stack) from [<c02d14d8>] (dump_stack+0x80/0xa0)
       [   22.453645] [<c02d1458>] (dump_stack) from [<c011e294>] (__warn+0xc4/0xf0)
       [   22.465179]  r5:c033e0b8 r4:00000000
       [   22.473477] [<c011e1d0>] (__warn) from [<c011e378>] (warn_slowpath_null+0x28/0x30)
       [   22.485785]  r10:c03a8830 r8:ee0d3cf0 r7:ef35ba80 r6:00000006 r5:ee9e4180 r4:ee975400
       [   22.498439] [<c011e350>] (warn_slowpath_null) from [<c033e0b8>] (regulator_unregister+0x6c/0xb8)
       [   22.512014] [<c033e04c>] (regulator_unregister) from [<c033eb20>] (devm_rdev_release+0x14/0x18)
       [   22.525539]  r4:eea2a620 r3:c033eb0c
       [   22.533959] [<c033eb0c>] (devm_rdev_release) from [<c03a8b94>] (release_nodes+0x1a8/0x1d4)
       [   22.547139] [<c03a89ec>] (release_nodes) from [<c03a8f70>] (devres_release_all+0x4c/0x54)
       [   22.560271]  r10:ee0d3f80 r9:ee0d2000 r8:00000100 r7:00000000 r6:c0a30678 r5:c0a22660
       [   22.573189]  r4:eea2a620
       [   22.580694] [<c03a8f24>] (devres_release_all) from [<c03a6178>] (__device_release_driver+0xa4/0x110)
       [   22.594895]  r4:eea2a620 r3:00000000
       [   22.603537] [<c03a60d4>] (__device_release_driver) from [<c03a6310>] (device_release_driver+0x24/0x30)
       [   22.617981]  r5:eea2a620 r4:eea2a654
       [   22.626609] [<c03a62ec>] (device_release_driver) from [<c03a4bf0>] (bus_remove_device+0xe0/0xf0)
       [   22.640434]  r5:ef142030 r4:eea2a620
       [   22.649030] [<c03a4b10>] (bus_remove_device) from [<c03a2770>] (device_del+0x150/0x1dc)
       [   22.662172]  r6:ef1bf058 r5:ee0d3e08 r4:eea2a620 r3:00000009
       [   22.673065] [<c03a2620>] (device_del) from [<c03a2810>] (device_unregister+0x14/0x20)
       [   22.686113]  r6:c04777b4 r5:ee0d3e08 r4:eea2a620
       [   22.696003] [<c03a27fc>] (device_unregister) from [<c047756c>] (i2c_unregister_device+0x30/0x34)
       [   22.710095]  r4:eea2a600 r3:00000008
       [   22.718949] [<c047753c>] (i2c_unregister_device) from [<c04777f4>] (__unregister_client+0x40/0x50)
       [   22.733285]  r4:eea2a600 r3:00000061
       [   22.742240] [<c04777b4>] (__unregister_client) from [<c03a2b0c>] (device_for_each_child+0x44/0x80)
       [   22.756669]  r4:00000000 r3:c0872000
       [   22.765644] [<c03a2ac8>] (device_for_each_child) from [<c0477c24>] (i2c_del_adapter+0x10c/0x1ac)
       [   22.779826]  r7:ef1bf020 r6:c0a7b498 r5:ef1bf058 r4:ef1bf020
       [   22.790898] [<c0477b18>] (i2c_del_adapter) from [<c047ee7c>] (current_master_store+0x64/0xb4)
       [   22.804751]  r8:00000025 r7:00000001 r6:00000000 r5:00000002 r4:ef1bf010 r3:00000002
       [   22.817976] [<c047ee18>] (current_master_store) from [<c03a19cc>] (dev_attr_store+0x20/0x2c)
       [   22.831904]  r8:00000051 r7:ee28a38c r6:edcf9a80 r5:00000002 r4:edcf9a80
       [   22.844254] [<c03a19ac>] (dev_attr_store) from [<c02336f4>] (sysfs_kf_write+0x44/0x50)
       [   22.857811] [<c02336b0>] (sysfs_kf_write) from [<c0232d44>] (kernfs_fop_write+0x154/0x1c0)
       [   22.871729]  r4:ee28a380 r3:c02336b0
       [   22.880953] [<c0232bf0>] (kernfs_fop_write) from [<c01d7298>] (__vfs_write+0x34/0x110)
       [   22.894589]  r10:00000000 r8:000228d0 r7:00000002 r6:ee0d3f80 r5:c0232bf0 r4:ee7c2b40
       [   22.908255] [<c01d7264>] (__vfs_write) from [<c01d7500>] (vfs_write+0xc4/0x150)
       [   22.921333]  r8:ee0d3f80 r7:000228d0 r6:00000002 r5:00000000 r4:ee7c2b40
       [   22.933907] [<c01d743c>] (vfs_write) from [<c01d7658>] (SyS_write+0x48/0x84)
       [   22.946715]  r10:00000000 r8:c01070c4 r7:000228d0 r6:00000002 r5:ee7c2b40 r4:ee7c2b40
       [   22.960386] [<c01d7610>] (SyS_write) from [<c0106f00>] (ret_fast_syscall+0x0/0x3c)
       [   22.973666]  r7:00000004 r6:000217bc r5:00000002 r4:000228d0
       [   22.985117] ---[ end trace 6ff385e193525a58 ]---
       [   22.997372] i2c-rcar e6540000.i2c: probed

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

* [PATCH v2 0/4] ARM: dts: r8a7790: lager: use demuxer for I2C
@ 2016-06-08  7:14 ` Simon Horman
  0 siblings, 0 replies; 34+ messages in thread
From: Simon Horman @ 2016-06-08  7:14 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

the intention of this series is to extend use of the demuxer for I2C
on the lager/r8a7790 to cover all I2C IP blocks.

* This is based on work by Wolfram Sang.
* Testing is discussed below
* This series is based on renesas-devel-20160530-v4.7-rc1.
* To aid review it is provided in git at:
  git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git topic/i2c-demux-v2 
* I also intend to add demux for I2C to other R-Car Gen2 boards as a follow-up.

Changes since v1
* Provide GPIO fallback for I2C2,
  this does not seem appropriate for other I2C blocks on the lager board

Simon Horman (4):
  ARM: dts: r8a7790: lager: rename i2cexio as i2cexio0
  ARM: dts: r8a7790: lager: use demuxer for IIC1/I2C1
  ARM: dts: r8a7790: lager: use demuxer for IIC2/I2C2
  ARM: dts: r8a7790: lager: use demuxer for IIC3/I2C3

 arch/arm/boot/dts/r8a7790-lager.dts | 252 +++++++++++++++++++++++-------------
 1 file changed, 162 insertions(+), 90 deletions(-)

-- 
2.1.4

Discussion of Testing
=====================

My test case iterates through each available master of each demux that
is available and tries to select the masters in reverse. All relevant
drivers are present as per the shmobile_defconfig. The test fails when
the first error occurs. If there are no errors, that is all masters can
be initialises for all demuxes then the test passes.

My test script, which implements the above, is as follows:

--- begin ---
#!/bin/sh

set -e

cd /sys/devices/platform/

sleep 5 

for i in i2c-*; do
        [ "$i" != 'i2c-*' ] || break
        [ -e "$i/current_master" -a -e "$i/available_masters" ] || continue
        echo "I2C Demux: $i"
        for j in $(< "$i/available_masters" tr ' ' '\n' | tac); do
                idx=${j%:*}
                echo "  Master: $j ($idx)"
                echo "$idx" > "$i/current_master"
                sleep 5
        done
done
--- end ---


Results
-------

1. With no patches applied - that is only the demux for I2C0 present -
   the test passes. Excellent!

   # .  /exercise-i2c-demux.sh
   I2C Demux: i2c-8
     Master: 1:/i2c at e6508000 (1)
   [   22.532192] i2c-rcar e6508000.i2c: probed
     Master: 0:/i2c at e6500000 (0)
   [   27.549555] i2c-sh_mobile e6500000.i2c: I2C adapter 4, bus speed 100000 Hz

   Unfortunately from there things are a little less rosy.

2. In general it seems that if more than one demux is present then the
   test fails when iterating through the masters for the first demux
   (that of I2C). E.g. with the first two patches of this series applied
   there is a demux present for I2C0 and I2C1 and the test run is as
   follows. Logs are from the kernel, displayed on the system console where
   the test is also run.

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

3. With some manual hacks so that only one demux is present in DT the test
   pasts for the I2C0 (as per 1, above) and I2C2 demux.

   For the I2C2 demux the result is as follows:
   # ./exercise-i2c-demux.sh
   I2C Demux: i2c-9
     Master: 1:/i2c at e6518000 (1)
   [   22.430321] i2c-rcar e6518000.i2c: probed
     Master: 0:/i2c at e6510000 (0)
   [   27.447884] i2c-sh_mobile e6510000.i2c: I2C adapter 5, bus speed 100000 Hz

   3.1 Unfortunately it fails for the I2C2 dmux if the GPIO fallback is
       present.

       # ./exercise-i2c-demux.sh
       I2C Demux: i2c-10
         Master: 2:/i2c-11 (2)
       [   22.347864] i2c-gpio i2c-11: using pins 842 (SDA) and 841 (SCL)
       [   22.358210] i2c-demux-pinctrl i2c-10: failed to setup demux-adapter 2 (-19)
       With gpio fallback removed the test passes:

       # ./exercise-i2c-demux.sh
       I2C Demux: i2c-10
         Master: 1:/i2c at e6530000 (1)
       [  120.307738] i2c-rcar e6530000.i2c: probed
       [  120.313186] adv7180 8-0020: chip found @ 0x20 (i2c-demux (master i2c-2))
       [  120.337700] soc-camera-pdrv soc-camera-pdrv.0: Probing soc-camera-pdrv.0
         Master: 0:/i2c at e6520000 (0)
       [  125.359197] i2c-sh_mobile e6520000.i2c: I2C adapter 6, bus speed 100000 Hz
       [  125.367702] adv7180 8-0020: chip found @ 0x20 (i2c-demux (master i2c-6))
       [  125.387803] soc-camera-pdrv soc-camera-pdrv.0: Probing soc-camera-pdrv.0

   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:

       [   22.365156] ------------[ cut here ]------------
       [   22.374061] WARNING: CPU: 2 PID: 1959 at drivers/regulator/core.c:4099 regulator_unregister+0x6c/0xb8
       [   22.387730] CPU: 2 PID: 1959 Comm: exercise-i2c-de Not tainted 4.7.0-rc1-00006-g05ba3a31af73-dirty #200
       [   22.401620] Hardware name: Generic R8A7790 (Flattened Device Tree)
       [   22.412295] Backtrace:
       [   22.419217] [<c010a070>] (dump_backtrace) from [<c010a210>] (show_stack+0x18/0x1c)
       [   22.431344]  r6:c08271e6 r5:00000000 r4:60000013 r3:00404000
       [   22.441729] [<c010a1f8>] (show_stack) from [<c02d14d8>] (dump_stack+0x80/0xa0)
       [   22.453645] [<c02d1458>] (dump_stack) from [<c011e294>] (__warn+0xc4/0xf0)
       [   22.465179]  r5:c033e0b8 r4:00000000
       [   22.473477] [<c011e1d0>] (__warn) from [<c011e378>] (warn_slowpath_null+0x28/0x30)
       [   22.485785]  r10:c03a8830 r8:ee0d3cf0 r7:ef35ba80 r6:00000006 r5:ee9e4180 r4:ee975400
       [   22.498439] [<c011e350>] (warn_slowpath_null) from [<c033e0b8>] (regulator_unregister+0x6c/0xb8)
       [   22.512014] [<c033e04c>] (regulator_unregister) from [<c033eb20>] (devm_rdev_release+0x14/0x18)
       [   22.525539]  r4:eea2a620 r3:c033eb0c
       [   22.533959] [<c033eb0c>] (devm_rdev_release) from [<c03a8b94>] (release_nodes+0x1a8/0x1d4)
       [   22.547139] [<c03a89ec>] (release_nodes) from [<c03a8f70>] (devres_release_all+0x4c/0x54)
       [   22.560271]  r10:ee0d3f80 r9:ee0d2000 r8:00000100 r7:00000000 r6:c0a30678 r5:c0a22660
       [   22.573189]  r4:eea2a620
       [   22.580694] [<c03a8f24>] (devres_release_all) from [<c03a6178>] (__device_release_driver+0xa4/0x110)
       [   22.594895]  r4:eea2a620 r3:00000000
       [   22.603537] [<c03a60d4>] (__device_release_driver) from [<c03a6310>] (device_release_driver+0x24/0x30)
       [   22.617981]  r5:eea2a620 r4:eea2a654
       [   22.626609] [<c03a62ec>] (device_release_driver) from [<c03a4bf0>] (bus_remove_device+0xe0/0xf0)
       [   22.640434]  r5:ef142030 r4:eea2a620
       [   22.649030] [<c03a4b10>] (bus_remove_device) from [<c03a2770>] (device_del+0x150/0x1dc)
       [   22.662172]  r6:ef1bf058 r5:ee0d3e08 r4:eea2a620 r3:00000009
       [   22.673065] [<c03a2620>] (device_del) from [<c03a2810>] (device_unregister+0x14/0x20)
       [   22.686113]  r6:c04777b4 r5:ee0d3e08 r4:eea2a620
       [   22.696003] [<c03a27fc>] (device_unregister) from [<c047756c>] (i2c_unregister_device+0x30/0x34)
       [   22.710095]  r4:eea2a600 r3:00000008
       [   22.718949] [<c047753c>] (i2c_unregister_device) from [<c04777f4>] (__unregister_client+0x40/0x50)
       [   22.733285]  r4:eea2a600 r3:00000061
       [   22.742240] [<c04777b4>] (__unregister_client) from [<c03a2b0c>] (device_for_each_child+0x44/0x80)
       [   22.756669]  r4:00000000 r3:c0872000
       [   22.765644] [<c03a2ac8>] (device_for_each_child) from [<c0477c24>] (i2c_del_adapter+0x10c/0x1ac)
       [   22.779826]  r7:ef1bf020 r6:c0a7b498 r5:ef1bf058 r4:ef1bf020
       [   22.790898] [<c0477b18>] (i2c_del_adapter) from [<c047ee7c>] (current_master_store+0x64/0xb4)
       [   22.804751]  r8:00000025 r7:00000001 r6:00000000 r5:00000002 r4:ef1bf010 r3:00000002
       [   22.817976] [<c047ee18>] (current_master_store) from [<c03a19cc>] (dev_attr_store+0x20/0x2c)
       [   22.831904]  r8:00000051 r7:ee28a38c r6:edcf9a80 r5:00000002 r4:edcf9a80
       [   22.844254] [<c03a19ac>] (dev_attr_store) from [<c02336f4>] (sysfs_kf_write+0x44/0x50)
       [   22.857811] [<c02336b0>] (sysfs_kf_write) from [<c0232d44>] (kernfs_fop_write+0x154/0x1c0)
       [   22.871729]  r4:ee28a380 r3:c02336b0
       [   22.880953] [<c0232bf0>] (kernfs_fop_write) from [<c01d7298>] (__vfs_write+0x34/0x110)
       [   22.894589]  r10:00000000 r8:000228d0 r7:00000002 r6:ee0d3f80 r5:c0232bf0 r4:ee7c2b40
       [   22.908255] [<c01d7264>] (__vfs_write) from [<c01d7500>] (vfs_write+0xc4/0x150)
       [   22.921333]  r8:ee0d3f80 r7:000228d0 r6:00000002 r5:00000000 r4:ee7c2b40
       [   22.933907] [<c01d743c>] (vfs_write) from [<c01d7658>] (SyS_write+0x48/0x84)
       [   22.946715]  r10:00000000 r8:c01070c4 r7:000228d0 r6:00000002 r5:ee7c2b40 r4:ee7c2b40
       [   22.960386] [<c01d7610>] (SyS_write) from [<c0106f00>] (ret_fast_syscall+0x0/0x3c)
       [   22.973666]  r7:00000004 r6:000217bc r5:00000002 r4:000228d0
       [   22.985117] ---[ end trace 6ff385e193525a58 ]---
       [   22.997372] i2c-rcar e6540000.i2c: probed

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

* [PATCH v2 1/4] ARM: dts: r8a7790: lager: rename i2cexio as i2cexio0
  2016-06-08  7:14 ` Simon Horman
@ 2016-06-08  7:14   ` Simon Horman
  -1 siblings, 0 replies; 34+ messages in thread
From: Simon Horman @ 2016-06-08  7:14 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: linux-arm-kernel, Magnus Damm, Wolfram Sang, Simon Horman

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] 34+ messages in thread

* [PATCH v2 1/4] ARM: dts: r8a7790: lager: rename i2cexio as i2cexio0
@ 2016-06-08  7:14   ` Simon Horman
  0 siblings, 0 replies; 34+ 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] 34+ messages in thread

* [PATCH v2 2/4] ARM: dts: r8a7790: lager: use demuxer for IIC1/I2C1
  2016-06-08  7:14 ` Simon Horman
@ 2016-06-08  7:14   ` Simon Horman
  -1 siblings, 0 replies; 34+ messages in thread
From: Simon Horman @ 2016-06-08  7:14 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: linux-arm-kernel, Magnus Damm, Wolfram Sang, Simon Horman

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] 34+ messages in thread

* [PATCH v2 2/4] ARM: dts: r8a7790: lager: use demuxer for IIC1/I2C1
@ 2016-06-08  7:14   ` Simon Horman
  0 siblings, 0 replies; 34+ 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] 34+ messages in thread

* [PATCH v2 3/4] ARM: dts: r8a7790: lager: use demuxer for IIC2/I2C2
  2016-06-08  7:14 ` Simon Horman
@ 2016-06-08  7:14   ` Simon Horman
  -1 siblings, 0 replies; 34+ messages in thread
From: Simon Horman @ 2016-06-08  7:14 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: linux-arm-kernel, Magnus Damm, Wolfram Sang, Simon Horman

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@12 {
+			compatible = "asahi-kasei,ak4643";
+			#sound-dai-cells = <0>;
+			reg = <0x12>;
+		};
+
+		composite-in@20 {
+			compatible = "adi,adv7180";
+			reg = <0x20>;
+			remote = <&vin1>;
+
+			port {
+				adv7180: endpoint {
+					bus-width = <8>;
+					remote-endpoint = <&vin1ep0>;
+				};
+			};
+		};
+
+		hdmi@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@0 {
+					reg = <0>;
+					adv7511_in: endpoint {
+						remote-endpoint = <&du_out_lvds0>;
+					};
+				};
+
+				port@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@12 {
-		compatible = "asahi-kasei,ak4643";
-		#sound-dai-cells = <0>;
-		reg = <0x12>;
-	};
-
-	composite-in@20 {
-		compatible = "adi,adv7180";
-		reg = <0x20>;
-		remote = <&vin1>;
-
-		port {
-			adv7180: endpoint {
-				bus-width = <8>;
-				remote-endpoint = <&vin1ep0>;
-			};
-		};
-	};
-
-	hdmi@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@0 {
-				reg = <0>;
-				adv7511_in: endpoint {
-					remote-endpoint = <&du_out_lvds0>;
-				};
-			};
+&iic2	{
+	pinctrl-0 = <&iic2_pins>;
+	pinctrl-names = "i2c-hdmi";
 
-			port@1 {
-				reg = <1>;
-				adv7511_out: endpoint {
-					remote-endpoint = <&hdmi_con>;
-				};
-			};
-		};
-	};
+	clock-frequency = <100000>;
 };
 
 &iic3 {
-- 
2.1.4

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

* [PATCH v2 3/4] ARM: dts: r8a7790: lager: use demuxer for IIC2/I2C2
@ 2016-06-08  7:14   ` Simon Horman
  0 siblings, 0 replies; 34+ 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] 34+ messages in thread

* [PATCH v2 4/4] ARM: dts: r8a7790: lager: use demuxer for IIC3/I2C3
  2016-06-08  7:14 ` Simon Horman
@ 2016-06-08  7:14   ` Simon Horman
  -1 siblings, 0 replies; 34+ messages in thread
From: Simon Horman @ 2016-06-08  7:14 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: linux-arm-kernel, Magnus Damm, Wolfram Sang, Simon Horman

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@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@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@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@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] 34+ messages in thread

* [PATCH v2 4/4] ARM: dts: r8a7790: lager: use demuxer for IIC3/I2C3
@ 2016-06-08  7:14   ` Simon Horman
  0 siblings, 0 replies; 34+ 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] 34+ messages in thread

* Re: [PATCH v2 1/4] ARM: dts: r8a7790: lager: rename i2cexio as i2cexio0
  2016-06-08  7:14   ` Simon Horman
@ 2016-06-08  8:03     ` Wolfram Sang
  -1 siblings, 0 replies; 34+ messages in thread
From: Wolfram Sang @ 2016-06-08  8:03 UTC (permalink / raw)
  To: Simon Horman
  Cc: linux-renesas-soc, linux-arm-kernel, Magnus Damm, Wolfram Sang

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

On Wed, Jun 08, 2016 at 04:14:23PM +0900, Simon Horman wrote:
> This is in preparation for adding i2cexio1 which will use the
> dmuxer for IIC1/I2C0.

I2C1


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

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

* [PATCH v2 1/4] ARM: dts: r8a7790: lager: rename i2cexio as i2cexio0
@ 2016-06-08  8:03     ` Wolfram Sang
  0 siblings, 0 replies; 34+ messages in thread
From: Wolfram Sang @ 2016-06-08  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jun 08, 2016 at 04:14:23PM +0900, Simon Horman wrote:
> This is in preparation for adding i2cexio1 which will use the
> dmuxer for IIC1/I2C0.

I2C1

-------------- 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/3223d18d/attachment-0001.sig>

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

* Re: [PATCH v2 4/4] ARM: dts: r8a7790: lager: use demuxer for IIC3/I2C3
  2016-06-08  7:14   ` Simon Horman
@ 2016-06-08  8:05     ` Wolfram Sang
  -1 siblings, 0 replies; 34+ messages in thread
From: Wolfram Sang @ 2016-06-08  8:05 UTC (permalink / raw)
  To: Simon Horman
  Cc: linux-renesas-soc, linux-arm-kernel, Magnus Damm, Wolfram Sang

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

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?


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

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

* [PATCH v2 4/4] ARM: dts: r8a7790: lager: use demuxer for IIC3/I2C3
@ 2016-06-08  8:05     ` Wolfram Sang
  0 siblings, 0 replies; 34+ 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] 34+ messages in thread

* Re: [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
  -1 siblings, 0 replies; 34+ messages in thread
From: Simon Horman @ 2016-06-09  0:55 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-renesas-soc, linux-arm-kernel, Magnus Damm, Wolfram Sang

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] 34+ messages in thread

* [PATCH v2 4/4] ARM: dts: r8a7790: lager: use demuxer for IIC3/I2C3
@ 2016-06-09  0:55       ` Simon Horman
  0 siblings, 0 replies; 34+ 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] 34+ messages in thread

* Re: [PATCH v2 0/4] ARM: dts: r8a7790: lager: use demuxer for I2C
  2016-06-08  7:14 ` Simon Horman
@ 2016-06-13 14:31   ` Wolfram Sang
  -1 siblings, 0 replies; 34+ messages in thread
From: Wolfram Sang @ 2016-06-13 14:31 UTC (permalink / raw)
  To: Simon Horman
  Cc: linux-renesas-soc, linux-arm-kernel, Magnus Damm, Wolfram Sang

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


>    # ./exercise-i2c-demux.sh
>    I2C Demux: i2c-8
>      Master: 1:/i2c@e650800
>    [   97.694487] i2c-rcar e6508000.i2c: probed 0 (1)
>      Master: 0:/i2c@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/


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

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

* [PATCH v2 0/4] ARM: dts: r8a7790: lager: use demuxer for I2C
@ 2016-06-13 14:31   ` Wolfram Sang
  0 siblings, 0 replies; 34+ 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] 34+ messages in thread

* Re: [PATCH v2 2/4] ARM: dts: r8a7790: lager: use demuxer for IIC1/I2C1
  2016-06-08  7:14   ` Simon Horman
@ 2016-06-13 14:33     ` Wolfram Sang
  -1 siblings, 0 replies; 34+ messages in thread
From: Wolfram Sang @ 2016-06-13 14:33 UTC (permalink / raw)
  To: Simon Horman
  Cc: linux-renesas-soc, linux-arm-kernel, Magnus Damm, Wolfram Sang

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

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?


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

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

* [PATCH v2 2/4] ARM: dts: r8a7790: lager: use demuxer for IIC1/I2C1
@ 2016-06-13 14:33     ` Wolfram Sang
  0 siblings, 0 replies; 34+ 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] 34+ messages in thread

* Re: [PATCH v2 4/4] ARM: dts: r8a7790: lager: use demuxer for IIC3/I2C3
  2016-06-08  7:14   ` Simon Horman
@ 2016-06-13 14:35     ` Wolfram Sang
  -1 siblings, 0 replies; 34+ messages in thread
From: Wolfram Sang @ 2016-06-13 14:35 UTC (permalink / raw)
  To: Simon Horman
  Cc: linux-renesas-soc, linux-arm-kernel, Magnus Damm, Wolfram Sang

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


>  		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

?

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

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

* [PATCH v2 4/4] ARM: dts: r8a7790: lager: use demuxer for IIC3/I2C3
@ 2016-06-13 14:35     ` Wolfram Sang
  0 siblings, 0 replies; 34+ 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] 34+ messages in thread

* Re: [PATCH v2 0/4] ARM: dts: r8a7790: lager: use demuxer for I2C
  2016-06-13 14:31   ` Wolfram Sang
@ 2016-06-14 22:09     ` Wolfram Sang
  -1 siblings, 0 replies; 34+ messages in thread
From: Wolfram Sang @ 2016-06-14 22:09 UTC (permalink / raw)
  To: Simon Horman
  Cc: linux-renesas-soc, linux-arm-kernel, Magnus Damm, Wolfram Sang

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


> 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 :(


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

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

* [PATCH v2 0/4] ARM: dts: r8a7790: lager: use demuxer for I2C
@ 2016-06-14 22:09     ` Wolfram Sang
  0 siblings, 0 replies; 34+ 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] 34+ messages in thread

* Re: [PATCH v2 1/4] ARM: dts: r8a7790: lager: rename i2cexio as i2cexio0
  2016-06-08  8:03     ` Wolfram Sang
@ 2016-06-15  4:08       ` Simon Horman
  -1 siblings, 0 replies; 34+ messages in thread
From: Simon Horman @ 2016-06-15  4:08 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-renesas-soc, linux-arm-kernel, Magnus Damm, Wolfram Sang

On Wed, Jun 08, 2016 at 10:03:40AM +0200, Wolfram Sang wrote:
> On Wed, Jun 08, 2016 at 04:14:23PM +0900, Simon Horman wrote:
> > This is in preparation for adding i2cexio1 which will use the
> > dmuxer for IIC1/I2C0.
> 
> I2C1

Thanks, I will fix that.

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

* [PATCH v2 1/4] ARM: dts: r8a7790: lager: rename i2cexio as i2cexio0
@ 2016-06-15  4:08       ` Simon Horman
  0 siblings, 0 replies; 34+ messages in thread
From: Simon Horman @ 2016-06-15  4:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jun 08, 2016 at 10:03:40AM +0200, Wolfram Sang wrote:
> On Wed, Jun 08, 2016 at 04:14:23PM +0900, Simon Horman wrote:
> > This is in preparation for adding i2cexio1 which will use the
> > dmuxer for IIC1/I2C0.
> 
> I2C1

Thanks, I will fix that.

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

* Re: [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
  -1 siblings, 0 replies; 34+ messages in thread
From: Simon Horman @ 2016-06-15  4:12 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-renesas-soc, linux-arm-kernel, Magnus Damm, Wolfram Sang

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] 34+ messages in thread

* [PATCH v2 2/4] ARM: dts: r8a7790: lager: use demuxer for IIC1/I2C1
@ 2016-06-15  4:12       ` Simon Horman
  0 siblings, 0 replies; 34+ 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] 34+ messages in thread

* Re: [PATCH v2 4/4] ARM: dts: r8a7790: lager: use demuxer for IIC3/I2C3
  2016-06-13 14:35     ` Wolfram Sang
@ 2016-06-15  4:29       ` Simon Horman
  -1 siblings, 0 replies; 34+ messages in thread
From: Simon Horman @ 2016-06-15  4:29 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-renesas-soc, linux-arm-kernel, Magnus Damm, Wolfram Sang

On Mon, Jun 13, 2016 at 04:35:21PM +0200, Wolfram Sang wrote:
> 
> >  		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

Should we also group gpioi2cX?

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

* [PATCH v2 4/4] ARM: dts: r8a7790: lager: use demuxer for IIC3/I2C3
@ 2016-06-15  4:29       ` Simon Horman
  0 siblings, 0 replies; 34+ messages in thread
From: Simon Horman @ 2016-06-15  4:29 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jun 13, 2016 at 04:35:21PM +0200, Wolfram Sang wrote:
> 
> >  		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

Should we also group gpioi2cX?

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

* Re: [PATCH v2 4/4] ARM: dts: r8a7790: lager: use demuxer for IIC3/I2C3
  2016-06-15  4:29       ` Simon Horman
@ 2016-06-15  6:24         ` Wolfram Sang
  -1 siblings, 0 replies; 34+ messages in thread
From: Wolfram Sang @ 2016-06-15  6:24 UTC (permalink / raw)
  To: Simon Horman
  Cc: linux-renesas-soc, linux-arm-kernel, Magnus Damm, Wolfram Sang

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

On Wed, Jun 15, 2016 at 01:29:43PM +0900, Simon Horman wrote:
> On Mon, Jun 13, 2016 at 04:35:21PM +0200, Wolfram Sang wrote:
> > 
> > >  		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
> 
> Should we also group gpioi2cX?

That's what I meant with "additional gpio busses" :) I assume we only
need 2 on lager.


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

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

* [PATCH v2 4/4] ARM: dts: r8a7790: lager: use demuxer for IIC3/I2C3
@ 2016-06-15  6:24         ` Wolfram Sang
  0 siblings, 0 replies; 34+ messages in thread
From: Wolfram Sang @ 2016-06-15  6:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jun 15, 2016 at 01:29:43PM +0900, Simon Horman wrote:
> On Mon, Jun 13, 2016 at 04:35:21PM +0200, Wolfram Sang wrote:
> > 
> > >  		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
> 
> Should we also group gpioi2cX?

That's what I meant with "additional gpio busses" :) I assume we only
need 2 on lager.

-------------- 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/ac7ee1e9/attachment.sig>

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

* Re: [PATCH v2 0/4] ARM: dts: r8a7790: lager: use demuxer for I2C
  2016-06-13 14:31   ` Wolfram Sang
@ 2016-06-16  1:26     ` Simon Horman
  -1 siblings, 0 replies; 34+ messages in thread
From: Simon Horman @ 2016-06-16  1:26 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-renesas-soc, linux-arm-kernel, Magnus Damm, Wolfram Sang

On Mon, Jun 13, 2016 at 04:31:34PM +0200, Wolfram Sang wrote:
> 
> >    # ./exercise-i2c-demux.sh
> >    I2C Demux: i2c-8
> >      Master: 1:/i2c@e650800
> >    [   97.694487] i2c-rcar e6508000.i2c: probed 0 (1)
> >      Master: 0:/i2c@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@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@e6500000

   i2c-demux-pinctrl i2c-8: i2c_demux_activate_master chan:0 bus_name:i2c-exio0 np->full_name/i2c@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@e6508000 np:ef7dabfc statename:i2c-exio0

2. At run time I select the second parent, 1:/i2c@e6508000.
   This works. But the statename of i2c@e6500000 is already i2c-exio1.

   i2c-demux-pinctrl i2c-8: i2c_demux_deactivate_master chan:0 bus_name:i2c-exio0 np->full_name:/i2c@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@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@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@e6508000 np:ef7dabfc statename:i2c-exio0

3. At run time I re-select the first parent, 0:/i2c@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@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@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@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] 34+ messages in thread

* [PATCH v2 0/4] ARM: dts: r8a7790: lager: use demuxer for I2C
@ 2016-06-16  1:26     ` Simon Horman
  0 siblings, 0 replies; 34+ 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] 34+ messages in thread

end of thread, other threads:[~2016-06-16  1:26 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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  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-08  8:03   ` Wolfram Sang
2016-06-08  8:03     ` Wolfram Sang
2016-06-15  4:08     ` Simon Horman
2016-06-15  4:08       ` 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-13 14:33   ` Wolfram Sang
2016-06-13 14:33     ` Wolfram Sang
2016-06-15  4:12     ` Simon Horman
2016-06-15  4:12       ` Simon Horman
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  7:14 ` [PATCH v2 4/4] ARM: dts: r8a7790: lager: use demuxer for IIC3/I2C3 Simon Horman
2016-06-08  7:14   ` Simon Horman
2016-06-08  8:05   ` Wolfram Sang
2016-06-08  8:05     ` Wolfram Sang
2016-06-09  0:55     ` Simon Horman
2016-06-09  0:55       ` Simon Horman
2016-06-13 14:35   ` Wolfram Sang
2016-06-13 14:35     ` Wolfram Sang
2016-06-15  4:29     ` Simon Horman
2016-06-15  4:29       ` Simon Horman
2016-06-15  6:24       ` Wolfram Sang
2016-06-15  6:24         ` Wolfram Sang
2016-06-13 14:31 ` [PATCH v2 0/4] ARM: dts: r8a7790: lager: use demuxer for I2C Wolfram Sang
2016-06-13 14:31   ` Wolfram Sang
2016-06-14 22:09   ` Wolfram Sang
2016-06-14 22:09     ` Wolfram Sang
2016-06-16  1:26   ` Simon Horman
2016-06-16  1:26     ` Simon Horman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.