[PATCH 1/9] mtd: nand: qcom: use the ecc strength from device parameter

From: Abhishek Sahu
Date: Wed Apr 04 2018 - 08:42:53 EST


Currently the driver uses the ECC strength specified in
device tree. The ONFI or JEDEC device parameter page
contains the âECC correctabilityâ field which indicates the
number of bits that the host should be able to correct per
512 bytes of data. The ecc correctability is assigned in
chip parameter during device probe time. QPIC/EBI2 NAND
supports 4/8-bit ecc correction. The Same kind of board
can have different NAND parts so use the ecc strength
from device parameter (if its non zero) instead of
device tree.

Signed-off-by: Abhishek Sahu <absahu@xxxxxxxxxxxxxx>
---
drivers/mtd/nand/qcom_nandc.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/mtd/nand/qcom_nandc.c b/drivers/mtd/nand/qcom_nandc.c
index 563b759..8dd40de 100644
--- a/drivers/mtd/nand/qcom_nandc.c
+++ b/drivers/mtd/nand/qcom_nandc.c
@@ -2334,6 +2334,14 @@ static int qcom_nand_host_setup(struct qcom_nand_host *host)
return -EINVAL;
}

+ /*
+ * Read the required ecc strength from NAND device and overwrite
+ * the device tree ecc strength for devices which require
+ * ecc correctability bits >= 8
+ */
+ if (chip->ecc_strength_ds >= 8)
+ ecc->strength = 8;
+
wide_bus = chip->options & NAND_BUSWIDTH_16 ? true : false;

if (ecc->strength >= 8) {
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation