]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.36.2/cs5535-gpio-apply-cs5536-errata-workaround-for-gpios.patch
Fixes for 5.10
[thirdparty/kernel/stable-queue.git] / releases / 2.6.36.2 / cs5535-gpio-apply-cs5536-errata-workaround-for-gpios.patch
1 From 853ff88324a248a9f5da6e110850223db353ec07 Mon Sep 17 00:00:00 2001
2 From: Andres Salomon <dilinger@queued.net>
3 Date: Thu, 2 Dec 2010 14:31:17 -0800
4 Subject: cs5535-gpio: apply CS5536 errata workaround for GPIOs
5
6 From: Andres Salomon <dilinger@queued.net>
7
8 commit 853ff88324a248a9f5da6e110850223db353ec07 upstream.
9
10 The AMD Geode CS5536 Companion Device Silicon Revision B1 Specification
11 Update mentions the follow as issue #36:
12
13 "Atomic write transactions to the atomic GPIO High Bank Feature Bit
14 registers should only affect the bits selected [...]"
15
16 "after Suspend, an atomic write transaction [...] will clear all
17 non-selected bits of the accessed register."
18
19 In other words, writing to the high bank for a single GPIO bit will
20 clear every other GPIO bit (but only sometimes after a suspend).
21
22 The workaround described is obvious and simple; do a read-modify-write.
23 This patch does that, and documents why we're doing it.
24
25 Signed-off-by: Andres Salomon <dilinger@queued.net>
26 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
27 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
28 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
29
30 ---
31 drivers/gpio/cs5535-gpio.c | 16 ++++++++++++++--
32 1 file changed, 14 insertions(+), 2 deletions(-)
33
34 --- a/drivers/gpio/cs5535-gpio.c
35 +++ b/drivers/gpio/cs5535-gpio.c
36 @@ -56,6 +56,18 @@ static struct cs5535_gpio_chip {
37 * registers, see include/linux/cs5535.h.
38 */
39
40 +static void errata_outl(u32 val, unsigned long addr)
41 +{
42 + /*
43 + * According to the CS5536 errata (#36), after suspend
44 + * a write to the high bank GPIO register will clear all
45 + * non-selected bits; the recommended workaround is a
46 + * read-modify-write operation.
47 + */
48 + val |= inl(addr);
49 + outl(val, addr);
50 +}
51 +
52 static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset,
53 unsigned int reg)
54 {
55 @@ -64,7 +76,7 @@ static void __cs5535_gpio_set(struct cs5
56 outl(1 << offset, chip->base + reg);
57 else
58 /* high bank register */
59 - outl(1 << (offset - 16), chip->base + 0x80 + reg);
60 + errata_outl(1 << (offset - 16), chip->base + 0x80 + reg);
61 }
62
63 void cs5535_gpio_set(unsigned offset, unsigned int reg)
64 @@ -86,7 +98,7 @@ static void __cs5535_gpio_clear(struct c
65 outl(1 << (offset + 16), chip->base + reg);
66 else
67 /* high bank register */
68 - outl(1 << offset, chip->base + 0x80 + reg);
69 + errata_outl(1 << offset, chip->base + 0x80 + reg);
70 }
71
72 void cs5535_gpio_clear(unsigned offset, unsigned int reg)