From mboxrd@z Thu Jan 1 00:00:00 1970 From: Abhishek Sahu Subject: [PATCH 1/9] mtd: nand: qcom: use the ecc strength from device parameter Date: Wed, 4 Apr 2018 18:12:17 +0530 Message-ID: <1522845745-6624-2-git-send-email-absahu@codeaurora.org> References: <1522845745-6624-1-git-send-email-absahu@codeaurora.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Return-path: In-Reply-To: <1522845745-6624-1-git-send-email-absahu@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org To: Boris Brezillon Cc: David Woodhouse , Brian Norris , Marek Vasut , Richard Weinberger , Cyrille Pitchen , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, Andy Gross , Archit Taneja , Abhishek Sahu List-Id: linux-arm-msm@vger.kernel.org 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 --- 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