linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 1/2] arm: introduce arch_ioremap and arch_iounmap function pointer
@ 2011-05-22  9:04 Jean-Christophe PLAGNIOL-VILLARD
  2011-05-22  9:04 ` [RFC PATCH 2/2] omap: switch to ioremap " Jean-Christophe PLAGNIOL-VILLARD
  2011-05-22 10:03 ` [RFC PATCH 1/2] arm: introduce arch_ioremap and arch_iounmap " Russell King - ARM Linux
  0 siblings, 2 replies; 17+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-05-22  9:04 UTC (permalink / raw)
  To: linux-arm-kernel

today we define it at runtime via __arch_ioremap and __arch_iounmap

this PATH will allow to overwrite the default ioremap at runtime
to be able to compile multiple soc in the same kernel

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/include/asm/io.h |    3 +++
 arch/arm/mm/ioremap.c     |   16 +++++++++++++++-
 arch/arm/mm/nommu.c       |    4 ++++
 3 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index d66605d..0c0cfe0 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -246,6 +246,9 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
 #define __arch_iounmap			__iounmap
 #endif
 
+extern void __iomem* (*arch_ioremap)(unsigned long p, size_t size, unsigned int type);
+extern void (*arch_iounmap)(volatile void __iomem *addr);
+
 #define ioremap(cookie,size)		__arch_ioremap((cookie), (size), MT_DEVICE)
 #define ioremap_nocache(cookie,size)	__arch_ioremap((cookie), (size), MT_DEVICE)
 #define ioremap_cached(cookie,size)	__arch_ioremap((cookie), (size), MT_DEVICE_CACHED)
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index ab50627..40ef390 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -281,9 +281,15 @@ __arm_ioremap_pfn(unsigned long pfn, unsigned long offset, size_t size,
 }
 EXPORT_SYMBOL(__arm_ioremap_pfn);
 
+void __iomem* (*arch_ioremap)(unsigned long p, size_t size, unsigned int type);
+void (*arch_iounmap)(volatile void __iomem *addr);
+
 void __iomem *
 __arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
 {
+	if (arch_ioremap)
+		return arch_ioremap(phys_addr, size, mtype);
+
 	return __arm_ioremap_caller(phys_addr, size, mtype,
 			__builtin_return_address(0));
 }
@@ -291,10 +297,18 @@ EXPORT_SYMBOL(__arm_ioremap);
 
 void __iounmap(volatile void __iomem *io_addr)
 {
-	void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr);
+	void *addr;
 #ifndef CONFIG_SMP
 	struct vm_struct **p, *tmp;
+#endif
 
+	if (arch_iounmap) {
+		arch_iounmap(io_addr);
+		return;
+	}
+
+	addr = (void *)(PAGE_MASK & (unsigned long)io_addr);
+#ifndef CONFIG_SMP
 	/*
 	 * If this is a section based mapping we need to handle it
 	 * specially as the VM subsystem does not know how to handle
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index 687d023..561f19f 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -73,6 +73,10 @@ void __iomem *__arm_ioremap_pfn_caller(unsigned long pfn, unsigned long offset,
 	return __arm_ioremap_pfn(pfn, offset, size, mtype);
 }
 
+/* declare to just avoid the ifdef in nommu case */
+void __iomem* (*arch_ioremap)(unsigned long p, size_t size, unsigned int type);
+void (*arch_iounmap)(volatile void __iomem *addr);
+
 void __iomem *__arm_ioremap(unsigned long phys_addr, size_t size,
 			    unsigned int mtype)
 {
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2011-05-22 16:40 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-22  9:04 [RFC PATCH 1/2] arm: introduce arch_ioremap and arch_iounmap function pointer Jean-Christophe PLAGNIOL-VILLARD
2011-05-22  9:04 ` [RFC PATCH 2/2] omap: switch to ioremap " Jean-Christophe PLAGNIOL-VILLARD
2011-05-22  9:54   ` Arnd Bergmann
2011-05-22 11:13     ` Jean-Christophe PLAGNIOL-VILLARD
2011-05-22 11:20     ` Santosh Shilimkar
2011-05-22 11:17       ` Jean-Christophe PLAGNIOL-VILLARD
2011-05-22 11:35       ` Arnd Bergmann
2011-05-22 11:46         ` Santosh Shilimkar
2011-05-22 12:56           ` Arnd Bergmann
2011-05-22 13:20             ` Santosh Shilimkar
2011-05-22 13:09         ` Russell King - ARM Linux
2011-05-22 13:23           ` Santosh Shilimkar
2011-05-22 16:40           ` Arnd Bergmann
2011-05-22 10:03 ` [RFC PATCH 1/2] arm: introduce arch_ioremap and arch_iounmap " Russell King - ARM Linux
2011-05-22 11:05   ` Jean-Christophe PLAGNIOL-VILLARD
2011-05-22 13:19     ` Russell King - ARM Linux
2011-05-22 14:58       ` Jean-Christophe PLAGNIOL-VILLARD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).