From patchwork Wed Sep 13 18:20:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arun Nagendran X-Patchwork-Id: 813557 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="FWzOG3vh"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="qY0HAo/Y"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="pFwBRNMS"; 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 3xsqk967yNz9s7g for ; Thu, 14 Sep 2017 04:21:37 +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=40SNAWl6cWvK2xdvlVyA+CUxeLW1TjOHmCvXwU9RT+4=; b=FWzOG3vh2wAUCS mOqiGkjVUZ8QPURXlK4N4v4r0CbX5CiBb3tyP96vWfn0WksGuHAsi522pLsiWLlo7YJazaPsJl2wb MTJLfv8R6IcUFLHjJ/f8gXnW9wgqsqwJx5fxg6WmALia5ad3u3g5Hx+6tpbKmkvDH7+ENCXP8BEXd bHujXEniG9/dm/Cvbs3WyO5M3p/NaOpdPKQMFD5ibYX1SlZsJ4LvaVijzy+oXqOYqPcOsBp8mFKPd C1fe5CUBnW0u2MPj+bq2HjKhyw7USMxpPZWbu67703+MKHCl7mxrn5e6t0wslttKB8CHnwXwWpR5z sC7CNzB4MGhqkLHQb3yQ==; 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 1dsCHy-0002jE-P7; Wed, 13 Sep 2017 18:21:30 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dsCHw-0002iv-GT for linux-mtd@bombadil.infradead.org; Wed, 13 Sep 2017 18:21:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:Subject:Cc:To :From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=mdHDi3lQJqgBv1mEOMD/pVOd4f7335SwMloGoBeJfFU=; b=qY0HAo/YACTwkzso21SM1tXCWh pBDbih3RxGT6WexQ2/ug4J3vsMxTVsWtmJOSnF8X5h9uRZaVNTh+WezwDnx+nSP+eYQzWF+SqfZ5+ 5Yr+hUaZi/2grWUA5F70pxFOs7cywmzyc4Up1UlPp2ZweOLSyvQaNLzoGotcLYI0xwCb6P1R50D7d NVbTKrBOIwL60L5oreINsM9tRXhV2QPuoJXCyNLerEQn63jERU/NjBj6gbUf4kT2uBcYf21+2adDL RFv+MlxqMzj3nf8cGwgSjeTnj+Q81VVJc+49cUqDAtHckpcgdRclpgb8WE/gvGjhz9jQjTThGtCVq C7sLea/w==; Received: from mail-qk0-x243.google.com ([2607:f8b0:400d:c09::243]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dsCHt-0005Pb-9y for linux-mtd@lists.infradead.org; Wed, 13 Sep 2017 18:21:26 +0000 Received: by mail-qk0-x243.google.com with SMTP id i14so618022qke.3 for ; Wed, 13 Sep 2017 11:21:02 -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=mdHDi3lQJqgBv1mEOMD/pVOd4f7335SwMloGoBeJfFU=; b=pFwBRNMSTMLVJ6q3BvjFW4NKk76cMEPeZOvD1yJwWC0d4cABzAVgG0u43OnIug+K8R iOWHOzHfROrEkztGQjlFtQx4Ua5vwAkXEZoLruymr+7XlsCDQBIgf9WbZl0MRhV1xY5P HS1UqpgYwjkkfanILQtk9APn87ZbxAY9NyxJtEU/1pTy6EWKbe40ZV4XrttkcWU0z8tn ++6/dTDs+wd2j4TBPpFVU+wZyHnPjAMgbar9y1ZGm39WvlOa9JcF98S8TKuzMEAAZ19q 4oyfu32DJ901UAG1l34G/TaxJODChKk3G1cGvicA+KPp1ciZwZyFshAlX93PTZ/31XzS k7gw== 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=mdHDi3lQJqgBv1mEOMD/pVOd4f7335SwMloGoBeJfFU=; b=ePZWmsSicmPBr6fCVqae74G1z55YnHPeoxFspJH2v7qnVYVY4jg17pkacEYgMg09Nk gDakVwfPDEJdC6UspOnl7umsEPVKI4ndTWgAkacpXtcQJqeyOZu3qrBDsVy9bYFcqfvf ynJs/H4a04aX1sc9D3FMoGV/PMx1OUP4Zz6ye2UT7na3zMZ8ob9tH+Qg8alZByUGFNoN w+2YltBeOtsxNvGKBZRtyV5FMHPVA7o1M3QG+Q+3DgLj7ScvdIXr5+ARM9qmtGm+Ql/V uBay2AdTJEq8DseZc/MytoKpnKqspstGuooSi0icMMZGEnpP1QH7xlNah2w7EA/h30X2 bDAg== X-Gm-Message-State: AHPjjUiSfLS+sGDFREC/47Wdn/sF2FO8W4otqReYS+5Jkkp82z8mVag+ 70L3EgO9z6ZlrH7n X-Google-Smtp-Source: AOwi7QD53s/dJ0VgpEV8c2lw8T5AHdwou3cKoicRBim93Ku0gPxeUmrjbmXkOde/IklQYPiqgoDNLg== X-Received: by 10.55.17.156 with SMTP id 28mr26848239qkr.336.1505326856289; Wed, 13 Sep 2017 11:20:56 -0700 (PDT) Received: from arunluma ([204.77.239.78]) by smtp.gmail.com with ESMTPSA id n186sm9630548qkd.23.2017.09.13.11.20.55 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 Sep 2017 11:20:55 -0700 (PDT) Message-ID: <59b97707.c38b370a.3fa1c.ac86@mx.google.com> X-Google-Original-Message-ID: <20170913182055.GA25988@arun@getluma.com> Date: Wed, 13 Sep 2017 14:20:55 -0400 From: Arun Nagendran To: kamlakant.patel@broadcom.com 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-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on merlin.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:400d:c09:0:0:0:243 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_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -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: gregkh@linuxfoundation.org, 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 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/staging/mt29f_spinand/mt29f_spinand.c b/drivers/staging/mt29f_spinand/mt29f_spinand.c index a4e3ae8..2b03cc9 100644 --- a/drivers/staging/mt29f_spinand/mt29f_spinand.c +++ b/drivers/staging/mt29f_spinand/mt29f_spinand.c @@ -496,8 +496,12 @@ 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); + { + 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];