[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1398938214-17847-41-git-send-email-lee.jones@linaro.org>
Date: Thu, 1 May 2014 10:56:47 +0100
From: Lee Jones <lee.jones@...aro.org>
To: linux-kernel@...r.kernel.org
Cc: computersforpeace@...il.com, linux-mtd@...ts.infradead.org,
kernel@...inux.com, Lee Jones <lee.jones@...aro.org>
Subject: [PATCH 40/47] mtd: nand: stm_nand_bch: fetch the bit-flips threshold
If none is provided by the platform, the default ECC mode will be used.
Signed-off-by: Lee Jones <lee.jones@...aro.org>
---
drivers/mtd/nand/stm_nand_bch.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/mtd/nand/stm_nand_bch.c b/drivers/mtd/nand/stm_nand_bch.c
index 0f96f75..e742655 100644
--- a/drivers/mtd/nand/stm_nand_bch.c
+++ b/drivers/mtd/nand/stm_nand_bch.c
@@ -44,6 +44,12 @@ static int bch_ecc_sizes[] = {
[BCH_NO_ECC] = 0,
};
+static int bch_ecc_strength[] = {
+ [BCH_18BIT_ECC] = 18,
+ [BCH_30BIT_ECC] = 30,
+ [BCH_NO_ECC] = 0,
+};
+
/*
* Inband Bad Block Table (IBBT)
*/
@@ -2030,6 +2036,21 @@ static int stm_nand_bch_probe(struct platform_device *pdev)
info->ecclayout.eccbytes =
nandi->sectors_per_page * bch_ecc_sizes[nandi->bch_ecc_mode];
+ /*
+ * Get bit-flips threshold. A value of '0' is interpreted as
+ * <ecc_strength>.
+ */
+ if (pdata->bch_bitflip_threshold) {
+ nandi->bitflip_threshold = pdata->bch_bitflip_threshold;
+ } else {
+ dev_warn(nandi->dev,
+ "WARNING: bit-flips threshold not specified.\n"
+ " Defaulting to ECC strength [%d]\n",
+ bch_ecc_strength[nandi->bch_ecc_mode]);
+ nandi->bitflip_threshold =
+ bch_ecc_strength[nandi->bch_ecc_mode];
+ }
+
compatible = bch_check_compatibility(nandi, mtd, chip);
if (!compatible) {
dev_err(nandi->dev,
--
1.8.3.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists