Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: tglx@linutronix.de (Thomas Gleixner)
To: linux-arm-kernel@lists.infradead.org
Subject: i.MX & IRQF_ONESHOT
Date: Fri, 14 Jan 2011 11:57:34 +0100 (CET)	[thread overview]
Message-ID: <alpine.LFD.2.00.1101141138480.2678@localhost6.localdomain6> (raw)
In-Reply-To: <4D2FFCBE.3010704@eukrea.com>

On Fri, 14 Jan 2011, Eric B?nard wrote:

> On 13/01/2011 22:24, Uwe Kleine-K?nig wrote:
> > On Thu, Jan 13, 2011 at 10:12:23PM +0100, Eric B?nard wrote:
> > > On 13/01/2011 19:15, Thomas Gleixner wrote:
> > > > On Thu, 13 Jan 2011, Nicolas Ferre wrote:
> > > > > Le 13/01/2011 10:13, Uwe Kleine-K?nig :
> > > > > > On Thu, Jan 13, 2011 at 09:25:19AM +0100, Eric B?nard wrote:
> > > > > > > Commenting out this line in the ads7846 driver makes it work
> > > > > > > again.
> > > > > > > Am I missing something obvious or is there a reason for
> > > > > > > IRQF_ONESHOT
> > > > > > > creating trouble with gpio irq or SPI on i.MX ?
> > > > > > I don't know.  Is the irq masked?  pending?
> > > > > 
> > > > > Just to let you know that I have the same issue on my at91sam9g10ek:
> > > > > atmel_spi + ads7846 (using ADS7843e actually).
> > > > > ... solved by same workaround.
> > > > 
> > > > Eric, Nicolas: How are the interrupt handlers set for the relevant
> > > > interrupt lines and how are the interrupt pins configured?
> > > > 
> > > on the i.MX27 :
> > > - gpio configured as a plain input (in function ads7846_dev_init()
> > > in arch/arm/mach-imx/eukrea_mbimx27-baseboard.c)
> > > - threaded interrupt handler registered with flags
> > > IRQF_TRIGGER_FALLING | IRQF_ONESHOT (in function ads7846_probe() in
> > > drivers/input/touchscreen/ads7846.c)
> > I didn't recheck the hw manual, but adding IRQF_TRIGGER_FALLING calls
> > gpio_set_irq_type (defined in arch/arm/plat-mxc/gpio.c) which results
> > into something called GPIO_INT_FALL_EDGE being written into a register.
> > 
> > So I'd say it's configured to be edge sensitive.
> > 
> I confirm this point : the gpio is configured to trigger an irq on falling
> edge.

Right, but that does not tell me which flow handler is used for this
particular irq. Looking at arch/arm/plat-mxc/gpio.c it seems that the
gpio irqs are set up using handle_level_irq ! That explains the
ONESHOT wreckage nicely as you are missing an edge irq which comes in
_BEFORE_ the finalize code unmasks the line.

So there are several things wrong here:

1) Using handle_level_irq for an edge interrupt is wrong. That's not
   restricted to the TS driver problem at hand. That's wrong in
   general. Other set_type() functions adjust the handler as well when
   they switch the edge/level types.

2) Using ONESHOT for an edge interrupt is wrong as well. Removing the
   ONESHOT flag is just papering over the problem because it does not
   make the #1 problem go away, it just hides it.

The TS driver uses probably edge for historical reasons to avoid an
interrupt storm. But now with the oneshot mechanism we really should
use level type interrupts and keep the ONESHOT flag. 

Thanks,

	tglx

  reply	other threads:[~2011-01-14 10:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-13  9:13 No subject Uwe Kleine-König
2011-01-13 11:12 ` i.MX & IRQF_ONESHOT Nicolas Ferre
2011-01-13 18:15   ` Thomas Gleixner
2011-01-13 21:12     ` Eric Bénard
2011-01-13 21:24       ` Uwe Kleine-König
2011-01-14  7:35         ` Eric Bénard
2011-01-14 10:57           ` Thomas Gleixner [this message]
2011-01-14 13:08             ` Uwe Kleine-König
2011-02-02 21:20               ` Uwe Kleine-König
2011-02-02 21:26                 ` Eric Bénard
2011-01-14 11:25     ` Nicolas Ferre
2011-01-14 11:47       ` Thomas Gleixner
  -- strict thread matches above, loose matches on Subject: below --
2011-01-13  8:25 Eric Bénard

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=alpine.LFD.2.00.1101141138480.2678@localhost6.localdomain6 \
    --to=tglx@linutronix.de \
    --cc=linux-arm-kernel@lists.infradead.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