linux-stable/arch
Cory Maccarrone 4318f36b7c omap: gpio: Simultaneously requested rising and falling edge
Some chips, namely any OMAP1 chips using METHOD_MPUIO,
OMAP15xx and OMAP7xx, cannot be setup to respond to on-chip GPIO
interrupts in both rising and falling edge directions -- they can
only respond to one direction or the other, depending on how the
ICR is configured.

Additionally, current code forces rising edge detection if both
flags are specified:

        if (trigger & IRQ_TYPE_EDGE_RISING)
                l |= 1 << gpio;
        else if (trigger & IRQ_TYPE_EDGE_FALLING)
                l &= ~(1 << gpio);
        else
                goto bad;

This change implements a toggle function that will modify the ICR
to flip the direction of interrupt for IRQs that are requested with
both rising and falling flags.  The toggle function is not called
for chips and GPIOs it does not apply to through the use of a flip_mask
that's added on a per-bank basis.  The mask is only set for those
GPIOs where a toggle is necessary.  Edge detection starts out the
same as above with FALLING mode first.

The toggle happens on EACH interrupt; without it, we have the
following sequence of actions on GPIO transition:

  ICR    GPIO               Result
  0x1    0 -> 1 (rising)    Interrupt
  0x1    1 -> 0 (falling)   No interrupt

  (set ICR to 0x0 manually)
  0x0    0 -> 1 (rising)    No interrupt
  0x0    1 -> 0 (falling)   Interrupt

That is, with the ICR set to 1 for a gpio, only rising edge interrupts
are caught, and with it set to 0, only falling edge interrupts are
caught.  If we add in the toggle, we get this:

  ICR    GPIO               Result
  0x1    0 -> 1 (rising)    Interrupt (ICR set to 0x0)
  0x0    1 -> 0 (falling)   Interrupt (ICR set to 0x1)
  0x1    0 -> 1 ...

so, both rising and falling are caught, per the request for both
(IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING).

Signed-off-by: Cory Maccarrone <darkstar6262@gmail.com>
Acked-by: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
2010-01-08 10:29:04 -08:00
..
alpha alpha: Convert BUG() to use unreachable() 2009-12-18 01:14:52 -05:00
arm omap: gpio: Simultaneously requested rising and falling edge 2010-01-08 10:29:04 -08:00
avr32 Merge branch 'for-33' of git://repo.or.cz/linux-kbuild 2009-12-17 07:23:42 -08:00
blackfin Merge branch 'for-33' of git://repo.or.cz/linux-kbuild 2009-12-17 07:23:42 -08:00
cris Merge branch 'for-33' of git://repo.or.cz/linux-kbuild 2009-12-17 07:23:42 -08:00
frv Merge branch 'for-33' of git://repo.or.cz/linux-kbuild 2009-12-17 07:23:42 -08:00
h8300 Merge branch 'for-33' of git://repo.or.cz/linux-kbuild 2009-12-17 07:23:42 -08:00
ia64 KVM: ia64: fix build breakage due to host spinlock change 2009-12-27 13:36:33 -02:00
m32r elf: kill USE_ELF_CORE_DUMP 2009-12-16 07:20:12 -08:00
m68k Merge branch 'for-33' of git://repo.or.cz/linux-kbuild 2009-12-17 07:23:42 -08:00
m68knommu Unify sys_mmap* 2009-12-11 06:44:29 -05:00
microblaze Merge branch 'for-33' of git://repo.or.cz/linux-kbuild 2009-12-17 07:23:42 -08:00
mips Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus 2009-12-17 16:38:06 -08:00
mn10300 Merge branch 'for-33' of git://repo.or.cz/linux-kbuild 2009-12-17 07:23:42 -08:00
parisc Merge branch 'for-33' of git://repo.or.cz/linux-kbuild 2009-12-17 07:23:42 -08:00
powerpc Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6 2009-12-30 13:13:24 -08:00
s390 [S390] Update default configuration. 2010-01-04 09:05:58 +01:00
score Merge branch 'for-linus' of git://gitserver.sunplusct.com/linux-2.6-score 2009-12-17 08:08:57 -08:00
sh sh: update defconfigs. 2010-01-04 15:38:50 +09:00
sparc sparc64: Fix Niagara2 perf event handling. 2010-01-04 23:16:03 -08:00
um Merge branch 'for-33' of git://repo.or.cz/linux-kbuild 2009-12-17 07:23:42 -08:00
x86 Revert "x86: Side-step lguest problem by only building cmpxchg8b_emu for pre-Pentium" 2010-01-05 16:01:35 -08:00
xtensa Merge branch 'for-33' of git://repo.or.cz/linux-kbuild 2009-12-17 07:23:42 -08:00
.gitignore
Kconfig hw-breakpoints: Fix hardware breakpoints -> perf events dependency 2009-12-18 13:11:51 +01:00