linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] i2c: sh_mobile: cleanups
@ 2014-04-30 22:21 Wolfram Sang
  2014-04-30 22:21 ` [PATCH 1/6] i2c: sh_mobile: replace magic hex values with constants Wolfram Sang
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Wolfram Sang @ 2014-04-30 22:21 UTC (permalink / raw)
  To: linux-i2c; +Cc: Wolfram Sang, linux-sh, Magnus Damm

Some cleanups for i2c-sh_mobile. Tested on top of renesas-devel-v3.15-rc3-20140429
and with a lager board. Branch is at

git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git renesas/sh_mobile-cleanup

Wolfram Sang (6):
  i2c: sh_mobile: replace magic hex values with constants
  i2c: sh_mobile: improve error handling
  i2c: sh_mobile: honor DT bus speed settings
  i2c: sh_mobile: add devicetree documentation
  i2c: sh_mobile: devm conversion, low hanging fruits
  i2c: sh_mobile: devm conversion, irq setup

 .../devicetree/bindings/i2c/i2c-sh_mobile.txt      |  26 ++++
 drivers/i2c/busses/i2c-sh_mobile.c                 | 132 +++++++--------------
 2 files changed, 67 insertions(+), 91 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-sh_mobile.txt

-- 
1.9.2


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

* [PATCH 1/6] i2c: sh_mobile: replace magic hex values with constants
  2014-04-30 22:21 [PATCH 0/6] i2c: sh_mobile: cleanups Wolfram Sang
@ 2014-04-30 22:21 ` Wolfram Sang
  2014-04-30 22:21 ` [PATCH 2/6] i2c: sh_mobile: improve error handling Wolfram Sang
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 14+ messages in thread
From: Wolfram Sang @ 2014-04-30 22:21 UTC (permalink / raw)
  To: linux-i2c; +Cc: Wolfram Sang, linux-sh, Magnus Damm, Wolfram Sang

From: Wolfram Sang <wsa+renesas@sang-engineering.com>

No functional change, binaries are identical.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/i2c-sh_mobile.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
index 1d79585ba4b3..d91625eea6bb 100644
--- a/drivers/i2c/busses/i2c-sh_mobile.c
+++ b/drivers/i2c/busses/i2c-sh_mobile.c
@@ -316,7 +316,7 @@ static unsigned char i2c_op(struct sh_mobile_i2c_data *pd,
 
 	switch (op) {
 	case OP_START: /* issue start and trigger DTE interrupt */
-		iic_wr(pd, ICCR, 0x94);
+		iic_wr(pd, ICCR, ICCR_ICE | ICCR_TRS | ICCR_BBSY);
 		break;
 	case OP_TX_FIRST: /* disable DTE interrupt and write data */
 		iic_wr(pd, ICIC, ICIC_WAITE | ICIC_ALE | ICIC_TACKE);
@@ -327,10 +327,11 @@ static unsigned char i2c_op(struct sh_mobile_i2c_data *pd,
 		break;
 	case OP_TX_STOP: /* write data and issue a stop afterwards */
 		iic_wr(pd, ICDR, data);
-		iic_wr(pd, ICCR, pd->send_stop ? 0x90 : 0x94);
+		iic_wr(pd, ICCR, pd->send_stop ? ICCR_ICE | ICCR_TRS
+					       : ICCR_ICE | ICCR_TRS | ICCR_BBSY);
 		break;
 	case OP_TX_TO_RX: /* select read mode */
-		iic_wr(pd, ICCR, 0x81);
+		iic_wr(pd, ICCR, ICCR_ICE | ICCR_SCP);
 		break;
 	case OP_RX: /* just read data */
 		ret = iic_rd(pd, ICDR);
@@ -338,13 +339,13 @@ static unsigned char i2c_op(struct sh_mobile_i2c_data *pd,
 	case OP_RX_STOP: /* enable DTE interrupt, issue stop */
 		iic_wr(pd, ICIC,
 		       ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE);
-		iic_wr(pd, ICCR, 0xc0);
+		iic_wr(pd, ICCR, ICCR_ICE | ICCR_RACK);
 		break;
 	case OP_RX_STOP_DATA: /* enable DTE interrupt, read data, issue stop */
 		iic_wr(pd, ICIC,
 		       ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE);
 		ret = iic_rd(pd, ICDR);
-		iic_wr(pd, ICCR, 0xc0);
+		iic_wr(pd, ICCR, ICCR_ICE | ICCR_RACK);
 		break;
 	}
 
-- 
1.9.2


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

* [PATCH 2/6] i2c: sh_mobile: improve error handling
  2014-04-30 22:21 [PATCH 0/6] i2c: sh_mobile: cleanups Wolfram Sang
  2014-04-30 22:21 ` [PATCH 1/6] i2c: sh_mobile: replace magic hex values with constants Wolfram Sang
@ 2014-04-30 22:21 ` Wolfram Sang
       [not found]   ` <1398896470-24663-3-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
  2014-04-30 22:21 ` [PATCH 3/6] i2c: sh_mobile: honor DT bus speed settings Wolfram Sang
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Wolfram Sang @ 2014-04-30 22:21 UTC (permalink / raw)
  To: linux-i2c; +Cc: Wolfram Sang, linux-sh, Magnus Damm, Wolfram Sang

From: Wolfram Sang <wsa+renesas@sang-engineering.com>

Use standard i2c error codes for i2c failures. Also, don't print
something on timeout since it happens regularly with i2c. Simplify some,
logic, too.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/i2c-sh_mobile.c | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
index d91625eea6bb..d2fa222df3d1 100644
--- a/drivers/i2c/busses/i2c-sh_mobile.c
+++ b/drivers/i2c/busses/i2c-sh_mobile.c
@@ -480,7 +480,7 @@ static int start_ch(struct sh_mobile_i2c_data *pd, struct i2c_msg *usr_msg,
 {
 	if (usr_msg->len == 0 && (usr_msg->flags & I2C_M_RD)) {
 		dev_err(pd->dev, "Unsupported zero length i2c read\n");
-		return -EIO;
+		return -EOPNOTSUPP;
 	}
 
 	if (do_init) {
@@ -515,17 +515,12 @@ static int poll_dte(struct sh_mobile_i2c_data *pd)
 			break;
 
 		if (val & ICSR_TACK)
-			return -EIO;
+			return -ENXIO;
 
 		udelay(10);
 	}
 
-	if (!i) {
-		dev_warn(pd->dev, "Timeout polling for DTE!\n");
-		return -ETIMEDOUT;
-	}
-
-	return 0;
+	return i ? 0 : -ETIMEDOUT;
 }
 
 static int poll_busy(struct sh_mobile_i2c_data *pd)
@@ -543,20 +538,18 @@ static int poll_busy(struct sh_mobile_i2c_data *pd)
 		 */
 		if (!(val & ICSR_BUSY)) {
 			/* handle missing acknowledge and arbitration lost */
-			if ((val | pd->sr) & (ICSR_TACK | ICSR_AL))
-				return -EIO;
+			val |= pd->sr;
+			if (val & ICSR_TACK)
+				return -ENXIO;
+			if (val & ICSR_AL)
+				return -EAGAIN;
 			break;
 		}
 
 		udelay(10);
 	}
 
-	if (!i) {
-		dev_err(pd->dev, "Polling timed out\n");
-		return -ETIMEDOUT;
-	}
-
-	return 0;
+	return i ? 0 : -ETIMEDOUT;
 }
 
 static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter,
-- 
1.9.2


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

* [PATCH 3/6] i2c: sh_mobile: honor DT bus speed settings
  2014-04-30 22:21 [PATCH 0/6] i2c: sh_mobile: cleanups Wolfram Sang
  2014-04-30 22:21 ` [PATCH 1/6] i2c: sh_mobile: replace magic hex values with constants Wolfram Sang
  2014-04-30 22:21 ` [PATCH 2/6] i2c: sh_mobile: improve error handling Wolfram Sang
@ 2014-04-30 22:21 ` Wolfram Sang
       [not found] ` <1398896470-24663-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
  2014-04-30 22:21 ` [PATCH 5/6] i2c: sh_mobile: devm conversion, low hanging fruits Wolfram Sang
  4 siblings, 0 replies; 14+ messages in thread
From: Wolfram Sang @ 2014-04-30 22:21 UTC (permalink / raw)
  To: linux-i2c; +Cc: Wolfram Sang, linux-sh, Magnus Damm, Wolfram Sang

From: Wolfram Sang <wsa+renesas@sang-engineering.com>

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/i2c-sh_mobile.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
index d2fa222df3d1..2e481abd50ce 100644
--- a/drivers/i2c/busses/i2c-sh_mobile.c
+++ b/drivers/i2c/busses/i2c-sh_mobile.c
@@ -657,6 +657,7 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
 	struct resource *res;
 	int size;
 	int ret;
+	u32 bus_speed;
 
 	pd = kzalloc(sizeof(struct sh_mobile_i2c_data), GFP_KERNEL);
 	if (pd == NULL) {
@@ -697,7 +698,9 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
 	}
 
 	/* Use platform data bus speed or STANDARD_MODE */
-	pd->bus_speed = STANDARD_MODE;
+	ret = of_property_read_u32(dev->dev.of_node, "clock-frequency", &bus_speed);
+	pd->bus_speed = ret ? STANDARD_MODE : bus_speed;
+
 	if (pdata && pdata->bus_speed)
 		pd->bus_speed = pdata->bus_speed;
 	pd->clks_per_count = 1;
-- 
1.9.2


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

* [PATCH 4/6] i2c: sh_mobile: add devicetree documentation
       [not found] ` <1398896470-24663-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
@ 2014-04-30 22:21   ` Wolfram Sang
  2014-04-30 22:32     ` Geert Uytterhoeven
  2014-04-30 22:21   ` [PATCH 6/6] i2c: sh_mobile: devm conversion, irq setup Wolfram Sang
  1 sibling, 1 reply; 14+ messages in thread
From: Wolfram Sang @ 2014-04-30 22:21 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
  Cc: Wolfram Sang, linux-sh-u79uwXL29TY76Z2rM5mHXA, Magnus Damm,
	Wolfram Sang

From: Wolfram Sang <wsa+renesas-jBu1N2QxHDJrcw3mvpCnnVaTQe2KTcn/@public.gmane.org>

Reported-by: Geert Uytterhoeven <geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
Signed-off-by: Wolfram Sang <wsa+renesas-jBu1N2QxHDJrcw3mvpCnnVaTQe2KTcn/@public.gmane.org>
---
 .../devicetree/bindings/i2c/i2c-sh_mobile.txt      | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-sh_mobile.txt

diff --git a/Documentation/devicetree/bindings/i2c/i2c-sh_mobile.txt b/Documentation/devicetree/bindings/i2c/i2c-sh_mobile.txt
new file mode 100644
index 000000000000..d2153ce36fa8
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/i2c-sh_mobile.txt
@@ -0,0 +1,26 @@
+Device tree configuration for Renesas IIC (sh_mobile) driver
+
+Required properties:
+- compatible      : "renesas,iic-<soctype>". "renesas,rmobile-iic" as fallback
+- reg             : address start and address range size of device
+- interrupts      : interrupt of device
+- clocks          : clock for device
+- #address-cells  : should be <1>
+- #size-cells     : should be <0>
+
+Optional properties:
+- clock-frequency : frequency of bus clock in Hz. Default 100kHz if unset.
+
+Pinctrl properties might be needed, too. See there.
+
+Example:
+
+	iic0: i2c@e6500000 {
+		compatible = "renesas,iic-r8a7790", "renesas,rmobile-iic";
+		reg = <0 0xe6500000 0 0x425>;
+		interrupts = <0 174 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&mstp3_clks R8A7790_CLK_IIC0>;
+		clock-frequency = <400000>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+	};
-- 
1.9.2

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

* [PATCH 5/6] i2c: sh_mobile: devm conversion, low hanging fruits
  2014-04-30 22:21 [PATCH 0/6] i2c: sh_mobile: cleanups Wolfram Sang
                   ` (3 preceding siblings ...)
       [not found] ` <1398896470-24663-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
@ 2014-04-30 22:21 ` Wolfram Sang
  2014-04-30 22:39   ` Geert Uytterhoeven
  4 siblings, 1 reply; 14+ messages in thread
From: Wolfram Sang @ 2014-04-30 22:21 UTC (permalink / raw)
  To: linux-i2c; +Cc: Wolfram Sang, linux-sh, Magnus Damm, Wolfram Sang

From: Wolfram Sang <wsa+renesas@sang-engineering.com>

Convert the easy parts to devm. irqs will be converted in a seperate
patch to keep diffs readable.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/i2c-sh_mobile.c | 41 ++++++++++----------------------------
 1 file changed, 10 insertions(+), 31 deletions(-)

diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
index 2e481abd50ce..c47d11493b97 100644
--- a/drivers/i2c/busses/i2c-sh_mobile.c
+++ b/drivers/i2c/busses/i2c-sh_mobile.c
@@ -655,45 +655,33 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
 	struct sh_mobile_i2c_data *pd;
 	struct i2c_adapter *adap;
 	struct resource *res;
-	int size;
 	int ret;
 	u32 bus_speed;
 
-	pd = kzalloc(sizeof(struct sh_mobile_i2c_data), GFP_KERNEL);
-	if (pd == NULL) {
-		dev_err(&dev->dev, "cannot allocate private data\n");
+	pd = devm_kzalloc(&dev->dev, sizeof(struct sh_mobile_i2c_data), GFP_KERNEL);
+	if (!pd)
 		return -ENOMEM;
-	}
 
-	pd->clk = clk_get(&dev->dev, NULL);
+	pd->clk = devm_clk_get(&dev->dev, NULL);
 	if (IS_ERR(pd->clk)) {
 		dev_err(&dev->dev, "cannot get clock\n");
-		ret = PTR_ERR(pd->clk);
-		goto err;
+		return PTR_ERR(pd->clk);
 	}
 
 	ret = sh_mobile_i2c_hook_irqs(dev, 1);
 	if (ret) {
 		dev_err(&dev->dev, "cannot request IRQ\n");
-		goto err_clk;
+		return ret;
 	}
 
 	pd->dev = &dev->dev;
 	platform_set_drvdata(dev, pd);
 
 	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
-	if (res == NULL) {
-		dev_err(&dev->dev, "cannot find IO resource\n");
-		ret = -ENOENT;
-		goto err_irq;
-	}
 
-	size = resource_size(res);
-
-	pd->reg = ioremap(res->start, size);
-	if (pd->reg == NULL) {
-		dev_err(&dev->dev, "cannot map IO\n");
-		ret = -ENXIO;
+	pd->reg = devm_ioremap_resource(&dev->dev, res);
+	if (IS_ERR(pd->reg)) {
+		ret = PTR_ERR(pd->reg);
 		goto err_irq;
 	}
 
@@ -710,7 +698,7 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
 	/* The IIC blocks on SH-Mobile ARM processors
 	 * come with two new bits in ICIC.
 	 */
-	if (size > 0x17)
+	if (resource_size(res) > 0x17)
 		pd->flags |= IIC_FLAG_HAS_ICIC67;
 
 	sh_mobile_i2c_init(pd);
@@ -747,7 +735,7 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
 	ret = i2c_add_numbered_adapter(adap);
 	if (ret < 0) {
 		dev_err(&dev->dev, "cannot add numbered adapter\n");
-		goto err_all;
+		goto err_irq;
 	}
 
 	dev_info(&dev->dev,
@@ -756,14 +744,8 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
 
 	return 0;
 
- err_all:
-	iounmap(pd->reg);
  err_irq:
 	sh_mobile_i2c_hook_irqs(dev, 0);
- err_clk:
-	clk_put(pd->clk);
- err:
-	kfree(pd);
 	return ret;
 }
 
@@ -772,11 +754,8 @@ static int sh_mobile_i2c_remove(struct platform_device *dev)
 	struct sh_mobile_i2c_data *pd = platform_get_drvdata(dev);
 
 	i2c_del_adapter(&pd->adap);
-	iounmap(pd->reg);
 	sh_mobile_i2c_hook_irqs(dev, 0);
-	clk_put(pd->clk);
 	pm_runtime_disable(&dev->dev);
-	kfree(pd);
 	return 0;
 }
 
-- 
1.9.2


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

* [PATCH 6/6] i2c: sh_mobile: devm conversion, irq setup
       [not found] ` <1398896470-24663-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
  2014-04-30 22:21   ` [PATCH 4/6] i2c: sh_mobile: add devicetree documentation Wolfram Sang
@ 2014-04-30 22:21   ` Wolfram Sang
  2014-04-30 22:44     ` Geert Uytterhoeven
  1 sibling, 1 reply; 14+ messages in thread
From: Wolfram Sang @ 2014-04-30 22:21 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
  Cc: Wolfram Sang, linux-sh-u79uwXL29TY76Z2rM5mHXA, Magnus Damm,
	Wolfram Sang

From: Wolfram Sang <wsa+renesas-jBu1N2QxHDJrcw3mvpCnnVaTQe2KTcn/@public.gmane.org>

This is what devm was made for. No rollback mechanism needed, remove the
hook parameter from the irq setup function and simplify it. While we are
here change some variables to proper types.

Signed-off-by: Wolfram Sang <wsa+renesas-jBu1N2QxHDJrcw3mvpCnnVaTQe2KTcn/@public.gmane.org>
---
 drivers/i2c/busses/i2c-sh_mobile.c | 56 ++++++++++----------------------------
 1 file changed, 15 insertions(+), 41 deletions(-)

diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
index c47d11493b97..ddc9970fd724 100644
--- a/drivers/i2c/busses/i2c-sh_mobile.c
+++ b/drivers/i2c/busses/i2c-sh_mobile.c
@@ -611,42 +611,25 @@ static struct i2c_algorithm sh_mobile_i2c_algorithm = {
 	.master_xfer	= sh_mobile_i2c_xfer,
 };
 
-static int sh_mobile_i2c_hook_irqs(struct platform_device *dev, int hook)
+static int sh_mobile_i2c_hook_irqs(struct platform_device *dev)
 {
 	struct resource *res;
-	int ret = -ENXIO;
-	int n, k = 0;
+	resource_size_t n;
+	int k = 0, ret;
 
 	while ((res = platform_get_resource(dev, IORESOURCE_IRQ, k))) {
-		for (n = res->start; hook && n <= res->end; n++) {
-			if (request_irq(n, sh_mobile_i2c_isr, 0,
-					dev_name(&dev->dev), dev)) {
-				for (n--; n >= res->start; n--)
-					free_irq(n, dev);
-
-				goto rollback;
+		for (n = res->start; n <= res->end; n++) {
+			ret = devm_request_irq(&dev->dev, n, sh_mobile_i2c_isr,
+					  0, dev_name(&dev->dev), dev);
+			if (ret) {
+				dev_err(&dev->dev, "cannot request IRQ %pa\n", &n);
+				return ret;
 			}
 		}
 		k++;
 	}
 
-	if (hook)
-		return k > 0 ? 0 : -ENOENT;
-
-	ret = 0;
-
- rollback:
-	k--;
-
-	while (k >= 0) {
-		res = platform_get_resource(dev, IORESOURCE_IRQ, k);
-		for (n = res->start; n <= res->end; n++)
-			free_irq(n, dev);
-
-		k--;
-	}
-
-	return ret;
+	return k > 0 ? 0 : -ENOENT;
 }
 
 static int sh_mobile_i2c_probe(struct platform_device *dev)
@@ -668,11 +651,9 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
 		return PTR_ERR(pd->clk);
 	}
 
-	ret = sh_mobile_i2c_hook_irqs(dev, 1);
-	if (ret) {
-		dev_err(&dev->dev, "cannot request IRQ\n");
+	ret = sh_mobile_i2c_hook_irqs(dev);
+	if (ret)
 		return ret;
-	}
 
 	pd->dev = &dev->dev;
 	platform_set_drvdata(dev, pd);
@@ -680,10 +661,8 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
 	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
 
 	pd->reg = devm_ioremap_resource(&dev->dev, res);
-	if (IS_ERR(pd->reg)) {
-		ret = PTR_ERR(pd->reg);
-		goto err_irq;
-	}
+	if (IS_ERR(pd->reg))
+		return PTR_ERR(pd->reg);
 
 	/* Use platform data bus speed or STANDARD_MODE */
 	ret = of_property_read_u32(dev->dev.of_node, "clock-frequency", &bus_speed);
@@ -735,7 +714,7 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
 	ret = i2c_add_numbered_adapter(adap);
 	if (ret < 0) {
 		dev_err(&dev->dev, "cannot add numbered adapter\n");
-		goto err_irq;
+		return ret;
 	}
 
 	dev_info(&dev->dev,
@@ -743,10 +722,6 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
 		 adap->nr, pd->bus_speed, pd->iccl, pd->icch);
 
 	return 0;
-
- err_irq:
-	sh_mobile_i2c_hook_irqs(dev, 0);
-	return ret;
 }
 
 static int sh_mobile_i2c_remove(struct platform_device *dev)
@@ -754,7 +729,6 @@ static int sh_mobile_i2c_remove(struct platform_device *dev)
 	struct sh_mobile_i2c_data *pd = platform_get_drvdata(dev);
 
 	i2c_del_adapter(&pd->adap);
-	sh_mobile_i2c_hook_irqs(dev, 0);
 	pm_runtime_disable(&dev->dev);
 	return 0;
 }
-- 
1.9.2

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

* Re: [PATCH 2/6] i2c: sh_mobile: improve error handling
       [not found]   ` <1398896470-24663-3-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
@ 2014-04-30 22:25     ` Geert Uytterhoeven
  2014-05-02  7:19       ` Wolfram Sang
  0 siblings, 1 reply; 14+ messages in thread
From: Geert Uytterhoeven @ 2014-04-30 22:25 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: Linux I2C, Linux-sh list, Magnus Damm, Wolfram Sang

Hi Wolfram,

On Thu, May 1, 2014 at 12:21 AM, Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org> wrote:
> Use standard i2c error codes for i2c failures. Also, don't print
> something on timeout since it happens regularly with i2c. Simplify some,
> logic, too.

You may want to keep the timeout messages with dev_dbg()?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 4/6] i2c: sh_mobile: add devicetree documentation
  2014-04-30 22:21   ` [PATCH 4/6] i2c: sh_mobile: add devicetree documentation Wolfram Sang
@ 2014-04-30 22:32     ` Geert Uytterhoeven
  2014-05-01  1:02       ` Rob Herring
  0 siblings, 1 reply; 14+ messages in thread
From: Geert Uytterhoeven @ 2014-04-30 22:32 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Linux I2C, Linux-sh list, Magnus Damm, Wolfram Sang,
	devicetree@vger.kernel.org

Hi Wolfram,

CC devicetree

On Thu, May 1, 2014 at 12:21 AM, Wolfram Sang <wsa@the-dreams.de> wrote:
> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
> Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  .../devicetree/bindings/i2c/i2c-sh_mobile.txt      | 26 ++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/i2c/i2c-sh_mobile.txt
>
> diff --git a/Documentation/devicetree/bindings/i2c/i2c-sh_mobile.txt b/Documentation/devicetree/bindings/i2c/i2c-sh_mobile.txt
> new file mode 100644
> index 000000000000..d2153ce36fa8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/i2c/i2c-sh_mobile.txt
> @@ -0,0 +1,26 @@
> +Device tree configuration for Renesas IIC (sh_mobile) driver
> +
> +Required properties:
> +- compatible      : "renesas,iic-<soctype>". "renesas,rmobile-iic" as fallback

Please also list all supported values, so checkpatch can validate DTS compatible
properties against this binding document.

> +- reg             : address start and address range size of device
> +- interrupts      : interrupt of device
> +- clocks          : clock for device
> +- #address-cells  : should be <1>
> +- #size-cells     : should be <0>
> +
> +Optional properties:
> +- clock-frequency : frequency of bus clock in Hz. Default 100kHz if unset.
> +
> +Pinctrl properties might be needed, too. See there.
> +
> +Example:
> +
> +       iic0: i2c@e6500000 {
> +               compatible = "renesas,iic-r8a7790", "renesas,rmobile-iic";
> +               reg = <0 0xe6500000 0 0x425>;
> +               interrupts = <0 174 IRQ_TYPE_LEVEL_HIGH>;
> +               clocks = <&mstp3_clks R8A7790_CLK_IIC0>;
> +               clock-frequency = <400000>;
> +               #address-cells = <1>;
> +               #size-cells = <0>;
> +       };

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 5/6] i2c: sh_mobile: devm conversion, low hanging fruits
  2014-04-30 22:21 ` [PATCH 5/6] i2c: sh_mobile: devm conversion, low hanging fruits Wolfram Sang
@ 2014-04-30 22:39   ` Geert Uytterhoeven
  0 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2014-04-30 22:39 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: Linux I2C, Linux-sh list, Magnus Damm, Wolfram Sang

On Thu, May 1, 2014 at 12:21 AM, Wolfram Sang <wsa@the-dreams.de> wrote:
> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
> Convert the easy parts to devm. irqs will be converted in a seperate
> patch to keep diffs readable.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 6/6] i2c: sh_mobile: devm conversion, irq setup
  2014-04-30 22:21   ` [PATCH 6/6] i2c: sh_mobile: devm conversion, irq setup Wolfram Sang
@ 2014-04-30 22:44     ` Geert Uytterhoeven
  0 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2014-04-30 22:44 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: Linux I2C, Linux-sh list, Magnus Damm, Wolfram Sang

On Thu, May 1, 2014 at 12:21 AM, Wolfram Sang <wsa@the-dreams.de> wrote:
> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
> This is what devm was made for. No rollback mechanism needed, remove the
> hook parameter from the irq setup function and simplify it. While we are
> here change some variables to proper types.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 4/6] i2c: sh_mobile: add devicetree documentation
  2014-04-30 22:32     ` Geert Uytterhoeven
@ 2014-05-01  1:02       ` Rob Herring
  2014-05-02  7:23         ` Wolfram Sang
  0 siblings, 1 reply; 14+ messages in thread
From: Rob Herring @ 2014-05-01  1:02 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Wolfram Sang, Linux I2C, Linux-sh list, Magnus Damm, Wolfram Sang,
	devicetree@vger.kernel.org

On Wed, Apr 30, 2014 at 5:32 PM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> Hi Wolfram,
>
> CC devicetree
>
> On Thu, May 1, 2014 at 12:21 AM, Wolfram Sang <wsa@the-dreams.de> wrote:
>> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
>>
>> Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
>> ---
>>  .../devicetree/bindings/i2c/i2c-sh_mobile.txt      | 26 ++++++++++++++++++++++
>>  1 file changed, 26 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/i2c/i2c-sh_mobile.txt
>>
>> diff --git a/Documentation/devicetree/bindings/i2c/i2c-sh_mobile.txt b/Documentation/devicetree/bindings/i2c/i2c-sh_mobile.txt
>> new file mode 100644
>> index 000000000000..d2153ce36fa8
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/i2c/i2c-sh_mobile.txt
>> @@ -0,0 +1,26 @@
>> +Device tree configuration for Renesas IIC (sh_mobile) driver
>> +
>> +Required properties:
>> +- compatible      : "renesas,iic-<soctype>". "renesas,rmobile-iic" as fallback
>
> Please also list all supported values, so checkpatch can validate DTS compatible
> properties against this binding document.

You could add this pattern to checkpatch as well. I really wish
Renesas would follow normal convention of <vendor>,<chip>-<device>.

Rob

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

* Re: [PATCH 2/6] i2c: sh_mobile: improve error handling
  2014-04-30 22:25     ` Geert Uytterhoeven
@ 2014-05-02  7:19       ` Wolfram Sang
  0 siblings, 0 replies; 14+ messages in thread
From: Wolfram Sang @ 2014-05-02  7:19 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Linux I2C, Linux-sh list, Magnus Damm, Wolfram Sang

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

On Thu, May 01, 2014 at 12:25:38AM +0200, Geert Uytterhoeven wrote:
> Hi Wolfram,
> 
> On Thu, May 1, 2014 at 12:21 AM, Wolfram Sang <wsa@the-dreams.de> wrote:
> > Use standard i2c error codes for i2c failures. Also, don't print
> > something on timeout since it happens regularly with i2c. Simplify some,
> > logic, too.
> 
> You may want to keep the timeout messages with dev_dbg()?

Not really. We now have an I2C tracer which shows the return value of
the transfer. I really want to reduce debug output of all drivers in
favor of the tracer.


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

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

* Re: [PATCH 4/6] i2c: sh_mobile: add devicetree documentation
  2014-05-01  1:02       ` Rob Herring
@ 2014-05-02  7:23         ` Wolfram Sang
  0 siblings, 0 replies; 14+ messages in thread
From: Wolfram Sang @ 2014-05-02  7:23 UTC (permalink / raw)
  To: Rob Herring
  Cc: Geert Uytterhoeven, Linux I2C, Linux-sh list, Magnus Damm,
	Wolfram Sang, devicetree@vger.kernel.org

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

On Wed, Apr 30, 2014 at 08:02:10PM -0500, Rob Herring wrote:
> On Wed, Apr 30, 2014 at 5:32 PM, Geert Uytterhoeven
> <geert@linux-m68k.org> wrote:
> > Hi Wolfram,
> >
> > CC devicetree

Yes. Thanks, Geert.

> >> +Required properties:
> >> +- compatible      : "renesas,iic-<soctype>". "renesas,rmobile-iic" as fallback
> >
> > Please also list all supported values, so checkpatch can validate DTS compatible
> > properties against this binding document.
> 
> You could add this pattern to checkpatch as well. I really wish
> Renesas would follow normal convention of <vendor>,<chip>-<device>.

The binding is already applied and this patch just adds forgotten
documentation. Can we keep this documentation describing the current
state for now and discuss the binding convention seperately?


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

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

end of thread, other threads:[~2014-05-02  7:23 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-30 22:21 [PATCH 0/6] i2c: sh_mobile: cleanups Wolfram Sang
2014-04-30 22:21 ` [PATCH 1/6] i2c: sh_mobile: replace magic hex values with constants Wolfram Sang
2014-04-30 22:21 ` [PATCH 2/6] i2c: sh_mobile: improve error handling Wolfram Sang
     [not found]   ` <1398896470-24663-3-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2014-04-30 22:25     ` Geert Uytterhoeven
2014-05-02  7:19       ` Wolfram Sang
2014-04-30 22:21 ` [PATCH 3/6] i2c: sh_mobile: honor DT bus speed settings Wolfram Sang
     [not found] ` <1398896470-24663-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2014-04-30 22:21   ` [PATCH 4/6] i2c: sh_mobile: add devicetree documentation Wolfram Sang
2014-04-30 22:32     ` Geert Uytterhoeven
2014-05-01  1:02       ` Rob Herring
2014-05-02  7:23         ` Wolfram Sang
2014-04-30 22:21   ` [PATCH 6/6] i2c: sh_mobile: devm conversion, irq setup Wolfram Sang
2014-04-30 22:44     ` Geert Uytterhoeven
2014-04-30 22:21 ` [PATCH 5/6] i2c: sh_mobile: devm conversion, low hanging fruits Wolfram Sang
2014-04-30 22:39   ` Geert Uytterhoeven

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