From patchwork Mon Apr 18 15:06:53 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: charu@ti.com X-Patchwork-Id: 715751 X-Patchwork-Delegate: tony@atomide.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3IF3oFf015163 for ; Mon, 18 Apr 2011 15:03:50 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753307Ab1DRPDt (ORCPT ); Mon, 18 Apr 2011 11:03:49 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:47462 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752296Ab1DRPDq (ORCPT ); Mon, 18 Apr 2011 11:03:46 -0400 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id p3IF3ZcG009853 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 18 Apr 2011 10:03:37 -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 p3IF3WR4008856; Mon, 18 Apr 2011 20:33:34 +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; Mon, 18 Apr 2011 20:33:16 +0530 Received: from ucmsshproxy.india.ext.ti.com (dbdp20.itg.ti.com [172.24.170.38]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with SMTP id p3IF3VcV023165; Mon, 18 Apr 2011 20:33:31 +0530 (IST) Received: from x0084895-pc (unknown [10.24.244.78]) by ucmsshproxy.india.ext.ti.com (Postfix) with ESMTP id 81E39158005; Mon, 18 Apr 2011 20:33:31 +0530 (IST) From: "Varadarajan, Charulatha" To: , CC: , , , Charulatha V Subject: [PATCH 3/7] OMAP4: GPIO: Save/restore context Date: Mon, 18 Apr 2011 20:36:53 +0530 Message-ID: <1303139217-10285-4-git-send-email-charu@ti.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: References: 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 (demeter1.kernel.org [140.211.167.41]); Mon, 18 Apr 2011 15:03:50 +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 --- arch/arm/plat-omap/gpio.c | 131 +++++++++++++++++++++++++++++--------------- 1 files changed, 86 insertions(+), 45 deletions(-) diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 74085b5..e68da08 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -2022,43 +2022,62 @@ void omap2_gpio_resume_after_idle(void) #endif -#ifdef CONFIG_ARCH_OMAP3 -/* save the registers of bank 2-6 */ void omap_gpio_save_context(void) { int i; - /* saving banks from 2-6 only since GPIO1 is in WKUP */ for (i = 0; i < gpio_bank_count; i++) { struct gpio_bank *bank = &gpio_bank[i]; if (!bank->looses_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); + } } } -/* restore the required registers of bank 2-6 */ void omap_gpio_restore_context(void) { int i; @@ -2069,29 +2088,51 @@ void omap_gpio_restore_context(void) if (!bank->looses_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 = { .probe = omap_gpio_probe,