All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ari Kauppi <Ext-Ari.Kauppi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
To: ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org
Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 1/2] i2c: i2c-omap: Fix BUFSTAT_REG reading
Date: Fri,  6 Mar 2009 15:34:53 +0200	[thread overview]
Message-ID: <187aef71c7b1862caf6fe6a935ed94cdb64ca3fd.1236345858.git.Ext-Ari.Kauppi@nokia.com> (raw)
In-Reply-To: <cover.1236345858.git.Ext-Ari.Kauppi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>

From: Eero Nurkkala <ext-eero.nurkkala-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>

The number of bytes to be received is read from wrong
place with all OMAPs with highspeed I2C support,
which involves a FIFO and BUFSTAT_REG. It is the 6
bits starting from the bit 8 in the BUFSTAT_REG
that indicate this amount of bytes to be read.
Moreover, only the 6 LSB:s are relevant for the
TXSTAT field.

Signed-off-by: Eero Nurkkala <ext-eero.nurkkala-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
Signed-off-by: Ari Kauppi <Ext-Ari.Kauppi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Acked-by: Felipe Balbi <felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
---
 drivers/i2c/busses/i2c-omap.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index be8ee2c..0c3ed41 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -675,8 +675,9 @@ omap_i2c_isr(int this_irq, void *dev_id)
 				if (stat & OMAP_I2C_STAT_RRDY)
 					num_bytes = dev->fifo_size;
 				else
-					num_bytes = omap_i2c_read_reg(dev,
-							OMAP_I2C_BUFSTAT_REG);
+					num_bytes = (omap_i2c_read_reg(dev,
+							OMAP_I2C_BUFSTAT_REG)
+							>> 8) & 0x3F;
 			}
 			while (num_bytes) {
 				num_bytes--;
@@ -714,8 +715,9 @@ omap_i2c_isr(int this_irq, void *dev_id)
 				if (stat & OMAP_I2C_STAT_XRDY)
 					num_bytes = dev->fifo_size;
 				else
-					num_bytes = omap_i2c_read_reg(dev,
-							OMAP_I2C_BUFSTAT_REG);
+					num_bytes = (omap_i2c_read_reg(dev,
+							OMAP_I2C_BUFSTAT_REG))
+							& 0x3F;
 			}
 			while (num_bytes) {
 				num_bytes--;
-- 
1.5.6.5

  parent reply	other threads:[~2009-03-06 13:34 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-06 13:34 [PATCH 0/2] i2c: i2c-omap: Reliablity and register fixes Ari Kauppi
     [not found] ` <cover.1236345858.git.Ext-Ari.Kauppi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2009-03-06 13:34   ` Ari Kauppi [this message]
2009-03-06 13:34 ` [PATCH 2/2] i2c: i2c-omap: Call request_irq with IRQF_DISABLED Ari Kauppi
     [not found]   ` <7d7e7dd1a4c64c732a21bdfcf2bd42556be708c3.1236345858.git.Ext-Ari.Kauppi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2009-03-06 14:54     ` Woodruff, Richard
2009-03-10  0:52     ` Ben Dooks
2009-03-11 19:16       ` Felipe Balbi
2009-03-11 23:55       ` Paul Walmsley
     [not found]         ` <alpine.DEB.2.00.0903111741270.26959-rwI8Ez+7Ko+d5PgPZx9QOdBPR1lH4CV8@public.gmane.org>
2009-03-11 23:59           ` Felipe Balbi
2009-03-12  0:07             ` Paul Walmsley
     [not found]               ` <alpine.DEB.2.00.0903111804510.26959-rwI8Ez+7Ko+d5PgPZx9QOdBPR1lH4CV8@public.gmane.org>
2009-03-12  0:20                 ` Kevin Hilman
2009-03-12  0:23               ` Felipe Balbi
2009-03-12  3:30                 ` Paul Walmsley
2009-03-12  0:11             ` Felipe Contreras
2009-03-12  0:25               ` Felipe Balbi
2009-03-12  1:28             ` David Brownell
2009-03-12  0:04           ` Paul Walmsley
2009-03-12  6:26             ` Kauppi Ari (EXT-Ixonos/Oulu)
2009-03-12  6:46               ` Paul Walmsley
2009-03-12  7:54                 ` Kauppi Ari (EXT-Ixonos/Oulu)
2009-03-12  9:58                   ` Paul Walmsley
     [not found]                     ` <alpine.DEB.2.00.0903120356230.26959-rwI8Ez+7Ko+d5PgPZx9QOdBPR1lH4CV8@public.gmane.org>
2009-03-12 11:33                       ` Kauppi Ari (EXT-Ixonos/Oulu)
2009-03-12 15:04                         ` Woodruff, Richard
2009-03-13  0:04                         ` Paul Walmsley

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=187aef71c7b1862caf6fe6a935ed94cdb64ca3fd.1236345858.git.Ext-Ari.Kauppi@nokia.com \
    --to=ext-ari.kauppi-xnzwkgviw5gavxtiumwx3w@public.gmane.org \
    --cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@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 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.