public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] ARM: omap4: gpio: fix setting IRQWAKEN bits
@ 2011-06-06 20:38 Colin Cross
  2011-06-06 20:38 ` [PATCH v2 2/2] ARM: omap4: gpio: add locking around calls to _set_gpio_triggering Colin Cross
  2011-06-06 23:18 ` [PATCH v2 1/2] ARM: omap4: gpio: fix setting IRQWAKEN bits Kevin Hilman
  0 siblings, 2 replies; 6+ messages in thread
From: Colin Cross @ 2011-06-06 20:38 UTC (permalink / raw)
  To: linux-omap
  Cc: Santosh Shilimkar, tarun.kanti, linux-arm-kernel, Colin Cross,
	Grant Likely, linux-kernel

Setting the IRQWAKEN bit was overwriting previous IRQWAKEN bits,
causing only the last bit set to take effect, resulting in lost
wakeups when the GPIO controller is in idle.

Replace direct writes to IRQWAKEN with MOD_REG_BIT calls to
perform a read-modify-write on the register.

Signed-off-by: Colin Cross <ccross@android.com>
---
 drivers/gpio/gpio-omap.c |   12 ++----------
 1 files changed, 2 insertions(+), 10 deletions(-)

Santosh, I left your Acked-by off this patch because I changed
the register access to match the OMAP4 TRM.

diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 6c51191..8ba6957 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -432,7 +432,6 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio,
 {
 	void __iomem *base = bank->base;
 	u32 gpio_bit = 1 << gpio;
-	u32 val;
 
 	if (cpu_is_omap44xx()) {
 		MOD_REG_BIT(OMAP4_GPIO_LEVELDETECT0, gpio_bit,
@@ -455,15 +454,8 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio,
 	}
 	if (likely(!(bank->non_wakeup_gpios & gpio_bit))) {
 		if (cpu_is_omap44xx()) {
-			if (trigger != 0)
-				__raw_writel(1 << gpio, bank->base+
-						OMAP4_GPIO_IRQWAKEN0);
-			else {
-				val = __raw_readl(bank->base +
-							OMAP4_GPIO_IRQWAKEN0);
-				__raw_writel(val & (~(1 << gpio)), bank->base +
-							 OMAP4_GPIO_IRQWAKEN0);
-			}
+			MOD_REG_BIT(OMAP4_GPIO_IRQWAKEN0, gpio_bit,
+				trigger != 0);
 		} else {
 			/*
 			 * GPIO wakeup request can only be generated on edge
-- 
1.7.4.1


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

end of thread, other threads:[~2011-06-07 16:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-06 20:38 [PATCH v2 1/2] ARM: omap4: gpio: fix setting IRQWAKEN bits Colin Cross
2011-06-06 20:38 ` [PATCH v2 2/2] ARM: omap4: gpio: add locking around calls to _set_gpio_triggering Colin Cross
2011-06-06 23:18 ` [PATCH v2 1/2] ARM: omap4: gpio: fix setting IRQWAKEN bits Kevin Hilman
2011-06-07  1:06   ` Grant Likely
2011-06-07 16:04     ` Kevin Hilman
2011-06-07 16:37       ` Grant Likely

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