public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] arm: omap3: i2c: don't zero cnt in i2c_write
Date: Wed, 27 Nov 2013 10:09:28 -0500	[thread overview]
Message-ID: <20131127150928.GA420@bill-the-cat> (raw)
In-Reply-To: <1385563449-15094-1-git-send-email-nikita@compulab.co.il>

On Wed, Nov 27, 2013 at 04:44:09PM +0200, Nikita Kiryanov wrote:
> The zeroing of I2Ci.I2C_CNT register at the end of i2c_write causes
> random I2C failures in OMAP3 based devices. This is probably related
> to the following advisory in OMAP3 errata:
> 
> I2C Module Does Not Allow 0-Byte Data Requests
> Details:
> When configured as the master, the I2C module does not allow 0-byte data
> transfers. Note: Programming I2Ci.I2C_CNT[15:0]: DCOUNT = 0 will cause
> undefined behavior.
> Workaround(s):
> No workaround. Do not use 0-byte data requests.
> 
> Make the write conditional so that only non-OMAP3 devices will perform it.
> 
> Cc: Heiko Schocher <hs@denx.de>
> Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
> ---
>  drivers/i2c/omap24xx_i2c.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/i2c/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c
> index 3d38c03..2862a8f 100644
> --- a/drivers/i2c/omap24xx_i2c.c
> +++ b/drivers/i2c/omap24xx_i2c.c
> @@ -473,7 +473,10 @@ static int omap24_i2c_write(struct i2c_adapter *adap, uchar chip, uint addr,
>  wr_exit:
>  	flush_fifo(adap);
>  	writew(0xFFFF, &i2c_base->stat);
> +	/* This write is known to cause undefined behavior on OMAP3 */
> +#ifndef CONFIG_OMAP34XX
>  	writew(0, &i2c_base->cnt);
> +#endif
>  	return i2c_error;
>  }

Yay for tracking this down.  Can you please expand the comment to
mention the specific advisory?  Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131127/8a074c06/attachment.pgp>

  reply	other threads:[~2013-11-27 15:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-27 14:44 [U-Boot] [PATCH] arm: omap3: i2c: don't zero cnt in i2c_write Nikita Kiryanov
2013-11-27 15:09 ` Tom Rini [this message]
2013-11-27 16:11   ` Nikita Kiryanov
2013-11-28 16:04 ` [U-Boot] [PATCH V2] arm: omap: " Nikita Kiryanov
2013-11-29 10:22   ` Enric Balletbo Serra
2013-11-29 16:05   ` Lubomir Popov
2013-12-02  7:08   ` Andreas Naumann
2013-12-02 12:48   ` Thomas Petazzoni
2013-12-02 15:47   ` Lubomir Popov
2013-12-03  4:02     ` Lokesh Vutla
2013-12-03  8:50       ` Lubomir Popov
2013-12-03 11:10         ` Lokesh Vutla
2013-12-09  6:57   ` [U-Boot] [U-Boot, " Heiko Schocher

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=20131127150928.GA420@bill-the-cat \
    --to=trini@ti.com \
    --cc=u-boot@lists.denx.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