summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>2018-01-04 16:04:22 +0530
committerMichal Simek <michal.simek@xilinx.com>2018-01-30 14:29:07 +0100
commitf25ac66c528553a38d349c563d67d0eebbdd77f9 (patch)
tree525378bbe22a1020885976e2f88ba376d9f1a55b
parentcacb8a029fa1d1c140625f18e01663817a2d1b7f (diff)
nand: arasan_nfc: Use the calculated ecc address for updating ecc register
This patch corrects the ecc address calculation before updating to ecc register. The ecc address has to be calculated based on page, oob and ecc sizes of the device. Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
-rw-r--r--drivers/mtd/nand/arasan_nfc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/mtd/nand/arasan_nfc.c b/drivers/mtd/nand/arasan_nfc.c
index 70cb00e85f..3c9a0215c5 100644
--- a/drivers/mtd/nand/arasan_nfc.c
+++ b/drivers/mtd/nand/arasan_nfc.c
@@ -1133,7 +1133,7 @@ static void arasan_check_ondie(struct mtd_info *mtd)
static int arasan_nand_ecc_init(struct mtd_info *mtd)
{
int found = -1;
- u32 regval, eccpos_start, i;
+ u32 regval, eccpos_start, i, eccaddr;
struct nand_chip *nand_chip = mtd_to_nand(mtd);
for (i = 0; i < ARRAY_SIZE(ecc_matrix); i++) {
@@ -1152,7 +1152,10 @@ static int arasan_nand_ecc_init(struct mtd_info *mtd)
if (found < 0)
return 1;
- regval = ecc_matrix[found].eccaddr |
+ eccaddr = mtd->writesize + mtd->oobsize -
+ ecc_matrix[found].eccsize;
+
+ regval = eccaddr |
(ecc_matrix[found].eccsize << ARASAN_NAND_ECC_SIZE_SHIFT) |
(ecc_matrix[found].bch << ARASAN_NAND_ECC_BCH_SHIFT);
writel(regval, &arasan_nand_base->ecc_reg);