Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu
[pandora-kernel.git] / arch / arm / plat-mxc / include / mach / io.h
1 /*
2  *  Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3  */
4
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 #ifndef __ASM_ARCH_MXC_IO_H__
12 #define __ASM_ARCH_MXC_IO_H__
13
14 /* Allow IO space to be anywhere in the memory */
15 #define IO_SPACE_LIMIT 0xffffffff
16
17 #if defined(CONFIG_SOC_IMX31) || defined(CONFIG_SOC_IMX35)
18 #include <mach/hardware.h>
19
20 #define __arch_ioremap __imx_ioremap
21 #define __arch_iounmap __iounmap
22
23 #define addr_in_module(addr, mod) \
24         ((unsigned long)(addr) - mod ## _BASE_ADDR < mod ## _SIZE)
25
26 static inline void __iomem *
27 __imx_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
28 {
29         if (mtype == MT_DEVICE && (cpu_is_mx31() || cpu_is_mx35())) {
30                 /*
31                  * Access all peripherals below 0x80000000 as nonshared device
32                  * on mx3, but leave l2cc alone.  Otherwise cache corruptions
33                  * can occur.
34                  */
35                 if (phys_addr < 0x80000000 &&
36                                 !addr_in_module(phys_addr, MX3x_L2CC))
37                         mtype = MT_DEVICE_NONSHARED;
38         }
39
40         return __arm_ioremap(phys_addr, size, mtype);
41 }
42 #endif
43
44 /* io address mapping macro */
45 #define __io(a)         __typesafe_io(a)
46
47 #define __mem_pci(a)    (a)
48
49 #endif