From: Jochen Friedrich <jochen-NIgtFMG+Po8@public.gmane.org>
To: Laurent Pinchart
<laurentp-BSmb2szPELAwsLKNixborgC/G2K4zDHf@public.gmane.org>
Cc: linuxppc-dev-mnsaURCQ41sdnm+yROfE0A@public.gmane.org,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: Erratic MPC8248 CPM2 I2C behaviour
Date: Thu, 04 Dec 2008 16:37:15 +0100 [thread overview]
Message-ID: <4937F92B.6050701@scram.de> (raw)
In-Reply-To: <200811281724.49620.laurentp-BSmb2szPELAwsLKNixborgC/G2K4zDHf@public.gmane.org>
Hi Laurent,
> The two messages making up the transaction are parsed. The driver fills a TX
> buffer descriptor for the first one, and a TX and an RX buffer descriptor for
> the second one.
>
>> rbase 0x01e0 tbase 0x01c0 rfcr 0x30 tfcr 0x30 mrblr 0x0201
>> rstate 0x00000000 rptr 0x00000000 rbptr 0x01e0 rcount 0x0000 rtmp 0x00000000
>> tstate 0x00000000 tptr 0x00000000 tbptr 0x01c0 tcount 0x0000 ttmp 0x00000000
>> i2mod 0x00, i2add 0xfe i2brg 0x03 i2com 0x01 i2cer 0x00 i2cmr 0x00
>> rx 0 sc 0x9000 tx 0 sc 0x9400
>> rx 1 sc 0x7da4 tx 1 sc 0xac00
>> rx 2 sc 0xefef tx 2 sc 0x743b
>> rx 3 sc 0xf264 tx 3 sc 0x10e6
Just to rule out some possible issues with the rx queue,
could you check if this patch improves anything?
Thanks,
Jochen
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index 228f757..b83b733 100644
--- a/drivers/i2c/busses/i2c-cpm.c
+++ b/drivers/i2c/busses/i2c-cpm.c
@@ -231,12 +231,6 @@ static void cpm_i2c_parse_message(struct i2c_adapter *adap,
dev_dbg(&adap->dev, "cpm_i2c_read(abyte=0x%x)\n", addr);
- out_be16(&rbdf->cbd_datlen, 0);
- out_be16(&rbdf->cbd_sc, BD_SC_EMPTY | BD_SC_INTRPT);
-
- if (rx + 1 == CPM_MAXBD)
- setbits16(&rbdf->cbd_sc, BD_SC_WRAP);
-
eieio();
setbits16(&tbdf->cbd_sc, BD_SC_READY);
} else {
@@ -328,6 +322,16 @@ static int cpm_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
return -EINVAL;
}
+ /* Initialize rx queue */
+ for (i = 0; i < CPM_MAXBD; i++) {
+ rbdf = cpm->rbase + i;
+ out_be16(&rbdf->cbd_datlen, 0);
+ out_be16(&rbdf->cbd_sc, BD_SC_EMPTY | BD_SC_INTRPT);
+
+ if (i + 1 == CPM_MAXBD)
+ setbits16(&rbdf->cbd_sc, BD_SC_WRAP);
+ }
+
/* Reset to use first buffer */
out_be16(&i2c_ram->rbptr, in_be16(&i2c_ram->rbase));
out_be16(&i2c_ram->tbptr, in_be16(&i2c_ram->tbase));
WARNING: multiple messages have this Message-ID (diff)
From: Jochen Friedrich <jochen@scram.de>
To: Laurent Pinchart <laurentp@cse-semaphore.com>
Cc: linuxppc-dev@ozlabs.org, linux-i2c@vger.kernel.org
Subject: Re: Erratic MPC8248 CPM2 I2C behaviour
Date: Thu, 04 Dec 2008 16:37:15 +0100 [thread overview]
Message-ID: <4937F92B.6050701@scram.de> (raw)
In-Reply-To: <200811281724.49620.laurentp@cse-semaphore.com>
Hi Laurent,
> The two messages making up the transaction are parsed. The driver fills a TX
> buffer descriptor for the first one, and a TX and an RX buffer descriptor for
> the second one.
>
>> rbase 0x01e0 tbase 0x01c0 rfcr 0x30 tfcr 0x30 mrblr 0x0201
>> rstate 0x00000000 rptr 0x00000000 rbptr 0x01e0 rcount 0x0000 rtmp 0x00000000
>> tstate 0x00000000 tptr 0x00000000 tbptr 0x01c0 tcount 0x0000 ttmp 0x00000000
>> i2mod 0x00, i2add 0xfe i2brg 0x03 i2com 0x01 i2cer 0x00 i2cmr 0x00
>> rx 0 sc 0x9000 tx 0 sc 0x9400
>> rx 1 sc 0x7da4 tx 1 sc 0xac00
>> rx 2 sc 0xefef tx 2 sc 0x743b
>> rx 3 sc 0xf264 tx 3 sc 0x10e6
Just to rule out some possible issues with the rx queue,
could you check if this patch improves anything?
Thanks,
Jochen
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index 228f757..b83b733 100644
--- a/drivers/i2c/busses/i2c-cpm.c
+++ b/drivers/i2c/busses/i2c-cpm.c
@@ -231,12 +231,6 @@ static void cpm_i2c_parse_message(struct i2c_adapter *adap,
dev_dbg(&adap->dev, "cpm_i2c_read(abyte=0x%x)\n", addr);
- out_be16(&rbdf->cbd_datlen, 0);
- out_be16(&rbdf->cbd_sc, BD_SC_EMPTY | BD_SC_INTRPT);
-
- if (rx + 1 == CPM_MAXBD)
- setbits16(&rbdf->cbd_sc, BD_SC_WRAP);
-
eieio();
setbits16(&tbdf->cbd_sc, BD_SC_READY);
} else {
@@ -328,6 +322,16 @@ static int cpm_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
return -EINVAL;
}
+ /* Initialize rx queue */
+ for (i = 0; i < CPM_MAXBD; i++) {
+ rbdf = cpm->rbase + i;
+ out_be16(&rbdf->cbd_datlen, 0);
+ out_be16(&rbdf->cbd_sc, BD_SC_EMPTY | BD_SC_INTRPT);
+
+ if (i + 1 == CPM_MAXBD)
+ setbits16(&rbdf->cbd_sc, BD_SC_WRAP);
+ }
+
/* Reset to use first buffer */
out_be16(&i2c_ram->rbptr, in_be16(&i2c_ram->rbase));
out_be16(&i2c_ram->tbptr, in_be16(&i2c_ram->tbase));
next prev parent reply other threads:[~2008-12-04 15:37 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-28 16:24 Erratic MPC8248 CPM2 I2C behaviour Laurent Pinchart
2008-11-29 5:41 ` Wolfram Sang
[not found] ` <20081129054153.GA22692-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2008-12-01 9:56 ` Laurent Pinchart
2008-12-01 9:56 ` Laurent Pinchart
[not found] ` <200811281724.49620.laurentp-BSmb2szPELAwsLKNixborgC/G2K4zDHf@public.gmane.org>
2008-12-04 15:37 ` Jochen Friedrich [this message]
2008-12-04 15:37 ` Jochen Friedrich
-- strict thread matches above, loose matches on Subject: below --
2008-12-01 9:52 Laurent Pinchart
[not found] <mailman.569.1227903153.29923.linuxppc-dev@ozlabs.org>
[not found] ` <mailman.569.1227903153.29923.linuxppc-dev-mnsaURCQ41sdnm+yROfE0A@public.gmane.org>
2008-12-01 23:28 ` Mike Ditto
2008-12-01 23:28 ` Mike Ditto
2008-12-02 8:39 ` Joakim Tjernlund
2008-12-02 8:39 ` Joakim Tjernlund
[not found] ` <1228207199.9867.69.camel-/EMGr9iCeazgSi9v3i4K4Pmbkio/vSLMs0AfqQuZ5sE@public.gmane.org>
2008-12-02 10:50 ` Laurent Pinchart
2008-12-02 10:50 ` Laurent Pinchart
[not found] ` <200812021150.26233.laurentp-BSmb2szPELAwsLKNixborgC/G2K4zDHf@public.gmane.org>
2008-12-02 11:45 ` Joakim Tjernlund
2008-12-02 11:45 ` Joakim Tjernlund
2008-12-03 2:27 ` Mike Ditto
2008-12-03 2:27 ` Mike Ditto
[not found] ` <49347317.5080600-Vjf7OWgA3BLqlBn2x/YWAg@public.gmane.org>
2008-12-02 11:07 ` Laurent Pinchart
2008-12-02 11:07 ` Laurent Pinchart
[not found] ` <200812021207.06140.laurentp-BSmb2szPELAwsLKNixborgC/G2K4zDHf@public.gmane.org>
2008-12-03 1:44 ` Mike Ditto
2008-12-03 1:44 ` Mike Ditto
2008-12-01 23:30 ` Mike Ditto
2008-12-01 23:30 ` Mike Ditto
2008-12-02 0:51 ` Mike Ditto
2008-12-02 0:51 ` Mike Ditto
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=4937F92B.6050701@scram.de \
--to=jochen-nigtfmg+po8@public.gmane.org \
--cc=laurentp-BSmb2szPELAwsLKNixborgC/G2K4zDHf@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 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.