Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp891898pxt; Fri, 6 Aug 2021 17:10:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRLfVEx/thgXlxB1jucRu4dPrmrX8lzEbbKbXr64r2T6iHrvBXVVNQ5rlWYrJBhc7Ja/yh X-Received: by 2002:a02:698f:: with SMTP id e137mr12294782jac.89.1628295011192; Fri, 06 Aug 2021 17:10:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628295011; cv=none; d=google.com; s=arc-20160816; b=Cof2Kp5iOmi7+ck2YlZtklhVlG0P5/Q836cLnwnES33xltWq6uJaoYEMwJ9ABj1gTy jILoysJxeqAcWF//vyQuwOGG3d5dy7TYSBaU9mNlIHjuzs2RIpbcpn7IWwxZQZZazMmv MrQ3jTkWVmMZUzpDbV/SmoN/GVQ0MFwLfivRZckeq0YQnrmpMb2Wc/9xdcfMZtGhjF47 XC0Q7yEhB+F7O33QspfKEs4ydLALdTCsTfkMz63oFWpO6niWUo8CoKmmi3fnQlbfsvPY CkuyTS0VN1cjJteAdcc9WY8sopuWfpaA/gN9JIFeuLJFqDzx1qNvsBGGHC6a+fFG10Ow EZLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=VKfXN25sRzd5NZtbGNnQzc5Ufe7f/bd/is100LWPo5U=; b=tKITugBvkKaQKoOYD62qHa3sBjf70uE4BJqjKQ4y0lt12W/WWYQEvw/CKshQHxjlRD RzrVl6Ocp8U7N8SMGD8rw+uppLCKVkL6TABcvCqU4sSi3/xjI2EctBu4mBZvt0K2vg8N +jiMnDMeRW46dMkBaGDkHdtnmroPlwQGyFKpitccOe8dk2X1GRrjRGMgcG72iLUVqRpa GjSRJRRLeIWiRs5KiW3tUdDIWqBto76XDDC5KwL3c6lqoHo6wtSqBBHPq3xUjCkRgYcP 6rj2E8wyzghM10m6BUYbn1CeL8xbSz940Q0IZo69AEE/nKsfnoXbONnMLev0+W7b4bSr ivLw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w17si9831376ioc.46.2021.08.06.17.10.00; Fri, 06 Aug 2021 17:10:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244273AbhHFUDB convert rfc822-to-8bit (ORCPT + 99 others); Fri, 6 Aug 2021 16:03:01 -0400 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:41853 "EHLO relay6-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244163AbhHFUDA (ORCPT ); Fri, 6 Aug 2021 16:03:00 -0400 Received: (Authenticated sender: miquel.raynal@bootlin.com) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 93C98C0002; Fri, 6 Aug 2021 20:02:43 +0000 (UTC) Date: Fri, 6 Aug 2021 22:02:42 +0200 From: Miquel Raynal To: Daniel Palmer Cc: richard@nod.at, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH] mtd: spinand: core: Properly fill the OOB area. Message-ID: <20210806220242.4b83237d@xps13> In-Reply-To: <20210617110842.2358461-1-daniel@0x0f.com> References: <20210617110842.2358461-1-daniel@0x0f.com> 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 Thu, 17 Jun 2021 20:08:42 +0900: > The comment in spinand_write_to_cache_op() says that > spinand_ondie_ecc_prepare_io_req() should 0xff fill the OOB > area but it doesn't. > > This causes the OOB area to get filled with zeros > and anytime the first page in a block the bad block marker > is cleared and it becomes a bad block on the next boot. > > This was observed on Longsys FORSEE branded parts and > might be specific to these parts. > > Signed-off-by: Daniel Palmer This change looks fine, I'll use spinand->oobbuf instead of databuf + offset (will update when applying). > --- > drivers/mtd/nand/spi/core.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c > index 6f2d39f9bb06..f1c76fa0e220 100644 > --- a/drivers/mtd/nand/spi/core.c > +++ b/drivers/mtd/nand/spi/core.c > @@ -281,6 +281,9 @@ static int spinand_ondie_ecc_prepare_io_req(struct nand_device *nand, > struct spinand_device *spinand = nand_to_spinand(nand); > bool enable = (req->mode != MTD_OPS_RAW); > > + memset(spinand->databuf + nanddev_page_size(nand), > + 0xff, nanddev_per_page_oobsize(nand)); > + > /* Only enable or disable the engine */ > return spinand_ecc_enable(spinand, enable); > } Thanks, Miquèl