aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2011-05-06 23:16:00 -0400
committerArnd Bergmann <arnd@arndb.de>2011-07-28 11:09:26 -0400
commitfb149f9e2835446e02e796081635520b881dc351 (patch)
treee80f681871748b0bcddaff9383ebed026dd1c55a
parentf0051d82a68abcf35418d49db1c82e6f0e514d78 (diff)
at91: add arch specific ioremap support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Cc: Patrice Vilchez <patrice.vilchez@atmel.com>
-rw-r--r--arch/arm/mach-at91/include/mach/io.h11
-rw-r--r--arch/arm/mach-at91/setup.c19
2 files changed, 29 insertions, 1 deletions
diff --git a/arch/arm/mach-at91/include/mach/io.h b/arch/arm/mach-at91/include/mach/io.h
index 0b0cccc46e68..4298e7806c76 100644
--- a/arch/arm/mach-at91/include/mach/io.h
+++ b/arch/arm/mach-at91/include/mach/io.h
@@ -21,14 +21,23 @@
21#ifndef __ASM_ARCH_IO_H 21#ifndef __ASM_ARCH_IO_H
22#define __ASM_ARCH_IO_H 22#define __ASM_ARCH_IO_H
23 23
24#include <mach/hardware.h>
25
24#define IO_SPACE_LIMIT 0xFFFFFFFF 26#define IO_SPACE_LIMIT 0xFFFFFFFF
25 27
26#define __io(a) __typesafe_io(a) 28#define __io(a) __typesafe_io(a)
27#define __mem_pci(a) (a) 29#define __mem_pci(a) (a)
28 30
29
30#ifndef __ASSEMBLY__ 31#ifndef __ASSEMBLY__
31 32
33#ifndef CONFIG_ARCH_AT91X40
34#define __arch_ioremap at91_ioremap
35#define __arch_iounmap at91_iounmap
36#endif
37
38void __iomem *at91_ioremap(unsigned long phys, size_t size, unsigned int type);
39void at91_iounmap(volatile void __iomem *addr);
40
32static inline unsigned int at91_sys_read(unsigned int reg_offset) 41static inline unsigned int at91_sys_read(unsigned int reg_offset)
33{ 42{
34 void __iomem *addr = (void __iomem *)AT91_VA_BASE_SYS; 43 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 816599fce55b..aa64294c7db3 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -7,6 +7,7 @@
7 7
8#include <linux/module.h> 8#include <linux/module.h>
9#include <linux/io.h> 9#include <linux/io.h>
10#include <linux/mm.h>
10 11
11#include <asm/mach/map.h> 12#include <asm/mach/map.h>
12 13
@@ -72,6 +73,24 @@ static struct map_desc at91_io_desc __initdata = {
72 .type = MT_DEVICE, 73 .type = MT_DEVICE,
73}; 74};
74 75
76void __iomem *at91_ioremap(unsigned long p, size_t size, unsigned int type)
77{
78 if (p >= AT91_BASE_SYS && p <= (AT91_BASE_SYS + SZ_16K - 1))
79 return (void __iomem *)AT91_IO_P2V(p);
80
81 return __arm_ioremap_caller(p, size, type, __builtin_return_address(0));
82}
83EXPORT_SYMBOL(at91_ioremap);
84
85void at91_iounmap(volatile void __iomem *addr)
86{
87 unsigned long virt = (unsigned long)addr;
88
89 if (virt >= VMALLOC_START && virt < VMALLOC_END)
90 __iounmap(addr);
91}
92EXPORT_SYMBOL(at91_iounmap);
93
75#define AT91_DBGU0 0xfffff200 94#define AT91_DBGU0 0xfffff200
76#define AT91_DBGU1 0xffffee00 95#define AT91_DBGU1 0xffffee00
77 96