linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] i2c: imx: add workaround for erratum ERR010027
@ 2017-11-17  8:21 ying.zhang22455
  2017-11-17  8:21 ` [PATCH 2/2] i2c: imx: implement bus recovery with gpio for Layerscape ying.zhang22455
  0 siblings, 1 reply; 2+ messages in thread
From: ying.zhang22455 @ 2017-11-17  8:21 UTC (permalink / raw)
  To: linux-i2c; +Cc: Zhang Ying-22455

From: Zhang Ying-22455 <ying.zhang22455@nxp.com>

ERR010027: 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: Zhang Ying-22455 <ying.zhang22455@nxp.com>
---
 drivers/i2c/busses/i2c-imx.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index f96830ffd9f1..5df381c5f70d 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -889,6 +889,14 @@ 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 out;
+
 	result = pm_runtime_get_sync(i2c_imx->adapter.dev.parent);
 	if (result < 0)
 		goto out;
-- 
2.14.1

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

end of thread, other threads:[~2017-11-17  8:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-17  8:21 [PATCH 1/2] i2c: imx: add workaround for erratum ERR010027 ying.zhang22455
2017-11-17  8:21 ` [PATCH 2/2] i2c: imx: implement bus recovery with gpio for Layerscape ying.zhang22455

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