From patchwork Mon Apr 23 09:14:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 8024 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id C190623E23 for ; Mon, 23 Apr 2012 09:14:32 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 85F0DA1835A for ; Mon, 23 Apr 2012 09:14:32 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id e36so22452743iag.11 for ; Mon, 23 Apr 2012 02:14:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:mime-version:content-type :x-gm-message-state; bh=AV2CWYqn/Krb6lYPbQRdxpbrjfooLDVvo+vikVPuV2g=; b=UaYAIVk+1uE/AXii+r2NdlSQzqC7IyS4SporFLs2rus3CpQ9Gt9BznNJ7MDRzatzto tuWOHXmTR2OVL43sK93VBfhWtwOVUs1j1l9TSknMqNISgEs3biwENMygIteOmHaCm8z5 njQ3wJGCqlTvya3uzWoVlUZwao8wfF9vwWAv6KatbCE1mVfd+EwPgVlMLeTu6Uzoa1SX ZvZZ0bZ/AmdL0WvpKhiKgVJotych9UgoZo3Ke58MFZgRsTDf+MX+ZRYAOrT+mEcnVvEQ 1rt5ognY1AUxDQzByWsQoeY2TzllRNG8Txu1ww9lP5AMeyeNVFrKX+6JkrlxIztGVQzp /WuA== Received: by 10.50.194.163 with SMTP id hx3mr5521824igc.49.1335172472318; Mon, 23 Apr 2012 02:14:32 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.137.198 with SMTP id x6csp97907ibt; Mon, 23 Apr 2012 02:14:31 -0700 (PDT) Received: by 10.213.4.198 with SMTP id 6mr1233320ebs.26.1335172470941; Mon, 23 Apr 2012 02:14:30 -0700 (PDT) Received: from eu1sys200aog111.obsmtp.com (eu1sys200aog111.obsmtp.com. [207.126.144.131]) by mx.google.com with SMTP id a46si4194329eeg.129.2012.04.23.02.14.24 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 Apr 2012 02:14:30 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.131 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.131; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.131 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob111.postini.com ([207.126.147.11]) with SMTP ID DSNKT5UdcFRJLAE2mUu3JGmGLJ5RPQNST+qf@postini.com; Mon, 23 Apr 2012 09:14:30 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 890A91B7; Mon, 23 Apr 2012 09:14:23 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 0818524F9; Mon, 23 Apr 2012 09:14:23 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id 8356E24C2F1; Mon, 23 Apr 2012 11:14:17 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.83.0; Mon, 23 Apr 2012 11:14:22 +0200 From: Linus Walleij To: , Cc: Grant Likely , Philippe LANGLAIS , Rabin Vincent , Jonas Aberg , Lee Jones , Linus Walleij Subject: [PATCH 2/9] gpio/nomadik: cache [rf]w?imsc Date: Mon, 23 Apr 2012 11:14:19 +0200 Message-ID: <1335172459-27542-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.9.2 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmPA6WaydqKTdJjNi04jn0sD8A3aZ6noEZs53BSfO3Y+SVp1TzvPP7KMn7Y8b+fL0mkvdZO From: Rabin Vincent Cache two more registers in the GPIO controller. Signed-off-by: Rabin Vincent Reviewed-by: Srinidhi KASAGAR Signed-off-by: Linus Walleij --- drivers/gpio/gpio-nomadik.c | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/drivers/gpio/gpio-nomadik.c b/drivers/gpio/gpio-nomadik.c index f1ebd05..45a0e0a 100644 --- a/drivers/gpio/gpio-nomadik.c +++ b/drivers/gpio/gpio-nomadik.c @@ -58,6 +58,8 @@ struct nmk_gpio_chip { u32 real_wake; u32 rwimsc; u32 fwimsc; + u32 rimsc; + u32 fimsc; u32 pull_up; }; @@ -149,8 +151,8 @@ static void __nmk_gpio_set_mode_safe(struct nmk_gpio_chip *nmk_chip, unsigned offset, int gpio_mode, bool glitch) { - u32 rwimsc = readl(nmk_chip->addr + NMK_GPIO_RWIMSC); - u32 fwimsc = readl(nmk_chip->addr + NMK_GPIO_FWIMSC); + u32 rwimsc = nmk_chip->rwimsc; + u32 fwimsc = nmk_chip->fwimsc; if (glitch && nmk_chip->set_ioforce) { u32 bit = BIT(offset); @@ -555,27 +557,38 @@ static void __nmk_gpio_irq_modify(struct nmk_gpio_chip *nmk_chip, int gpio, enum nmk_gpio_irq_type which, bool enable) { - u32 rimsc = which == WAKE ? NMK_GPIO_RWIMSC : NMK_GPIO_RIMSC; - u32 fimsc = which == WAKE ? NMK_GPIO_FWIMSC : NMK_GPIO_FIMSC; u32 bitmask = nmk_gpio_get_bitmask(gpio); - u32 reg; + u32 *rimscval; + u32 *fimscval; + u32 rimscreg; + u32 fimscreg; + + if (which == NORMAL) { + rimscreg = NMK_GPIO_RIMSC; + fimscreg = NMK_GPIO_FIMSC; + rimscval = &nmk_chip->rimsc; + fimscval = &nmk_chip->fimsc; + } else { + rimscreg = NMK_GPIO_RWIMSC; + fimscreg = NMK_GPIO_FWIMSC; + rimscval = &nmk_chip->rwimsc; + fimscval = &nmk_chip->fwimsc; + } /* we must individually set/clear the two edges */ if (nmk_chip->edge_rising & bitmask) { - reg = readl(nmk_chip->addr + rimsc); if (enable) - reg |= bitmask; + *rimscval |= bitmask; else - reg &= ~bitmask; - writel(reg, nmk_chip->addr + rimsc); + *rimscval &= ~bitmask; + writel(*rimscval, nmk_chip->addr + rimscreg); } if (nmk_chip->edge_falling & bitmask) { - reg = readl(nmk_chip->addr + fimsc); if (enable) - reg |= bitmask; + *fimscval |= bitmask; else - reg &= ~bitmask; - writel(reg, nmk_chip->addr + fimsc); + *fimscval &= ~bitmask; + writel(*fimscval, nmk_chip->addr + fimscreg); } } @@ -1011,9 +1024,6 @@ void nmk_gpio_wakeups_suspend(void) clk_enable(chip->clk); - chip->rwimsc = readl(chip->addr + NMK_GPIO_RWIMSC); - chip->fwimsc = readl(chip->addr + NMK_GPIO_FWIMSC); - writel(chip->rwimsc & chip->real_wake, chip->addr + NMK_GPIO_RWIMSC); writel(chip->fwimsc & chip->real_wake,