diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
commit | fcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch) | |
tree | a57612d1888735a2ec7972891b68c1ac5ec8faea /arch/arm/mach-davinci/io.c | |
parent | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff) |
Diffstat (limited to 'arch/arm/mach-davinci/io.c')
-rw-r--r-- | arch/arm/mach-davinci/io.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/arch/arm/mach-davinci/io.c b/arch/arm/mach-davinci/io.c new file mode 100644 index 00000000000..8ea60a8b249 --- /dev/null +++ b/arch/arm/mach-davinci/io.c | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | * DaVinci I/O mapping code | ||
3 | * | ||
4 | * Copyright (C) 2005-2006 Texas Instruments | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/module.h> | ||
12 | #include <linux/io.h> | ||
13 | |||
14 | #include <asm/tlb.h> | ||
15 | #include <asm/mach/map.h> | ||
16 | |||
17 | #include <mach/common.h> | ||
18 | |||
19 | /* | ||
20 | * Intercept ioremap() requests for addresses in our fixed mapping regions. | ||
21 | */ | ||
22 | void __iomem *davinci_ioremap(unsigned long p, size_t size, unsigned int type) | ||
23 | { | ||
24 | struct map_desc *desc = davinci_soc_info.io_desc; | ||
25 | int desc_num = davinci_soc_info.io_desc_num; | ||
26 | int i; | ||
27 | |||
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)); | ||
38 | } | ||
39 | EXPORT_SYMBOL(davinci_ioremap); | ||
40 | |||
41 | void davinci_iounmap(volatile void __iomem *addr) | ||
42 | { | ||
43 | unsigned long virt = (unsigned long)addr; | ||
44 | |||
45 | if (virt >= VMALLOC_START && virt < VMALLOC_END) | ||
46 | __iounmap(addr); | ||
47 | } | ||
48 | EXPORT_SYMBOL(davinci_iounmap); | ||