mtd: mtd_blk: spinor reserved area aligned to 64KB

1.reserve for GPT
2.kernel spinor erasesize is 64KB

Change-Id: I32a5b26f8f39b4b226ec54342ce5d8d3d71f1c4d
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
This commit is contained in:
Jon Lin 2021-01-14 11:59:30 +08:00 committed by Jianhong Chen
parent e3a5bc90c0
commit ce9d2743ba
1 changed files with 27 additions and 12 deletions

View File

@ -403,6 +403,20 @@ char *mtd_part_parse(void)
info.name); info.name);
strcat(mtd_part_info, ","); strcat(mtd_part_info, ",");
if (part_get_info(dev_desc, p + 1, &info)) { if (part_get_info(dev_desc, p + 1, &info)) {
if (dev_desc->devnum == BLK_MTD_SPI_NOR) {
/* Nor is 64KB erase block(kernel) and gpt table just
* resserve 33 sectors for the last partition. This
* will erase the backup gpt table by user program,
* so reserve one block.
*/
snprintf(mtd_part_info_p, data_len - 1, "0x%x@0x%x(%s)",
(int)(size_t)(info.size -
(info.size - 1) %
(0x10000 >> 9) - 1) << 9,
(int)(size_t)info.start << 9,
info.name);
break;
} else {
/* Nand flash is erased by block and gpt table just /* Nand flash is erased by block and gpt table just
* resserve 33 sectors for the last partition. This * resserve 33 sectors for the last partition. This
* will erase the backup gpt table by user program, * will erase the backup gpt table by user program,
@ -416,6 +430,7 @@ char *mtd_part_parse(void)
info.name); info.name);
break; break;
} }
}
length = strlen(mtd_part_info_temp); length = strlen(mtd_part_info_temp);
data_len -= length; data_len -= length;
mtd_part_info_p = mtd_part_info_p + length + 1; mtd_part_info_p = mtd_part_info_p + length + 1;