diff options
-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) |