diff mbox

[1/2] i2c: ls1/ls2: add workaround for erratum ERR010027

Message ID 1453884283-33414-1-git-send-email-ying.zhang22455@nxp.com
State Changes Requested
Headers show

Commit Message

Zhang Ying-22455 Jan. 27, 2016, 8:44 a.m. UTC
From: Ying Zhang <b40530@freescale.com>

ERR010027/ERR008951: Attempting a start cycle while the
bus is busy may generate a short clock pulse.

Software must ensure that the I2C BUS is idle by checking the
bus busy before switching to master mode and attempting a Start
cycle.

Signed-off-by: Ying Zhang <b40530@freescale.com>
---
 drivers/i2c/busses/i2c-imx.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Wolfram Sang April 26, 2016, 9:29 p.m. UTC | #1
On Wed, Jan 27, 2016 at 04:44:42PM +0800, ying.zhang22455@nxp.com wrote:
> From: Ying Zhang <b40530@freescale.com>
> 
> ERR010027/ERR008951: Attempting a start cycle while the
> bus is busy may generate a short clock pulse.
> 
> Software must ensure that the I2C BUS is idle by checking the
> bus busy before switching to master mode and attempting a Start
> cycle.
> 
> Signed-off-by: Ying Zhang <b40530@freescale.com>
> ---
>  drivers/i2c/busses/i2c-imx.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index a2b132c..f1fe599 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -889,6 +889,13 @@ static int i2c_imx_xfer(struct i2c_adapter *adapter,
>  
>  	dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__);
>  
> +	/* workround for ERR010027: ensure that the I2C BUS is idle
> +	   before switching to master mode and attempting a Start cycle
> +	 */

Please use kernel coding style for comments.


> +	result =  i2c_imx_bus_busy(i2c_imx, 0);
> +	if (result)
> +		goto fail0;

This is wrong! You need 'goto out'. Please be careful.

> +
>  	result = pm_runtime_get_sync(i2c_imx->adapter.dev.parent);
>  	if (result < 0)
>  		goto out;
> -- 
> 2.1.0.27.g96db324
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wolfram Sang April 26, 2016, 9:30 p.m. UTC | #2
And what does 'ls1/ls2' in the subject mean? Why not imx?
diff mbox

Patch

diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index a2b132c..f1fe599 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -889,6 +889,13 @@  static int i2c_imx_xfer(struct i2c_adapter *adapter,
 
 	dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__);
 
+	/* workround for ERR010027: ensure that the I2C BUS is idle
+	   before switching to master mode and attempting a Start cycle
+	 */
+	result =  i2c_imx_bus_busy(i2c_imx, 0);
+	if (result)
+		goto fail0;
+
 	result = pm_runtime_get_sync(i2c_imx->adapter.dev.parent);
 	if (result < 0)
 		goto out;