linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: wellsk40-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: vitaly.wool-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	Kevin Wells <wellsk40-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: [PATCH 2/3] i2c-pnx: Add stop conditions for end of transfer
Date: Tue, 16 Mar 2010 15:55:37 -0700	[thread overview]
Message-ID: <1268780138-10019-4-git-send-email-wellsk40@gmail.com> (raw)
In-Reply-To: <1268780138-10019-1-git-send-email-wellsk40-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

From: Kevin Wells <wellsk40-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Add a stop condition bit flag to the last byte in the transfer.
This will generate an extra clock to handle the stop condition
and prevent devices from staying in an ACK'd state.

Signed-off-by: Kevin Wells <wellsk40-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/i2c/busses/i2c-pnx.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
index 77919fa..6bb6ff7 100644
--- a/drivers/i2c/busses/i2c-pnx.c
+++ b/drivers/i2c/busses/i2c-pnx.c
@@ -172,6 +172,9 @@ static int i2c_pnx_master_xmit(struct i2c_pnx_algo_data *alg_data)
 		/* We still have something to talk about... */
 		val = *alg_data->mif.buf++;
 
+		if (alg_data->mif.len == 1)
+			val |= stop_bit;
+
 		alg_data->mif.len--;
 		iowrite32(val, I2C_REG_TX(alg_data));
 
@@ -245,6 +248,9 @@ static int i2c_pnx_master_rcv(struct i2c_pnx_algo_data *alg_data)
 			__func__);
 
 		if (alg_data->mif.len == 1) {
+			/* Last byte, do not acknowledge next rcv. */
+			val |= stop_bit;
+
 			/*
 			 * Enable interrupt RFDAIE (data in Rx fifo),
 			 * and disable DRMIE (need data for Tx)
-- 
1.6.6

  parent reply	other threads:[~2010-03-16 22:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-16 22:55 i2c-pnx: Improvements and fixes wellsk40-Re5JQEeQqe8AvxtiuMwx3w
     [not found] ` <1268780138-10019-1-git-send-email-wellsk40-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-03-16 22:55   ` [PATCH 1/3] i2c-pnx: Limit maximum divider to 1023 wellsk40-Re5JQEeQqe8AvxtiuMwx3w
2010-03-16 22:55   ` wellsk40-Re5JQEeQqe8AvxtiuMwx3w
2010-03-16 22:55   ` wellsk40-Re5JQEeQqe8AvxtiuMwx3w [this message]
2010-03-16 22:55   ` [PATCH 3/3] i2c-pnx: Disable/enable clocks only when needed to reduce power wellsk40-Re5JQEeQqe8AvxtiuMwx3w
     [not found]     ` <1268780138-10019-5-git-send-email-wellsk40-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-04-05 23:01       ` Ben Dooks
2010-03-22 17:09   ` i2c-pnx: Improvements and fixes Kevin Wells
     [not found]     ` <a08234131003221009j1ec74009jc2eb289386455b65-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-04-05 23:00       ` Ben Dooks

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=1268780138-10019-4-git-send-email-wellsk40@gmail.com \
    --to=wellsk40-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=vitaly.wool-Re5JQEeQqe8AvxtiuMwx3w@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).