From: Grygorii Strashko <grygorii.strashko@ti.com>
To: Wolfram Sang <wsa@the-dreams.de>, Tony Lindgren <tony@atomide.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-omap@vger.kernel.org>,
<linux-i2c@vger.kernel.org>,
Grygorii Strashko <grygorii.strashko@ti.com>,
Kevin Hilman <khilman@linaro.org>
Subject: [PATCH 3/5] i2c: omap: handle all irqs befor unblocking omap_i2c_xfer_msg()
Date: Fri, 7 Jun 2013 21:46:06 +0300 [thread overview]
Message-ID: <1370630768-4077-4-git-send-email-grygorii.strashko@ti.com> (raw)
In-Reply-To: <1370630768-4077-1-git-send-email-grygorii.strashko@ti.com>
ARDY|NACK and ARDY|AL are set together in OMAP_I2C_STAT_REG, which will be
processed incorrectly now:
iterration 1:
- I2C irq triggered (ARDY|NACK)
- omap_i2c_isr_thread() will ask NACK, fill dev->cmd_err = OMAP_I2C_STAT_NACK
and trigger "cmd_complete" completion.
- omap_i2c_xfer_msg() will be unblocked, hande NACK and finish its execution.
- omap_i2c_xfer() will finish
iteration 2:
- I2C irq triggered (ARDY)
- omap_i2c_isr_thread() will ask ARDY, trigger completion
At this point dev->cmd_err == OMAP_I2C_STAT_NACK, "cmd_complete" is not
initialized and omap_i2c_xfer() may be completed at all.
So, I2C driver is not ready for iteration 2.
Hence, fix it by asking NACK, AL and ARDY all togather in omap_i2c_isr_thread()
before unblocking omap_i2c_xfer_msg() execution.
This is the "old" I2C interrupt handler behavior which was changed by commit:
1d7afc95946487945cc7f5019b41255b72224b70 "i2c: omap: ack IRQ in parts".
CC: Kevin Hilman <khilman@linaro.org>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
drivers/i2c/busses/i2c-omap.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 2dac598..46fb8a5 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -938,17 +938,15 @@ omap_i2c_isr_thread(int this_irq, void *dev_id)
break;
}
+ omap_i2c_ack_stat(dev, OMAP_I2C_STAT_NACK | OMAP_I2C_STAT_AL);
+
if (stat & OMAP_I2C_STAT_NACK) {
err |= OMAP_I2C_STAT_NACK;
- omap_i2c_ack_stat(dev, OMAP_I2C_STAT_NACK);
- break;
}
if (stat & OMAP_I2C_STAT_AL) {
dev_err(dev->dev, "Arbitration lost\n");
err |= OMAP_I2C_STAT_AL;
- omap_i2c_ack_stat(dev, OMAP_I2C_STAT_AL);
- break;
}
/*
--
1.7.9.5
next prev parent reply other threads:[~2013-06-07 18:50 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-07 18:46 [PATCH 0/5] v3.10-rc4: fix OMAP4 boot failure if CONFIG_SENSORS_LM75=y Grygorii Strashko
2013-06-07 18:46 ` [PATCH 1/5] i2c: omap: fix spurious IRQs: disable/enable IRQ at INTC when idle Grygorii Strashko
2013-06-07 20:51 ` Kevin Hilman
2013-06-19 18:35 ` Grygorii Strashko
2013-06-19 19:31 ` Felipe Balbi
2013-06-19 20:01 ` Kevin Hilman
2013-06-19 20:56 ` Felipe Balbi
2013-06-07 18:46 ` [PATCH 2/5] i2c: omap: add runtime check in isr to be sure that i2c is enabled Grygorii Strashko
2013-06-07 19:02 ` Felipe Balbi
2013-06-19 18:42 ` Grygorii Strashko
2013-06-19 19:39 ` Felipe Balbi
2013-06-07 18:46 ` Grygorii Strashko [this message]
2013-06-07 19:05 ` [PATCH 3/5] i2c: omap: handle all irqs befor unblocking omap_i2c_xfer_msg() Felipe Balbi
2013-06-19 18:43 ` Grygorii Strashko
2013-06-19 19:44 ` Felipe Balbi
2013-06-07 18:46 ` [PATCH 4/5] i2c: omap: query STP always when NACK is received Grygorii Strashko
2013-06-07 19:07 ` Felipe Balbi
2013-06-07 18:46 ` [PATCH 5/5] i2c: omap: remove omap_i2c_isr() hw irq handler Grygorii Strashko
2013-06-07 19:07 ` Felipe Balbi
2013-06-19 18:43 ` Grygorii Strashko
2013-06-19 19:44 ` Felipe Balbi
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=1370630768-4077-4-git-send-email-grygorii.strashko@ti.com \
--to=grygorii.strashko@ti.com \
--cc=khilman@linaro.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