From patchwork Wed Sep 13 18:34:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arun Nagendran X-Patchwork-Id: 813572 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="o6c+3uhE"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="MM/WD8iC"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xsr2K04lZz9rxl for ; Thu, 14 Sep 2017 04:35:34 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Subject:To:From:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=TQRqDSaWmIisttni5QWaAUc98wSKuXAL0s69jov6jUs=; b=o6c+3uhEZGyOgu NUzmjnO78bdx17dnb03jr3xfUqbojXHBKNtUXBR+YDpzd81BdpSZH1g7W3IW0SeTiPeWDKDATmMHX pdcWVniZpZjn+ESxL9RG03CYgUmmZZ+o8acy5hiq9suG88+psrbxE/WVvWtfcRq0f5LJQ5nxhIhak 2CCug0lhNykhWic8QHw6PVWISc0uBsKHYJWuVpREFleiOHl77Pqhn4KKECSvurAFFh8zvpuDz+Fkm kS3hHXe6xpZfKiMpVt+Lm9F1SovVWqWnUbWeGQo7l6MKa22oacls6Y/vREh58flMKrYDKil3HBO1i AuT0rYtrmu3UwzhItgRw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dsCVQ-0000Gv-HV; Wed, 13 Sep 2017 18:35:24 +0000 Received: from mail-ua0-x241.google.com ([2607:f8b0:400c:c08::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dsCVI-0007VZ-RM for linux-mtd@lists.infradead.org; Wed, 13 Sep 2017 18:35:22 +0000 Received: by mail-ua0-x241.google.com with SMTP id g47so299490uad.2 for ; Wed, 13 Sep 2017 11:34:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:date:from:to:cc:subject:mime-version:content-disposition :user-agent; bh=f09Z54ac+ANGF/5DFWYmu9FzCZJPdgXATncunH81uJc=; b=MM/WD8iC010yrnCiZA+ClJ+pJkcGPFTK6ufWr7UlCW8tNhGhMmR6hlOKOxgSCrP9v7 eCkxejr829JY1rROoJqh8ly/afIglbsCmpoH5KTCwk1D6UtVytTk1BDoaA3IVIlNaTSn xZPZXFI8Gq4B88Mg74ovM3Jjeb8cnZQxrudxA/tDionlx4SldFMAS7fLveusdRFDVm7H U5U1zVxm+P94iIoybGWWfwQ19Ezo6uy8fO8FKVMdQyHjOSUSZKcHnuENcX18wYvCVSe1 pZKOfusyzk5OVU/XoWQb9dazaU0O2PJ0oLUdt1QjXMUjG1vs65PtZx1Z19Tkj2YZL9wk mneA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:date:from:to:cc:subject:mime-version :content-disposition:user-agent; bh=f09Z54ac+ANGF/5DFWYmu9FzCZJPdgXATncunH81uJc=; b=lAV/+pw4k18DkT5exk3Iml/ATqdppTa3GcvlZ2nzdlBPLDyhdLIE3kTF8Vr9cdfde1 JgqLyPPuzfS/gn0KLWcLsirvEVq100ZSiUZQkSJhgCgXUBaUjUL8ff057sgQpuhdVvzq xJ6zYiV5wm18rvl48thkJoc5NdIzbbkhxWkHd0QLD4IdZEtmuJ9vzdpMmT8kmpn3TeEW 5tOa2xFFzz+XEtNDHgIdHHvaXs9u9ezNTRMBh4Vlt2R/4i6ULkp65cwlCqnLltWY5G3I g+XFMFig1mcwF6E3ZhlGgFSftdqbjMzotIHBxCs4LzkgDStpJGhCubOzN4u4FoqcFqA5 4K3Q== X-Gm-Message-State: AHPjjUiwcE/bbYt9XWdO2pSvdr/Y4L7e6T9WHokFMx383Zp5CTb7Qkf1 meJbrJCFhUn4/D6u X-Google-Smtp-Source: AOwi7QCcEdtvSn8hvlQnXF/yfa+bMt6UsC1qZgnSf/vPZ3qofy076OuNSrmHACBmiy+NUnNkkXXNZQ== X-Received: by 10.176.5.101 with SMTP id 92mr15380356uax.188.1505327694927; Wed, 13 Sep 2017 11:34:54 -0700 (PDT) Received: from arunluma ([204.77.239.78]) by smtp.gmail.com with ESMTPSA id 73sm3238690uah.32.2017.09.13.11.34.53 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 Sep 2017 11:34:54 -0700 (PDT) Message-ID: <59b97a4e.cf02b00a.d8b82.a310@mx.google.com> X-Google-Original-Message-ID: <20170913183453.GA26343@arun@getluma.com> Date: Wed, 13 Sep 2017 14:34:53 -0400 From: Arun Nagendran To: gregkh@linuxfoundation.org Subject: [PATCH] Enable the read ECC before program the page MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170913_113520_494269_7F83F375 X-CRM114-Status: GOOD ( 12.04 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2607:f8b0:400c:c08:0:0:0:241 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (arunrasppi[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mtd@lists.infradead.org, manonuevo@micron.com Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Current program_page function did following operation: 1. read page (with ECC OFF) 2. modify the page 3. write the page (with ECC ON) For some case(buggy flash Chip), while read the page without ECC ON, we may read the page with bit flip error and modify that bad page without knowing the bit flip error on that page. also we re-calculate the hash for bad page and write it. This could bring potential in-consistency problem with Flash data. Verify this logic with GIGA DEVICE Part(GD5F2GQ4RCFIG): we see this in-conststency problem wit Giga Device and fix on this patch resovle that issue. --- drivers/staging/mt29f_spinand/mt29f_spinand.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/staging/mt29f_spinand/mt29f_spinand.c b/drivers/staging/mt29f_spinand/mt29f_spinand.c index a4e3ae8..202d222 100644 --- a/drivers/staging/mt29f_spinand/mt29f_spinand.c +++ b/drivers/staging/mt29f_spinand/mt29f_spinand.c @@ -496,8 +496,13 @@ static int spinand_program_page(struct spi_device *spi_nand, if (!wbuf) return -ENOMEM; - enable_read_hw_ecc = 0; - spinand_read_page(spi_nand, page_id, 0, CACHE_BUF, wbuf); + enable_read_hw_ecc = 1; + retval = spinand_read_page(spi_nand, page_id, 0, CACHE_BUF, wbuf); + if( retval < 0 ) + { + dev_err(&spi_nand->dev, "ecc error on read page!!!\n"); + return retval; + } for (i = offset, j = 0; i < len; i++, j++) wbuf[i] &= buf[j];