All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Datta, Shubhrajyoti" <shubhrajyoti-l0cyMroinI0@public.gmane.org>
To: Yegor Yefremov <yegorslists-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
Cc: Shubhrajyoti Datta
	<omaplinuxkernel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>,
	Linux I2C <linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: OMAP: send i2c message ignoring NAK
Date: Thu, 12 Jul 2012 10:54:59 +0530	[thread overview]
Message-ID: <CANQgH-YxYY7M6o4Hxw0kq9=GSwF8TSgiobXLJoPnGhj=c3w4KQ@mail.gmail.com> (raw)
In-Reply-To: <4FFDAF5A.8070205-l0cyMroinI0@public.gmane.org>

On Wed, Jul 11, 2012 at 10:22 PM, Shubhrajyoti <shubhrajyoti-l0cyMroinI0@public.gmane.org> wrote:
> On Wednesday 11 July 2012 09:53 PM, Yegor Yefremov wrote:
[...]
Yegor I have made a patch to ignore the NACK in the ISR let me know if
that helps you.


diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 9895fa7..e13061f 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -476,6 +476,8 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap,

 	if (msg->len == 0)
 		return -EINVAL;
+	if (msg->flags & I2C_M_IGNORE_NAK)
+		dev->flags |= OMAP_I2C_FLAG_NO_NAK;

 	omap_i2c_write_reg(dev, OMAP_I2C_SA_REG, msg->addr);

@@ -776,18 +778,26 @@ complete:
 				~(OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR |
 				OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR));

-		if (stat & OMAP_I2C_STAT_NACK)
+		if (stat & OMAP_I2C_STAT_NACK &&
+				!(dev->flags & OMAP_I2C_FLAG_NO_NAK)) {
 			err |= OMAP_I2C_STAT_NACK;
+			omap_i2c_ack_stat(dev, stat &
+				(OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR |
+				OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR |
+				OMAP_I2C_STAT_ARDY));
+			omap_i2c_complete_cmd(dev, err);
+			return IRQ_HANDLED;
+		}

 		if (stat & OMAP_I2C_STAT_AL) {
 			dev_err(dev->dev, "Arbitration lost\n");
 			err |= OMAP_I2C_STAT_AL;
 		}
+
 		/*
 		 * ProDB0017052: Clear ARDY bit twice
 		 */
-		if (stat & (OMAP_I2C_STAT_ARDY | OMAP_I2C_STAT_NACK |
-					OMAP_I2C_STAT_AL)) {
+		if (stat & (OMAP_I2C_STAT_ARDY | OMAP_I2C_STAT_AL)) {
 			omap_i2c_ack_stat(dev, stat &
 				(OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR |
 				OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR |
diff --git a/include/linux/i2c-omap.h b/include/linux/i2c-omap.h
index 92a0dc7..f386150 100644
--- a/include/linux/i2c-omap.h
+++ b/include/linux/i2c-omap.h
@@ -29,6 +29,7 @@
 #define OMAP_I2C_FLAG_BUS_SHIFT_1		BIT(7)
 #define OMAP_I2C_FLAG_BUS_SHIFT_2		BIT(8)
 #define OMAP_I2C_FLAG_BUS_SHIFT__SHIFT 7
+#define OMAP_I2C_FLAG_NO_NAK			BIT(9)

 struct omap_i2c_bus_platform_data {
 	u32		clkrate;

  parent reply	other threads:[~2012-07-12  5:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-03  8:12 OMAP: send i2c message ignoring NAK Yegor Yefremov
     [not found] ` <CAGm1_ktL96X7kF3tvKErtirwnL7FGU=zGe+EyhX4GcUkZUeSkQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-07-03  8:32   ` Jean Delvare
     [not found]     ` <20120703103221.62fcb7ae-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-07-10 14:59       ` Yegor Yefremov
     [not found]         ` <CAGm1_kvBerv_Ot-NX2+ozZT3y+h4ECzwb-MM0-v=3M9aRRznzA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-07-10 15:08           ` Shubhrajyoti Datta
     [not found]             ` <CAM=Q2cv2yCEaxjSL45PSpf8k8pgMuhr88TJ-RWc0OW1GL+n6Dg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-07-11 16:23               ` Yegor Yefremov
     [not found]                 ` <CAGm1_kvLwj3iFz5M6zc+pitS_45OYPYw=aBU4bv8TdOhH600NA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-07-11 16:52                   ` Shubhrajyoti
     [not found]                     ` <4FFDAF5A.8070205-l0cyMroinI0@public.gmane.org>
2012-07-12  5:24                       ` Datta, Shubhrajyoti [this message]
     [not found]                         ` <CANQgH-YxYY7M6o4Hxw0kq9=GSwF8TSgiobXLJoPnGhj=c3w4KQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-07-17  9:31                           ` Yegor Yefremov
     [not found]                             ` <CAGm1_ktYqq5HKt13RuQVL8axX0FUnZ_5a6va7BRuUschQRKERQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-07-17 14:01                               ` Shubhrajyoti Datta
     [not found]                                 ` <CAM=Q2ct_mfGiuKrX9KAuk7B+PA==FRL7DPOfge9fRAuFg6bA3Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-07-19 13:05                                   ` Yegor Yefremov
     [not found]                                     ` <CAGm1_ktVXmEBZz90_SMB+WmZGax5DwoXD5pr66Dja=8QW1QcGA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-07-19 13:26                                       ` Shubhrajyoti
2012-07-11 16:52                   ` Shubhrajyoti

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='CANQgH-YxYY7M6o4Hxw0kq9=GSwF8TSgiobXLJoPnGhj=c3w4KQ@mail.gmail.com' \
    --to=shubhrajyoti-l0cymroini0@public.gmane.org \
    --cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=omaplinuxkernel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=yegorslists-gM/Ye1E23mwN+BqQ9rBEUg@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.