mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
nand: fix data corruption after mtd write
PD#138714: fix data corruption after mtd write nand_chip.erase is obligatory, without this implement, nand write will fail and cause ecc fail next time read data. Change-Id: I79cabce7c03938e13785ecc42d48b9e750508f3e Signed-off-by: Frank Chen <frank.chen@amlogic.com>
This commit is contained in:
@@ -798,7 +798,7 @@ void aml_nand_command(struct mtd_info *mtd,
|
||||
|
||||
int aml_nand_wait(struct mtd_info *mtd, struct nand_chip *chip);
|
||||
|
||||
void aml_nand_erase_cmd(struct mtd_info *mtd, int page);
|
||||
int aml_nand_erase_cmd(struct mtd_info *mtd, int page);
|
||||
|
||||
int add_mtd_partitions(struct mtd_info *mtd,
|
||||
const struct mtd_partition *part, int num);
|
||||
|
||||
@@ -1109,7 +1109,7 @@ void aml_nand_command(struct mtd_info *mtd,
|
||||
}
|
||||
|
||||
|
||||
void aml_nand_erase_cmd(struct mtd_info *mtd, int page)
|
||||
int aml_nand_erase_cmd(struct mtd_info *mtd, int page)
|
||||
{
|
||||
struct aml_nand_chip *aml_chip = mtd_to_nand_chip(mtd);
|
||||
struct nand_chip *chip = mtd->priv;
|
||||
@@ -1123,7 +1123,7 @@ void aml_nand_erase_cmd(struct mtd_info *mtd, int page)
|
||||
vt_page_num = (mtd->writesize / (1 << chip->page_shift));
|
||||
vt_page_num *= (1 << pages_per_blk_shift);
|
||||
if (page % vt_page_num)
|
||||
return;
|
||||
return 0;
|
||||
|
||||
/* Send commands to erase a block */
|
||||
valid_page_num = (mtd->writesize >> chip->page_shift);
|
||||
@@ -1131,7 +1131,7 @@ void aml_nand_erase_cmd(struct mtd_info *mtd, int page)
|
||||
block_addr = ((page / valid_page_num) >> pages_per_blk_shift);
|
||||
|
||||
if (aml_nand_rsv_erase_protect(mtd, block_addr) == -1)
|
||||
return;
|
||||
return -EPERM;
|
||||
|
||||
valid_page_num /= aml_chip->plane_num;
|
||||
|
||||
@@ -1166,6 +1166,7 @@ void aml_nand_erase_cmd(struct mtd_info *mtd, int page)
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void aml_nand_dma_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
|
||||
|
||||
@@ -1285,7 +1285,7 @@ static int aml_nand_scan_ident(struct mtd_info *mtd, int maxchips)
|
||||
|
||||
chip->cmdfunc = aml_nand_command;
|
||||
chip->waitfunc = aml_nand_wait;
|
||||
/*chip->erase_cmd = aml_nand_erase_cmd;*/
|
||||
chip->erase = aml_nand_erase_cmd;
|
||||
chip->write_page = aml_nand_write_page;
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user