linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matt Weber <matthew.weber@rockwellcollins.com>
To: linux-i2c@vger.kernel.org
Cc: wsa@the-dreams.de, soren.brinkmann@xilinx.com,
	Matt Weber <matthew.weber@rockwellcollins.com>,
	John Linn <john.linn@xilinx.com>,
	Paresh Chaudhary <paresh.chaudhary@rockwellcollins.com>
Subject: [PATCH 1/1] i2c: cadance: (bugfix) ctrl/addr reg write order
Date: Wed, 21 Jun 2017 20:45:26 -0500	[thread overview]
Message-ID: <1498095926-51264-1-git-send-email-matthew.weber@rockwellcollins.com> (raw)

The driver was clearing the hold bit in the control register before
writing to the address register which resulted in a stop condition
being generated rather than a repeated start.

This issue was only observed when a system was running much
slower than a normal processor would execute.  The IP data sheet
mentions a ordering of writing to the address register before
clearing the hold.

Signed-off-by: John Linn <john.linn@xilinx.com>
Signed-off-by: Paresh Chaudhary <paresh.chaudhary@rockwellcollins.com>
Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
---
 drivers/i2c/busses/i2c-cadence.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
index 45d6771..75d8016 100644
--- a/drivers/i2c/busses/i2c-cadence.c
+++ b/drivers/i2c/busses/i2c-cadence.c
@@ -405,14 +405,14 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id)
 		cdns_i2c_writereg(id->recv_count, CDNS_I2C_XFER_SIZE_OFFSET);
 	}
 
+	/* Set the slave address in address register - triggers operation */
+	cdns_i2c_writereg(id->p_msg->addr & CDNS_I2C_ADDR_MASK,
+						CDNS_I2C_ADDR_OFFSET);
 	/* Clear the bus hold flag if bytes to receive is less than FIFO size */
 	if (!id->bus_hold_flag &&
 		((id->p_msg->flags & I2C_M_RECV_LEN) != I2C_M_RECV_LEN) &&
 		(id->recv_count <= CDNS_I2C_FIFO_DEPTH))
 			cdns_i2c_clear_bus_hold(id);
-	/* Set the slave address in address register - triggers operation */
-	cdns_i2c_writereg(id->p_msg->addr & CDNS_I2C_ADDR_MASK,
-						CDNS_I2C_ADDR_OFFSET);
 	cdns_i2c_writereg(CDNS_I2C_ENABLED_INTR_MASK, CDNS_I2C_IER_OFFSET);
 }
 
-- 
1.9.1

             reply	other threads:[~2017-06-22  1:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-22  1:45 Matt Weber [this message]
2017-06-22  8:35 ` [PATCH 1/1] i2c: cadance: (bugfix) ctrl/addr reg write order Wolfram Sang
2017-06-22 11:34   ` Matthew Weber
2017-06-22 13:26     ` 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=1498095926-51264-1-git-send-email-matthew.weber@rockwellcollins.com \
    --to=matthew.weber@rockwellcollins.com \
    --cc=john.linn@xilinx.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=paresh.chaudhary@rockwellcollins.com \
    --cc=soren.brinkmann@xilinx.com \
    --cc=wsa@the-dreams.de \
    /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).