ARM: tegra: Prevent dynamically ioremapping device io memory
authorColin Cross <ccross@android.com>
Sat, 22 Jan 2011 01:04:36 +0000 (17:04 -0800)
committerColin Cross <ccross@android.com>
Sat, 22 Jan 2011 01:05:18 +0000 (17:05 -0800)
Change-Id: I893a42bd773b1acdf2b83f8602fe1aa6a8ea6741
Signed-off-by: Colin Cross <ccross@android.com>
arch/arm/mach-tegra/io.c

index 0856818e92da255017f3344163ebfb0b09f89d2a..a1674da7dd812a13dcd58191c513dc964cbca868 100644 (file)
@@ -86,8 +86,20 @@ void __init tegra_map_common_io(void)
 void __iomem *tegra_ioremap(unsigned long p, size_t size, unsigned int type)
 {
        void __iomem *v = IO_ADDRESS(p);
-       if (v == NULL)
+
+       /*
+        * __arm_ioremap fails to set the domain of ioremapped memory
+        * correctly, only use it on physical memory.
+        */
+       if (v == NULL && p < SZ_1G)
                v = __arm_ioremap(p, size, type);
+
+       /*
+        * If the physical address was not physical memory or statically
+        * mapped, there's nothing we can do to map it safely.
+        */
+       BUG_ON(v == NULL);
+
        return v;
 }
 EXPORT_SYMBOL(tegra_ioremap);