ARM: tegra: pm: Do not use ioremap for sys mem
Prashant Gaikwad [Wed, 3 Aug 2011 09:19:20 +0000 (14:19 +0530)]
ARMv6+ architecture does not allow ioremap on system memory.
lp0 is relocated using ioremap on DRAM. If lp0 vector start address
is in system memory then use memblock_reserve and do not relocate.
Else if it is overlapping with carveout/fb then first remove the
carveout/fb using memblock_remove and then use ioremap.

Bug 827199

Reviewed-on: http://git-master/r/43685
(cherry picked from commit 1753408edc65ebfc0d4d203f2be960d49ca747a8)

Original-Change-Id: Ic4abfbc98b43aafb2756cb3e69d0ee178204ec7d
Reviewed-on: http://git-master/r/44717
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>

Rebase-Id: Re90d5554c301471fd177632887741109318c2c97

arch/arm/mach-tegra/board.h
arch/arm/mach-tegra/common.c
arch/arm/mach-tegra/pm.c

index e918cfe..6aa01dd 100644 (file)
@@ -58,6 +58,7 @@ extern unsigned long tegra_carveout_start;
 extern unsigned long tegra_carveout_size;
 extern unsigned long tegra_lp0_vec_start;
 extern unsigned long tegra_lp0_vec_size;
+extern bool tegra_lp0_vec_relocate;
 extern unsigned long tegra_grhost_aperture;
 
 void tegra_init_late(void);
index 5d8b6b6..949a262 100644 (file)
@@ -84,6 +84,7 @@ unsigned long tegra_carveout_start;
 unsigned long tegra_carveout_size;
 unsigned long tegra_lp0_vec_start;
 unsigned long tegra_lp0_vec_size;
+bool tegra_lp0_vec_relocate;
 unsigned long tegra_grhost_aperture = ~0ul;
 static   bool is_tegra_debug_uart_hsport;
 static struct board_info pmu_board_info;
@@ -552,6 +553,18 @@ void __init tegra_reserve(unsigned long carveout_size, unsigned long fb_size,
        }
 #endif
 
+       if (tegra_lp0_vec_size &&
+          (tegra_lp0_vec_start < memblock_end_of_DRAM())) {
+               if (memblock_reserve(tegra_lp0_vec_start, tegra_lp0_vec_size)) {
+                       pr_err("Failed to reserve lp0_vec %08lx@%08lx\n",
+                               tegra_lp0_vec_size, tegra_lp0_vec_start);
+                       tegra_lp0_vec_start = 0;
+                       tegra_lp0_vec_size = 0;
+               }
+               tegra_lp0_vec_relocate = false;
+       } else
+               tegra_lp0_vec_relocate = true;
+
        /*
         * We copy the bootloader's framebuffer to the framebuffer allocated
         * above, and then free this one.
index 22e4a08..8033cdd 100644 (file)
@@ -913,7 +913,8 @@ void __init tegra_init_suspend(struct tegra_suspend_platform_data *plat)
                           "-- disabling LP0\n", __func__);
                plat->suspend_mode = TEGRA_SUSPEND_LP1;
        }
-       if (plat->suspend_mode == TEGRA_SUSPEND_LP0 && tegra_lp0_vec_size) {
+       if (plat->suspend_mode == TEGRA_SUSPEND_LP0 && tegra_lp0_vec_size &&
+               tegra_lp0_vec_relocate) {
                unsigned char *reloc_lp0;
                unsigned long tmp;
                void __iomem *orig;