linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] i2c: pca-platform: updates
@ 2017-06-13  1:56 Chris Packham
       [not found] ` <20170613015641.29373-1-chris.packham-6g8wRflRTwXFdCa3tKVlE6U/zSkkHjvu@public.gmane.org>
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Chris Packham @ 2017-06-13  1:56 UTC (permalink / raw)
  To: wsa, linux-i2c; +Cc: linux-kernel, Chris Packham

We're using a PCA9564 on an embedded platform to provide an i2c
controller. This adds devicetree support and I've included some
cleanups for the driver while I was at it.

Chris Packham (4):
  i2c: pca-platform: add devicetree awareness
  i2c: pca-platform: use gpio_is_valid
  i2c: pca-platform: use device managed allocations
  i2c: pca-platform: use dev_warn/dev_info instead of printk

 .../devicetree/bindings/i2c/i2c-pca-platform.txt   | 18 ++++
 drivers/i2c/busses/i2c-pca-platform.c              | 96 +++++++++-------------
 2 files changed, 56 insertions(+), 58 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-pca-platform.txt

-- 
2.13.0

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

* [PATCH 1/4] i2c: pca-platform: add devicetree awareness
       [not found] ` <20170613015641.29373-1-chris.packham-6g8wRflRTwXFdCa3tKVlE6U/zSkkHjvu@public.gmane.org>
@ 2017-06-13  1:56   ` Chris Packham
  2017-06-13  4:38     ` Chris Packham
  2017-06-18 14:04     ` Rob Herring
  0 siblings, 2 replies; 9+ messages in thread
From: Chris Packham @ 2017-06-13  1:56 UTC (permalink / raw)
  To: wsa-z923LK4zBo2bacvFa/9K2g, linux-i2c-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Chris Packham, Rob Herring,
	Mark Rutland, devicetree-u79uwXL29TY76Z2rM5mHXA

Allow devices that use this driver to be registered via a
devicetree.

Signed-off-by: Chris Packham <chris.packham-6g8wRflRTwXFdCa3tKVlE6U/zSkkHjvu@public.gmane.org>
---
 .../devicetree/bindings/i2c/i2c-pca-platform.txt    | 18 ++++++++++++++++++
 drivers/i2c/busses/i2c-pca-platform.c               | 21 +++++++++++++++++++++
 2 files changed, 39 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-pca-platform.txt

diff --git a/Documentation/devicetree/bindings/i2c/i2c-pca-platform.txt b/Documentation/devicetree/bindings/i2c/i2c-pca-platform.txt
new file mode 100644
index 000000000000..47410bda3f37
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/i2c-pca-platform.txt
@@ -0,0 +1,18 @@
+* NXP PCA PCA9564/PCA9665 I2C controller
+
+The PCA9564/PCA9665 serves as an interface between most standard
+parallel-bus microcontrollers/microprocessors and the serial I2C-bus
+and allows the parallel bus system to communicate bi-directionally
+with the I2C-bus.
+
+Required properties :
+
+ - reg : Offset and length of the register set for the device
+ - compatible : one of "nxp,pca9564" or "nxp,pca9665"
+
+Optional properties
+ - interrupts : the interrupt number
+ - interrupt-parent : the phandle for the interrupt controller.
+   If an interrupt is not specified polling will be used.
+ - gpios : gpio phandle to control device reset.
+ - clock-frequency : I2C bus frequency.
\ No newline at end of file
diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c
index 3bd2e7d06e4b..ca63fee400cb 100644
--- a/drivers/i2c/busses/i2c-pca-platform.c
+++ b/drivers/i2c/busses/i2c-pca-platform.c
@@ -23,6 +23,9 @@
 #include <linux/i2c-pca-platform.h>
 #include <linux/gpio.h>
 #include <linux/io.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/of_gpio.h>
 
 #include <asm/irq.h>
 
@@ -136,12 +139,15 @@ static int i2c_pca_pf_probe(struct platform_device *pdev)
 	struct resource *res;
 	struct i2c_pca9564_pf_platform_data *platform_data =
 				dev_get_platdata(&pdev->dev);
+	struct device_node *np = pdev->dev.of_node;
 	int ret = 0;
 	int irq;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	irq = platform_get_irq(pdev, 0);
 	/* If irq is 0, we do polling. */
+	if (irq < 0)
+		irq = 0;
 
 	if (res == NULL) {
 		ret = -ENODEV;
@@ -182,6 +188,11 @@ static int i2c_pca_pf_probe(struct platform_device *pdev)
 		i2c->adap.timeout = platform_data->timeout;
 		i2c->algo_data.i2c_clock = platform_data->i2c_clock_speed;
 		i2c->gpio = platform_data->gpio;
+	} else if (np) {
+		i2c->adap.timeout = HZ;
+		i2c->gpio = of_get_gpio(np, 0);
+		of_property_read_u32_index(np, "clock-frequency", 0,
+					   &i2c->algo_data.i2c_clock);
 	} else {
 		i2c->adap.timeout = HZ;
 		i2c->algo_data.i2c_clock = 59000;
@@ -275,11 +286,21 @@ static int i2c_pca_pf_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id i2c_pca_of_match_table[] = {
+	{ .compatible = "nxp,pca9564" },
+	{ .compatible = "nxp,pca9665" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, i2c_pca_of_match_table);
+#endif
+
 static struct platform_driver i2c_pca_pf_driver = {
 	.probe = i2c_pca_pf_probe,
 	.remove = i2c_pca_pf_remove,
 	.driver = {
 		.name = "i2c-pca-platform",
+		.of_match_table = of_match_ptr(i2c_pca_of_match_table),
 	},
 };
 
-- 
2.13.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 2/4] i2c: pca-platform: use gpio_is_valid
  2017-06-13  1:56 [PATCH 0/4] i2c: pca-platform: updates Chris Packham
       [not found] ` <20170613015641.29373-1-chris.packham-6g8wRflRTwXFdCa3tKVlE6U/zSkkHjvu@public.gmane.org>
@ 2017-06-13  1:56 ` Chris Packham
  2017-06-13  1:56 ` [PATCH 3/4] i2c: pca-platform: use device managed allocations Chris Packham
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Chris Packham @ 2017-06-13  1:56 UTC (permalink / raw)
  To: wsa, linux-i2c; +Cc: linux-kernel, Chris Packham

Use gpio_is_valid() instead of gpio > -1.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
 drivers/i2c/busses/i2c-pca-platform.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c
index ca63fee400cb..79d737eb2770 100644
--- a/drivers/i2c/busses/i2c-pca-platform.c
+++ b/drivers/i2c/busses/i2c-pca-platform.c
@@ -196,7 +196,7 @@ static int i2c_pca_pf_probe(struct platform_device *pdev)
 	} else {
 		i2c->adap.timeout = HZ;
 		i2c->algo_data.i2c_clock = 59000;
-		i2c->gpio = -1;
+		i2c->gpio = -ENODEV;
 	}
 
 	i2c->algo_data.data = i2c;
@@ -219,8 +219,7 @@ static int i2c_pca_pf_probe(struct platform_device *pdev)
 		break;
 	}
 
-	/* Use gpio_is_valid() when in mainline */
-	if (i2c->gpio > -1) {
+	if (gpio_is_valid(i2c->gpio)) {
 		ret = gpio_request(i2c->gpio, i2c->adap.name);
 		if (ret == 0) {
 			gpio_direction_output(i2c->gpio, 1);
@@ -254,7 +253,7 @@ static int i2c_pca_pf_probe(struct platform_device *pdev)
 	if (irq)
 		free_irq(irq, i2c);
 e_reqirq:
-	if (i2c->gpio > -1)
+	if (gpio_is_valid(i2c->gpio))
 		gpio_free(i2c->gpio);
 
 	iounmap(i2c->reg_base);
@@ -276,7 +275,7 @@ static int i2c_pca_pf_remove(struct platform_device *pdev)
 	if (i2c->irq)
 		free_irq(i2c->irq, i2c);
 
-	if (i2c->gpio > -1)
+	if (gpio_is_valid(i2c->gpio))
 		gpio_free(i2c->gpio);
 
 	iounmap(i2c->reg_base);
-- 
2.13.0

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

* [PATCH 3/4] i2c: pca-platform: use device managed allocations
  2017-06-13  1:56 [PATCH 0/4] i2c: pca-platform: updates Chris Packham
       [not found] ` <20170613015641.29373-1-chris.packham-6g8wRflRTwXFdCa3tKVlE6U/zSkkHjvu@public.gmane.org>
  2017-06-13  1:56 ` [PATCH 2/4] i2c: pca-platform: use gpio_is_valid Chris Packham
@ 2017-06-13  1:56 ` Chris Packham
  2017-06-13  1:56 ` [PATCH 4/4] i2c: pca-platform: use dev_warn/dev_info instead of printk Chris Packham
  2017-06-19 15:01 ` [PATCH 0/4] i2c: pca-platform: updates Wolfram Sang
  4 siblings, 0 replies; 9+ messages in thread
From: Chris Packham @ 2017-06-13  1:56 UTC (permalink / raw)
  To: wsa, linux-i2c; +Cc: linux-kernel, Chris Packham

Switch to using the devm_ APIs and remove the now unnecessary error
handling and most of the device removal code.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
 drivers/i2c/busses/i2c-pca-platform.c | 61 +++++++----------------------------
 1 file changed, 11 insertions(+), 50 deletions(-)

diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c
index 79d737eb2770..ee217ef5d879 100644
--- a/drivers/i2c/busses/i2c-pca-platform.c
+++ b/drivers/i2c/busses/i2c-pca-platform.c
@@ -143,35 +143,23 @@ static int i2c_pca_pf_probe(struct platform_device *pdev)
 	int ret = 0;
 	int irq;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	irq = platform_get_irq(pdev, 0);
 	/* If irq is 0, we do polling. */
 	if (irq < 0)
 		irq = 0;
 
-	if (res == NULL) {
-		ret = -ENODEV;
-		goto e_print;
-	}
+	i2c = devm_kzalloc(&pdev->dev, sizeof(*i2c), GFP_KERNEL);
+	if (!i2c)
+		return -ENOMEM;
 
-	if (!request_mem_region(res->start, resource_size(res), res->name)) {
-		ret = -ENOMEM;
-		goto e_print;
-	}
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	i2c->reg_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(i2c->reg_base))
+		return PTR_ERR(i2c->reg_base);
 
-	i2c = kzalloc(sizeof(struct i2c_pca_pf_data), GFP_KERNEL);
-	if (!i2c) {
-		ret = -ENOMEM;
-		goto e_alloc;
-	}
 
 	init_waitqueue_head(&i2c->wait);
 
-	i2c->reg_base = ioremap(res->start, resource_size(res));
-	if (!i2c->reg_base) {
-		ret = -ENOMEM;
-		goto e_remap;
-	}
 	i2c->io_base = res->start;
 	i2c->io_size = resource_size(res);
 	i2c->irq = irq;
@@ -220,7 +208,7 @@ static int i2c_pca_pf_probe(struct platform_device *pdev)
 	}
 
 	if (gpio_is_valid(i2c->gpio)) {
-		ret = gpio_request(i2c->gpio, i2c->adap.name);
+		ret = devm_gpio_request(&pdev->dev, i2c->gpio, i2c->adap.name);
 		if (ret == 0) {
 			gpio_direction_output(i2c->gpio, 1);
 			i2c->algo_data.reset_chip = i2c_pca_pf_resetchip;
@@ -232,15 +220,14 @@ static int i2c_pca_pf_probe(struct platform_device *pdev)
 	}
 
 	if (irq) {
-		ret = request_irq(irq, i2c_pca_pf_handler,
+		ret = devm_request_irq(&pdev->dev, irq, i2c_pca_pf_handler,
 			IRQF_TRIGGER_FALLING, pdev->name, i2c);
 		if (ret)
-			goto e_reqirq;
+			return ret;
 	}
 
 	if (i2c_pca_add_numbered_bus(&i2c->adap) < 0) {
-		ret = -ENODEV;
-		goto e_adapt;
+		return -ENODEV;
 	}
 
 	platform_set_drvdata(pdev, i2c);
@@ -248,22 +235,6 @@ static int i2c_pca_pf_probe(struct platform_device *pdev)
 	printk(KERN_INFO "%s registered.\n", i2c->adap.name);
 
 	return 0;
-
-e_adapt:
-	if (irq)
-		free_irq(irq, i2c);
-e_reqirq:
-	if (gpio_is_valid(i2c->gpio))
-		gpio_free(i2c->gpio);
-
-	iounmap(i2c->reg_base);
-e_remap:
-	kfree(i2c);
-e_alloc:
-	release_mem_region(res->start, resource_size(res));
-e_print:
-	printk(KERN_ERR "Registering PCA9564/PCA9665 FAILED! (%d)\n", ret);
-	return ret;
 }
 
 static int i2c_pca_pf_remove(struct platform_device *pdev)
@@ -272,16 +243,6 @@ static int i2c_pca_pf_remove(struct platform_device *pdev)
 
 	i2c_del_adapter(&i2c->adap);
 
-	if (i2c->irq)
-		free_irq(i2c->irq, i2c);
-
-	if (gpio_is_valid(i2c->gpio))
-		gpio_free(i2c->gpio);
-
-	iounmap(i2c->reg_base);
-	release_mem_region(i2c->io_base, i2c->io_size);
-	kfree(i2c);
-
 	return 0;
 }
 
-- 
2.13.0

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

* [PATCH 4/4] i2c: pca-platform: use dev_warn/dev_info instead of printk
  2017-06-13  1:56 [PATCH 0/4] i2c: pca-platform: updates Chris Packham
                   ` (2 preceding siblings ...)
  2017-06-13  1:56 ` [PATCH 3/4] i2c: pca-platform: use device managed allocations Chris Packham
@ 2017-06-13  1:56 ` Chris Packham
  2017-06-19 15:01 ` [PATCH 0/4] i2c: pca-platform: updates Wolfram Sang
  4 siblings, 0 replies; 9+ messages in thread
From: Chris Packham @ 2017-06-13  1:56 UTC (permalink / raw)
  To: wsa, linux-i2c; +Cc: linux-kernel, Chris Packham

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
 drivers/i2c/busses/i2c-pca-platform.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c
index ee217ef5d879..f3285c4c159c 100644
--- a/drivers/i2c/busses/i2c-pca-platform.c
+++ b/drivers/i2c/busses/i2c-pca-platform.c
@@ -107,8 +107,8 @@ static int i2c_pca_pf_waitforcompletion(void *pd)
 static void i2c_pca_pf_dummyreset(void *pd)
 {
 	struct i2c_pca_pf_data *i2c = pd;
-	printk(KERN_WARNING "%s: No reset-pin found. Chip may get stuck!\n",
-		i2c->adap.name);
+
+	dev_warn(&i2c->adap.dev, "No reset-pin found. Chip may get stuck!\n");
 }
 
 static void i2c_pca_pf_resetchip(void *pd)
@@ -213,8 +213,7 @@ static int i2c_pca_pf_probe(struct platform_device *pdev)
 			gpio_direction_output(i2c->gpio, 1);
 			i2c->algo_data.reset_chip = i2c_pca_pf_resetchip;
 		} else {
-			printk(KERN_WARNING "%s: Registering gpio failed!\n",
-				i2c->adap.name);
+			dev_warn(&pdev->dev, "Registering gpio failed!\n");
 			i2c->gpio = ret;
 		}
 	}
@@ -232,7 +231,7 @@ static int i2c_pca_pf_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, i2c);
 
-	printk(KERN_INFO "%s registered.\n", i2c->adap.name);
+	dev_info(&pdev->dev, "registered.\n");
 
 	return 0;
 }
-- 
2.13.0

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

* Re: [PATCH 1/4] i2c: pca-platform: add devicetree awareness
  2017-06-13  1:56   ` [PATCH 1/4] i2c: pca-platform: add devicetree awareness Chris Packham
@ 2017-06-13  4:38     ` Chris Packham
  2017-06-18 14:04     ` Rob Herring
  1 sibling, 0 replies; 9+ messages in thread
From: Chris Packham @ 2017-06-13  4:38 UTC (permalink / raw)
  To: wsa@the-dreams.de, linux-i2c@vger.kernel.org
  Cc: linux-kernel@vger.kernel.org, Rob Herring, Mark Rutland,
	devicetree@vger.kernel.org

On 13/06/17 13:56, Chris Packham wrote:
> Allow devices that use this driver to be registered via a
> devicetree.
> 
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---
>   .../devicetree/bindings/i2c/i2c-pca-platform.txt    | 18 ++++++++++++++++++
>   drivers/i2c/busses/i2c-pca-platform.c               | 21 +++++++++++++++++++++
>   2 files changed, 39 insertions(+)
>   create mode 100644 Documentation/devicetree/bindings/i2c/i2c-pca-platform.txt
> 
> diff --git a/Documentation/devicetree/bindings/i2c/i2c-pca-platform.txt b/Documentation/devicetree/bindings/i2c/i2c-pca-platform.txt
> new file mode 100644
> index 000000000000..47410bda3f37
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/i2c/i2c-pca-platform.txt
> @@ -0,0 +1,18 @@
> +* NXP PCA PCA9564/PCA9665 I2C controller
> +
> +The PCA9564/PCA9665 serves as an interface between most standard
> +parallel-bus microcontrollers/microprocessors and the serial I2C-bus
> +and allows the parallel bus system to communicate bi-directionally
> +with the I2C-bus.
> +
> +Required properties :
> +
> + - reg : Offset and length of the register set for the device
> + - compatible : one of "nxp,pca9564" or "nxp,pca9665"
> +
> +Optional properties
> + - interrupts : the interrupt number
> + - interrupt-parent : the phandle for the interrupt controller.
> +   If an interrupt is not specified polling will be used.
> + - gpios : gpio phandle to control device reset.
> + - clock-frequency : I2C bus frequency.
> \ No newline at end of file
> diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c
> index 3bd2e7d06e4b..ca63fee400cb 100644
> --- a/drivers/i2c/busses/i2c-pca-platform.c
> +++ b/drivers/i2c/busses/i2c-pca-platform.c
> @@ -23,6 +23,9 @@
>   #include <linux/i2c-pca-platform.h>
>   #include <linux/gpio.h>
>   #include <linux/io.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
> +#include <linux/of_gpio.h>
>   
>   #include <asm/irq.h>
>   
> @@ -136,12 +139,15 @@ static int i2c_pca_pf_probe(struct platform_device *pdev)
>   	struct resource *res;
>   	struct i2c_pca9564_pf_platform_data *platform_data =
>   				dev_get_platdata(&pdev->dev);
> +	struct device_node *np = pdev->dev.of_node;
>   	int ret = 0;
>   	int irq;
>   
>   	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>   	irq = platform_get_irq(pdev, 0);
>   	/* If irq is 0, we do polling. */
> +	if (irq < 0)
> +		irq = 0;
>   
>   	if (res == NULL) {
>   		ret = -ENODEV;
> @@ -182,6 +188,11 @@ static int i2c_pca_pf_probe(struct platform_device *pdev)


I should be setting i2c->adap.dev.of_node somewhere around here so that 
the child nodes get automatically probed.

>   		i2c->adap.timeout = platform_data->timeout;
>   		i2c->algo_data.i2c_clock = platform_data->i2c_clock_speed;
>   		i2c->gpio = platform_data->gpio;
> +	} else if (np) {
> +		i2c->adap.timeout = HZ;
> +		i2c->gpio = of_get_gpio(np, 0);
> +		of_property_read_u32_index(np, "clock-frequency", 0,
> +					   &i2c->algo_data.i2c_clock);
>   	} else {
>   		i2c->adap.timeout = HZ;
>   		i2c->algo_data.i2c_clock = 59000;
> @@ -275,11 +286,21 @@ static int i2c_pca_pf_remove(struct platform_device *pdev)
>   	return 0;
>   }
>   
> +#ifdef CONFIG_OF
> +static const struct of_device_id i2c_pca_of_match_table[] = {
> +	{ .compatible = "nxp,pca9564" },
> +	{ .compatible = "nxp,pca9665" },
> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, i2c_pca_of_match_table);
> +#endif
> +
>   static struct platform_driver i2c_pca_pf_driver = {
>   	.probe = i2c_pca_pf_probe,
>   	.remove = i2c_pca_pf_remove,
>   	.driver = {
>   		.name = "i2c-pca-platform",
> +		.of_match_table = of_match_ptr(i2c_pca_of_match_table),
>   	},
>   };
>   
> 


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

* Re: [PATCH 1/4] i2c: pca-platform: add devicetree awareness
  2017-06-13  1:56   ` [PATCH 1/4] i2c: pca-platform: add devicetree awareness Chris Packham
  2017-06-13  4:38     ` Chris Packham
@ 2017-06-18 14:04     ` Rob Herring
  1 sibling, 0 replies; 9+ messages in thread
From: Rob Herring @ 2017-06-18 14:04 UTC (permalink / raw)
  To: Chris Packham; +Cc: wsa, linux-i2c, linux-kernel, Mark Rutland, devicetree

On Tue, Jun 13, 2017 at 01:56:38PM +1200, Chris Packham wrote:
> Allow devices that use this driver to be registered via a
> devicetree.
> 
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---
>  .../devicetree/bindings/i2c/i2c-pca-platform.txt    | 18 ++++++++++++++++++

It's preferred to split bindings to separate patch.

>  drivers/i2c/busses/i2c-pca-platform.c               | 21 +++++++++++++++++++++
>  2 files changed, 39 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/i2c/i2c-pca-platform.txt
> 
> diff --git a/Documentation/devicetree/bindings/i2c/i2c-pca-platform.txt b/Documentation/devicetree/bindings/i2c/i2c-pca-platform.txt
> new file mode 100644
> index 000000000000..47410bda3f37
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/i2c/i2c-pca-platform.txt
> @@ -0,0 +1,18 @@
> +* NXP PCA PCA9564/PCA9665 I2C controller
> +
> +The PCA9564/PCA9665 serves as an interface between most standard
> +parallel-bus microcontrollers/microprocessors and the serial I2C-bus
> +and allows the parallel bus system to communicate bi-directionally
> +with the I2C-bus.
> +
> +Required properties :
> +
> + - reg : Offset and length of the register set for the device
> + - compatible : one of "nxp,pca9564" or "nxp,pca9665"
> +
> +Optional properties
> + - interrupts : the interrupt number
> + - interrupt-parent : the phandle for the interrupt controller.
> +   If an interrupt is not specified polling will be used.
> + - gpios : gpio phandle to control device reset.

reset-gpios and state the active state.

> + - clock-frequency : I2C bus frequency.
> \ No newline at end of file

^^^

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

* Re: [PATCH 0/4] i2c: pca-platform: updates
  2017-06-13  1:56 [PATCH 0/4] i2c: pca-platform: updates Chris Packham
                   ` (3 preceding siblings ...)
  2017-06-13  1:56 ` [PATCH 4/4] i2c: pca-platform: use dev_warn/dev_info instead of printk Chris Packham
@ 2017-06-19 15:01 ` Wolfram Sang
  2017-06-19 20:50   ` Chris Packham
  4 siblings, 1 reply; 9+ messages in thread
From: Wolfram Sang @ 2017-06-19 15:01 UTC (permalink / raw)
  To: Chris Packham; +Cc: linux-i2c, linux-kernel

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

On Tue, Jun 13, 2017 at 01:56:37PM +1200, Chris Packham wrote:

> We're using a PCA9564 on an embedded platform to provide an i2c
> controller. This adds devicetree support and I've included some
> cleanups for the driver while I was at it.

Coooool, this was the first driver I ever hacked! Ah, memories :D

Patches 2-4 look good to me. I agree to your and Rob's comments on patch
1.

Thanks,

   Wolfram


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

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

* Re: [PATCH 0/4] i2c: pca-platform: updates
  2017-06-19 15:01 ` [PATCH 0/4] i2c: pca-platform: updates Wolfram Sang
@ 2017-06-19 20:50   ` Chris Packham
  0 siblings, 0 replies; 9+ messages in thread
From: Chris Packham @ 2017-06-19 20:50 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org

On 20/06/17 03:01, Wolfram Sang wrote:
> On Tue, Jun 13, 2017 at 01:56:37PM +1200, Chris Packham wrote:
> 
>> We're using a PCA9564 on an embedded platform to provide an i2c
>> controller. This adds devicetree support and I've included some
>> cleanups for the driver while I was at it.
> 
> Coooool, this was the first driver I ever hacked! Ah, memories :D
> 
> Patches 2-4 look good to me. I agree to your and Rob's comments on patch
> 1.
> 

Happy to bring some nostalgia :).

I'll post a v2 series later today.

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

end of thread, other threads:[~2017-06-19 20:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-13  1:56 [PATCH 0/4] i2c: pca-platform: updates Chris Packham
     [not found] ` <20170613015641.29373-1-chris.packham-6g8wRflRTwXFdCa3tKVlE6U/zSkkHjvu@public.gmane.org>
2017-06-13  1:56   ` [PATCH 1/4] i2c: pca-platform: add devicetree awareness Chris Packham
2017-06-13  4:38     ` Chris Packham
2017-06-18 14:04     ` Rob Herring
2017-06-13  1:56 ` [PATCH 2/4] i2c: pca-platform: use gpio_is_valid Chris Packham
2017-06-13  1:56 ` [PATCH 3/4] i2c: pca-platform: use device managed allocations Chris Packham
2017-06-13  1:56 ` [PATCH 4/4] i2c: pca-platform: use dev_warn/dev_info instead of printk Chris Packham
2017-06-19 15:01 ` [PATCH 0/4] i2c: pca-platform: updates Wolfram Sang
2017-06-19 20:50   ` Chris Packham

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