mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 20:32:04 +09:00
mtd: nand: fix rsv info save
PD#146160: mtd: nand: fix rsv info save operations 1. fix pages calculations 2. update valid flag after 1st write. Change-Id: I498ff0b6e11939813d69141d8d18be30d15d8b1c Signed-off-by: Yonghui Yu <yonghui.yu@amlogic.com>
This commit is contained in:
@@ -601,7 +601,6 @@ int aml_nand_save_rsv_info(struct mtd_info *mtd,
|
||||
int error = 0, pages_per_blk, i = 1;
|
||||
loff_t addr = 0;
|
||||
struct erase_info erase_info;
|
||||
struct aml_nand_chip *aml_chip = mtd_to_nand_chip(mtd);
|
||||
|
||||
pages_per_blk = mtd->erasesize / mtd->writesize;
|
||||
/*solve these abnormals caused by power off and ecc error*/
|
||||
@@ -609,11 +608,10 @@ int aml_nand_save_rsv_info(struct mtd_info *mtd,
|
||||
|| (nandrsv_info->valid_node->status & ECC_ABNORMAL_FLAG))
|
||||
nandrsv_info->valid_node->phy_page_addr = pages_per_blk;
|
||||
|
||||
if ((mtd->writesize < nandrsv_info->size)
|
||||
&& (aml_chip->aml_nandenv_info->valid == 1))
|
||||
if (mtd->writesize < nandrsv_info->size)
|
||||
i = (nandrsv_info->size + mtd->writesize - 1) / mtd->writesize;
|
||||
pr_info("%s:%d,valid=%d, pages=%d\n", __func__, __LINE__,
|
||||
aml_chip->aml_nandenv_info->valid, i);
|
||||
pr_info("%s:%d, %s: valid=%d, pages=%d\n", __func__, __LINE__,
|
||||
nandrsv_info->name, nandrsv_info->valid, i);
|
||||
RE_SEARCH:
|
||||
if (nandrsv_info->valid) {
|
||||
/*pr_info("%s:%d,phy_page_addr=%d,pages=%d\n",
|
||||
@@ -711,7 +709,8 @@ if ((nandrsv_info->valid_node->phy_page_addr+i) > pages_per_blk) {
|
||||
pr_info("update nand env FAILED!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!nandrsv_info->valid)
|
||||
nandrsv_info->valid = 1;
|
||||
/* clear status when write successfully*/
|
||||
nandrsv_info->valid_node->status = 0;
|
||||
return error;
|
||||
|
||||
Reference in New Issue
Block a user