Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1929855imm; Sun, 8 Jul 2018 14:49:27 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdsptiRSNQsZ3cAMVR1z0allkJPZ9PHEBxQfaNRDKKGb2uZl2VtXvTs6/oEOjpGqH5hg13Q X-Received: by 2002:a63:9a01:: with SMTP id o1-v6mr10653663pge.439.1531086567594; Sun, 08 Jul 2018 14:49:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531086567; cv=none; d=google.com; s=arc-20160816; b=hgWRVrfsA9c3wNTARnXU6E+u8Y6bjLGRiUFsYVpoevd8nZK1CY6+tDNJz/dEg85ScR cp2Fkt0za0/MR8c3DlKY6QlnhUXA5l3BOvMB/KAdmnK1B3uN6xSt2cOvHvgbCa+R0Jb2 GQhV6hChSUwEApVnCboz+x2FbPwaVwlEgaOhR3G2//o12AhFrcyNOP51X43+fViBbJYB WjWdUGsK7E5I7hN9IWOw13EE2JXewa/zavYrzpu28Tr5DKrQsKkblzZ+FxWR5rbDr1Cy 0W8YMloQyd/K++1WiUgvS61NMrJNWfpjFS5tXTKOpKfozPyF8dg4kPAA1qyZmXX+Y5Bd UDdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=AUgtu7Eelecijprlwep5qsEpjBOdDbztoYsytx+qQ48=; b=nBMZnvOejg8sL4AxV3eDEDZenDeyCoQmNoa3W3HMuqPwr4sqxaw1H7fbXrASiLf/ut IryPzRrtan+mFd5EqymC2OqwCC+AvuqMV2Mqa8x5WGzS80Wdgl6pZIKTDwkxN1q3YVDF nWxRiHDrYCjZdSmA2hHZqdukX71UGOoXKsoJjQ93yZDFC7YL9BJFSJtZAEmWeuJE9Rf7 QNmjBhta28oq3IqijbcvD349hmqLAoDLgaNR2SWTvzB34qe38FErzDSDpAWP2STGWDMz ZcpgXWS9tMOm+ReFfcb6hLkPlMb/hP8YxF4ge027nqVRJu+lanLsX++RNXXIM10e2hRO 7LSw== ARC-Authentication-Results: i=1; mx.google.com; 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 b12-v6si13481793pla.201.2018.07.08.14.49.13; Sun, 08 Jul 2018 14:49:27 -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; 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 S933053AbeGHVrq convert rfc822-to-8bit (ORCPT + 99 others); Sun, 8 Jul 2018 17:47:46 -0400 Received: from mail.bootlin.com ([62.4.15.54]:38056 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754371AbeGHVro (ORCPT ); Sun, 8 Jul 2018 17:47:44 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 449002079C; Sun, 8 Jul 2018 23:47:42 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from xps13 (unknown [91.224.148.103]) by mail.bootlin.com (Postfix) with ESMTPSA id 9E5B1203B4; Sun, 8 Jul 2018 23:47:41 +0200 (CEST) Date: Sun, 8 Jul 2018 23:47:42 +0200 From: Miquel Raynal To: Abhishek Sahu Cc: David Woodhouse , Boris Brezillon , Brian Norris , Marek Vasut , Richard Weinberger , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, Andy Gross , Archit Taneja Subject: Re: [PATCH v5] mtd: rawnand: qcom: erased page bitflips detection Message-ID: <20180708234742.0d86b9d1@xps13> In-Reply-To: <1530619563-24712-1-git-send-email-absahu@codeaurora.org> References: <1530619563-24712-1-git-send-email-absahu@codeaurora.org> Organization: Bootlin X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Abhishek, Abhishek Sahu wrote on Tue, 3 Jul 2018 17:36:03 +0530: > NAND parts can have bitflips in an erased page due to the > process technology used. In this case, QCOM NAND controller > is not able to identify that page as an erased page. > Currently the driver calls nand_check_erased_ecc_chunk() for > identifying the erased pages but this won’t work always since the > checking is being with ECC engine returned data. In case of > bitflips, the ECC engine tries to correct the data and then it > generates the uncorrectable error. Now, this data is not equal to > original raw data. For erased CW identification, the raw data > should be read again from NAND device and this > nand_check_erased_ecc_chunk function() should be called for raw > data only. > > Now following logic is being added to identify the erased > codeword bitflips. > > 1. In most of the cases, not all the codewords will have bitflips > and only single CW will have bitflips. So, there is no need to > read the complete raw page data. The NAND raw read can be > scheduled for any CW in page. The NAND controller works on CW > basis and it will update the status register after each CW read. > Maintain the bitmask for the CW which generated the uncorrectable > error. > 2. Do raw read for all the CW's which generated the uncorrectable > error. > 3. Both DATA and OOB need to be checked for number of 0. The > top-level API can be called with only data buf or OOB buf so use > chip->databuf if data buf is null and chip->oob_poi if > OOB buf is null for copying the raw bytes temporarily. > 4. For each CW, check the number of 0 in cw_data and usable > oob bytes, The bbm and spare (unused) bytes bit flip won’t > affect the ECC so don’t check the number of bitflips in this area. > > Signed-off-by: Abhishek Sahu > --- > * Changes from v4: > > 1. Used for_each_set_bit for determining CW’s which generated > uncorrectable errors. > 2. Introduced cw_data_buf and cw_oob_buf which will have starting > buffer address for current codeword and used the same in helper > functions. > 3. Added new line before calling of nand_check_erased_ecc_chunk for > better code readability. > > * Changes from v3: > > 1. Major changes in erased codeword detection for > raw read function > > * Changes from v2: > NONE > > * Changes from v1: > 1. Minor change in commit message > 2. invalidate pagebuf if databuf or oob_poi is used > > drivers/mtd/nand/raw/qcom_nandc.c | 126 +++++++++++++++++++++++++++----------- > 1 file changed, 89 insertions(+), 37 deletions(-) Applied to nand/next. Thanks, Miquèl