public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cs5535-gpio: apply CS5536 errata workaround for GPIOs
@ 2010-11-30  1:19 Andres Salomon
  2010-11-30  3:30 ` [stable] " Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Andres Salomon @ 2010-11-30  1:19 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-geode, dsd, cjb, stable


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>
---
 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 e23c068..599f6c9 100644
--- a/drivers/gpio/cs5535-gpio.c
+++ b/drivers/gpio/cs5535-gpio.c
@@ -56,6 +56,18 @@ static struct cs5535_gpio_chip {
  * registers, see include/linux/cs5535.h.
  */
 
+static void errata_outl(u32 val, unsigned long addr)
+{
+	/*
+	 * According to the CS5536 errata (#36), after suspend
+	 * a write to the high bank GPIO register will clear all
+	 * non-selected bits; the recommended workaround is a
+	 * read-modify-write operation.
+	 */
+	val |= inl(addr);
+	outl(val, addr);
+}
+
 static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset,
 		unsigned int reg)
 {
@@ -64,7 +76,7 @@ static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset,
 		outl(1 << offset, chip->base + reg);
 	else
 		/* high bank register */
-		outl(1 << (offset - 16), chip->base + 0x80 + reg);
+		errata_outl(1 << (offset - 16), chip->base + 0x80 + reg);
 }
 
 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,
 		outl(1 << (offset + 16), chip->base + reg);
 	else
 		/* high bank register */
-		outl(1 << offset, chip->base + 0x80 + reg);
+		errata_outl(1 << offset, chip->base + 0x80 + reg);
 }
 
 void cs5535_gpio_clear(unsigned offset, unsigned int reg)
-- 
1.5.6.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [stable] [PATCH] cs5535-gpio: apply CS5536 errata workaround for GPIOs
  2010-11-30  1:19 [PATCH] cs5535-gpio: apply CS5536 errata workaround for GPIOs Andres Salomon
@ 2010-11-30  3:30 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2010-11-30  3:30 UTC (permalink / raw)
  To: Andres Salomon; +Cc: akpm, dsd, stable, cjb, linux-kernel, linux-geode

On Mon, Nov 29, 2010 at 05:19:30PM -0800, Andres Salomon wrote:
> 
> 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>

Please read Documentation/stable_kernel_rules.txt for how to get patches
into the stable kernel releases (hint, this wasn't the proper way...)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-11-30  3:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-30  1:19 [PATCH] cs5535-gpio: apply CS5536 errata workaround for GPIOs Andres Salomon
2010-11-30  3:30 ` [stable] " Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox