Merge "msm7627a: Update cache size to be 8M for 8 bit bch ecc NAND"
diff --git a/target/msm7627a/init.c b/target/msm7627a/init.c
index cbdae6a..bbda93f 100644
--- a/target/msm7627a/init.c
+++ b/target/msm7627a/init.c
@@ -62,7 +62,7 @@
  * this altogether.
  *
  */
-static struct ptentry board_part_list[] = {
+static struct ptentry board_part_list_default[] = {
 	{
 		.start = 0,
 		.length = 10 /* In MB */,
@@ -99,8 +99,49 @@
 		.name = "recovery",
 	},
 };
-static int num_parts = sizeof(board_part_list)/sizeof(struct ptentry);
+static int num_parts = sizeof(board_part_list_default)/sizeof(struct ptentry);
 
+/*
+ * Define partition table for Bch ecc NAND and increase the cache partition size
+ * to 8MB
+ */
+static struct ptentry board_part_list_bchecc[] = {
+	{
+		.start = 0,
+		.length = 10 /* In MB */,
+		.name = "boot",
+	},
+	{
+		.start = DIFF_START_ADDR,
+		.length = 120 /* In MB */,
+		.name = "system",
+	},
+	{
+		.start = DIFF_START_ADDR,
+		.length = 8 /* In MB */,
+		.name = "cache",
+	},
+	{
+		.start = DIFF_START_ADDR,
+		.length = 4 /* In MB */,
+		.name = "misc",
+	},
+	{
+		.start = DIFF_START_ADDR,
+		.length = VARIABLE_LENGTH,
+		.name = "userdata",
+	},
+	{
+		.start = DIFF_START_ADDR,
+		.length = 4 /* In MB */,
+		.name = "persist",
+	},
+	{
+		.start = DIFF_START_ADDR,
+		.length = 10 /* In MB */,
+		.name = "recovery",
+	},
+};
 void smem_ptable_init(void);
 unsigned smem_get_apps_flash_start(void);
 
@@ -112,6 +153,7 @@
 {
 	unsigned offset;
 	struct flash_info *flash_info;
+	struct ptentry *board_part_list;
 	unsigned total_num_of_blocks;
 	unsigned next_ptr_start_adr = 0;
 	unsigned blocks_per_1MB = 8; /* Default value of 2k page size on 256MB flash drive*/
@@ -152,6 +194,11 @@
 	total_num_of_blocks = flash_info->num_blocks;
 	blocks_per_1MB = (1 << 20) / (flash_info->block_size);
 
+	if (flash_ecc_bch_enabled())
+		board_part_list = board_part_list_bchecc;
+	else
+		board_part_list = board_part_list_default;
+
 	for (i = 0; i < num_parts; i++) {
 		struct ptentry *ptn = &board_part_list[i];
 		unsigned len = ((ptn->length) * blocks_per_1MB);