linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sifan Naeem <sifan.naeem-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
To: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>,
	James Hogan <james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Ezequiel Garcia
	<ezequiel-30ULvvUtt6G51wMPkGsGjgyUoB5FGQPZ@public.gmane.org>
Cc: Ionela Voinescu
	<Ionela.Voinescu-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>,
	Sifan Naeem <sifan.naeem-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
Subject: [PATCH v3 6/7] i2c: img-scb: Clear line and interrupt status before starting a transfer
Date: Thu, 10 Sep 2015 15:50:06 +0100	[thread overview]
Message-ID: <1441896607-16310-7-git-send-email-sifan.naeem@imgtec.com> (raw)
In-Reply-To: <1441896607-16310-1-git-send-email-sifan.naeem-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>

Clear line status and all generated interrupts from the interrupt
status register before starting a transfer, as we may have
unserviced interrupts from previous transfers that might be
handled in the context of the new transfer.

Fixes: commit 27bce457d588 ("i2c: img-scb: Add Imagination Technologies I2C SCB driver")
Signed-off-by: Sifan Naeem <sifan.naeem-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
Acked-by: James Hogan <james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
Reviewed-by: James Hartley <james.hartley-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
---
 drivers/i2c/busses/i2c-img-scb.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/i2c/busses/i2c-img-scb.c b/drivers/i2c/busses/i2c-img-scb.c
index 049d193d01ac..0fa47158dbe4 100644
--- a/drivers/i2c/busses/i2c-img-scb.c
+++ b/drivers/i2c/busses/i2c-img-scb.c
@@ -1060,6 +1060,15 @@ static int img_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
 		i2c->last_msg = (i == num - 1);
 		reinit_completion(&i2c->msg_complete);
 
+		/*
+		 * Clear line status and all interrupts before starting a
+		 * transfer, as we may have unserviced interrupts from
+		 * previous transfers that might be handled in the context
+		 * of the new transfer.
+		 */
+		img_i2c_writel(i2c, SCB_INT_CLEAR_REG, ~0);
+		img_i2c_writel(i2c, SCB_CLEAR_REG, ~0);
+
 		if (atomic)
 			img_i2c_atomic_start(i2c);
 		else if (msg->flags & I2C_M_RD)
-- 
1.7.9.5

  parent reply	other threads:[~2015-09-10 14:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-10 14:50 [PATCH v3 0/7] i2c: img-scb: fixes to support i2c on pistachio Sifan Naeem
     [not found] ` <1441896607-16310-1-git-send-email-sifan.naeem-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
2015-09-10 14:50   ` [PATCH v3 1/7] i2c: img-scb: enable fencing for all versions of the ip Sifan Naeem
2015-09-10 14:50   ` [PATCH v3 2/7] i2c: img-scb: do dummy writes before fifo access Sifan Naeem
2015-09-10 14:50   ` [PATCH v3 3/7] i2c: img-scb: use DIV_ROUND_UP to round divisor values Sifan Naeem
2015-09-10 14:50   ` [PATCH v3 4/7] i2c: img-scb: fix LOW and HIGH period values for the SCL clock Sifan Naeem
2015-09-10 14:50   ` [PATCH v3 5/7] i2c: img-scb: use line_status instead of i2c->line_status Sifan Naeem
     [not found]     ` <1441896607-16310-6-git-send-email-sifan.naeem-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
2015-09-14 12:15       ` James Hogan
2015-09-10 14:50   ` Sifan Naeem [this message]
2015-09-10 14:50   ` [PATCH v3 7/7] i2c: img-scb: verify support for requested bit rate Sifan Naeem
2015-10-10  7:43 ` [PATCH v3 0/7] i2c: img-scb: fixes to support i2c on pistachio Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1441896607-16310-7-git-send-email-sifan.naeem@imgtec.com \
    --to=sifan.naeem-1axoqhu6uovqt0dzr+alfa@public.gmane.org \
    --cc=Ionela.Voinescu-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org \
    --cc=ezequiel-30ULvvUtt6G51wMPkGsGjgyUoB5FGQPZ@public.gmane.org \
    --cc=james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).