]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ARM: EXYNOS: Add ioremap interceptor for statically remapped regions
authorThomas Abraham <thomas.abraham@linaro.org>
Sun, 6 Nov 2011 15:49:37 +0000 (21:19 +0530)
committerKukjin Kim <kgene.kim@samsung.com>
Tue, 8 Nov 2011 07:53:21 +0000 (16:53 +0900)
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.

Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
arch/arm/mach-exynos/cpu.c
arch/arm/mach-exynos/include/mach/io.h

index 90ec247f3b375f498e20f46c20e25fe2c943b54a..8a37e8c048c7a766d1cf2f5c0d91a5e379404e3e 100644 (file)
@@ -141,6 +141,28 @@ 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;
+       unsigned int idx;
+
+       desc = exynos_iodesc;
+       for (idx = 0; idx < ARRAY_SIZE(exynos_iodesc); idx++, desc++)
+               if (desc->pfn == __phys_to_pfn(phy) && desc->type == type)
+                       return (void __iomem *)desc->virtual;
+
+       desc = exynos4_iodesc;
+       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 exynos_idle(void)
 {
        if (!need_resched())
index d5478d24753555c4fd60a63ce58592b8dabad959..c1b21d5c1275cf10ee90fcb5ee5eb7465a1adca5 100644 (file)
 #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 */