diff options
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 { | |||
56 | * registers, see include/linux/cs5535.h. | 56 | * registers, see include/linux/cs5535.h. |
57 | */ | 57 | */ |
58 | 58 | ||
59 | static void errata_outl(struct cs5535_gpio_chip *chip, u32 val, | ||
60 | unsigned int reg) | ||
61 | { | ||
62 | unsigned long addr = chip->base + 0x80 + reg; | ||
63 | |||
64 | /* | ||
65 | * According to the CS5536 errata (#36), after suspend | ||
66 | * a write to the high bank GPIO register will clear all | ||
67 | * non-selected bits; the recommended workaround is a | ||
68 | * read-modify-write operation. | ||
69 | * | ||
70 | * Don't apply this errata to the edge status GPIOs, as writing | ||
71 | * to their lower bits will clear them. | ||
72 | */ | ||
73 | if (reg != GPIO_POSITIVE_EDGE_STS && reg != GPIO_NEGATIVE_EDGE_STS) { | ||
74 | if (val & 0xffff) | ||
75 | val |= (inl(addr) & 0xffff); /* ignore the high bits */ | ||
76 | else | ||
77 | val |= (inl(addr) ^ (val >> 16)); | ||
78 | } | ||
79 | outl(val, addr); | ||
80 | } | ||
81 | |||
59 | static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset, | 82 | static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset, |
60 | unsigned int reg) | 83 | unsigned int reg) |
61 | { | 84 | { |
@@ -64,7 +87,7 @@ static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset, | |||
64 | outl(1 << offset, chip->base + reg); | 87 | outl(1 << offset, chip->base + reg); |
65 | else | 88 | else |
66 | /* high bank register */ | 89 | /* high bank register */ |
67 | outl(1 << (offset - 16), chip->base + 0x80 + reg); | 90 | errata_outl(chip, 1 << (offset - 16), reg); |
68 | } | 91 | } |
69 | 92 | ||
70 | void cs5535_gpio_set(unsigned offset, unsigned int reg) | 93 | 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, | |||
86 | outl(1 << (offset + 16), chip->base + reg); | 109 | outl(1 << (offset + 16), chip->base + reg); |
87 | else | 110 | else |
88 | /* high bank register */ | 111 | /* high bank register */ |
89 | outl(1 << offset, chip->base + 0x80 + reg); | 112 | errata_outl(chip, 1 << offset, reg); |
90 | } | 113 | } |
91 | 114 | ||
92 | void cs5535_gpio_clear(unsigned offset, unsigned int reg) | 115 | void cs5535_gpio_clear(unsigned offset, unsigned int reg) |