From patchwork Mon Oct 10 08:11:28 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: thomas.abraham@linaro.org X-Patchwork-Id: 4580 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 A2DF823E51 for ; Mon, 10 Oct 2011 08:10:11 +0000 (UTC) Received: from mail-ey0-f180.google.com (mail-ey0-f180.google.com [209.85.215.180]) by fiordland.canonical.com (Postfix) with ESMTP id 985F4A18131 for ; Mon, 10 Oct 2011 08:10:11 +0000 (UTC) Received: by eyg5 with SMTP id 5so305088eyg.11 for ; Mon, 10 Oct 2011 01:10:11 -0700 (PDT) Received: by 10.223.75.137 with SMTP id y9mr30792247faj.14.1318234211385; Mon, 10 Oct 2011 01:10:11 -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.152.23.170 with SMTP id n10cs86374laf; Mon, 10 Oct 2011 01:10:11 -0700 (PDT) Received: by 10.236.145.74 with SMTP id o50mr22056546yhj.36.1318234210240; Mon, 10 Oct 2011 01:10:10 -0700 (PDT) Received: from mailout1.samsung.com (mailout1.samsung.com. [203.254.224.24]) by mx.google.com with ESMTP id z43si14595182yhn.138.2011.10.10.01.10.09; Mon, 10 Oct 2011 01:10:10 -0700 (PDT) Received-SPF: neutral (google.com: 203.254.224.24 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) client-ip=203.254.224.24; Authentication-Results: mx.google.com; spf=neutral (google.com: 203.254.224.24 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) smtp.mail=thomas.abraham@linaro.org Received: from epcpsbgm1.samsung.com (mailout1.samsung.com [203.254.224.24]) by mailout1.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTP id <0LSU00LX6C0WU430@mailout1.samsung.com> for patches@linaro.org; Mon, 10 Oct 2011 17:10:08 +0900 (KST) X-AuditID: cbfee61a-b7cf1ae00000208e-26-4e92a8603f4d Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (MMPCPMTA) with SMTP id 57.5B.08334.068A29E4; Mon, 10 Oct 2011 17:10:08 +0900 (KST) Received: from localhost.localdomain ([107.108.73.37]) by mmp2.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTPA id <0LSU001GXC0LKE30@mmp2.samsung.com> for patches@linaro.org; Mon, 10 Oct 2011 17:10:08 +0900 (KST) From: Thomas Abraham To: devicetree-discuss@lists.ozlabs.org, linux-samsung-soc@vger.kernel.org Cc: grant.likely@secretlab.ca, rob.herring@calxeda.com, kgene.kim@samsung.com, linux-arm-kernel@lists.infradead.org, patches@linaro.org Subject: [PATCH 2/3] ARM: Exynos4: Add ioremap interceptor for statically remapped regions Date: Mon, 10 Oct 2011 13:41:28 +0530 Message-id: <1318234289-22041-3-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.6.6.rc2 In-reply-to: <1318234289-22041-1-git-send-email-thomas.abraham@linaro.org> References: <1318234289-22041-1-git-send-email-thomas.abraham@linaro.org> X-Brightmail-Tracker: AAAAAA== ioremap() request for statically remapped regions are intercepted and the statically assigned virtual address is returned. For requests for which there are no statically remapped regions, the requests are let through. Cc: Kukjin Kim Signed-off-by: Thomas Abraham --- arch/arm/mach-exynos4/cpu.c | 16 ++++++++++++++++ arch/arm/mach-exynos4/include/mach/io.h | 4 ++++ 2 files changed, 20 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-exynos4/cpu.c b/arch/arm/mach-exynos4/cpu.c index 5b1765b..358624d 100644 --- a/arch/arm/mach-exynos4/cpu.c +++ b/arch/arm/mach-exynos4/cpu.c @@ -137,6 +137,22 @@ static struct map_desc exynos4_iodesc1[] __initdata = { }, }; +/* + * For all ioremap requests of statically mapped regions, intercept ioremap and + * return virtual address from the iodesc table. + */ +void __iomem *exynos4_ioremap(unsigned long phy, size_t size, unsigned int type) +{ + struct map_desc *desc = exynos4_iodesc; + unsigned int idx; + + for (idx = 0; idx < ARRAY_SIZE(exynos4_iodesc); idx++, desc++) + if (desc->pfn == __phys_to_pfn(phy) && desc->type == type) + return (void __iomem *)desc->virtual; + + return __arm_ioremap(phy, size, type); +} + static void exynos4_idle(void) { if (!need_resched()) diff --git a/arch/arm/mach-exynos4/include/mach/io.h b/arch/arm/mach-exynos4/include/mach/io.h index d5478d2..33c2890 100644 --- a/arch/arm/mach-exynos4/include/mach/io.h +++ b/arch/arm/mach-exynos4/include/mach/io.h @@ -22,5 +22,10 @@ #define __mem_pci(a) (a) #define IO_SPACE_LIMIT (0xFFFFFFFF) +#define __arch_ioremap exynos4_ioremap +#define __arch_iounmap __iounmap + +void __iomem *exynos4_ioremap(unsigned long phy, size_t size, + unsigned int type); #endif /* __ASM_ARM_ARCH_IO_H */