From patchwork Tue Apr 24 07:39:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 8065 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 4EB4F23E13 for ; Tue, 24 Apr 2012 07:39:49 +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 C97B1A18549 for ; Tue, 24 Apr 2012 07:39:48 +0000 (UTC) Received: by iage36 with SMTP id e36so911937iag.11 for ; Tue, 24 Apr 2012 00:39:48 -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=hry38J9PwNk+1Mef1pfrINXCowrcZGS6AEahuzdfhfc=; b=YnfkDsIPUQS0uMJw4TP4DqMW/797xoBwr0qTyW5clURtvfUbxF55eXGbtYKdg2MfrD 1iKQT+r9/TVpfFoWKTds4j0CVEVC/hJ1UrqZn6Cwso/dqwZFr4ZUbzK2dDKt5SD0O1XO 80wZ7mr3AvsHWpizBg40lTCngRjCf5AI8GnKG4y11Flgsl8I4tMzASLaKv7zrqMDgyUm lqahXWduuyabQ4hVQJDGpWbd4U5pVZTEDnVpCNEH5SpElHQSNkkUuLXFCQgUUJnrkXwz 7e2ahBhr7Bhb+jmZ8OKlcSORRuYD2T1K2SHJCOcfjWJEPy5YcShr/aR44nzXCu1QjQYq gPWw== Received: by 10.50.183.225 with SMTP id ep1mr4872027igc.1.1335253188258; Tue, 24 Apr 2012 00:39:48 -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 x6csp163423ibt; Tue, 24 Apr 2012 00:39:47 -0700 (PDT) Received: by 10.14.149.148 with SMTP id x20mr868914eej.44.1335253186399; Tue, 24 Apr 2012 00:39:46 -0700 (PDT) Received: from eu1sys200aog116.obsmtp.com (eu1sys200aog116.obsmtp.com. [207.126.144.141]) by mx.google.com with SMTP id g44si1687993eea.192.2012.04.24.00.39.37 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 24 Apr 2012 00:39:46 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.141 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.141; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.141 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-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob116.postini.com ([207.126.147.11]) with SMTP ID DSNKT5ZYue4WdVVvmSFWKM9Taj7PxcHgRBAZ@postini.com; Tue, 24 Apr 2012 07:39:45 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 62E26F0; Tue, 24 Apr 2012 07:31:12 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id E690B33D; Tue, 24 Apr 2012 07:39:33 +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 92C9C24C075; Tue, 24 Apr 2012 09:39:28 +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; Tue, 24 Apr 2012 09:39:32 +0200 From: Linus Walleij To: , Cc: Grant Likely , Philippe LANGLAIS , Rabin Vincent , Jonas Aberg , Lee Jones , Linus Walleij Subject: [PATCH 5/9 v3] gpio/nomadik: use ioremap() instead of static mappings Date: Tue, 24 Apr 2012 09:39:27 +0200 Message-ID: <1335253167-31905-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: ALoCoQmvvPA7WjoET692GdzoutDrF4I16aaicfOqtoMqxYZsAW89mZvr0labgmk2/XBQqzDzXYbZ From: Linus Walleij We were using a custom io_p2v() (physical-to-virtual) translation macro, but it's fully possible to just ioremap() this memory now, so skip use of static addresses altogether. Signed-off-by: Linus Walleij --- drivers/gpio/gpio-nomadik.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio-nomadik.c b/drivers/gpio/gpio-nomadik.c index 7b45d88..b35eb25 100644 --- a/drivers/gpio/gpio-nomadik.c +++ b/drivers/gpio/gpio-nomadik.c @@ -28,8 +28,6 @@ #include #include -#include -#include /* * The GPIO module in the Nomadik family of Systems-on-Chip is an @@ -1139,6 +1137,7 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev) struct resource *res; struct clk *clk; int secondary_irq; + void __iomem *base; int irq; int ret; @@ -1169,10 +1168,16 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev) goto out; } + base = ioremap(res->start, resource_size(res)); + if (!base) { + ret = -ENOMEM; + goto out_release; + } + clk = clk_get(&dev->dev, NULL); if (IS_ERR(clk)) { ret = PTR_ERR(clk); - goto out_release; + goto out_unmap; } nmk_chip = kzalloc(sizeof(*nmk_chip), GFP_KERNEL); @@ -1186,7 +1191,7 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev) */ nmk_chip->bank = dev->id; nmk_chip->clk = clk; - nmk_chip->addr = io_p2v(res->start); + nmk_chip->addr = base; nmk_chip->chip = nmk_gpio_template; nmk_chip->parent_irq = irq; nmk_chip->secondary_parent_irq = secondary_irq; @@ -1226,6 +1231,8 @@ out_free: out_clk: clk_disable(clk); clk_put(clk); +out_unmap: + iounmap(base); out_release: release_mem_region(res->start, resource_size(res)); out: