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,18 +403,33 @@ 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)) {
/* Nand flash is erased by block and gpt table just if (dev_desc->devnum == BLK_MTD_SPI_NOR) {
* resserve 33 sectors for the last partition. This /* Nor is 64KB erase block(kernel) and gpt table just
* will erase the backup gpt table by user program, * resserve 33 sectors for the last partition. This
* so reserve one block. * 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 - snprintf(mtd_part_info_p, data_len - 1, "0x%x@0x%x(%s)",
(info.size - 1) % (int)(size_t)(info.size -
(mtd->erasesize >> 9) - 1) << 9, (info.size - 1) %
(int)(size_t)info.start << 9, (0x10000 >> 9) - 1) << 9,
info.name); (int)(size_t)info.start << 9,
break; info.name);
break;
} else {
/* Nand flash is erased by block 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) %
(mtd->erasesize >> 9) - 1) << 9,
(int)(size_t)info.start << 9,
info.name);
break;
}
} }
length = strlen(mtd_part_info_temp); length = strlen(mtd_part_info_temp);
data_len -= length; data_len -= length;