From patchwork Tue May 24 14:24:45 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: 812212 Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4OESJWQ014493 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 24 May 2011 14:28:40 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by bombadil.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QOsZB-0003lT-Nx; Tue, 24 May 2011 14:26:37 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QOsZ9-0000Cl-V4; Tue, 24 May 2011 14:26:35 +0000 Received: from bear.ext.ti.com ([192.94.94.41]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QOsXk-00006K-1r for linux-arm-kernel@lists.infradead.org; Tue, 24 May 2011 14:25:14 +0000 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id p4OEP4k1000738 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 24 May 2011 09:25:06 -0500 Received: from dbde70.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id p4OEOwxB028450; Tue, 24 May 2011 19:55:00 +0530 (IST) Received: from dbdp31.itg.ti.com (172.24.170.98) by DBDE70.ent.ti.com (172.24.170.148) with Microsoft SMTP Server id 8.3.106.1; Tue, 24 May 2011 19:54:59 +0530 Received: from localhost.localdomain ([172.24.190.106]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id p4OEOsqB004036; Tue, 24 May 2011 19:54:58 +0530 (IST) From: Tarun Kanti DebBarma To: Subject: [PATCH 06/15] OMAP4: GPIO: Save/restore context Date: Tue, 24 May 2011 19:54:45 +0530 Message-ID: <1306247094-25372-7-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 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110524_102508_513517_A2C0D383 X-CRM114-Status: GOOD ( 11.20 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [192.94.94.41 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: khilman@ti.com, tony@atomide.com, santosh.shilimkar@ti.com, linux-arm-kernel@lists.infradead.org, Charulatha V X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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:28:40 +0000 (UTC) From: Charulatha V Modify the omap_gpio_save/restore_context to support OMAP4 architecture so that the OMAP GPIO driver need not be modified when OMAP4 off mode support is available. Signed-off-by: Charulatha V --- drivers/gpio/gpio_omap.c | 130 +++++++++++++++++++++++++++++++--------------- 1 files changed, 87 insertions(+), 43 deletions(-) diff --git a/drivers/gpio/gpio_omap.c b/drivers/gpio/gpio_omap.c index 5673951..9d55b7d 100644 --- a/drivers/gpio/gpio_omap.c +++ b/drivers/gpio/gpio_omap.c @@ -1476,9 +1476,6 @@ void omap2_gpio_resume_after_idle(void) } -#endif - -#ifdef CONFIG_ARCH_OMAP3 void omap_gpio_save_context(void) { struct gpio_bank *bank; @@ -1488,26 +1485,49 @@ void omap_gpio_save_context(void) if (!bank->loses_context) continue; - bank->context.irqenable1 = - __raw_readl(bank->base + OMAP24XX_GPIO_IRQENABLE1); - bank->context.irqenable2 = - __raw_readl(bank->base + OMAP24XX_GPIO_IRQENABLE2); - bank->context.wake_en = - __raw_readl(bank->base + OMAP24XX_GPIO_WAKE_EN); - bank->context.ctrl = - __raw_readl(bank->base + OMAP24XX_GPIO_CTRL); - bank->context.oe = - __raw_readl(bank->base + OMAP24XX_GPIO_OE); - bank->context.leveldetect0 = - __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT0); - bank->context.leveldetect1 = - __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT1); - bank->context.risingdetect = - __raw_readl(bank->base + OMAP24XX_GPIO_RISINGDETECT); - bank->context.fallingdetect = - __raw_readl(bank->base + OMAP24XX_GPIO_FALLINGDETECT); - bank->context.dataout = - __raw_readl(bank->base + OMAP24XX_GPIO_DATAOUT); + if (bank->method == METHOD_GPIO_24XX) { + bank->context.irqenable1 = __raw_readl( + bank->base + OMAP24XX_GPIO_IRQENABLE1); + bank->context.irqenable2 = __raw_readl( + bank->base + OMAP24XX_GPIO_IRQENABLE2); + bank->context.wake_en = __raw_readl( + bank->base + OMAP24XX_GPIO_WAKE_EN); + bank->context.ctrl = __raw_readl( + bank->base + OMAP24XX_GPIO_CTRL); + bank->context.oe = __raw_readl( + bank->base + OMAP24XX_GPIO_OE); + bank->context.leveldetect0 = __raw_readl(bank->base + + OMAP24XX_GPIO_LEVELDETECT0); + bank->context.leveldetect1 = __raw_readl(bank->base + + OMAP24XX_GPIO_LEVELDETECT1); + bank->context.risingdetect = __raw_readl(bank->base + + OMAP24XX_GPIO_RISINGDETECT); + bank->context.fallingdetect = __raw_readl(bank->base + + OMAP24XX_GPIO_FALLINGDETECT); + bank->context.dataout = __raw_readl( + bank->base + OMAP24XX_GPIO_DATAOUT); + } else if (bank->method == METHOD_GPIO_44XX) { + bank->context.irqenable1 = __raw_readl( + bank->base + OMAP4_GPIO_IRQSTATUSSET0); + bank->context.irqenable2 = __raw_readl( + bank->base + OMAP4_GPIO_IRQSTATUSSET1); + bank->context.wake_en = __raw_readl( + bank->base + OMAP4_GPIO_IRQWAKEN0); + bank->context.ctrl = __raw_readl( + bank->base + OMAP4_GPIO_CTRL); + bank->context.oe = __raw_readl( + bank->base + OMAP24XX_GPIO_OE); + bank->context.leveldetect0 = __raw_readl(bank->base + + OMAP4_GPIO_LEVELDETECT0); + bank->context.leveldetect1 = __raw_readl(bank->base + + OMAP4_GPIO_LEVELDETECT1); + bank->context.risingdetect = __raw_readl(bank->base + + OMAP4_GPIO_RISINGDETECT); + bank->context.fallingdetect = __raw_readl(bank->base + + OMAP4_GPIO_FALLINGDETECT); + bank->context.dataout = __raw_readl( + bank->base + OMAP4_GPIO_DATAOUT); + } } } @@ -1520,28 +1540,52 @@ void omap_gpio_restore_context(void) if (!bank->loses_context) continue; - __raw_writel(bank->context.irqenable1, - bank->base + OMAP24XX_GPIO_IRQENABLE1); - __raw_writel(bank->context.irqenable2, - bank->base + OMAP24XX_GPIO_IRQENABLE2); - __raw_writel(bank->context.wake_en, - bank->base + OMAP24XX_GPIO_WAKE_EN); - __raw_writel(bank->context.ctrl, - bank->base + OMAP24XX_GPIO_CTRL); - __raw_writel(bank->context.oe, - bank->base + OMAP24XX_GPIO_OE); - __raw_writel(bank->context.leveldetect0, - bank->base + OMAP24XX_GPIO_LEVELDETECT0); - __raw_writel(bank->context.leveldetect1, - bank->base + OMAP24XX_GPIO_LEVELDETECT1); - __raw_writel(bank->context.risingdetect, - bank->base + OMAP24XX_GPIO_RISINGDETECT); - __raw_writel(bank->context.fallingdetect, - bank->base + OMAP24XX_GPIO_FALLINGDETECT); - __raw_writel(bank->context.dataout, - bank->base + OMAP24XX_GPIO_DATAOUT); + if (bank->method == METHOD_GPIO_24XX) { + __raw_writel(bank->context.irqenable1, bank->base + + OMAP24XX_GPIO_IRQENABLE1); + __raw_writel(bank->context.irqenable2, bank->base + + OMAP24XX_GPIO_IRQENABLE2); + __raw_writel(bank->context.wake_en, bank->base + + OMAP24XX_GPIO_WAKE_EN); + __raw_writel(bank->context.ctrl, bank->base + + OMAP24XX_GPIO_CTRL); + __raw_writel(bank->context.oe, bank->base + + OMAP24XX_GPIO_OE); + __raw_writel(bank->context.leveldetect0, bank->base + + OMAP24XX_GPIO_LEVELDETECT0); + __raw_writel(bank->context.leveldetect1, bank->base + + OMAP24XX_GPIO_LEVELDETECT1); + __raw_writel(bank->context.risingdetect, bank->base + + OMAP24XX_GPIO_RISINGDETECT); + __raw_writel(bank->context.fallingdetect, bank->base + + OMAP24XX_GPIO_FALLINGDETECT); + __raw_writel(bank->context.dataout, bank->base + + OMAP24XX_GPIO_DATAOUT); + } else if (bank->method == METHOD_GPIO_44XX) { + __raw_writel(bank->context.irqenable1, bank->base + + OMAP4_GPIO_IRQSTATUSSET0); + __raw_writel(bank->context.irqenable2, bank->base + + OMAP4_GPIO_IRQSTATUSSET1); + __raw_writel(bank->context.wake_en, bank->base + + OMAP4_GPIO_IRQWAKEN0); + __raw_writel(bank->context.ctrl, bank->base + + OMAP4_GPIO_CTRL); + __raw_writel(bank->context.oe, bank->base + + OMAP24XX_GPIO_OE); + __raw_writel(bank->context.leveldetect0, bank->base + + OMAP4_GPIO_LEVELDETECT0); + __raw_writel(bank->context.leveldetect1, bank->base + + OMAP4_GPIO_LEVELDETECT1); + __raw_writel(bank->context.risingdetect, bank->base + + OMAP4_GPIO_RISINGDETECT); + __raw_writel(bank->context.fallingdetect, bank->base + + OMAP4_GPIO_FALLINGDETECT); + __raw_writel(bank->context.dataout, bank->base + + OMAP4_GPIO_DATAOUT); + } } } + #endif static struct platform_driver omap_gpio_driver = {