]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ARM: EXYNOS4: Add ioremap interceptor for statically remapped regions
authorThomas Abraham <thomas.abraham@linaro.org>
Sun, 23 Oct 2011 11:59:16 +0000 (13:59 +0200)
committerKukjin Kim <kgene.kim@samsung.com>
Wed, 2 Nov 2011 10:16:28 +0000 (19:16 +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-exynos4/cpu.c
arch/arm/mach-exynos4/include/mach/io.h

index 5b1765b37f75bb6c89acd6b121aed27409a204e5..358624d657060c54914d2a563d2342a75b158c1b 100644 (file)
@@ -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())
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 */