diff options
author | Andres Salomon <dilinger@queued.net> | 2010-12-21 16:04:42 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-12-23 18:31:48 -0500 |
commit | 001851659354cce436b749a793f3512a53394d80 (patch) | |
tree | cbce3c7d8f68c384229c40b915514b4668051d4a /drivers/gpio/cs5535-gpio.c | |
parent | e819eb8687767cefca7b6abf5ac6d5efcf581eeb (diff) |
cs5535-gpio: don't apply errata #36 to edge detect GPIOs
The edge detect status GPIOs function differently from the other atomic
model CS5536 GPIO registers; writing 1 to the high bits clears the GPIO,
but writing 1 to the lower bits also clears the bit.
This means that read-modify-write doesn't actually work for it, so don't
apply the errata here. If a negative edge status gets lost after
resume.. well, we tried our best!
Tested-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Andres Salomon <dilinger@queued.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/gpio/cs5535-gpio.c')
-rw-r--r-- | drivers/gpio/cs5535-gpio.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/gpio/cs5535-gpio.c b/drivers/gpio/cs5535-gpio.c index 599f6c9e0fbf..79eb9c5a2923 100644 --- a/drivers/gpio/cs5535-gpio.c +++ b/drivers/gpio/cs5535-gpio.c | |||
@@ -56,15 +56,22 @@ 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) | 59 | static void errata_outl(struct cs5535_gpio_chip *chip, u32 val, |
60 | unsigned int reg) | ||
60 | { | 61 | { |
62 | unsigned long addr = chip->base + 0x80 + reg; | ||
63 | |||
61 | /* | 64 | /* |
62 | * According to the CS5536 errata (#36), after suspend | 65 | * According to the CS5536 errata (#36), after suspend |
63 | * a write to the high bank GPIO register will clear all | 66 | * a write to the high bank GPIO register will clear all |
64 | * non-selected bits; the recommended workaround is a | 67 | * non-selected bits; the recommended workaround is a |
65 | * read-modify-write operation. | 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. | ||
66 | */ | 72 | */ |
67 | val |= inl(addr); | 73 | if (reg != GPIO_POSITIVE_EDGE_STS && reg != GPIO_NEGATIVE_EDGE_STS) |
74 | val |= inl(addr); | ||
68 | outl(val, addr); | 75 | outl(val, addr); |
69 | } | 76 | } |
70 | 77 | ||
@@ -76,7 +83,7 @@ static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset, | |||
76 | outl(1 << offset, chip->base + reg); | 83 | outl(1 << offset, chip->base + reg); |
77 | else | 84 | else |
78 | /* high bank register */ | 85 | /* high bank register */ |
79 | errata_outl(1 << (offset - 16), chip->base + 0x80 + reg); | 86 | errata_outl(chip, 1 << (offset - 16), reg); |
80 | } | 87 | } |
81 | 88 | ||
82 | void cs5535_gpio_set(unsigned offset, unsigned int reg) | 89 | void cs5535_gpio_set(unsigned offset, unsigned int reg) |
@@ -98,7 +105,7 @@ static void __cs5535_gpio_clear(struct cs5535_gpio_chip *chip, unsigned offset, | |||
98 | outl(1 << (offset + 16), chip->base + reg); | 105 | outl(1 << (offset + 16), chip->base + reg); |
99 | else | 106 | else |
100 | /* high bank register */ | 107 | /* high bank register */ |
101 | errata_outl(1 << offset, chip->base + 0x80 + reg); | 108 | errata_outl(chip, 1 << offset, reg); |
102 | } | 109 | } |
103 | 110 | ||
104 | void cs5535_gpio_clear(unsigned offset, unsigned int reg) | 111 | void cs5535_gpio_clear(unsigned offset, unsigned int reg) |