diff options
author | Andres Salomon <dilinger@queued.net> | 2010-12-02 17:31:17 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-12-02 17:51:15 -0500 |
commit | 853ff88324a248a9f5da6e110850223db353ec07 (patch) | |
tree | 6e48a44c672123d8671af2bffedfefee68133151 /drivers/gpio | |
parent | 238af8751f64a75f8b638193353b1c31ea32e738 (diff) |
cs5535-gpio: apply CS5536 errata workaround for GPIOs
The AMD Geode CS5536 Companion Device Silicon Revision B1 Specification
Update mentions the follow as issue #36:
"Atomic write transactions to the atomic GPIO High Bank Feature Bit
registers should only affect the bits selected [...]"
"after Suspend, an atomic write transaction [...] will clear all
non-selected bits of the accessed register."
In other words, writing to the high bank for a single GPIO bit will
clear every other GPIO bit (but only sometimes after a suspend).
The workaround described is obvious and simple; do a read-modify-write.
This patch does that, and documents why we're doing it.
Signed-off-by: Andres Salomon <dilinger@queued.net>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/cs5535-gpio.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/gpio/cs5535-gpio.c b/drivers/gpio/cs5535-gpio.c index e23c06893d19..599f6c9e0fbf 100644 --- a/drivers/gpio/cs5535-gpio.c +++ b/drivers/gpio/cs5535-gpio.c | |||
@@ -56,6 +56,18 @@ 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(u32 val, unsigned long addr) | ||
60 | { | ||
61 | /* | ||
62 | * According to the CS5536 errata (#36), after suspend | ||
63 | * a write to the high bank GPIO register will clear all | ||
64 | * non-selected bits; the recommended workaround is a | ||
65 | * read-modify-write operation. | ||
66 | */ | ||
67 | val |= inl(addr); | ||
68 | outl(val, addr); | ||
69 | } | ||
70 | |||
59 | static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset, | 71 | static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset, |
60 | unsigned int reg) | 72 | unsigned int reg) |
61 | { | 73 | { |
@@ -64,7 +76,7 @@ static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset, | |||
64 | outl(1 << offset, chip->base + reg); | 76 | outl(1 << offset, chip->base + reg); |
65 | else | 77 | else |
66 | /* high bank register */ | 78 | /* high bank register */ |
67 | outl(1 << (offset - 16), chip->base + 0x80 + reg); | 79 | errata_outl(1 << (offset - 16), chip->base + 0x80 + reg); |
68 | } | 80 | } |
69 | 81 | ||
70 | void cs5535_gpio_set(unsigned offset, unsigned int reg) | 82 | void cs5535_gpio_set(unsigned offset, unsigned int reg) |
@@ -86,7 +98,7 @@ static void __cs5535_gpio_clear(struct cs5535_gpio_chip *chip, unsigned offset, | |||
86 | outl(1 << (offset + 16), chip->base + reg); | 98 | outl(1 << (offset + 16), chip->base + reg); |
87 | else | 99 | else |
88 | /* high bank register */ | 100 | /* high bank register */ |
89 | outl(1 << offset, chip->base + 0x80 + reg); | 101 | errata_outl(1 << offset, chip->base + 0x80 + reg); |
90 | } | 102 | } |
91 | 103 | ||
92 | void cs5535_gpio_clear(unsigned offset, unsigned int reg) | 104 | void cs5535_gpio_clear(unsigned offset, unsigned int reg) |