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>
16 #define BETWEEN(p, st, sz) ((p) >= (st) && (p) < ((st) + (sz)))
17 #define XLATE(p, pst, vst) ((void __iomem *)((p) - (pst) + (vst)))
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 if (BETWEEN(p, IO_PHYS, IO_SIZE))
25 return XLATE(p, IO_PHYS, IO_VIRT);
27 return __arm_ioremap(p, size, type);
29 EXPORT_SYMBOL(davinci_ioremap);
31 void davinci_iounmap(volatile void __iomem *addr)
33 unsigned long virt = (unsigned long)addr;
35 if (virt >= VMALLOC_START && virt < VMALLOC_END)
38 EXPORT_SYMBOL(davinci_iounmap);