]> git.baikalelectronics.ru Git - kernel.git/commit
cs5535-gpio: handle GPIO regs where higher (clear) bits are set
authorAndres Salomon <dilinger@queued.net>
Tue, 21 Dec 2010 21:04:52 +0000 (13:04 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 23 Dec 2010 23:31:48 +0000 (15:31 -0800)
commita6c08b0d8418632529e5172624d638adbb51c230
tree599549060943c051e8943f85da80e4905d941016
parent270c45b8f2cce838c903ecfefa0dd55231525b12
cs5535-gpio: handle GPIO regs where higher (clear) bits are set

The default for non-READ_BACK GPIO regs is to have the clear bits set;
this means that our original errata fix was too simplistic.  This
changes it to the following behavior:

 - when setting GPIOs, ignore the higher order bits (they're for
   clearing, we don't need to care about them).

 - when clearing GPIOs, keep all the bits, but unset (via XOR) the
   lower order bit that negates the clear bit that we care about.  That
   is, if we're clearing GPIO 26 (val = 0x04000000), we first XOR what's
   currently in the register with 0x0400 (GPIO 26's SET bit), and then
   OR that with the GPIO 26's CLEAR bit.

Tested-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Andres Salomon <dilinger@queued.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/gpio/cs5535-gpio.c