mtd: nand: Base BCH ECC bytes on required strength

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Dec 15 19:59:04 PST 2014


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=438320dd34a4d0b2b177fbae749c3b9d00532faf
Commit:     438320dd34a4d0b2b177fbae749c3b9d00532faf
Parent:     c9d79c4bbb0e47a75f35652567b2647b99d6295e
Author:     Jordan Friendshuh <jfriendshuh at xes-inc.com>
AuthorDate: Wed Aug 27 12:45:36 2014 -0500
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Wed Nov 5 00:08:59 2014 -0800

    mtd: nand: Base BCH ECC bytes on required strength
    
    NAND devices with page sizes over 4 KiB require more than 4-bits of ECC
    coverage. This patch calculates the value of ecc_bytes based on a still
    assumed 512-byte step size (13-bits) and the ecc_strength.
    
    Example:
    Micron M73A devices (8 KiB page) require 8-bit ECC per 512-byte
    
    Signed-off-by: Jordan Friendshuh <jfriendshuh at xes-inc.com>
    Signed-off-by: Aaron Sierra <asierra at xes-inc.com>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/nand/nand_base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 5b5c627..4b7e028 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -4035,7 +4035,7 @@ int nand_scan_tail(struct mtd_info *mtd)
 		 */
 		if (!ecc->size && (mtd->oobsize >= 64)) {
 			ecc->size = 512;
-			ecc->bytes = 7;
+			ecc->bytes = DIV_ROUND_UP(13 * ecc->strength, 8);
 		}
 		ecc->priv = nand_bch_init(mtd, ecc->size, ecc->bytes,
 					       &ecc->layout);



More information about the linux-mtd-cvs mailing list