aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArun Nagendran <arunrasppi@gmail.com>2017-09-15 12:30:32 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-09-18 06:25:31 -0400
commita3563b09f132661d447f69224ef65fdec02f5c61 (patch)
tree533e0a1c20bb1eb630e52e656002cda3b826edb7
parent056e4fc2018364ba01a23a1ced0ccbbdfa4520b3 (diff)
staging: mt29f_spinand: Enable the read ECC before program the page
Current program_page function did following operation: 1. read page (with ECC OFF) 2. modify the page 3. write the page (with ECC ON) For some case(buggy flash Chip), while read the page without ECC ON, we may read the page with bit flip error and modify that bad page without knowing the bit flip error on that page. also we re-calculate the hash for bad page and write it. This could bring potential in-consistency problem with Flash data. Verify this logic with GIGA DEVICE Part(GD5F2GQ4RCFIG): we see this in-conststency problem wit Giga Device and fix on this patch resovle that issue. Signed-off-by: Arun Nagendran <arunrasppi@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/mt29f_spinand/mt29f_spinand.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/staging/mt29f_spinand/mt29f_spinand.c b/drivers/staging/mt29f_spinand/mt29f_spinand.c
index 13eaf16ecd16..87595c594b12 100644
--- a/drivers/staging/mt29f_spinand/mt29f_spinand.c
+++ b/drivers/staging/mt29f_spinand/mt29f_spinand.c
@@ -496,8 +496,12 @@ static int spinand_program_page(struct spi_device *spi_nand,
496 if (!wbuf) 496 if (!wbuf)
497 return -ENOMEM; 497 return -ENOMEM;
498 498
499 enable_read_hw_ecc = 0; 499 enable_read_hw_ecc = 1;
500 spinand_read_page(spi_nand, page_id, 0, CACHE_BUF, wbuf); 500 retval = spinand_read_page(spi_nand, page_id, 0, CACHE_BUF, wbuf);
501 if (retval < 0) {
502 dev_err(&spi_nand->dev, "ecc error on read page!!!\n");
503 return retval;
504 }
501 505
502 for (i = offset, j = 0; i < len; i++, j++) 506 for (i = offset, j = 0; i < len; i++, j++)
503 wbuf[i] &= buf[j]; 507 wbuf[i] &= buf[j];