mtd: atmel_nand: add pmecc support for 512, 1k, 4k, 8k page size

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Wed Oct 15 23:59:01 PDT 2014


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=a35571058ec8e7c82dceea90cdecead51674f963
Commit:     a35571058ec8e7c82dceea90cdecead51674f963
Parent:     796fe3648a13b311f5b9a125e2d2532a2ce7c78a
Author:     Wu, Josh <Josh.wu at atmel.com>
AuthorDate: Tue Jul 22 17:24:18 2014 +0800
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Tue Aug 19 11:53:06 2014 -0700

    mtd: atmel_nand: add pmecc support for 512, 1k, 4k, 8k page size
    
    PMECC can support 512, 1k, 2k, 4k, 8k page size.
    The driver currently only support 2k page size nand flash. So this patch
    add support to 512, 1k, 4k and 8k page size nand flash.
    
    Signed-off-by: Josh Wu <josh.wu at atmel.com>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/nand/atmel_nand.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 77bd877..e4d57ff 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -1174,7 +1174,17 @@ static int atmel_pmecc_nand_init_params(struct platform_device *pdev,
 
 	/* set ECC page size and oob layout */
 	switch (mtd->writesize) {
+	case 512:
+	case 1024:
 	case 2048:
+	case 4096:
+	case 8192:
+		if (sector_size > mtd->writesize) {
+			dev_err(host->dev, "pmecc sector size is bigger than the page size!\n");
+			err_no = -EINVAL;
+			goto err;
+		}
+
 		host->pmecc_degree = (sector_size == 512) ?
 			PMECC_GF_DIMENSION_13 : PMECC_GF_DIMENSION_14;
 		host->pmecc_cw_len = (1 << host->pmecc_degree) - 1;
@@ -1201,13 +1211,9 @@ static int atmel_pmecc_nand_init_params(struct platform_device *pdev,
 
 		nand_chip->ecc.layout = &atmel_pmecc_oobinfo;
 		break;
-	case 512:
-	case 1024:
-	case 4096:
-		/* TODO */
+	default:
 		dev_warn(host->dev,
 			"Unsupported page size for PMECC, use Software ECC\n");
-	default:
 		/* page size not handled by HW ECC */
 		/* switching back to soft ECC */
 		nand_chip->ecc.mode = NAND_ECC_SOFT;



More information about the linux-mtd-cvs mailing list