From: Nishanth Menon <nm@ti.com>
To: "Sonasath, Moiz" <m-sonasath@ti.com>
Cc: "linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
"Kamat, Nishant" <nskamat@ti.com>, Paul Walmsley <paul@pwsan.com>
Subject: Re: [PATCH 3/3] [OMAP:I2C]OMAP3430 Silicon Errata 1.153
Date: Tue, 14 Jul 2009 18:23:25 -0500 [thread overview]
Message-ID: <4A5D136D.8030701@ti.com> (raw)
In-Reply-To: <CD8CC2B65FEE304DA95744A5472698F202957C7AFE@dlee06.ent.ti.com>
Sonasath, Moiz wrote:
> When an XRDY/XDR is hit, wait for XUDF before writing data to DATA_REG.
> Otherwise some data bytes can be lost while transferring them from the
> memory to the I2C interface.
>
> Do a Busy-wait for XUDF, before writing data to DATA_REG. While waiting
> if there is NACK | AL, set the appropriate error flags, ack the pending
> interrupts and return from the ISR.
>
> Signed-off-by: Moiz Sonasath<m-sonasath@ti.com>
> Signed-off-by: Vikram Pandita<vikram.pandita@ti.com>
> ---
> drivers/i2c/busses/i2c-omap.c | 24 +++++++++++++++++++++++-
> 1 files changed, 23 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 05b5e4c..8deaf87 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -672,9 +672,10 @@ omap_i2c_isr(int this_irq, void *dev_id)
> break;
> }
>
> + err = 0;
> +complete:
cant we rename this label?
> omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, stat);
>
> - err = 0;
> if (stat & OMAP_I2C_STAT_NACK) {
> err |= OMAP_I2C_STAT_NACK;
> omap_i2c_write_reg(dev, OMAP_I2C_CON_REG,
> @@ -764,6 +765,27 @@ omap_i2c_isr(int this_irq, void *dev_id)
> "data to send\n");
> break;
> }
> +
> + /*
> + * OMAP3430 Errata 1.153: When an XRDY/XDR
> + * is hit, wait for XUDF before writing data
> + * to DATA_REG. Otherwise some data bytes can
> + * be lost while transferring them from the
> + * memory to the I2C interface.
> + */
> +
> + if (cpu_is_omap34xx()) {
> + while (!(stat & OMAP_I2C_STAT_XUDF)) {
> + if (stat & (OMAP_I2C_STAT_NACK | OMAP_I2C_STAT_AL)) {
> + omap_i2c_ack_stat(dev, stat & (OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR));
generic comment - code nesting is getting overwhelming - we may like to
refactor the isr function at a later date I think..
> + err |= OMAP_I2C_STAT_XUDF;
why set the err if we wantedly force this to happen?
> + goto complete;
> + }
> + cpu_relax();
> + stat = omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG);
> + }
this is an infinite while loop + it tries to handle error cases -
essentially do another isr routine inside itself.
How about:
Apply [1] and the following?
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index ad8d201..e3f21af 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -728,6 +728,12 @@ omap_i2c_isr(int this_irq, void *dev_id)
}
if (stat & (OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR)) {
u8 num_bytes = 1;
+ if (cpu_is_omap34xx() &&
+ !(stat & OMAP_I2C_STAT_XUDF)){
+ cpu_relax();
+ continue;
+ }
+
if (dev->fifo_size) {
if (stat & OMAP_I2C_STAT_XRDY)
num_bytes = dev->fifo_size;
Regards,
Nishanth Menon
Ref:
[1] http://patchwork.kernel.org/patch/32332/
next prev parent reply other threads:[~2009-07-14 23:23 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-14 21:21 [PATCH 3/3] [OMAP:I2C]OMAP3430 Silicon Errata 1.153 Sonasath, Moiz
2009-07-14 23:23 ` Nishanth Menon [this message]
2009-07-15 15:40 ` Sonasath, Moiz
2009-07-15 21:43 ` Nishanth Menon
2009-07-15 22:23 ` Sonasath, Moiz
2009-07-15 22:27 ` Nishanth Menon
2009-07-15 22:29 ` Sonasath, Moiz
2009-07-15 22:31 ` Nishanth Menon
2009-07-15 22:37 ` Sonasath, Moiz
2009-07-15 23:03 ` Nishanth Menon
2009-07-16 15:52 ` Sonasath, Moiz
2009-07-20 16:54 ` Sonasath, Moiz
-- strict thread matches above, loose matches on Subject: below --
2009-07-21 15:15 Sonasath, Moiz
2009-08-03 7:35 ` Paul Walmsley
2009-08-03 20:19 ` Sonasath, Moiz
[not found] ` <CD8CC2B65FEE304DA95744A5472698F202959C0D61-UmuGNrFEPrGIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2009-08-10 15:44 ` Sonasath, Moiz
2009-08-10 16:29 ` Paul Walmsley
2009-08-11 16:33 ` Sonasath, Moiz
[not found] ` <CD8CC2B65FEE304DA95744A5472698F20295A89A21-UmuGNrFEPrGIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2009-08-16 17:39 ` Paul Walmsley
[not found] ` <alpine.DEB.2.00.0908160841160.31720-rwI8Ez+7Ko+d5PgPZx9QOdBPR1lH4CV8@public.gmane.org>
2009-08-20 17:16 ` Sonasath, Moiz
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=4A5D136D.8030701@ti.com \
--to=nm@ti.com \
--cc=linux-omap@vger.kernel.org \
--cc=m-sonasath@ti.com \
--cc=nskamat@ti.com \
--cc=paul@pwsan.com \
/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