msm: pm-8x60: Warmboot support for 9615

During warmboot, the boot remap register in the A5 core allows for a 64K
aligned warmboot handler to be remapped to the boot address. Use the
reserve callback in the machine_descriptor to allocate a memory block
that is aligned to 64K using memblock_alloc API.  The boot remapper
address is programmed so as to remap the allocated memory to boot
address. The power management code programs into this memory to jump to
the warmboot resume path during power collapse.

Change-Id: I2cf9e5ca346ac0632c9e21152dc25f5541166077
Signed-off-by: Maheshkumar Sivasubramanian <msivasub@codeaurora.org>
diff --git a/arch/arm/mach-msm/pm-boot.c b/arch/arm/mach-msm/pm-boot.c
index bcc4c64..6b92d1e 100644
--- a/arch/arm/mach-msm/pm-boot.c
+++ b/arch/arm/mach-msm/pm-boot.c
@@ -15,6 +15,10 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/io.h>
+#include <mach/msm_iomap.h>
+#include <mach/socinfo.h>
+#include <asm/mach-types.h>
+#include <asm/sizes.h>
 #include "scm-boot.h"
 #include "idle.h"
 #include "pm-boot.h"
@@ -55,7 +59,8 @@
 
 static int __init msm_pm_boot_reset_vector_init(uint32_t *reset_vector)
 {
-	WARN_ON(!reset_vector);
+	if (!reset_vector)
+		return -ENODEV;
 	msm_pm_reset_vector = reset_vector;
 	mb();
 
@@ -88,19 +93,47 @@
 	if (msm_pm_boot_after_pc)
 		msm_pm_boot_after_pc(cpu);
 }
+#define BOOT_REMAP_ENABLE  BIT(0)
 
-int __init msm_pm_boot_init(int tz_available, uint32_t* address)
+int __init msm_pm_boot_init(struct msm_pm_boot_platform_data *pdata)
 {
 	int ret = 0;
 
-	switch (tz_available) {
+	switch (pdata->mode) {
 	case MSM_PM_BOOT_CONFIG_TZ:
 		ret = msm_pm_tz_boot_init();
 		msm_pm_boot_before_pc = msm_pm_config_tz_before_pc;
 		msm_pm_boot_after_pc = NULL;
 		break;
-	case MSM_PM_BOOT_CONFIG_RESET_VECTOR:
-		ret = msm_pm_boot_reset_vector_init(address);
+	case MSM_PM_BOOT_CONFIG_RESET_VECTOR_PHYS:
+		if (!pdata->p_addr)
+			return -ENODEV;
+		pdata->v_addr = ioremap(pdata->p_addr, PAGE_SIZE);
+		/* Fall through */
+	case MSM_PM_BOOT_CONFIG_RESET_VECTOR_VIRT:
+
+		if (!pdata->v_addr)
+			return -ENODEV;
+
+		ret = msm_pm_boot_reset_vector_init(pdata->v_addr);
+		msm_pm_boot_before_pc
+			= msm_pm_config_rst_vector_before_pc;
+		msm_pm_boot_after_pc
+			= msm_pm_config_rst_vector_after_pc;
+		break;
+	case MSM_PM_BOOT_CONFIG_REMAP_BOOT_ADDR:
+		/*
+		 * Set the boot remap address and enable remapping of
+		 * reset vector
+		 */
+		if (!pdata->p_addr || !pdata->v_addr)
+			return -ENODEV;
+
+		__raw_writel((pdata->p_addr | BOOT_REMAP_ENABLE),
+				pdata->v_addr);
+
+		ret = msm_pm_boot_reset_vector_init(__va(pdata->p_addr));
+
 		msm_pm_boot_before_pc
 			= msm_pm_config_rst_vector_before_pc;
 		msm_pm_boot_after_pc