From: Thomas Abraham Date: Sun, 6 Nov 2011 15:49:37 +0000 (+0530) Subject: ARM: EXYNOS: Add ioremap interceptor for statically remapped regions X-Git-Tag: next-20111109~63^2~1^2~27 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=25767e6943a15d702bdc4cd7429f49f06ec6e4f4;p=karo-tx-linux.git ARM: EXYNOS: Add ioremap interceptor for statically remapped regions 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 Signed-off-by: Kukjin Kim --- diff --git a/arch/arm/mach-exynos/cpu.c b/arch/arm/mach-exynos/cpu.c index 90ec247f3b37..8a37e8c048c7 100644 --- a/arch/arm/mach-exynos/cpu.c +++ b/arch/arm/mach-exynos/cpu.c @@ -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()) diff --git a/arch/arm/mach-exynos/include/mach/io.h b/arch/arm/mach-exynos/include/mach/io.h index d5478d247535..c1b21d5c1275 100644 --- a/arch/arm/mach-exynos/include/mach/io.h +++ b/arch/arm/mach-exynos/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 */