target: msm8226: Add support for new QVGA platform subtype

Add support for new QVGA platform subtype and also modify
MEMBASE, scratch address and size to conform to the
new 128MB memorymap.

CRs-Fixed: 630700
Change-Id: I5dd2cfb5aee431a5aae8fa9ba0474b82417309a6
diff --git a/target/msm8226/init.c b/target/msm8226/init.c
index 71b46c5..9f1a873 100644
--- a/target/msm8226/init.c
+++ b/target/msm8226/init.c
@@ -78,6 +78,11 @@
 	HW_PLATFORM_SUBTYPE_SKUG = 5,
 };
 
+enum mtp_cdp_subtype
+{
+	HW_PLATFORM_SUBTYPE_QVGA = 4,
+};
+
 static uint32_t mmc_pwrctl_base[] =
 	{ MSM_SDC1_BASE, MSM_SDC2_BASE, MSM_SDC3_BASE };
 
@@ -280,6 +285,11 @@
 	*/
 }
 
+bool target_is_cdp_qvga()
+{
+	return board_hardware_subtype() == HW_PLATFORM_SUBTYPE_QVGA;
+}
+
 /* Detect the modem type */
 void target_baseband_detect(struct board_data *board)
 {
@@ -306,6 +316,8 @@
 		break;
 	case HW_PLATFORM_SUBTYPE_SKUG:
 		break;
+	case HW_PLATFORM_SUBTYPE_QVGA:
+		break;
 	default:
 		dprintf(CRITICAL, "Platform Subtype : %u is not supported\n", platform_subtype);
 		ASSERT(0);
diff --git a/target/msm8226/meminfo.c b/target/msm8226/meminfo.c
index e5a53d2..5de0ef0 100644
--- a/target/msm8226/meminfo.c
+++ b/target/msm8226/meminfo.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
@@ -34,6 +34,7 @@
 #include <libfdt.h>
 #include <platform/iomap.h>
 #include <dev_tree.h>
+#include <target.h>
 
 /* Funtion to add the ram partition entries into device tree.
  * The function assumes that all the entire fixed memory regions should
@@ -77,10 +78,24 @@
 
 void *target_get_scratch_address(void)
 {
-	return ((void *)SCRATCH_ADDR);
+	void *scratch_addr = 0;
+
+	if(target_is_cdp_qvga())
+		scratch_addr = (void *)SCRATCH_ADDR_128MAP;
+	else
+		scratch_addr = (void *)SCRATCH_ADDR_512MAP;
+
+	return scratch_addr;
 }
 
 unsigned target_get_max_flash_size(void)
 {
-	return (512 * 1024 * 1024);
+	uint32_t max_flash_size = 0;
+
+	if(target_is_cdp_qvga())
+		max_flash_size = SCRATCH_SIZE_128MAP;
+	else
+		max_flash_size = SCRATCH_SIZE_512MAP;
+
+	return max_flash_size;
 }
diff --git a/target/msm8226/rules.mk b/target/msm8226/rules.mk
index d31f2bc..7bef55e 100755
--- a/target/msm8226/rules.mk
+++ b/target/msm8226/rules.mk
@@ -5,7 +5,7 @@
 
 PLATFORM := msm8226
 
-MEMBASE := 0x0FF00000 # SDRAM
+MEMBASE := 0x07F00000 # SDRAM
 MEMSIZE := 0x00100000 # 1MB
 
 BASE_ADDR        := 0x00000
@@ -14,6 +14,10 @@
 KERNEL_ADDR      := BASE_ADDR+0x00008000
 RAMDISK_ADDR     := BASE_ADDR+0x01000000
 SCRATCH_ADDR     := 0x10000000
+SCRATCH_ADDR_128MAP     := 0x04200000
+SCRATCH_ADDR_512MAP     := 0x10000000
+SCRATCH_SIZE_128MAP     := 0x03D00000
+SCRATCH_SIZE_512MAP     := 0x20000000
 
 DEFINES += DISPLAY_SPLASH_SCREEN=1
 DEFINES += DISPLAY_TYPE_MIPI=1
@@ -35,7 +39,11 @@
 	TAGS_ADDR=$(TAGS_ADDR) \
 	KERNEL_ADDR=$(KERNEL_ADDR) \
 	RAMDISK_ADDR=$(RAMDISK_ADDR) \
-	SCRATCH_ADDR=$(SCRATCH_ADDR)
+	SCRATCH_ADDR=$(SCRATCH_ADDR) \
+	SCRATCH_ADDR_128MAP=$(SCRATCH_ADDR_128MAP) \
+	SCRATCH_ADDR_512MAP=$(SCRATCH_ADDR_512MAP) \
+	SCRATCH_SIZE_128MAP=$(SCRATCH_SIZE_128MAP) \
+	SCRATCH_SIZE_512MAP=$(SCRATCH_SIZE_512MAP)
 
 
 OBJS += \