From: Tony Lindgren <tony@atomide.com>
To: linux-omap@vger.kernel.org
Subject: Re: [PATCH 3/4] I2C: Ensure write posting for critical i2c-omap writes
Date: Fri, 31 Oct 2008 14:03:38 -0700 [thread overview]
Message-ID: <20081031210337.GE28924@atomide.com> (raw)
In-Reply-To: <1225480873-30835-4-git-send-email-tony@atomide.com>
[-- Attachment #1: Type: text/plain, Size: 291 bytes --]
* Tony Lindgren <tony@atomide.com> [081031 12:21]:
> Otherwise we may race, or will get spurious I2C interrupts:
>
> i2c_omap.1: XDR IRQ while no data to send
> ...
Here's an updated version of this to say "flush posted write" for easy
grepping. Also change previous wmb() to flush.
Tony
[-- Attachment #2: flush-i2c.patch --]
[-- Type: text/x-diff, Size: 1622 bytes --]
>From df5cf408d3a59a892ba8ff25feed402fdeb53a0d Mon Sep 17 00:00:00 2001
From: Tony Lindgren <tony@atomide.com>
Date: Fri, 31 Oct 2008 13:56:16 -0700
Subject: [PATCH] I2C: Flush posted write for i2c-omap
Otherwise we may race, or will get spurious I2C interrupts:
i2c_omap.1: XDR IRQ while no data to send
...
Also replace previous wmb() with a readback to flush posted write
there too.
Signed-off-by: Tony Lindgren <tony@atomide.com>
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index a999606..6d40781 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -220,16 +220,14 @@ static void omap_i2c_idle(struct omap_i2c_dev *dev)
dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);
omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, 0);
- if (dev->rev1)
+ if (dev->rev1) {
iv = omap_i2c_read_reg(dev, OMAP_I2C_IV_REG); /* Read clears */
- else
+ } else {
omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, dev->iestate);
- /*
- * The wmb() is to ensure that the I2C interrupt mask write
- * reaches the I2C controller before the dev->idle store
- * occurs.
- */
- wmb();
+
+ /* Flush posted write for interrupt mask before dev->idle = 1 */
+ omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG);
+ }
dev->idle = 1;
clk_disable(dev->fclk);
if (dev->iclk != NULL)
@@ -689,6 +687,9 @@ omap_i2c_isr(int this_irq, void *dev_id)
break;
}
omap_i2c_write_reg(dev, OMAP_I2C_DATA_REG, w);
+
+ /* Flush posted write */
+ omap_i2c_read_reg(dev, OMAP_I2C_DATA_REG);
}
omap_i2c_ack_stat(dev,
stat & (OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR));
next prev parent reply other threads:[~2008-10-31 21:03 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-31 19:21 [PATCH 0/4] 34xx spurious interrupts unravelling Tony Lindgren
2008-10-31 19:21 ` [PATCH 1/4] Revert "Add MT_MEMORY_SO, mark L3 and L4 to use it" Tony Lindgren
2008-10-31 19:21 ` [PATCH 2/4] ARM: OMAP3: Print debug info on spurious interrupts Tony Lindgren
2008-10-31 19:21 ` [PATCH 3/4] I2C: Ensure write posting for critical i2c-omap writes Tony Lindgren
2008-10-31 19:21 ` [PATCH 4/4] DSPBRIDGE: Ensure write posting when acking mailbox irq Tony Lindgren
2008-10-31 21:06 ` Tony Lindgren
2008-11-01 3:43 ` Woodruff, Richard
2008-11-02 22:10 ` Tony Lindgren
2008-11-03 18:54 ` Tony Lindgren
2008-10-31 21:03 ` Tony Lindgren [this message]
2008-10-31 20:55 ` [PATCH 2/4] ARM: OMAP3: Print debug info on spurious interrupts Tony Lindgren
2008-10-31 20:07 ` [PATCH 0/4] 34xx spurious interrupts unravelling David Brownell
2008-10-31 20:35 ` Tony Lindgren
2008-10-31 21:59 ` David Brownell
2008-11-01 4:01 ` Woodruff, Richard
2008-11-01 6:08 ` David Brownell
2008-11-01 12:57 ` Woodruff, Richard
2008-11-01 21:14 ` Felipe Contreras
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=20081031210337.GE28924@atomide.com \
--to=tony@atomide.com \
--cc=linux-omap@vger.kernel.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