diff mbox

[v2,1/2] ARM: omap4: gpio: fix setting IRQWAKEN bits

Message ID 1307392698-21170-1-git-send-email-ccross@android.com (mailing list archive)
State New, archived
Headers show

Commit Message

Colin Cross June 6, 2011, 8:38 p.m. UTC
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.

Comments

Kevin Hilman June 6, 2011, 11:18 p.m. UTC | #1
Hi Colin,

Colin Cross <ccross@android.com> writes:

> 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>

Thanks, I'll queue these both for Grant for the 3.0-rc fixes along with
another GPIO fix for a section mismatch I have queued.

Minor: now that this driver has moved to drivers, I changed the subject
prefixes slightly.  They now read:

GPIO: OMAP: fix setting IRQWAKEN bits for OMAP4
GPIO: OMAP: add locking around calls to _set_gpio_triggering

Kevin
Grant Likely June 7, 2011, 1:06 a.m. UTC | #2
On Mon, Jun 6, 2011 at 5:18 PM, Kevin Hilman <khilman@ti.com> wrote:
> Hi Colin,
>
> Colin Cross <ccross@android.com> writes:
>
>> 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>
>
> Thanks, I'll queue these both for Grant for the 3.0-rc fixes along with
> another GPIO fix for a section mismatch I have queued.
>
> Minor: now that this driver has moved to drivers, I changed the subject
> prefixes slightly.  They now read:
>
> GPIO: OMAP: fix setting IRQWAKEN bits for OMAP4
> GPIO: OMAP: add locking around calls to _set_gpio_triggering

If you're collecting fixes for Linus anyway, go ahead and add my a-b
line and include these two to send on to Linus

Acked-by: Grant Likely <grant.likely@secretlab.ca>

Or, if they are only gpio fixes, then I'd also be happy to get a git
pull req for the changes.  :-)

g.
Kevin Hilman June 7, 2011, 4:04 p.m. UTC | #3
Grant Likely <grant.likely@secretlab.ca> writes:

> On Mon, Jun 6, 2011 at 5:18 PM, Kevin Hilman <khilman@ti.com> wrote:
>> Hi Colin,
>>
>> Colin Cross <ccross@android.com> writes:
>>
>>> 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>
>>
>> Thanks, I'll queue these both for Grant for the 3.0-rc fixes along with
>> another GPIO fix for a section mismatch I have queued.
>>
>> Minor: now that this driver has moved to drivers, I changed the subject
>> prefixes slightly.  They now read:
>>
>> GPIO: OMAP: fix setting IRQWAKEN bits for OMAP4
>> GPIO: OMAP: add locking around calls to _set_gpio_triggering
>
> If you're collecting fixes for Linus anyway, go ahead and add my a-b
> line and include these two to send on to Linus
>
> Acked-by: Grant Likely <grant.likely@secretlab.ca>
>
> Or, if they are only gpio fixes, then I'd also be happy to get a git
> pull req for the changes.  :-)
>

I have a GPIO-only queue, so I'll have a pull req for you today.

Kevin
Grant Likely June 7, 2011, 4:37 p.m. UTC | #4
On Tue, Jun 7, 2011 at 10:04 AM, Kevin Hilman <khilman@ti.com> wrote:
> Grant Likely <grant.likely@secretlab.ca> writes:
>
>> On Mon, Jun 6, 2011 at 5:18 PM, Kevin Hilman <khilman@ti.com> wrote:
>>> Hi Colin,
>>>
>>> Colin Cross <ccross@android.com> writes:
>>>
>>>> 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>
>>>
>>> Thanks, I'll queue these both for Grant for the 3.0-rc fixes along with
>>> another GPIO fix for a section mismatch I have queued.
>>>
>>> Minor: now that this driver has moved to drivers, I changed the subject
>>> prefixes slightly.  They now read:
>>>
>>> GPIO: OMAP: fix setting IRQWAKEN bits for OMAP4
>>> GPIO: OMAP: add locking around calls to _set_gpio_triggering
>>
>> If you're collecting fixes for Linus anyway, go ahead and add my a-b
>> line and include these two to send on to Linus
>>
>> Acked-by: Grant Likely <grant.likely@secretlab.ca>
>>
>> Or, if they are only gpio fixes, then I'd also be happy to get a git
>> pull req for the changes.  :-)
>>
>
> I have a GPIO-only queue, so I'll have a pull req for you today.

thx.

g.
diff mbox

Patch

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