2 * DaVinci I/O mapping code
4 * Copyright (C) 2005-2006 Texas Instruments
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.
11 #include <linux/module.h>
15 #include <asm/mach/map.h>
17 #include <mach/common.h>
20 * Intercept ioremap() requests for addresses in our fixed mapping regions.
22 void __iomem *davinci_ioremap(unsigned long p, size_t size, unsigned int type)
24 struct map_desc *desc = davinci_soc_info.io_desc;
25 int desc_num = davinci_soc_info.io_desc_num;
28 for (i = 0; i < desc_num; i++, desc++) {
29 unsigned long iophys = __pfn_to_phys(desc->pfn);
30 unsigned long iosize = desc->length;
32 if (p >= iophys && (p + size) <= (iophys + iosize))
33 return __io(desc->virtual + p - iophys);
36 return __arm_ioremap_caller(p, size, type,
37 __builtin_return_address(0));
39 EXPORT_SYMBOL(davinci_ioremap);
41 void davinci_iounmap(volatile void __iomem *addr)
43 unsigned long virt = (unsigned long)addr;
45 if (virt >= VMALLOC_START && virt < VMALLOC_END)
48 EXPORT_SYMBOL(davinci_iounmap);