[PATCH 2/3 v2] mtd: atmel_nand: fix bit error correction

Raphael Poggi poggi.raph at gmail.com
Thu Jul 17 05:12:20 PDT 2014


When pmecc uses a 1024 sector size to correct bit error, the gf dimension
must be 14.

So this commit chooses the right degree for different sector size (512 or 1024).

Signed-off-by: Raphaël Poggi <poggi.raph at gmail.com>
---
 drivers/mtd/nand/atmel_nand.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index a02f38f..1ce7d4d 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -796,7 +796,8 @@ static int __init atmel_pmecc_nand_init_params(struct device_d *dev,
 	switch (mtd->writesize) {
 	case 2048:
 	case 4096:
-		host->pmecc_degree = PMECC_GF_DIMENSION_13;
+		host->pmecc_degree = (sector_size == 512) ?
+					PMECC_GF_DIMENSION_13 : PMECC_GF_DIMENSION_14;
 		host->pmecc_cw_len = (1 << host->pmecc_degree) - 1;
 		host->pmecc_sector_number = mtd->writesize / sector_size;
 		host->pmecc_bytes_per_sector = pmecc_get_ecc_bytes(
-- 
1.7.9.5




More information about the barebox mailing list