From: David Brownell <david-b@pacbell.net>
To: ext-eero.nurkkala@nokia.com
Cc: linux-omap@vger.kernel.org
Subject: Re: [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading
Date: Mon, 24 Nov 2008 23:27:11 -0800 [thread overview]
Message-ID: <200811242327.12026.david-b@pacbell.net> (raw)
In-Reply-To: <12275961701188-git-send-email-ext-eero.nurkkala@nokia.com>
On Monday 24 November 2008, ext-eero.nurkkala@nokia.com wrote:
> From: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
>
> The amount of bytes to receive is read from wrong
> place with omap 2430 and omap 3430.
More simply: on all OMAPs with highspeed I2C support,
which involves a FIFO and BUFSTAT_REG.
> It is the 6 bits
> starting from the bit 8 from BUFSTAT_REG that indicate
> this amount. Not the 8 LSB:s. Only 6 LSB:s are used
> for the TX buffer. Moreover, only the 6 LSB:s are
> relevant for XDR.
>
> Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
> ---
> drivers/i2c/busses/i2c-omap.c | 25 +++++++++++++++++++------
> 1 files changed, 19 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 96f3bed..630702c 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -672,11 +672,19 @@ omap_i2c_isr(int this_irq, void *dev_id)
> if (stat & (OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR)) {
> u8 num_bytes = 1;
> if (dev->fifo_size) {
... i.e. if (dev->rev >= OMAP_I2C_REV_ON_2430) ..
> - if (stat & OMAP_I2C_STAT_RRDY)
> + if (stat & OMAP_I2C_STAT_RRDY) {
> num_bytes = dev->fifo_size;
> - else
> - num_bytes = omap_i2c_read_reg(dev,
> + } else {
> + if (dev->rev >= OMAP_I2C_REV_ON_2430)
> + num_bytes =
> + (omap_i2c_read_reg(dev,
> + OMAP_I2C_BUFSTAT_REG)
> + >> 8) & 0x3F;
> + else
> + num_bytes =
> + omap_i2c_read_reg(dev,
> OMAP_I2C_BUFSTAT_REG);
... so this "else" branch is not needed, neither is the "if" test defining
the two branches ...
> + }
> }
> while (num_bytes) {
> num_bytes--;
> @@ -711,11 +719,16 @@ omap_i2c_isr(int this_irq, void *dev_id)
> if (stat & (OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR)) {
> u8 num_bytes = 1;
> if (dev->fifo_size) {
... likewise ...
> - if (stat & OMAP_I2C_STAT_XRDY)
> + if (stat & OMAP_I2C_STAT_XRDY) {
> num_bytes = dev->fifo_size;
> - else
> - num_bytes = omap_i2c_read_reg(dev,
> + } else {
> + num_bytes =
> + omap_i2c_read_reg(dev,
> OMAP_I2C_BUFSTAT_REG);
> +
> + if (dev->rev >= OMAP_I2C_REV_ON_2430)
> + num_bytes &= 0x3F;
... and likewise.
> + }
> }
> while (num_bytes) {
> num_bytes--;
> --
> 1.6.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
next prev parent reply other threads:[~2008-11-25 7:27 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-25 6:56 [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading ext-eero.nurkkala
2008-11-25 7:27 ` David Brownell [this message]
2008-11-25 9:19 ` Eero Nurkkala
2008-11-25 10:01 ` David Brownell
-- strict thread matches above, loose matches on Subject: below --
2008-11-25 11:03 ext-eero.nurkkala
2009-01-08 13:37 ` Tony Lindgren
2008-11-25 11:02 ext-eero.nurkkala
2008-11-14 8:41 ext-eero.nurkkala
2008-11-14 19:16 ` David Brownell
2008-11-19 12:12 ` Eero Nurkkala
2008-11-19 17:34 ` David Brownell
2008-11-21 22:03 ` Tony Lindgren
2008-11-11 6:51 ext-eero.nurkkala
2008-11-11 9:57 ` shekhar, chandra
2008-11-10 10:46 ext-eero.nurkkala
2008-11-10 12:27 ` Felipe Balbi
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=200811242327.12026.david-b@pacbell.net \
--to=david-b@pacbell.net \
--cc=ext-eero.nurkkala@nokia.com \
--cc=linux-omap@vger.kernel.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