devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] (Repost) Add reset GPIO support to the pca954x I2C mux
@ 2013-11-29  0:51 Laurent Pinchart
       [not found] ` <1385686285-23780-1-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Laurent Pinchart @ 2013-11-29  0:51 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
  Cc: Laurent Pinchart, devicetree-u79uwXL29TY76Z2rM5mHXA

Hello,

This patch set adds DT support for a reset GPIO to the pca954x I2C mux. It
starts by two cleanup patches for the driver, adds missing DT bindings
documentation and finally adds support for the reset GPIO.

(With the devicetree mailing list CC'ed this time, sorry for the noise :-/)

Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

Laurent Pinchart (4):
  i2c: pca954x: Sort headers alphabetically
  i2c: pca954x: Use devm_kzalloc managed allocator
  i2c: pca954x: Add device tree bindings documentation
  i2c: pca954x: Add reset GPIO support

 .../devicetree/bindings/i2c/i2c-mux-pca954x.txt    | 50 ++++++++++++++++++++++
 drivers/i2c/muxes/i2c-mux-pca954x.c                | 44 ++++++++++++-------
 2 files changed, 78 insertions(+), 16 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.txt

-- 
Regards,

Laurent Pinchart

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

* [PATCH 3/4] i2c: pca954x: Add device tree bindings documentation
       [not found] ` <1385686285-23780-1-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
@ 2013-11-29  0:51   ` Laurent Pinchart
  2013-11-29  0:51   ` [PATCH 4/4] i2c: pca954x: Add reset GPIO support Laurent Pinchart
  2014-01-03 15:42   ` [PATCH 0/4] (Repost) Add reset GPIO support to the pca954x I2C mux Wolfram Sang
  2 siblings, 0 replies; 4+ messages in thread
From: Laurent Pinchart @ 2013-11-29  0:51 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
  Cc: Laurent Pinchart, devicetree-u79uwXL29TY76Z2rM5mHXA

Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
---
 .../devicetree/bindings/i2c/i2c-mux-pca954x.txt    | 46 ++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.txt

diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.txt b/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.txt
new file mode 100644
index 0000000..cc7e7fd
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.txt
@@ -0,0 +1,46 @@
+* NXP PCA954x I2C bus switch
+
+Required Properties:
+
+  - compatible: Must contain one of the following.
+    "nxp,pca9540", "nxp,pca9542", "nxp,pca9543", "nxp,pca9544",
+    "nxp,pca9545", "nxp,pca9546", "nxp,pca9547", "nxp,pca9548"
+
+  - reg: The I2C address of the device.
+
+  The following required properties are defined externally:
+
+  - Standard I2C mux properties. See i2c-mux.txt in this directory.
+  - I2C child bus nodes. See i2c-mux.txt in this directory.
+
+
+Example:
+
+	i2c-switch@74 {
+		compatible = "nxp,pca9548";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x74>;
+
+		i2c@2 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <2>;
+
+			eeprom@54 {
+				compatible = "at,24c08";
+				reg = <0x54>;
+			};
+		};
+
+		i2c@4 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <4>;
+
+			rtc@51 {
+				compatible = "nxp,pcf8563";
+				reg = <0x51>;
+			};
+		};
+	};
-- 
1.8.3.2

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

* [PATCH 4/4] i2c: pca954x: Add reset GPIO support
       [not found] ` <1385686285-23780-1-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
  2013-11-29  0:51   ` [PATCH 3/4] i2c: pca954x: Add device tree bindings documentation Laurent Pinchart
@ 2013-11-29  0:51   ` Laurent Pinchart
  2014-01-03 15:42   ` [PATCH 0/4] (Repost) Add reset GPIO support to the pca954x I2C mux Wolfram Sang
  2 siblings, 0 replies; 4+ messages in thread
From: Laurent Pinchart @ 2013-11-29  0:51 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
  Cc: Laurent Pinchart, devicetree-u79uwXL29TY76Z2rM5mHXA

If a reset GPIO support is specified, request the GPIO and get the chip
out of reset at probe time.

Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
---
 .../devicetree/bindings/i2c/i2c-mux-pca954x.txt       |  4 ++++
 drivers/i2c/muxes/i2c-mux-pca954x.c                   | 19 +++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.txt b/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.txt
index cc7e7fd..34a3fb6 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.txt
@@ -13,6 +13,10 @@ Required Properties:
   - Standard I2C mux properties. See i2c-mux.txt in this directory.
   - I2C child bus nodes. See i2c-mux.txt in this directory.
 
+Optional Properties:
+
+  - reset-gpios: Reference to the GPIO connected to the reset input.
+
 
 Example:
 
diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
index 2880c38..e835304 100644
--- a/drivers/i2c/muxes/i2c-mux-pca954x.c
+++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
@@ -36,11 +36,13 @@
  */
 
 #include <linux/device.h>
+#include <linux/gpio.h>
 #include <linux/i2c.h>
 #include <linux/i2c-mux.h>
 #include <linux/i2c/pca954x.h>
 #include <linux/init.h>
 #include <linux/module.h>
+#include <linux/of_gpio.h>
 #include <linux/slab.h>
 
 #define PCA954X_MAX_NCHANS 8
@@ -185,6 +187,7 @@ static int pca954x_probe(struct i2c_client *client,
 {
 	struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent);
 	struct pca954x_platform_data *pdata = dev_get_platdata(&client->dev);
+	struct device_node *np = client->dev.of_node;
 	int num, force, class;
 	struct pca954x *data;
 	int ret;
@@ -198,6 +201,22 @@ static int pca954x_probe(struct i2c_client *client,
 
 	i2c_set_clientdata(client, data);
 
+	if (IS_ENABLED(CONFIG_OF) && np) {
+		enum of_gpio_flags flags;
+		int gpio;
+
+		/* Get the mux out of reset if a reset GPIO is specified. */
+		gpio = of_get_named_gpio_flags(np, "reset-gpio", 0, &flags);
+		if (gpio_is_valid(gpio)) {
+			ret = devm_gpio_request_one(&client->dev, gpio,
+					flags & OF_GPIO_ACTIVE_LOW ?
+					GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW,
+					"pca954x reset");
+			if (ret < 0)
+				return ret;
+		}
+	}
+
 	/* Write the mux register at addr to verify
 	 * that the mux is in fact present. This also
 	 * initializes the mux to disconnected state.
-- 
1.8.3.2

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

* Re: [PATCH 0/4] (Repost) Add reset GPIO support to the pca954x I2C mux
       [not found] ` <1385686285-23780-1-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
  2013-11-29  0:51   ` [PATCH 3/4] i2c: pca954x: Add device tree bindings documentation Laurent Pinchart
  2013-11-29  0:51   ` [PATCH 4/4] i2c: pca954x: Add reset GPIO support Laurent Pinchart
@ 2014-01-03 15:42   ` Wolfram Sang
  2 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2014-01-03 15:42 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA

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

On Fri, Nov 29, 2013 at 01:51:21AM +0100, Laurent Pinchart wrote:
> Hello,
> 
> This patch set adds DT support for a reset GPIO to the pca954x I2C mux. It
> starts by two cleanup patches for the driver, adds missing DT bindings
> documentation and finally adds support for the reset GPIO.

Applied series to for-next, thanks!


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2014-01-03 15:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-29  0:51 [PATCH 0/4] (Repost) Add reset GPIO support to the pca954x I2C mux Laurent Pinchart
     [not found] ` <1385686285-23780-1-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
2013-11-29  0:51   ` [PATCH 3/4] i2c: pca954x: Add device tree bindings documentation Laurent Pinchart
2013-11-29  0:51   ` [PATCH 4/4] i2c: pca954x: Add reset GPIO support Laurent Pinchart
2014-01-03 15:42   ` [PATCH 0/4] (Repost) Add reset GPIO support to the pca954x I2C mux Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).