From patchwork Tue May 24 14:24:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tarun Kanti DebBarma X-Patchwork-Id: 812062 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4OEPMPq011015 for ; Tue, 24 May 2011 14:25:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756742Ab1EXOZU (ORCPT ); Tue, 24 May 2011 10:25:20 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:37634 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756622Ab1EXOZT (ORCPT ); Tue, 24 May 2011 10:25:19 -0400 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id p4OEP4Kr015822 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 24 May 2011 09:25:06 -0500 Received: from dbde71.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id p4OEP0n9028536; Tue, 24 May 2011 19:55:00 +0530 (IST) Received: from dbdp31.itg.ti.com (172.24.170.98) by DBDE71.ent.ti.com (172.24.170.149) with Microsoft SMTP Server id 8.3.106.1; Tue, 24 May 2011 19:55:00 +0530 Received: from localhost.localdomain ([172.24.190.106]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id p4OEOsqH004036; Tue, 24 May 2011 19:55:00 +0530 (IST) From: Tarun Kanti DebBarma To: CC: , , , , Charulatha V Subject: [PATCH 12/15] OMAP: GPIO: Fix: use wake set/clear regs Date: Tue, 24 May 2011 19:54:51 +0530 Message-ID: <1306247094-25372-13-git-send-email-tarun.kanti@ti.com> X-Mailer: git-send-email 1.6.0.4 In-Reply-To: <1306247094-25372-1-git-send-email-tarun.kanti@ti.com> References: <1306247094-25372-1-git-send-email-tarun.kanti@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 24 May 2011 14:25:22 +0000 (UTC) From: Charulatha V In set_24xx_gpio_triggering(), for OMAP4, GPIO wakeup request is set for all type of GPIO triggers whereas as per TRM the GPIO wakeup request can only be generated on edge transitions. Fix this. In set_24xx_gpio_triggering(), OMAP4_GPIO_IRQWAKEN0 register is used for wakeup request and the GPIO set/clear wakeup registers are not used in OMAP4 but is handled without retaining it's old value. This would corrupt the contents of OMAP4_GPIO_IRQWAKEN0 register by writing the value of the last requested GPIO pin in a given bank. This can be avoided by making use of GPIO set/clear wakeup registers. Signed-off-by: Charulatha V --- arch/arm/mach-omap2/gpio.c | 4 ++-- drivers/gpio/gpio_omap.c | 32 ++++++++++---------------------- 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c index 5c888dd..fbedbbb 100644 --- a/arch/arm/mach-omap2/gpio.c +++ b/arch/arm/mach-omap2/gpio.c @@ -142,8 +142,8 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused) pdata->regs->risingdetect = OMAP4_GPIO_RISINGDETECT; pdata->regs->fallingdetect = OMAP4_GPIO_FALLINGDETECT; pdata->regs->wkupstatus = OMAP4_GPIO_IRQWAKEN0; - pdata->regs->wkupclear = OMAP4_GPIO_IRQWAKEN0; - pdata->regs->wkupset = OMAP4_GPIO_IRQWAKEN0; + pdata->regs->wkupclear = OMAP4_GPIO_CLEARWKUENA; + pdata->regs->wkupset = OMAP4_GPIO_SETWKUENA; break; default: WARN(1, "Invalid gpio bank_type\n"); diff --git a/drivers/gpio/gpio_omap.c b/drivers/gpio/gpio_omap.c index 05c2857..762d73c 100644 --- a/drivers/gpio/gpio_omap.c +++ b/drivers/gpio/gpio_omap.c @@ -229,30 +229,18 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio, MOD_REG_BIT(OMAP24XX_GPIO_FALLINGDETECT, gpio_bit, trigger & IRQ_TYPE_EDGE_FALLING); } + 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); - } - } else { - /* - * GPIO wakeup request can only be generated on edge - * transitions - */ - if (trigger & IRQ_TYPE_EDGE_BOTH) - __raw_writel(1 << gpio, bank->base - + OMAP24XX_GPIO_SETWKUENA); - else - __raw_writel(1 << gpio, bank->base - + OMAP24XX_GPIO_CLEARWKUENA); - } + /* + * GPIO wakeup request can only be generated on edge + * transitions + */ + if (trigger & IRQ_TYPE_EDGE_BOTH) + __raw_writel(1 << gpio, bank->wake_set); + else + __raw_writel(1 << gpio, bank->wake_clear); } + /* This part needs to be executed always for OMAP34xx */ if (cpu_is_omap34xx() || (bank->non_wakeup_gpios & gpio_bit)) { /*