Merge branch 'for-3.0' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound...
[pandora-kernel.git] / arch / arm / plat-mxc / include / mach / io.h
index b4f2de7..4347a87 100644 (file)
 /* Allow IO space to be anywhere in the memory */
 #define IO_SPACE_LIMIT 0xffffffff
 
-#ifdef CONFIG_ARCH_MX3
-#define __arch_ioremap __mx3_ioremap
+#if defined(CONFIG_SOC_IMX31) || defined(CONFIG_SOC_IMX35)
+#include <mach/hardware.h>
+
+#define __arch_ioremap __imx_ioremap
 #define __arch_iounmap __iounmap
 
+#define addr_in_module(addr, mod) \
+       ((unsigned long)(addr) - mod ## _BASE_ADDR < mod ## _SIZE)
+
 static inline void __iomem *
-__mx3_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
+__imx_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
 {
-       if (mtype == MT_DEVICE) {
-               /* Access all peripherals below 0x80000000 as nonshared device
-                * but leave l2cc alone.
+       if (mtype == MT_DEVICE && (cpu_is_mx31() || cpu_is_mx35())) {
+               /*
+                * Access all peripherals below 0x80000000 as nonshared device
+                * on mx3, but leave l2cc alone.  Otherwise cache corruptions
+                * can occur.
                 */
-               if ((phys_addr < 0x80000000) && ((phys_addr < 0x30000000) ||
-                       (phys_addr >= 0x30000000 + SZ_1M)))
+               if (phys_addr < 0x80000000 &&
+                               !addr_in_module(phys_addr, MX3x_L2CC))
                        mtype = MT_DEVICE_NONSHARED;
        }