From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 302ABC4338F for ; Mon, 16 Aug 2021 07:43:13 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E707F61ACE for ; Mon, 16 Aug 2021 07:43:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E707F61ACE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qq1WO//PwQ2xO88iAADcdTNIpNcGpR+6hNHakB1JrIY=; b=PomVX5XplPQNH2 TdDX/p1XTmXjDVYVKisZF3ry2Cy4IrdM28N9h1jWRJB+OmyKlVFNcfjT7cC1nkp1E/OEVkW1yFcOc JiSIv1tMclT1f766MgcvZfuUx/41+mIYg/opQjnXfP7oG41B5ZqpcACNaqlWkeCrG6CDA/kQsgTUt x061R/YzUkcz/LyLbFbUSabtGYXY/OBptJ/jT6Btx/hbxsFBDJviSDOi8XEJJvW66CCqNU6/wBSW3 QQL2TNoUCbs5nZ+nPxasph5KMe3J3CvftwbFcuJ8s2xW5Q1MS5k8AFVKd9oDahAxh6kE2mM8oWV1q g5JaN/rQrPDJYt6tAw8g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mFXGP-00GPUx-Ic; Mon, 16 Aug 2021 07:42:29 +0000 Received: from relay8-d.mail.gandi.net ([217.70.183.201]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mFXGM-00GPUY-8b for linux-mtd@lists.infradead.org; Mon, 16 Aug 2021 07:42:27 +0000 Received: (Authenticated sender: miquel.raynal@bootlin.com) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 1EC241BF203; Mon, 16 Aug 2021 07:42:22 +0000 (UTC) Date: Mon, 16 Aug 2021 09:42:21 +0200 From: Miquel Raynal To: Daniel Palmer Cc: richard@nod.at, linux-mtd@lists.infradead.org, Linux Kernel Mailing List Subject: Re: [RFC PATCH] mtd: spinand: core: Properly fill the OOB area. Message-ID: <20210816094221.28ad02ea@xps13> In-Reply-To: References: <20210617110842.2358461-1-daniel@0x0f.com> <20210806220242.4b83237d@xps13> Organization: Bootlin X-Mailer: Claws Mail 3.17.7 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210816_004226_485463_6FFFB929 X-CRM114-Status: GOOD ( 25.61 ) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org SGkgRGFuaWVsLAoKRGFuaWVsIFBhbG1lciA8ZGFuaWVsQDB4MGYuY29tPiB3cm90ZSBvbiBXZWQs IDExIEF1ZyAyMDIxIDE2OjM3OjU1CiswOTAwOgoKPiBIaSBNaXF1ZWwsCj4gCj4gT24gU2F0LCA3 IEF1ZyAyMDIxIGF0IDA1OjAyLCBNaXF1ZWwgUmF5bmFsIDxtaXF1ZWwucmF5bmFsQGJvb3RsaW4u Y29tPiB3cm90ZToKPiA+IFRoaXMgY2hhbmdlIGxvb2tzIGZpbmUsIEknbGwgdXNlIHNwaW5hbmQt Pm9vYmJ1ZiBpbnN0ZWFkIG9mIGRhdGFidWYgKwo+ID4gb2Zmc2V0ICh3aWxsIHVwZGF0ZSB3aGVu IGFwcGx5aW5nKS4gIAo+IAo+IFRoYW5rcyBmb3IgbG9va2luZyBhdCB0aGlzIGZvciBtZS4gT25l IHRoaW5nIEkgd2FzIHdvcnJpZWQgYWJvdXQgaXMKPiB3aHkgdGhlIFNQSSBOQU5EIHN1YnN5c3Rl bSB3b3JrZWQgYmVmb3JlIHRoaXMgY2hhbmdlIHdpdGggd2luYm9uZCBldGMKPiBwYXJ0cy4KCkkg ZGlkbid0IGxvb2sgY2xvc2VseSB0byB0aGUgaGlzdG9yeSBidXQgaXQgaXMgcG9zc2libGUgdGhh dCBkdXJpbmcgdGhlCkVDQyBlbmdpbmUgZnJhbWV3b3JrIGludHJvZHVjdGlvbiBhbmQgdGhlIHNw bGl0IG9mIHRoZSBvbi1kaWUgRUNDIGNvZGUKdGhlIGJlaGF2aW9yIGNoYW5nZWQgKHdoaWNoLCBp biB0aGlzIGNhc2UsIGlzIGEgcmVncmVzc2lvbikuCgo+IFlvdSBwcm9iYWJseSBkb24ndCByZW1l bWJlciBub3cgYnV0I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-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 578B3C4338F for ; Mon, 16 Aug 2021 07:42:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3001161ABE for ; Mon, 16 Aug 2021 07:42:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234288AbhHPHnA convert rfc822-to-8bit (ORCPT ); Mon, 16 Aug 2021 03:43:00 -0400 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:33985 "EHLO relay8-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231499AbhHPHm4 (ORCPT ); Mon, 16 Aug 2021 03:42:56 -0400 Received: (Authenticated sender: miquel.raynal@bootlin.com) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 1EC241BF203; Mon, 16 Aug 2021 07:42:22 +0000 (UTC) Date: Mon, 16 Aug 2021 09:42:21 +0200 From: Miquel Raynal To: Daniel Palmer Cc: richard@nod.at, linux-mtd@lists.infradead.org, Linux Kernel Mailing List Subject: Re: [RFC PATCH] mtd: spinand: core: Properly fill the OOB area. Message-ID: <20210816094221.28ad02ea@xps13> In-Reply-To: References: <20210617110842.2358461-1-daniel@0x0f.com> <20210806220242.4b83237d@xps13> Organization: Bootlin X-Mailer: Claws Mail 3.17.7 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Daniel, Daniel Palmer wrote on Wed, 11 Aug 2021 16:37:55 +0900: > Hi Miquel, > > On Sat, 7 Aug 2021 at 05:02, Miquel Raynal wrote: > > This change looks fine, I'll use spinand->oobbuf instead of databuf + > > offset (will update when applying). > > Thanks for looking at this for me. One thing I was worried about is > why the SPI NAND subsystem worked before this change with winbond etc > parts. I didn't look closely to the history but it is possible that during the ECC engine framework introduction and the split of the on-die ECC code the behavior changed (which, in this case, is a regression). > You probably don't remember now but I sent a patch to include support > for the longsys foresee parts that have the weird quirk of having no > ECC > data in the OOB so it's all usable by the user except for the bad > block marker and the ECC status bits being next to useless. > I found this issue while trying to validate ubi + my ECC status > decoding worked. [0] Yes I remember now! > The SPI NAND subsystem in u-boot worked fine as it could create the > ubi formatting on the flash and that would survive reboots but any > blocks written by Linux would be bad on reboot. > When Linux created the ubi format it would work until a reboot as the > correct data was cached in memory then u-boot would complain because > all of the blocks were marked bad. > > But winbond parts mounted on the same board, same code etc worked just fine. > I guess the OOB is getting fixed somewhere else for other parts. I think the reason is that most ECC codes do not cover the OOB part, hence writing garbage there is not an issue (while with your part, the OOB area was actually fully protected). But it is certainly best to keep this area tidy anyway. > Maybe > it only happens on the longsys parts because there is no ECC in OOB? > > Anyhow I was worried my fix hid some other issue/broke other parts. I think this patch is legit, I will keep it. > > Cheers, > > Daniel > > 0 - https://lore.kernel.org/lkml/20210408174922.55c1149f@xps13/ Thanks, Miquèl