diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2011-01-11 05:10:08 +0100 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2011-01-11 05:10:08 +0100 |
commit | eed0ba0b4ab2d1668588219a8efa81bf8636a12d (patch) | |
tree | f5aa3c732e7830a1b24e6071f8bed0f799881187 /drivers/gpio/cs5535-gpio.c | |
parent | powerpc/powermac: Make auto-loading of therm_pm72 possible (diff) | |
parent | powerpc/83xx: add mpc8308_p1m DMA controller device-tree node (diff) | |
download | linux-eed0ba0b4ab2d1668588219a8efa81bf8636a12d.tar.xz linux-eed0ba0b4ab2d1668588219a8efa81bf8636a12d.zip |
Merge remote branch 'gcl/next' into next
Diffstat (limited to 'drivers/gpio/cs5535-gpio.c')
-rw-r--r-- | drivers/gpio/cs5535-gpio.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/drivers/gpio/cs5535-gpio.c b/drivers/gpio/cs5535-gpio.c index e23c06893d19..d3e55a0ae92b 100644 --- a/drivers/gpio/cs5535-gpio.c +++ b/drivers/gpio/cs5535-gpio.c @@ -56,6 +56,29 @@ static struct cs5535_gpio_chip { * registers, see include/linux/cs5535.h. */ +static void errata_outl(struct cs5535_gpio_chip *chip, u32 val, + unsigned int reg) +{ + unsigned long addr = chip->base + 0x80 + reg; + + /* + * According to the CS5536 errata (#36), after suspend + * a write to the high bank GPIO register will clear all + * non-selected bits; the recommended workaround is a + * read-modify-write operation. + * + * Don't apply this errata to the edge status GPIOs, as writing + * to their lower bits will clear them. + */ + if (reg != GPIO_POSITIVE_EDGE_STS && reg != GPIO_NEGATIVE_EDGE_STS) { + if (val & 0xffff) + val |= (inl(addr) & 0xffff); /* ignore the high bits */ + else + val |= (inl(addr) ^ (val >> 16)); + } + outl(val, addr); +} + static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset, unsigned int reg) { @@ -64,7 +87,7 @@ static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset, outl(1 << offset, chip->base + reg); else /* high bank register */ - outl(1 << (offset - 16), chip->base + 0x80 + reg); + errata_outl(chip, 1 << (offset - 16), reg); } void cs5535_gpio_set(unsigned offset, unsigned int reg) @@ -86,7 +109,7 @@ static void __cs5535_gpio_clear(struct cs5535_gpio_chip *chip, unsigned offset, outl(1 << (offset + 16), chip->base + reg); else /* high bank register */ - outl(1 << offset, chip->base + 0x80 + reg); + errata_outl(chip, 1 << offset, reg); } void cs5535_gpio_clear(unsigned offset, unsigned int reg) |