From patchwork Mon Apr 18 15:06:55 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: 715731 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 p3IF3j10015096 for ; Mon, 18 Apr 2011 15:03:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752126Ab1DRPDo (ORCPT ); Mon, 18 Apr 2011 11:03:44 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:47455 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751518Ab1DRPDo (ORCPT ); Mon, 18 Apr 2011 11:03:44 -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 p3IF3Z7d009855 (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 p3IF3WR6008856; 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 p3IF3WqF023175; Mon, 18 Apr 2011 20:33:32 +0530 (IST) Received: from x0084895-pc (unknown [10.24.244.78]) by ucmsshproxy.india.ext.ti.com (Postfix) with ESMTP id 44DB0158003; Mon, 18 Apr 2011 20:33:32 +0530 (IST) From: "Varadarajan, Charulatha" To: , CC: , , , Charulatha V Subject: [PATCH 5/7] OMAP2+: GPIO: make workaround_enabled bank specific Date: Mon, 18 Apr 2011 20:36:55 +0530 Message-ID: <1303139217-10285-6-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:46 +0000 (UTC) From: Charulatha V Make workaround_enabled flag bank-specific instead of using a single flag for all the banks together. This would be helpful while making use of runtime framework in OMAP GPIO driver which would make the driver handle each GPIO bank independently. Also rename workaround_enabled flag to off_mode_wkup_wa_enabled Signed-off-by: Charulatha V --- arch/arm/plat-omap/gpio.c | 16 ++++++---------- 1 files changed, 6 insertions(+), 10 deletions(-) diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 5d4ed6c..5933c98 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -176,6 +176,7 @@ struct gpio_bank { int stride; bool looses_context; u32 ctx_lost_cnt_before; + bool off_mode_wkup_wa_enabled; }; /* @@ -1636,6 +1637,7 @@ static void __init omap_gpio_chip_init(struct gpio_bank *bank) static int gpio; bank->mod_usage = 0; + bank->off_mode_wkup_wa_enabled = false; /* * REVISIT eventually switch from OMAP-specific gpio structs * over to the generic ones @@ -1858,11 +1860,9 @@ static struct sys_device omap_gpio_device = { static void omap_gpio_save_context(struct gpio_bank *bank); static void omap_gpio_restore_context(struct gpio_bank *bank); -static int workaround_enabled; - void omap2_gpio_prepare_for_idle(int off_mode) { - int i, c = 0; + int i; for (i = 0; i < gpio_bank_count; i++) { struct gpio_bank *bank = &gpio_bank[i]; @@ -1922,7 +1922,7 @@ void omap2_gpio_prepare_for_idle(int off_mode) __raw_writel(l2, bank->base + OMAP4_GPIO_RISINGDETECT); } - c++; + bank->off_mode_wkup_wa_enabled = true; save_gpio_ctx: pdev = to_platform_device(bank->dev); @@ -1930,11 +1930,6 @@ save_gpio_ctx: omap_device_get_context_loss_count(pdev); omap_gpio_save_context(bank); } - if (!c) { - workaround_enabled = 0; - return; - } - workaround_enabled = 1; } void omap2_gpio_resume_after_idle(void) @@ -1964,7 +1959,7 @@ void omap2_gpio_resume_after_idle(void) if (ctx_lost_cnt_after == bank->ctx_lost_cnt_before) continue; - if (!workaround_enabled) + if (!bank->off_mode_wkup_wa_enabled) goto restore_gpio_ctx; if (!(bank->enabled_non_wakeup_gpios)) @@ -2042,6 +2037,7 @@ void omap2_gpio_resume_after_idle(void) } restore_gpio_ctx: + bank->off_mode_wkup_wa_enabled = false; omap_gpio_restore_context(bank); }