All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: mxs: disable QUEUE when sending is done
@ 2012-04-27 14:23 ` Wolfram Sang
  0 siblings, 0 replies; 12+ messages in thread
From: Wolfram Sang @ 2012-04-27 14:23 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Marek Vasut,
	Fabio Estevam, Wolfram Sang

Since the last fixes to this driver ensure now the queue termination is
done correctly, we can finally disable the queue after a transfer
without problems. The gain is that it will only be reenabled after the
next transfer is fully set up. Before, the queue was running all the
time and if the setup of the next message was interrupted by another
thread, an incomplete buffer could have been sent, padded with zeroes.

Signed-off-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---

In case you are testing this patch, please donate Tested-by tags. Regular I2C
usage should do, a bit of stress testing (putting I2C bus and system under
load) would be great.

 drivers/i2c/busses/i2c-mxs.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index 4c37347..76b8af4 100644
--- a/drivers/i2c/busses/i2c-mxs.c
+++ b/drivers/i2c/busses/i2c-mxs.c
@@ -253,6 +253,9 @@ static int mxs_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg,
 
 	if (i2c->cmd_err == -ENXIO)
 		mxs_i2c_reset(i2c);
+	else
+		writel(MXS_I2C_QUEUECTRL_QUEUE_RUN,
+				i2c->regs + MXS_I2C_QUEUECTRL_CLR);
 
 	dev_dbg(i2c->dev, "Done with err=%d\n", i2c->cmd_err);
 
@@ -383,8 +386,6 @@ static int __devexit mxs_i2c_remove(struct platform_device *pdev)
 	if (ret)
 		return -EBUSY;
 
-	writel(MXS_I2C_QUEUECTRL_QUEUE_RUN,
-			i2c->regs + MXS_I2C_QUEUECTRL_CLR);
 	writel(MXS_I2C_CTRL0_SFTRST, i2c->regs + MXS_I2C_CTRL0_SET);
 
 	platform_set_drvdata(pdev, NULL);
-- 
1.7.10

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

end of thread, other threads:[~2012-04-29  9:11 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-27 14:23 [PATCH] i2c: mxs: disable QUEUE when sending is done Wolfram Sang
2012-04-27 14:23 ` Wolfram Sang
     [not found] ` <1335536631-28202-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-04-27 14:51   ` Fabio Estevam
2012-04-27 14:51     ` Fabio Estevam
     [not found]     ` <CAOMZO5A1_Z7T5md61OJWmXbx2qCjFEByjyGvjhxqhfxzwfLEVQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-04-28 10:26       ` Uwe Kleine-König
2012-04-28 10:26         ` Uwe Kleine-König
     [not found]         ` <20120428102601.GO20039-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-04-28 13:33           ` Marek Vasut
2012-04-28 13:33             ` Marek Vasut
     [not found]             ` <201204281533.35277.marex-ynQEQJNshbs@public.gmane.org>
2012-04-29  8:43               ` Wolfram Sang
2012-04-29  8:43                 ` Wolfram Sang
     [not found]                 ` <20120429084324.GA3001-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-04-29  9:11                   ` Marek Vasut
2012-04-29  9:11                     ` Marek Vasut

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.