All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa@the-dreams.de>
To: linux-i2c@vger.kernel.org
Cc: Wolfram Sang <wsa@the-dreams.de>,
	linux-sh@vger.kernel.org, Magnus Damm <magnus.damm@gmail.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Pantelis Antoniou <pantelis.antoniou@konsulko.com>,
	Jan Luebbe <jlu@pengutronix.de>
Subject: [RFC v2 0/4] i2c/of: switch I2C IP cores at runtime via OF_DYNAMIC
Date: Wed, 06 Jan 2016 13:51:21 +0000	[thread overview]
Message-ID: <1452088285-6427-1-git-send-email-wsa@the-dreams.de> (raw)

I know this is gonna be a controversial series, but we have a usecase for this :)

This series allows an I2C bus to switch between multiple masters, i.e. a
n-to-1-demuxer. This is not hot-switching because connected I2C slaves will be
re-instantiated. It is meant to select the best I2C core at runtime once the
task is known. Example: Prefer i2c-gpio over another I2C core because of HW
errata affecting your current runtime configuration.

It works by using OF_DYNAMIC and en-/disabling the i2c parent as needed. See
the binding docs for more details. Because this is largely using OF_DYNAMIC, I
decided to post the whole series to the dt list.

Changes since RFC v1:

* gracefully handle if i2c adapters are not present at runtime
  (driver not loaded yet)
* added more documentation and examples
* properly put the i2c adapters after use
* respect PAGE_SIZE in sysfs_show

This has been tested on a Renesas Lager board switching between i2c-gpio and
two different IP cores (i2c-rcar and i2c-sh_mobile). The rebinding seems to be
working as expected. However, in practice, I couldn't use the HDMI i2c slaves
with another controller yet, because the rcar-du driver OOPSes when unbinding.
This seems unrelated to this series because it can also be triggered via
sysfs-unbind. soc-camera also had problems properly cleaning up on unbind, a
patch for this already has been sent. So, this series is for sure a good test
for the unbind path of drivers.

Let me know what you think.

Thanks,

   Wolfram


Wolfram Sang (4):
  of: make of_mutex public
  dt-bindings: i2c: mux: demux-pinctrl: add bindings
  i2c: mux: demux-pinctrl: add driver
  ARM: shmobile: r8a7790: rework dts to use i2c demuxer

 .../devicetree/bindings/i2c/i2c-demux-pinctrl.txt  | 155 ++++++++++++
 arch/arm/boot/dts/r8a7790-lager.dts                | 141 +++++++----
 drivers/i2c/muxes/Kconfig                          |   9 +
 drivers/i2c/muxes/Makefile                         |   2 +
 drivers/i2c/muxes/i2c-demux-pinctrl.c              | 276 +++++++++++++++++++++
 drivers/of/of_private.h                            |   1 -
 include/linux/of.h                                 |   2 +
 7 files changed, 532 insertions(+), 54 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-demux-pinctrl.txt
 create mode 100644 drivers/i2c/muxes/i2c-demux-pinctrl.c

-- 
2.1.4


WARNING: multiple messages have this Message-ID (diff)
From: Wolfram Sang <wsa@the-dreams.de>
To: linux-i2c@vger.kernel.org
Cc: Wolfram Sang <wsa@the-dreams.de>,
	linux-sh@vger.kernel.org, Magnus Damm <magnus.damm@gmail.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Pantelis Antoniou <pantelis.antoniou@konsulko.com>,
	Jan Luebbe <jlu@pengutronix.de>
Subject: [RFC v2 0/4] i2c/of: switch I2C IP cores at runtime via OF_DYNAMIC
Date: Wed,  6 Jan 2016 14:51:21 +0100	[thread overview]
Message-ID: <1452088285-6427-1-git-send-email-wsa@the-dreams.de> (raw)

I know this is gonna be a controversial series, but we have a usecase for this :)

This series allows an I2C bus to switch between multiple masters, i.e. a
n-to-1-demuxer. This is not hot-switching because connected I2C slaves will be
re-instantiated. It is meant to select the best I2C core at runtime once the
task is known. Example: Prefer i2c-gpio over another I2C core because of HW
errata affecting your current runtime configuration.

It works by using OF_DYNAMIC and en-/disabling the i2c parent as needed. See
the binding docs for more details. Because this is largely using OF_DYNAMIC, I
decided to post the whole series to the dt list.

Changes since RFC v1:

* gracefully handle if i2c adapters are not present at runtime
  (driver not loaded yet)
* added more documentation and examples
* properly put the i2c adapters after use
* respect PAGE_SIZE in sysfs_show

This has been tested on a Renesas Lager board switching between i2c-gpio and
two different IP cores (i2c-rcar and i2c-sh_mobile). The rebinding seems to be
working as expected. However, in practice, I couldn't use the HDMI i2c slaves
with another controller yet, because the rcar-du driver OOPSes when unbinding.
This seems unrelated to this series because it can also be triggered via
sysfs-unbind. soc-camera also had problems properly cleaning up on unbind, a
patch for this already has been sent. So, this series is for sure a good test
for the unbind path of drivers.

Let me know what you think.

Thanks,

   Wolfram


Wolfram Sang (4):
  of: make of_mutex public
  dt-bindings: i2c: mux: demux-pinctrl: add bindings
  i2c: mux: demux-pinctrl: add driver
  ARM: shmobile: r8a7790: rework dts to use i2c demuxer

 .../devicetree/bindings/i2c/i2c-demux-pinctrl.txt  | 155 ++++++++++++
 arch/arm/boot/dts/r8a7790-lager.dts                | 141 +++++++----
 drivers/i2c/muxes/Kconfig                          |   9 +
 drivers/i2c/muxes/Makefile                         |   2 +
 drivers/i2c/muxes/i2c-demux-pinctrl.c              | 276 +++++++++++++++++++++
 drivers/of/of_private.h                            |   1 -
 include/linux/of.h                                 |   2 +
 7 files changed, 532 insertions(+), 54 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-demux-pinctrl.txt
 create mode 100644 drivers/i2c/muxes/i2c-demux-pinctrl.c

-- 
2.1.4


             reply	other threads:[~2016-01-06 13:51 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-06 13:51 Wolfram Sang [this message]
2016-01-06 13:51 ` [RFC v2 0/4] i2c/of: switch I2C IP cores at runtime via OF_DYNAMIC Wolfram Sang
2016-01-06 13:51 ` [RFC v2 1/4] of: make of_mutex public Wolfram Sang
2016-01-06 13:51   ` Wolfram Sang
2016-01-06 14:26   ` Geert Uytterhoeven
2016-01-06 14:26     ` Geert Uytterhoeven
2016-01-06 13:51 ` [RFC v2 2/4] dt-bindings: i2c: mux: demux-pinctrl: add bindings Wolfram Sang
2016-01-06 13:51   ` Wolfram Sang
2016-01-06 14:30   ` Geert Uytterhoeven
2016-01-06 14:30     ` Geert Uytterhoeven
2016-01-13 12:52     ` Wolfram Sang
2016-01-13 12:52       ` Wolfram Sang
2016-01-13 14:07       ` Sergei Shtylyov
2016-01-13 14:07         ` Sergei Shtylyov
2016-01-07 16:56   ` Jan Lübbe
2016-01-07 16:56     ` Jan Lübbe
2016-01-13 13:02     ` Wolfram Sang
2016-01-13 13:02       ` Wolfram Sang
2016-01-11  2:52   ` Rob Herring
2016-01-11  2:52     ` Rob Herring
2016-01-11  8:01     ` Geert Uytterhoeven
2016-01-11  8:01       ` Geert Uytterhoeven
2016-01-06 13:51 ` [RFC v2 3/4] i2c: mux: demux-pinctrl: add driver Wolfram Sang
2016-01-06 13:51   ` Wolfram Sang
     [not found]   ` <1452088285-6427-4-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2016-01-06 14:20     ` Geert Uytterhoeven
2016-01-06 14:20       ` Geert Uytterhoeven
2016-01-06 14:20       ` Geert Uytterhoeven
2016-01-13 12:55       ` Wolfram Sang
2016-01-13 12:55         ` Wolfram Sang
2016-01-13 16:16         ` Geert Uytterhoeven
2016-01-13 16:16           ` Geert Uytterhoeven
2016-01-13 16:16           ` Geert Uytterhoeven
2016-01-06 17:08   ` Rob Herring
2016-01-06 17:08     ` Rob Herring
2016-01-13 12:55     ` Wolfram Sang
2016-01-13 12:55       ` Wolfram Sang
2016-01-06 13:51 ` [RFC v2 4/4] ARM: shmobile: r8a7790: rework dts to use i2c demuxer Wolfram Sang
2016-01-06 13:51   ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452088285-6427-1-git-send-email-wsa@the-dreams.de \
    --to=wsa@the-dreams.de \
    --cc=devicetree@vger.kernel.org \
    --cc=jlu@pengutronix.de \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=pantelis.antoniou@konsulko.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.