From: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
To: Esben Haabendal <eha-SIcX2qgNSybd/EuGEV170n9LOBIZ5rWg@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linuxppc-dev-mnsaURCQ41sdnm+yROfE0A@public.gmane.org
Subject: Re: [PATCH] i2c-mpc: generate START condition after STOP caused by read i2c_msg
Date: Thu, 14 May 2009 10:34:53 +0200 [thread overview]
Message-ID: <20090514083453.GB3043@pengutronix.de> (raw)
In-Reply-To: <4A0BD1DB.4090305-SIcX2qgNSybd/EuGEV170n9LOBIZ5rWg@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2105 bytes --]
On Thu, May 14, 2009 at 10:10:03AM +0200, Esben Haabendal wrote:
> This fixes MAL (arbitration lost) bug caused by illegal use of
> RSTA (repeated START) after STOP condition generated after last byte
> of reads.
>
Could you elaborate a bit, please? Like an example when the original bug
occured (so I could reproduce easily) and how this patch actually solves
the problem.
> Signed-off-by: Esben Haabendal <eha-SIcX2qgNSybd/EuGEV170n9LOBIZ5rWg@public.gmane.org>
> ---
> drivers/i2c/busses/i2c-mpc.c | 9 +++++++--
> 1 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
> index 4af5c09..9fe05d9 100644
> --- a/drivers/i2c/busses/i2c-mpc.c
> +++ b/drivers/i2c/busses/i2c-mpc.c
> @@ -456,17 +456,22 @@ static int mpc_xfer(struct i2c_adapter *adap,
> struct i2c_msg *msgs, int num)
> }
>
> for (i = 0; ret >= 0 && i < num; i++) {
> + int restart = i;
> pmsg = &msgs[i];
> dev_dbg(i2c->dev,
> "Doing %s %d bytes to 0x%02x - %d of %d messages\n",
> pmsg->flags & I2C_M_RD ? "read" : "write",
> pmsg->len, pmsg->addr, i + 1, num);
> + if (i > 0 && ((pmsg-1)->flags & I2C_M_RD))
CodingStyle: Spaces around '-'
> + restart = 0;
> if (pmsg->flags & I2C_M_RD)
> ret =
> - mpc_read(i2c, pmsg->addr, pmsg->buf, pmsg->len, i);
> + mpc_read(i2c, pmsg->addr, pmsg->buf, pmsg->len,
> + restart);
> else
> ret =
> - mpc_write(i2c, pmsg->addr, pmsg->buf, pmsg->len, i);
> + mpc_write(i2c, pmsg->addr, pmsg->buf, pmsg->len,
> + restart);
> }
> mpc_i2c_stop(i2c);
> return (ret < 0) ? ret : num;
> --
> 1.6.0.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
next prev parent reply other threads:[~2009-05-14 8:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-14 8:10 [PATCH] i2c-mpc: generate START condition after STOP caused by read i2c_msg Esben Haabendal
[not found] ` <4A0BD1DB.4090305-SIcX2qgNSybd/EuGEV170n9LOBIZ5rWg@public.gmane.org>
2009-05-14 8:34 ` Wolfram Sang [this message]
[not found] ` <20090514083453.GB3043-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2009-05-14 8:48 ` Esben Haabendal
2009-05-14 9:58 ` Joakim Tjernlund
[not found] ` <d2b9ea600905140317u7a4b9a70s574568d79a1ce7cc@mail.gmail.com>
[not found] ` <OF3CD158BA.04CCFBB5-ONC12575B6.005911D5-C12575B6.005CAFC2@transmode.se>
[not found] ` <OF3CD158BA.04CCFBB5-ONC12575B6.005911D5-C12575B6.005CAFC2-SNLAxHN9vbcOP4wsBPIw7w@public.gmane.org>
2009-05-15 10:18 ` Esben Haabendal
[not found] ` <d2b9ea600905150318s69b86b5ct3816b274bf343a79-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-05-15 11:05 ` Joakim Tjernlund
[not found] ` <OFCADC684E.A2599121-ONC12575B7.003B8AB5-C12575B7.003CF795-SNLAxHN9vbcOP4wsBPIw7w@public.gmane.org>
2009-05-15 12:52 ` Esben Haabendal
[not found] ` <d2b9ea600905150552u6951a92es5dd119dcc37e641d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-05-15 14:16 ` Joakim Tjernlund
2009-05-18 11:04 ` 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=20090514083453.GB3043@pengutronix.de \
--to=w.sang-bicnvbalz9megne8c9+irq@public.gmane.org \
--cc=eha-SIcX2qgNSybd/EuGEV170n9LOBIZ5rWg@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linuxppc-dev-mnsaURCQ41sdnm+yROfE0A@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).