linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: Felipe Balbi <balbi@ti.com>
Cc: Alexander Kochetkov <al.kochet@gmail.com>,
	linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org,
	Tony Lindgren <tony@atomide.com>,
	Wolfram Sang <wsa@the-dreams.de>
Subject: Re: [PATCH 2/2] i2c: omap: fix "Too much work in one IRQ" irq handling
Date: Fri, 14 Nov 2014 21:53:28 -0600	[thread overview]
Message-ID: <20141115035328.GA3289@saruman> (raw)
In-Reply-To: <20141115034756.GA2917@saruman>

[-- Attachment #1: Type: text/plain, Size: 1543 bytes --]

Hi again,

On Fri, Nov 14, 2014 at 09:47:56PM -0600, Felipe Balbi wrote:
> > > how ? This is an interesting bug which deserves further explanation.
> > 
> > Look at the loops above, and at the omap_i2c_complete_cmd:
> > 
> > static inline void
> > omap_i2c_complete_cmd(struct omap_i2c_dev *dev, u16 err)
> > {
> > 	dev->cmd_err |= err;
> > 	complete(&dev->cmd_complete);
> > }
> > 
> > You can see, loop will be aborted if counter reached 100. Final state
> > of transfer depends on values stored in the 'err' and 'dev->cmd_err'.
> > If 'err' and 'dev->cmd_err' are zero, than transfer would be aborted
> > with status 0.

look at the IRQ handler again:

| omap_i2c_isr_thread(int this_irq, void *dev_id)
| {
| 	struct omap_i2c_dev *dev = dev_id;
| 	unsigned long flags;
| 	u16 bits;
| 	u16 stat;
| 	int err = 0, count = 0;
| 
| 	spin_lock_irqsave(&dev->lock, flags);
| 	do {

[...]

| 		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;
| 		}

[...]

| 
| 	} while (stat);
| 
| 	omap_i2c_complete_cmd(dev, err);
| 
| out:
| 	spin_unlock_irqrestore(&dev->lock, flags);
| 
| 	return IRQ_HANDLED;
| }

How could I ever call omap_i2c_complete_cmd() with 'err' set as 0 if I
had either a NACK or Arbitration Lost ?

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2014-11-15  3:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-15  1:20 [PATCH 1/2] i2c: omap: fix NACK and Arbitration Lost irq handling Alexander Kochetkov
     [not found] ` <1416014452-6712-1-git-send-email-al.kochet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-11-15  1:20   ` [PATCH 2/2] i2c: omap: fix "Too much work in one IRQ" " Alexander Kochetkov
     [not found]     ` <1416014452-6712-2-git-send-email-al.kochet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-11-15  1:48       ` Felipe Balbi
2014-11-15  2:37         ` Alexander Kochetkov
2014-11-15  3:47           ` Felipe Balbi
2014-11-15  3:53             ` Felipe Balbi [this message]
2014-11-15  5:42               ` Alexander Kochetkov
2014-11-16 15:45                 ` Felipe Balbi
2014-11-17 14:41                   ` Wolfram Sang
2014-11-18 16:00                     ` Felipe Balbi
2014-11-18 16:12                       ` Wolfram Sang
2014-11-20 16:38                         ` Alexander Kochetkov
     [not found]                           ` <2DED62C3-7C54-49E0-A39B-F68D5DAC66B1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-11-20 16:43                             ` Wolfram Sang
2014-11-18 16:31                       ` Alexander Kochetkov
     [not found]                         ` <5D39428D-F359-4F04-8ACC-D607011B88B9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-11-18 16:38                           ` Felipe Balbi
2014-11-15  1:43   ` [PATCH 1/2] i2c: omap: fix NACK and Arbitration Lost " Felipe Balbi
     [not found]     ` <2159E044-9130-410D-905B-B941408DCDCD@gmail.com>
     [not found]       ` <2159E044-9130-410D-905B-B941408DCDCD-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-11-15  2:48         ` Alexander Kochetkov

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=20141115035328.GA3289@saruman \
    --to=balbi@ti.com \
    --cc=al.kochet@gmail.com \
    --cc=linux-i2c@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;
as well as URLs for NNTP newsgroup(s).