Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1451127 > unrolled thread

[PATCH 0/7] devicetree cleanup for i2c muxes/arbs/gates

Started byPeter Rosin <peda@axentia.se>
First post2016-07-27 10:50 +0200
Last post2016-07-29 23:30 +0200
Articles 5 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/7] devicetree cleanup for i2c muxes/arbs/gates Peter Rosin <peda@axentia.se> - 2016-07-27 10:50 +0200
    Re: [PATCH 1/7] dt-bindings: i2c: add support for 'i2c-mux' subnode Rob Herring <robh@kernel.org> - 2016-07-29 23:20 +0200
    Re: [PATCH 4/7] dt-bindings: i2c: add bindings for nxp,pca9541 Rob Herring <robh@kernel.org> - 2016-07-29 23:30 +0200
    Re: [PATCH 2/7] dt-bindings: i2c: add support for 'i2c-arb' subnode Rob Herring <robh@kernel.org> - 2016-07-29 23:30 +0200
    Re: [PATCH 3/7] dt-bindings: i2c: add support for 'i2c-gate' subnode Rob Herring <robh@kernel.org> - 2016-07-29 23:30 +0200

#1451127 — [PATCH 0/7] devicetree cleanup for i2c muxes/arbs/gates

FromPeter Rosin <peda@axentia.se>
Date2016-07-27 10:50 +0200
Subject[PATCH 0/7] devicetree cleanup for i2c muxes/arbs/gates
Message-ID<rZsHo-5to-11@gated-at.bofh.it>
Hi!

The nxp pca9541 chip does not have any devicetree bindings.
When trying to write such bindings matching the implementation,
I stumbled upon something which I did not like. I had to
give the node holding the i2c child bus a 'reg' property that
is left unused and is really odd to explain from a devicetree
point of view. It really is a leftover from the fact that linux
implements i2c arbitrators (and i2c gates) using the i2c mux
code. See this thread for history [1].

This series resolves the issues, and maintains backwards compat
with old device trees (well, one could, in theory, create a
device tree that would break with these changes, but my guess
is that the odds for that happening inadvertedly are high...)

This should also help Crestez Dan Leonard with the mpu6050
series containing the changes for its auxiliary i2c master [2],
especially if you also consider the recent (very similar) changes
from Jon Hunter that adds an optional 'i2c-bus' subnode [3].

If this is ok, I will follow up with patches for other drivers
so that they inform the i2c mux core if they are muxes, arbs or
gates. As stated, they will continue to work with these changes,
so there is no huge rush.

The mux core does not really need to differentiate between
arbitrators and gates. Should they be folded? What to call them
in that case?

Cheers,
Peter

[1] https://lkml.org/lkml/2016/6/27/203
[2] https://lkml.org/lkml/2016/5/18/355
[3] https://patchwork.ozlabs.org/patch/641934/

Peter Rosin (7):
  dt-bindings: i2c: add support for 'i2c-mux' subnode
  dt-bindings: i2c: add support for 'i2c-arb' subnode
  dt-bindings: i2c: add support for 'i2c-gate' subnode
  dt-bindings: i2c: add bindings for nxp,pca9541
  i2c: mux: add support for 'i2c-mux', 'i2c-arb' and 'i2c-gate' DT
    subnodes
  i2c: pca9541: add device tree binding
  i2c: pca954x: add device tree binding

 .../bindings/i2c/i2c-arb-gpio-challenge.txt        |  8 +---
 Documentation/devicetree/bindings/i2c/i2c-arb.txt  | 35 ++++++++++++++++
 Documentation/devicetree/bindings/i2c/i2c-gate.txt | 35 ++++++++++++++++
 Documentation/devicetree/bindings/i2c/i2c-mux.txt  | 23 ++++++++---
 .../devicetree/bindings/i2c/nxp,pca9541.txt        | 29 ++++++++++++++
 MAINTAINERS                                        |  2 +
 drivers/i2c/i2c-mux.c                              | 44 +++++++++++++++++----
 drivers/i2c/muxes/i2c-mux-pca9541.c                |  8 ++++
 drivers/i2c/muxes/i2c-mux-pca954x.c                | 46 ++++++++++++++++------
 include/linux/i2c-mux.h                            |  8 +++-
 10 files changed, 205 insertions(+), 33 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-arb.txt
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-gate.txt
 create mode 100644 Documentation/devicetree/bindings/i2c/nxp,pca9541.txt

-- 
2.1.4

[toc] | [next] | [standalone]


#1452576 — Re: [PATCH 1/7] dt-bindings: i2c: add support for 'i2c-mux' subnode

FromRob Herring <robh@kernel.org>
Date2016-07-29 23:20 +0200
SubjectRe: [PATCH 1/7] dt-bindings: i2c: add support for 'i2c-mux' subnode
Message-ID<s0nmh-1FG-23@gated-at.bofh.it>
In reply to#1451127
On Wed, Jul 27, 2016 at 10:43:24AM +0200, Peter Rosin wrote:
> Similar to the new optional 'i2c-bus' subnode from Jon Hunter, this
> adds an optional 'i2c-mux' subnode, for similar reasons. I.e. it is
> bad of the i2c mux core to assume that any subnode of an i2c mux device
> is a potential (when the 'reg' property matches) i2c-mux child bus,
> given that i2c mux devices might do more than mux i2c traffic.
> 
> So, if an 'i2c-mux' subnode is present, dictate that all i2c-mux child
> buses exist beneath that subnode.
> 
> Signed-off-by: Peter Rosin <peda@axentia.se>
> ---
>  Documentation/devicetree/bindings/i2c/i2c-mux.txt | 23 ++++++++++++++++++-----
>  1 file changed, 18 insertions(+), 5 deletions(-)

Acked-by: Rob Herring <robh@kernel.org>

[toc] | [prev] | [next] | [standalone]


#1452577 — Re: [PATCH 4/7] dt-bindings: i2c: add bindings for nxp,pca9541

FromRob Herring <robh@kernel.org>
Date2016-07-29 23:30 +0200
SubjectRe: [PATCH 4/7] dt-bindings: i2c: add bindings for nxp,pca9541
Message-ID<s0nvX-1Jz-1@gated-at.bofh.it>
In reply to#1451127
On Wed, Jul 27, 2016 at 10:43:27AM +0200, Peter Rosin wrote:
> Fill the gap for this pre-existing driver.
> 
> Signed-off-by: Peter Rosin <peda@axentia.se>
> ---
>  .../devicetree/bindings/i2c/nxp,pca9541.txt        | 29 ++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/i2c/nxp,pca9541.txt

Acked-by: Rob Herring <robh@kernel.org>

[toc] | [prev] | [next] | [standalone]


#1452579 — Re: [PATCH 2/7] dt-bindings: i2c: add support for 'i2c-arb' subnode

FromRob Herring <robh@kernel.org>
Date2016-07-29 23:30 +0200
SubjectRe: [PATCH 2/7] dt-bindings: i2c: add support for 'i2c-arb' subnode
Message-ID<s0nvY-1Jz-11@gated-at.bofh.it>
In reply to#1451127
On Wed, Jul 27, 2016 at 10:43:25AM +0200, Peter Rosin wrote:
> This gets rid of the need for a pointless 'reg' property for i2c
> arbitrators.
> 
> I.e. this new and more compact style
> 
> 	some-arbitrator {
> 		i2c-mux {

You mean i2c-arb here?

> 			#address-cells = <1>;
> 			#size-cells = <0>;
> 
> 			some-i2c-device@50 {
> 				reg = <0x50>;
> 			};
> 		};
> 	};
> 
> instead of the old
> 
> 	some-arbitrator {
> 		#address-cells = <1>;
> 		#size-cells = <0>;
> 
> 		i2c@0 {
> 			reg = <0>;
> 
> 			#address-cells = <1>;
> 			#size-cells = <0>;
> 
> 			some-i2c-device@50 {
> 				reg = <0x50>;
> 			};
> 		};
> 	};
> 
> Signed-off-by: Peter Rosin <peda@axentia.se>
> ---
>  .../bindings/i2c/i2c-arb-gpio-challenge.txt        |  8 ++---
>  Documentation/devicetree/bindings/i2c/i2c-arb.txt  | 35 ++++++++++++++++++++++
>  MAINTAINERS                                        |  1 +
>  3 files changed, 38 insertions(+), 6 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/i2c/i2c-arb.txt

Otherwise,

Acked-by: Rob Herring <robh@kernel.org>

[toc] | [prev] | [next] | [standalone]


#1452583 — Re: [PATCH 3/7] dt-bindings: i2c: add support for 'i2c-gate' subnode

FromRob Herring <robh@kernel.org>
Date2016-07-29 23:30 +0200
SubjectRe: [PATCH 3/7] dt-bindings: i2c: add support for 'i2c-gate' subnode
Message-ID<s0nvY-1Jz-19@gated-at.bofh.it>
In reply to#1451127
On Wed, Jul 27, 2016 at 10:43:26AM +0200, Peter Rosin wrote:
> Handle i2c gates similarly to how i2c arbitrators are handled.
> This gets rid of a pointless 'reg' property for i2c gates.
> 
> I.e. this new and more compact style
> 
>         some-gate {
>                 i2c-gate {
>                         #address-cells = <1>;
>                         #size-cells = <0>;
> 
>                         some-i2c-device@50 {
>                                 reg = <0x50>;
>                         };
>                 };
>         };
> 
> instead of the old
> 
>         some-gate {
>                 #address-cells = <1>;
>                 #size-cells = <0>;
> 
>                 i2c@0 {
>                         reg = <0>;
> 
>                         #address-cells = <1>;
>                         #size-cells = <0>;
> 
>                         some-i2c-device@50 {
>                                 reg = <0x50>;
>                         };
>                 };
>         };
> 
> Signed-off-by: Peter Rosin <peda@axentia.se>
> ---
>  Documentation/devicetree/bindings/i2c/i2c-gate.txt | 35 ++++++++++++++++++++++
>  MAINTAINERS                                        |  1 +
>  2 files changed, 36 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/i2c/i2c-gate.txt
> 
> diff --git a/Documentation/devicetree/bindings/i2c/i2c-gate.txt b/Documentation/devicetree/bindings/i2c/i2c-gate.txt
> new file mode 100644
> index 000000000000..78f17892dfc6
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/i2c/i2c-gate.txt
> @@ -0,0 +1,35 @@
> +Common i2c gate properties.

Perhaps define what a gate is.

> +
> +- i2c-gate child node
> +
> +Required properties for the i2c-gate child node:
> +- #address-cells = <1>;
> +- #size-cells = <0>;
> +
> +Optional properties for i2c-gate child node:
> +- Child nodes conforming to i2c bus binding
> +
> +
> +Example :
> +
> +	/*
> +	   An Invensense mpu9150 at address 0x68 featuring an on-chip Asahi
> +	   Kasei ak8975 compass behind a gate.
> +	 */
> +
> +	mpu9150@68 {
> +		compatible = "invensense,mpu9150";
> +		reg = <0x68>;
> +		interrupt-parent = <&gpio1>;
> +		interrupts = <18 1>;
> +
> +		i2c-gate {
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +
> +			ax8975@0c {
> +				compatible = "ak,ak8975";
> +				reg = <0x0c>;
> +			};
> +		};
> +	};
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 543052305a09..0e6cc071c480 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -5525,6 +5525,7 @@ F:	Documentation/i2c/i2c-topology
>  F:	Documentation/i2c/muxes/
>  F:	Documentation/devicetree/bindings/i2c/i2c-mux*
>  F:	Documentation/devicetree/bindings/i2c/i2c-arb*
> +F:	Documentation/devicetree/bindings/i2c/i2c-gate*
>  F:	drivers/i2c/i2c-mux.c
>  F:	drivers/i2c/muxes/
>  F:	include/linux/i2c-mux.h
> -- 
> 2.1.4
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web