summaryrefslogtreecommitdiff
path: root/drivers/mtd/nand/nand_base.c
diff options
context:
space:
mode:
authorJordan Friendshuh <jfriendshuh@xes-inc.com>2014-08-27 12:45:36 -0500
committerBrian Norris <computersforpeace@gmail.com>2014-11-05 00:08:59 -0800
commit438320dd34a4d0b2b177fbae749c3b9d00532faf (patch)
treecb8404e21d7d422408074cf1ae9f0df1f83cc89f /drivers/mtd/nand/nand_base.c
parentc9d79c4bbb0e47a75f35652567b2647b99d6295e (diff)
downloadlwn-438320dd34a4d0b2b177fbae749c3b9d00532faf.tar.gz
lwn-438320dd34a4d0b2b177fbae749c3b9d00532faf.zip
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@xes-inc.com> Signed-off-by: Aaron Sierra <asierra@xes-inc.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd/nand/nand_base.c')
-rw-r--r--drivers/mtd/nand/nand_base.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 5b5c62712814..4b7e0287b48f 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);