Received: by 10.213.65.68 with SMTP id h4csp692225imn; Wed, 4 Apr 2018 05:47:42 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/3egne4/8AwAmJlf+psasZFxh+PF/SW/TUwvMq2fVbziLKFIaqgTIwsF/jOWLgPTecOpNB X-Received: by 10.98.10.156 with SMTP id 28mr13831259pfk.33.1522846062296; Wed, 04 Apr 2018 05:47:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522846062; cv=none; d=google.com; s=arc-20160816; b=Bo2UpogTm2G2ELHPzHFkAOzLDeBYxqMW1yRdzCl8utWDsPS2GUUiJ2cU30QbJncqr+ 8n7P/At1lms3QWSGMtySFjk7Gg+Sc5A45CwquxllWDCLk8WnRGkJylwXEsrC78CKTLzB /biFrtdRkQxaYZubTNTNk1CB4QmpcwdrMSkUpCjkGFrhjaqs4eSYAc79Oi1SQdrlvn8u i/CnG4XMnEr8ZwgbknkZBY2gpuJnviaIdzqZF4y+Cmc7DDx6t26rSpZiyZoS7vwn4He8 Ud3ridmbzKXCvbz57zFW8ea86PqPls/wxEDOvk6fH0lqo071DRlTxY45aeJYGOXkfZhz TADQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=6LPX118JkpwPV1XJ+bRwX0GWh1DLgLmdfmXHBgCNiUU=; b=O0czMsBTE3LVWLffWfPq5FWGGxodALxX/TZ4DwwYrj6z15JovDQDZVcJrQ6BSMVXQu nhRMYa0RmCBv5WvwfcMov1tfNP3sIqCYwS/neRvxBCNRJsXZl9GuyO4EtiwLpyBeGM49 bv03thxAxlm3yNsg85qW8QkJ+q84ZU1Mzq9E1ZIvaVnHMserdDhFjd23UqP8/W7l4bJw A33ytVTEALJ9Ti1/6WL59rpkSvn8zBb7j15POvOJA+AAch/+iBaNqx6SImCjlQkfENOw 9Vzwh0VTu9nonlvhQkiyc4IujUJvN9YmNE3vWkJfkgfOiuSmYOx6O6C0AvoHqkM/K+F/ BJ/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Ek/qcME5; dkim=pass header.i=@codeaurora.org header.s=default header.b=MlvIrGN7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u2-v6si3237574plq.334.2018.04.04.05.47.28; Wed, 04 Apr 2018 05:47:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Ek/qcME5; dkim=pass header.i=@codeaurora.org header.s=default header.b=MlvIrGN7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751426AbeDDMnE (ORCPT + 99 others); Wed, 4 Apr 2018 08:43:04 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:40728 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751038AbeDDMnA (ORCPT ); Wed, 4 Apr 2018 08:43:00 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id E2C7B60F61; Wed, 4 Apr 2018 12:42:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522845779; bh=ACgRFF6QWKAoA1zRrrJQDD9PGF9Hn3Apee+BE0bwC/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ek/qcME5o/+X7pjYfpLVVGoxIBleSx7RgbsbX++d9DSiAfsgUEzHch0Ie3lr4SQx+ Ak2Xgpm9uF8QLcqMp/AVBg8d9ehNS44HWzKxDxRq5wZuDR960TM4x20BpY2yirYkdr kdo99eJkqhZTK6FyHXVDTbdh54i1WIdlC4hM5Qn4= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from absahu-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: absahu@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 6C89160C66; Wed, 4 Apr 2018 12:42:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522845778; bh=ACgRFF6QWKAoA1zRrrJQDD9PGF9Hn3Apee+BE0bwC/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MlvIrGN7DdoEOx2DhI++o0c9Ebk0nhCuPrpKo4+3qX8yP1HSmVuXafVEQ4+wCuDCy uhwo+a4mbaL6jaQc6IW116ziCe1wC2IPaLrW1uQBxTZpqnTGc6R6xh4qEBnoP4Qx9p PfcH00PpHG8z5ECCfgBsyiyTNNZC7r2uriguhs6c= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 6C89160C66 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=absahu@codeaurora.org From: Abhishek Sahu 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 Subject: [PATCH 3/9] mtd: nand: qcom: erased page detection for uncorrectable errors only Date: Wed, 4 Apr 2018 18:12:19 +0530 Message-Id: <1522845745-6624-4-git-send-email-absahu@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1522845745-6624-1-git-send-email-absahu@codeaurora.org> References: <1522845745-6624-1-git-send-email-absahu@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The NAND flash controller generates ECC uncorrectable error first in case of completely erased page. Currently driver applies the erased page detection logic for other operation errors also so fix this and return EIO for other operational errors. Signed-off-by: Abhishek Sahu --- drivers/mtd/nand/qcom_nandc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nand/qcom_nandc.c b/drivers/mtd/nand/qcom_nandc.c index 17321fc..57c16a6 100644 --- a/drivers/mtd/nand/qcom_nandc.c +++ b/drivers/mtd/nand/qcom_nandc.c @@ -1578,6 +1578,7 @@ static int parse_read_errors(struct qcom_nand_host *host, u8 *data_buf, struct nand_ecc_ctrl *ecc = &chip->ecc; unsigned int max_bitflips = 0; struct read_stats *buf; + bool flash_op_err = false; int i; buf = (struct read_stats *)nandc->reg_read_buf; @@ -1599,7 +1600,7 @@ static int parse_read_errors(struct qcom_nand_host *host, u8 *data_buf, buffer = le32_to_cpu(buf->buffer); erased_cw = le32_to_cpu(buf->erased_cw); - if (flash & (FS_OP_ERR | FS_MPU_ERR)) { + if ((flash & FS_OP_ERR) && (buffer & BS_UNCORRECTABLE_BIT)) { bool erased; /* ignore erased codeword errors */ @@ -1641,6 +1642,8 @@ static int parse_read_errors(struct qcom_nand_host *host, u8 *data_buf, max_t(unsigned int, max_bitflips, ret); } } + } else if (flash & (FS_OP_ERR | FS_MPU_ERR)) { + flash_op_err = true; } else { unsigned int stat; @@ -1654,6 +1657,9 @@ static int parse_read_errors(struct qcom_nand_host *host, u8 *data_buf, oob_buf += oob_len + ecc->bytes; } + if (flash_op_err) + return -EIO; + return max_bitflips; } -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation