linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: plagnioj@jcrosoft.com (Jean-Christophe PLAGNIOL-VILLARD)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 8/8] at91: add arch specific ioremap support
Date: Fri,  1 Jul 2011 08:44:42 +0200	[thread overview]
Message-ID: <1309502682-16897-8-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <1309502682-16897-1-git-send-email-plagnioj@jcrosoft.com>

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Patrice Vilchez <patrice.vilchez@atmel.com>
---
 arch/arm/mach-at91/include/mach/io.h |   16 +++++++++++++++-
 arch/arm/mach-at91/setup.c           |   19 +++++++++++++++++++
 2 files changed, 34 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-at91/include/mach/io.h b/arch/arm/mach-at91/include/mach/io.h
index 0b0cccc..6ffc53b 100644
--- a/arch/arm/mach-at91/include/mach/io.h
+++ b/arch/arm/mach-at91/include/mach/io.h
@@ -21,14 +21,28 @@
 #ifndef __ASM_ARCH_IO_H
 #define __ASM_ARCH_IO_H
 
+#include <mach/hardware.h>
+
 #define IO_SPACE_LIMIT		0xFFFFFFFF
 
 #define __io(a)		__typesafe_io(a)
 #define __mem_pci(a)	(a)
 
-
 #ifndef __ASSEMBLY__
 
+#ifndef CONFIG_ARCH_AT91X40
+#define __arch_ioremap	at91_ioremap
+#define __arch_iounmap	at91_iounmap
+#endif
+
+void __iomem *at91_ioremap(unsigned long phys, size_t size, unsigned int type);
+void at91_iounmap(volatile void __iomem *addr);
+
+static inline unsigned int at91_readl(unsigned int pa)
+{
+	return __raw_readl((void __iomem *)AT91_IO_P2V(pa));
+}
+
 static inline unsigned int at91_sys_read(unsigned int reg_offset)
 {
 	void __iomem *addr = (void __iomem *)AT91_VA_BASE_SYS;
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index 816599f..aa64294 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -7,6 +7,7 @@
 
 #include <linux/module.h>
 #include <linux/io.h>
+#include <linux/mm.h>
 
 #include <asm/mach/map.h>
 
@@ -72,6 +73,24 @@ static struct map_desc at91_io_desc __initdata = {
 	.type		= MT_DEVICE,
 };
 
+void __iomem *at91_ioremap(unsigned long p, size_t size, unsigned int type)
+{
+	if (p >= AT91_BASE_SYS && p <= (AT91_BASE_SYS + SZ_16K - 1))
+		return (void __iomem *)AT91_IO_P2V(p);
+
+	return __arm_ioremap_caller(p, size, type, __builtin_return_address(0));
+}
+EXPORT_SYMBOL(at91_ioremap);
+
+void at91_iounmap(volatile void __iomem *addr)
+{
+	unsigned long virt = (unsigned long)addr;
+
+	if (virt >= VMALLOC_START && virt < VMALLOC_END)
+		__iounmap(addr);
+}
+EXPORT_SYMBOL(at91_iounmap);
+
 #define AT91_DBGU0	0xfffff200
 #define AT91_DBGU1	0xffffee00
 
-- 
1.7.4.1

  parent reply	other threads:[~2011-07-01  6:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-01  6:44 [PATCH 1/8] at91: introduce commom AT91_BASE_SYS Jean-Christophe PLAGNIOL-VILLARD
2011-07-01  6:44 ` [PATCH 2/8] at91: factorize at91 interrupts init to soc Jean-Christophe PLAGNIOL-VILLARD
2011-07-01 15:47   ` Arnd Bergmann
2011-07-01 17:26     ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-04  9:19   ` Christian Glindkamp
2011-07-05  5:37     ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-01  6:44 ` [PATCH 3/8] at91: remove AT91_DBGU offset from dbgu register macro Jean-Christophe PLAGNIOL-VILLARD
2011-07-01 15:49   ` Arnd Bergmann
2011-07-27 12:05   ` [PATCH 3/8 v2] " Jean-Christophe PLAGNIOL-VILLARD
2011-07-01  6:44 ` [PATCH 4/8] at91: use structure to store the current soc Jean-Christophe PLAGNIOL-VILLARD
2011-07-01  6:44 ` [PATCH 5/8] at91: move clock subsystem init to soc generic init Jean-Christophe PLAGNIOL-VILLARD
2011-07-01  6:44 ` [PATCH 6/8] at91: move register clocks " Jean-Christophe PLAGNIOL-VILLARD
2011-07-01  6:44 ` [PATCH 7/8] at91: factorize sram init Jean-Christophe PLAGNIOL-VILLARD
2011-07-01  6:44 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2011-07-01 15:59   ` [PATCH 8/8] at91: add arch specific ioremap support Arnd Bergmann
2011-07-01 17:29     ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-01 15:46 ` [PATCH 1/8] at91: introduce commom AT91_BASE_SYS Arnd Bergmann
2011-07-01 17:25   ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-01 20:38     ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1309502682-16897-8-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).