From: Alexander Kochetkov <al.kochet@gmail.com>
To: Tony Lindgren <tony@atomide.com>
Cc: Kevin Hilman <khilman@kernel.org>,
linux-omap@vger.kernel.org, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org, Felipe Balbi <balbi@ti.com>,
Wolfram Sang <wsa@the-dreams.de>
Subject: Re: [RFC] i2c: omap: TEST: do IP reset during probe.
Date: Sat, 29 Nov 2014 05:14:13 +0300 [thread overview]
Message-ID: <AECD26B8-1FFA-4FFB-AC68-4CDC50F3F48B@gmail.com> (raw)
In-Reply-To: <20141128221350.GW2817@atomide.com>
29 нояб. 2014 г., в 1:13, Tony Lindgren <tony@atomide.com> написал(а):
> Looks like for some time 2430 i2c has not been behaving
> reliably
commit dd74548ddece4b9d68e5528287a272fa552c81d0 ("i2c: omap:
resize fifos before each message") dropped check for dev->buf_len.
As result, data processing loop cause dev->buf overruns for
devices with 16-bit data register (omap2420 only).
Found by code review.
I have the patch for that. omap2420 actually broken at all.
But I'm not ready to send it right now.
Part of the patch:
- while (num_bytes--) {
+ while (num_bytes) {
w = omap_i2c_read_reg(dev, OMAP_I2C_DATA_REG);
*dev->buf++ = w;
dev->buf_len--;
+ num_bytes--;
/*
* Data reg in 2430, omap3 and
* omap4 is 8 bit wide
*/
if (dev->flags & OMAP_I2C_FLAG_16BIT_DATA_REG) {
- *dev->buf++ = w >> 8;
- dev->buf_len--;
+ if (num_bytes) {
+ *dev->buf++ = w >> 8;
+ dev->buf_len--;
+ num_bytes--;
+ }
}
}
- while (num_bytes--) {
+ while (num_bytes) {
if (dev->errata & I2C_OMAP_ERRATA_I462) {
int ret;
@@ -931,14 +947,18 @@ static int omap_i2c_transmit_data(struct omap_i2c_dev *dev, u8 num_bytes,
w = *dev->buf++;
dev->buf_len--;
+ num_bytes--;
/*
* Data reg in 2430, omap3 and
* omap4 is 8 bit wide
*/
if (dev->flags & OMAP_I2C_FLAG_16BIT_DATA_REG) {
- w |= *dev->buf++ << 8;
- dev->buf_len--;
+ if (num_bytes) {
+ w |= *dev->buf++ << 8;
+ dev->buf_len--;
+ num_bytes--;
+ }
}
next prev parent reply other threads:[~2014-11-29 2:14 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-20 21:28 [RFC 0/4] i2c: omap: patch series related to multimaster mode Alexander Kochetkov
2014-11-20 21:28 ` [PATCH 1/4] i2c: omap: cleanup register definitions Alexander Kochetkov
2014-11-21 16:08 ` Felipe Balbi
2014-11-20 21:28 ` [PATCH 2/4] i2c: omap: implement workaround for handling invalid BB-bit values Alexander Kochetkov
2014-11-21 16:08 ` Felipe Balbi
2014-11-22 13:23 ` Wolfram Sang
2014-11-22 14:06 ` Alexander Kochetkov
2014-11-22 18:02 ` Wolfram Sang
2014-11-23 4:43 ` Felipe Balbi
2014-11-23 13:18 ` Alexander Kochetkov
2014-11-24 19:08 ` Felipe Balbi
2014-11-24 19:09 ` Felipe Balbi
2014-11-20 21:28 ` [PATCH 3/4] i2c: omap: don't reset controller if Arbitration Lost detected Alexander Kochetkov
2014-11-21 16:08 ` Felipe Balbi
2014-11-21 18:11 ` Wolfram Sang
2014-11-21 22:51 ` [PATCH v2 " Alexander Kochetkov
2014-11-22 1:07 ` Felipe Balbi
2014-11-20 21:28 ` [PATCH 4/4] i2c: omap: add notes related to i2c multimaster mode Alexander Kochetkov
2014-11-21 16:08 ` Felipe Balbi
2014-11-22 19:47 ` [PATCH v3 0/4] i2c: omap: patch series related to " Alexander Kochetkov
2014-11-22 19:47 ` [PATCH v3 1/4] i2c: omap: cleanup register definitions Alexander Kochetkov
2014-11-22 19:47 ` [PATCH v3 2/4] i2c: omap: implement workaround for handling invalid BB-bit values Alexander Kochetkov
2014-11-24 19:08 ` Kevin Hilman
2014-11-24 19:10 ` Felipe Balbi
2014-11-24 19:13 ` Wolfram Sang
2014-11-24 19:25 ` Tony Lindgren
2014-11-24 19:39 ` Alexander Kochetkov
2014-11-24 19:47 ` Tony Lindgren
2014-11-24 20:05 ` Alexander Kochetkov
2014-11-25 0:09 ` Alexander Kochetkov
2014-11-25 15:41 ` Tony Lindgren
2014-11-24 21:08 ` Alexander Kochetkov
2014-11-26 22:30 ` Alexander Kochetkov
2014-11-24 20:33 ` [PATCH] omap: i2c: don't check bus state IP rev3.3 and earlier Alexander Kochetkov
2014-11-24 21:08 ` Tony Lindgren
2014-11-24 22:20 ` [PATCH v2] " Alexander Kochetkov
2014-11-25 14:19 ` Wolfram Sang
2014-11-25 14:38 ` Alexander Kochetkov
2014-11-25 19:13 ` Kevin Hilman
2014-11-26 19:26 ` Alexander Kochetkov
2014-11-26 21:33 ` Kevin Hilman
2014-11-25 19:12 ` Kevin Hilman
2014-11-26 19:05 ` [RFC] i2c: omap: TEST: do IP reset during probe Alexander Kochetkov
2014-11-26 21:25 ` Kevin Hilman
2014-11-28 22:13 ` Tony Lindgren
2014-11-28 23:25 ` Alexander Kochetkov
2014-11-29 22:06 ` Tony Lindgren
2014-11-29 2:14 ` Alexander Kochetkov [this message]
2014-11-22 19:47 ` [PATCH v3 3/4] i2c: omap: don't reset controller if Arbitration Lost detected Alexander Kochetkov
2014-11-22 19:47 ` [PATCH v3 4/4] i2c: omap: add notes related to i2c multimaster mode Alexander Kochetkov
2014-11-22 21:08 ` [PATCH v3 0/4] i2c: omap: patch series related to " 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=AECD26B8-1FFA-4FFB-AC68-4CDC50F3F48B@gmail.com \
--to=al.kochet@gmail.com \
--cc=balbi@ti.com \
--cc=khilman@kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=tony@atomide.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
Powered by JetHome