From: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>
To: Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org>
Cc: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>,
Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Kevin Hilman <khilman-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>
Subject: Re: [PATCH 4/5] i2c: omap: query STP always when NACK is received
Date: Fri, 7 Jun 2013 22:07:02 +0300 [thread overview]
Message-ID: <20130607190701.GE15295@arwen.pp.htv.fi> (raw)
In-Reply-To: <1370630768-4077-5-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2003 bytes --]
Hi,
On Fri, Jun 07, 2013 at 09:46:07PM +0300, Grygorii Strashko wrote:
> According to I2C specification the NACK should be handled as folowing:
> "When SDA remains HIGH during this ninth clock pulse, this is defined as the Not
> Acknowledge signal. The master can then gene rate either a STOP condition to
> abort the transfer, or a repeated START condition to start a new transfer."
right ...
> [http://www.nxp.com/documents/user_manual/UM10204.pdf]
>
> The same is recomened by TI I2C wiki:
> http://processors.wiki.ti.com/index.php/I2C_Tips
>
> Currently, the OMAP I2C driver interrupts I2C trunsfer in case of NACK, but
> It queries Stop condition OMAP_I2C_CON_REG.STP=1 only if NACK has been received
> during the last message transmitting/recieving.
> This may lead to stuck Bus in "Bus Busy" until I2C IP reset (idle/enable).
>
> Hence, fix it by querying Stop condition (STP) always when NACK is received.
>
> CC: Kevin Hilman <khilman-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> CC: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>
> Signed-off-by: Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org>
> ---
> drivers/i2c/busses/i2c-omap.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 46fb8a5..b3daf3f 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -618,11 +618,10 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap,
> if (dev->cmd_err & OMAP_I2C_STAT_NACK) {
> if (msg->flags & I2C_M_IGNORE_NAK)
> return 0;
> - if (stop) {
> - w = omap_i2c_read_reg(dev, OMAP_I2C_CON_REG);
> - w |= OMAP_I2C_CON_STP;
> - omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, w);
> - }
> +
> + w = omap_i2c_read_reg(dev, OMAP_I2C_CON_REG);
> + w |= OMAP_I2C_CON_STP;
> + omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, w);
... and this is breaking repeated start.
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2013-06-07 19:07 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
[not found] ` <1370630768-4077-2-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
2013-06-07 20:51 ` Kevin Hilman
2013-06-19 18:35 ` Grygorii Strashko
[not found] ` <51C1F9FA.9000502-l0cyMroinI0@public.gmane.org>
2013-06-19 19:31 ` Felipe Balbi
[not found] ` <20130619193111.GD4779-S8G//mZuvNWo5Im9Ml3/Zg@public.gmane.org>
2013-06-19 20:01 ` Kevin Hilman
[not found] ` <878v257tuv.fsf-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
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
[not found] ` <1370630768-4077-3-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
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 ` [PATCH 3/5] i2c: omap: handle all irqs befor unblocking omap_i2c_xfer_msg() Grygorii Strashko
2013-06-07 19:05 ` 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
[not found] ` <1370630768-4077-5-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
2013-06-07 19:07 ` Felipe Balbi [this message]
2013-06-07 18:46 ` [PATCH 5/5] i2c: omap: remove omap_i2c_isr() hw irq handler Grygorii Strashko
[not found] ` <1370630768-4077-6-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
2013-06-07 19:07 ` Felipe Balbi
2013-06-19 18:43 ` Grygorii Strashko
[not found] ` <51C1FBC5.1030109-l0cyMroinI0@public.gmane.org>
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=20130607190701.GE15295@arwen.pp.htv.fi \
--to=balbi-l0cymroini0@public.gmane.org \
--cc=grygorii.strashko-l0cyMroinI0@public.gmane.org \
--cc=khilman-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org \
--cc=wsa-z923LK4zBo2bacvFa/9K2g@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).