diff options
author | Cyril Chemparathy <cyril@ti.com> | 2010-05-07 17:06:39 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2010-05-13 13:05:31 -0400 |
commit | bcd6a1c695c8b404bfde22b276186ac52a20291b (patch) | |
tree | 548f1308faa72bd90308632d16fb656718cf6090 /arch/arm/mach-davinci/io.c | |
parent | 779b0d53ca41873d59225eb776c5d4493a0abd0f (diff) |
Davinci: iotable based ioremap() interception
This patch allows for a more flexible ioremap() interception based on iotable
contents.
With this patch, the ioremap() interception code can properly translate
addresses only after davinci_soc_info has been initialized. Consequently,
in soc-specific init functions, davinci_common_init() has to happen before any
ioremap() attempts. The da8xx init sequence has been suitably modified to meet
this restriction.
Signed-off-by: Cyril Chemparathy <cyril@ti.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-davinci/io.c')
-rw-r--r-- | arch/arm/mach-davinci/io.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/arch/arm/mach-davinci/io.c b/arch/arm/mach-davinci/io.c index a1c0b6b99edf..8ea60a8b2495 100644 --- a/arch/arm/mach-davinci/io.c +++ b/arch/arm/mach-davinci/io.c | |||
@@ -12,19 +12,29 @@ | |||
12 | #include <linux/io.h> | 12 | #include <linux/io.h> |
13 | 13 | ||
14 | #include <asm/tlb.h> | 14 | #include <asm/tlb.h> |
15 | #include <asm/mach/map.h> | ||
15 | 16 | ||
16 | #define BETWEEN(p, st, sz) ((p) >= (st) && (p) < ((st) + (sz))) | 17 | #include <mach/common.h> |
17 | #define XLATE(p, pst, vst) ((void __iomem *)((p) - (pst) + (vst))) | ||
18 | 18 | ||
19 | /* | 19 | /* |
20 | * Intercept ioremap() requests for addresses in our fixed mapping regions. | 20 | * Intercept ioremap() requests for addresses in our fixed mapping regions. |
21 | */ | 21 | */ |
22 | void __iomem *davinci_ioremap(unsigned long p, size_t size, unsigned int type) | 22 | void __iomem *davinci_ioremap(unsigned long p, size_t size, unsigned int type) |
23 | { | 23 | { |
24 | if (BETWEEN(p, IO_PHYS, IO_SIZE)) | 24 | struct map_desc *desc = davinci_soc_info.io_desc; |
25 | return XLATE(p, IO_PHYS, IO_VIRT); | 25 | int desc_num = davinci_soc_info.io_desc_num; |
26 | int i; | ||
26 | 27 | ||
27 | return __arm_ioremap_caller(p, size, type, __builtin_return_address(0)); | 28 | for (i = 0; i < desc_num; i++, desc++) { |
29 | unsigned long iophys = __pfn_to_phys(desc->pfn); | ||
30 | unsigned long iosize = desc->length; | ||
31 | |||
32 | if (p >= iophys && (p + size) <= (iophys + iosize)) | ||
33 | return __io(desc->virtual + p - iophys); | ||
34 | } | ||
35 | |||
36 | return __arm_ioremap_caller(p, size, type, | ||
37 | __builtin_return_address(0)); | ||
28 | } | 38 | } |
29 | EXPORT_SYMBOL(davinci_ioremap); | 39 | EXPORT_SYMBOL(davinci_ioremap); |
30 | 40 | ||