diff options
author | Chandan Uddaraju <chandanu@quicinc.com> | 2010-01-21 15:36:37 -0800 |
---|---|---|
committer | Chandan Uddaraju <chandanu@quicinc.com> | 2010-01-21 16:31:30 -0800 |
commit | 9e5ab966faae3bd01baaa4fc1356605a241000c7 (patch) | |
tree | acedac8bbfb182c100f672913fdad5498e54ccdb | |
parent | a7be71db697d8d8712f0fb0708917828082a72b2 (diff) | |
download | lk-9e5ab966faae3bd01baaa4fc1356605a241000c7.tar.gz |
[target/[msm7627,msm7630]: Add persist partition and re-arange partition table.
Move recovery partition to the end.
Add persist partition to msm7627_surf, msm7627_ffa and msm7630_surf targets.
Make userdata partition to have variable length and add code to
allocate the remaining/leftover space on flash to userdata partition.
Correct the density value for 4k page nand device in the supported nand
devices array.
Increase the system partition for msm7630_surf target by 5MB.
-rwxr-xr-x | platform/msm_shared/nand.c | 2 | ||||
-rw-r--r-- | target/msm7627_ffa/init.c | 47 | ||||
-rw-r--r-- | target/msm7627_surf/init.c | 47 | ||||
-rw-r--r-- | target/msm7630_surf/init.c | 53 |
4 files changed, 124 insertions, 25 deletions
diff --git a/platform/msm_shared/nand.c b/platform/msm_shared/nand.c index 30dd3b97..6e5a86f2 100755 --- a/platform/msm_shared/nand.c +++ b/platform/msm_shared/nand.c @@ -132,7 +132,7 @@ static struct flash_identification supported_flash[] = {0x004000ec, 0xFFFFFFFF, (256<<20), 0, 2048, (2048<<6), 64, 1}, /*Sams*/ {0x005c00ec, 0xFFFFFFFF, (256<<20), 0, 2048, (2048<<6), 64, 1}, /*Sams*/ {0x005800ec, 0xFFFFFFFF, (256<<20), 0, 2048, (2048<<6), 64, 1}, /*Sams*/ - {0x6600bcec, 0xFF00FFFF, (1024<<20), 1, 4096, (4096<<6), 128, 0}, /*Sams*/ + {0x6600bcec, 0xFF00FFFF, (512<<20), 1, 4096, (2048<<6), 128, 0}, /*Sams*/ /* Note: Width flag is 0 for 8 bit Flash and 1 for 16 bit flash */ /* Note: Onenand flag is 0 for NAND Flash and 1 for OneNAND flash */ /* Note: The First row will be filled at runtime during ONFI probe */ diff --git a/target/msm7627_ffa/init.c b/target/msm7627_ffa/init.c index 2d8ac252..16c3c8a7 100644 --- a/target/msm7627_ffa/init.c +++ b/target/msm7627_ffa/init.c @@ -39,6 +39,10 @@ #define LINUX_MACHTYPE 1007015 +#define VARIABLE_LENGTH 0x10101010 +#define DIFF_START_ADDR 0xF0F0F0F0 +#define NUM_PAGES_PER_BLOCK 0x40 + static struct ptable flash_ptable; /* for these partitions, start will be offset by either what we get from @@ -67,13 +71,18 @@ static struct ptentry board_part_list[] = { }, { .start = 704, - .length = 40 /* 5MB */, - .name = "recovery", + .length = VARIABLE_LENGTH, + .name = "userdata", }, { - .start = 744, - .length = 720 /* 90MB */, - .name = "userdata", + .start = DIFF_START_ADDR, + .length = 8 /* 1MB */, + .name = "persist", + }, + { + .start = DIFF_START_ADDR, + .length = 40 /* 5MB */, + .name = "recovery", }, }; static int num_parts = sizeof(board_part_list)/sizeof(struct ptentry); @@ -89,6 +98,9 @@ void target_init(void) { unsigned offset; struct flash_info *flash_info; + unsigned total_num_of_blocks; + bool start_addr_changed = false; + unsigned next_ptr_start_adr = 0; int i; dprintf(INFO, "target_init()\n"); @@ -112,12 +124,33 @@ void target_init(void) if (offset == 0xffffffff) while(1); + total_num_of_blocks = (flash_info->block_size)/NUM_PAGES_PER_BLOCK; + for (i = 0; i < num_parts; i++) { struct ptentry *ptn = &board_part_list[i]; unsigned len = ptn->length; - if ((len == 0) && (i == num_parts - 1)) - len = flash_info->num_blocks - offset - ptn->start; + if(len == VARIABLE_LENGTH) + { + start_addr_changed = true; + unsigned length_for_prt = 0; + unsigned j; + for (j = i+1; j < num_parts; j++) + { + struct ptentry *temp_ptn = &board_part_list[j]; + ASSERT(temp_ptn->length != VARIABLE_LENGTH); + length_for_prt += temp_ptn->length; + } + len = (total_num_of_blocks - 1) - (offset + ptn->start + length_for_prt); + ASSERT(len >= 0); + next_ptr_start_adr = ptn->start + len; + } + if((ptn->start == DIFF_START_ADDR) && (start_addr_changed)) + { + ASSERT(next_ptr_start_adr); + ptn->start = next_ptr_start_adr; + next_ptr_start_adr = ptn->start + ptn->length; + } ptable_add(&flash_ptable, ptn->name, offset + ptn->start, len, ptn->flags); } diff --git a/target/msm7627_surf/init.c b/target/msm7627_surf/init.c index d198fe36..0d56db56 100644 --- a/target/msm7627_surf/init.c +++ b/target/msm7627_surf/init.c @@ -39,6 +39,10 @@ #define LINUX_MACHTYPE 1007014 +#define VARIABLE_LENGTH 0x10101010 +#define DIFF_START_ADDR 0xF0F0F0F0 +#define NUM_PAGES_PER_BLOCK 0x40 + static struct ptable flash_ptable; /* for these partitions, start will be offset by either what we get from @@ -67,13 +71,18 @@ static struct ptentry board_part_list[] = { }, { .start = 704, - .length = 40 /* 5MB */, - .name = "recovery", + .length = VARIABLE_LENGTH, + .name = "userdata", }, { - .start = 744, - .length = 720 /* 90MB */, - .name = "userdata", + .start = DIFF_START_ADDR, + .length = 8 /* 1MB */, + .name = "persist", + }, + { + .start = DIFF_START_ADDR, + .length = 40 /* 5MB */, + .name = "recovery", }, }; static int num_parts = sizeof(board_part_list)/sizeof(struct ptentry); @@ -89,6 +98,9 @@ void target_init(void) { unsigned offset; struct flash_info *flash_info; + unsigned total_num_of_blocks; + bool start_addr_changed = false; + unsigned next_ptr_start_adr = 0; int i; dprintf(INFO, "target_init()\n"); @@ -112,12 +124,33 @@ void target_init(void) if (offset == 0xffffffff) while(1); + total_num_of_blocks = (flash_info->block_size)/NUM_PAGES_PER_BLOCK; + for (i = 0; i < num_parts; i++) { struct ptentry *ptn = &board_part_list[i]; unsigned len = ptn->length; - if ((len == 0) && (i == num_parts - 1)) - len = flash_info->num_blocks - offset - ptn->start; + if(len == VARIABLE_LENGTH) + { + start_addr_changed = true; + unsigned length_for_prt = 0; + unsigned j; + for (j = i+1; j < num_parts; j++) + { + struct ptentry *temp_ptn = &board_part_list[j]; + ASSERT(temp_ptn->length != VARIABLE_LENGTH); + length_for_prt += temp_ptn->length; + } + len = (total_num_of_blocks - 1) - (offset + ptn->start + length_for_prt); + ASSERT(len >= 0); + next_ptr_start_adr = ptn->start + len; + } + if((ptn->start == DIFF_START_ADDR) && (start_addr_changed)) + { + ASSERT(next_ptr_start_adr); + ptn->start = next_ptr_start_adr; + next_ptr_start_adr = ptn->start + ptn->length; + } ptable_add(&flash_ptable, ptn->name, offset + ptn->start, len, ptn->flags); } diff --git a/target/msm7630_surf/init.c b/target/msm7630_surf/init.c index 1f1136c8..2ad8fb2d 100644 --- a/target/msm7630_surf/init.c +++ b/target/msm7630_surf/init.c @@ -51,6 +51,10 @@ enum platform HW_PLATFORM_32BITS = 0x7FFFFFFF }; +#define VARIABLE_LENGTH 0x10101010 +#define DIFF_START_ADDR 0xF0F0F0F0 +#define NUM_PAGES_PER_BLOCK 0x40 + static struct ptable flash_ptable; /* for these partitions, start will be offset by either what we get from @@ -69,24 +73,29 @@ static struct ptentry board_part_list[] = { }, { .start = 20, - .length = 320 /* 80MB */, + .length = 340 /* 85MB */, .name = "system", }, { - .start = 340, - .length = 20 /* 5MB */, - .name = "cache", - }, - { .start = 360, .length = 20 /* 5MB */, - .name = "recovery", + .name = "cache", }, { .start = 380, - .length = 400 /* 100MB */, + .length = VARIABLE_LENGTH, .name = "userdata", }, + { + .start = DIFF_START_ADDR, + .length = 4 /* 1MB */, + .name = "persist", + }, + { + .start = DIFF_START_ADDR, + .length = 20 /* 5MB */, + .name = "recovery", + }, }; static int num_parts = sizeof(board_part_list)/sizeof(struct ptentry); @@ -102,6 +111,9 @@ void target_init(void) { unsigned offset; struct flash_info *flash_info; + unsigned total_num_of_blocks; + bool start_addr_changed = false; + unsigned next_ptr_start_adr = 0; int i; dprintf(INFO, "target_init()\n"); @@ -125,12 +137,33 @@ void target_init(void) if (offset == 0xffffffff) while(1); + total_num_of_blocks = (flash_info->block_size)/NUM_PAGES_PER_BLOCK; + for (i = 0; i < num_parts; i++) { struct ptentry *ptn = &board_part_list[i]; unsigned len = ptn->length; - if ((len == 0) && (i == num_parts - 1)) - len = flash_info->num_blocks - offset - ptn->start; + if(len == VARIABLE_LENGTH) + { + start_addr_changed = true; + unsigned length_for_prt = 0; + unsigned j; + for (j = i+1; j < num_parts; j++) + { + struct ptentry *temp_ptn = &board_part_list[j]; + ASSERT(temp_ptn->length != VARIABLE_LENGTH); + length_for_prt += temp_ptn->length; + } + len = (total_num_of_blocks - 1) - (offset + ptn->start + length_for_prt); + ASSERT(len >= 0); + next_ptr_start_adr = ptn->start + len; + } + if((ptn->start == DIFF_START_ADDR) && (start_addr_changed)) + { + ASSERT(next_ptr_start_adr); + ptn->start = next_ptr_start_adr; + next_ptr_start_adr = ptn->start + ptn->length; + } ptable_add(&flash_ptable, ptn->name, offset + ptn->start, len, ptn->flags); } |