Merge "platform: msm8226: Modify MSM_SHARED_BASE based on platform subtype."
diff --git a/platform/msm8226/include/platform/iomap.h b/platform/msm8226/include/platform/iomap.h
index 5a26be6..d7e5094 100644
--- a/platform/msm8226/include/platform/iomap.h
+++ b/platform/msm8226/include/platform/iomap.h
@@ -35,6 +35,9 @@
 #define SDRAM_START_ADDR            0x00000000
 
 #define MSM_SHARED_BASE             0x0FA00000
+#define MSM_DYNAMIC_SHARED_BASE     0xFE802FF8
+
+#define SMEM_TARGET_INFO_ADDR       0xFE802FF0
 
 #define APPS_SS_BASE                0xF9000000
 
diff --git a/platform/msm8226/platform.c b/platform/msm8226/platform.c
index 3a25699..1d15a62 100644
--- a/platform/msm8226/platform.c
+++ b/platform/msm8226/platform.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -141,3 +141,19 @@
 		}
 	}
 }
+
+/* DYNAMIC SMEM REGION feature enables LK to dynamically read the SMEM address from MSM_DYNAMIC_SHARED_BASE.
+ * If the feature is enabled(by reading the MAGIC as mentioned below) then the SMEM address is read from
+ * MSM_DYNAMIC_SHARED_BASE otherwise revert to the older way of getting SMEM address - MSM_SHARED_BASE */
+
+uint32_t platform_get_smem_base_addr()
+{
+	uint32_t smem_addr = 0;
+
+	if(readl(SMEM_TARGET_INFO_ADDR) == SMEM_TARGET_INFO_IDENTIFIER)
+		smem_addr = readl(MSM_DYNAMIC_SHARED_BASE);
+	else
+		smem_addr = MSM_SHARED_BASE;
+
+	return smem_addr;
+}