Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7600879imu; Tue, 22 Jan 2019 08:30:34 -0800 (PST) X-Google-Smtp-Source: ALg8bN6VNE+krm4Z1XT8V5J95zGX2VsXvzDcv+U6CKurJGSjtaU4RKjKaeGN8pD27QC5m5kXZFss X-Received: by 2002:a17:902:8e8b:: with SMTP id bg11mr35527247plb.332.1548174634144; Tue, 22 Jan 2019 08:30:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548174634; cv=none; d=google.com; s=arc-20160816; b=o/SAT6w4KlafqVtxm9ROxXakFdiA7GLeAKFCJCwrGwklkhCpgoGDt8sLiHdxpSQyQx Jf1wQsgQaFZP1IJMVwL6sK47HTkV900e+iNUIGEYyk7FTj55kyebFGZ34VQJopSDCXoE sEbC4/up1Xka/Z+MZCQZQayN77owkl7VKc+/U+IdsHrSNX8SMd/KDN5vZYqet9yUTZIs 2tGQMAQxuMmx6a0+O5rpB78FDbNuN1WtBW4zZdPyMW7xfcadUV5PMqGa9/ckcoFFw+8G x6V/6qVX5zoaOksDg4UTuM+3fyKay/YpvIkC5WyKBqOQoH1i9JcGbv7pWYetxwVnjkK7 t44w== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=76E7dF4+tJAvDcfb1U/9Lh+801G4HDbFcm7DmbQR8dY=; b=ORAxGU1xqFnqCHAj+Y/0M6+BnO7AhuUSo8qkSgeYAdRcEol3AycVP4vwDyewMavoTj 4dcTA8McEDkfvSmYopo6BB/bwWoyJ4Zd2AOWfRmnVtsznmsGZt7+WXNYfboA3kMTamNl Q/S2t39fwhRD12Qfts/Tnw0VlPNx17mqWL78nOVSK7WRMSRLV3DlaHuG5EWaiQn23H7i 1E2tl6KI9E6zClMG1hM5UVCcXYU+TLffZzcpzYP2QBVazbxvqFi/AVoJwZCU61v45FU3 r/Om38kfvv8SUH4aszr8av1l+e6agH2tTqPl0fSiRSaRhbYJEljrmpnpkLQr6Ogec4sl QYhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lhBF2L5P; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c65si15416787pfa.148.2019.01.22.08.30.17; Tue, 22 Jan 2019 08:30:34 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=lhBF2L5P; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729301AbfAVQ2y (ORCPT + 99 others); Tue, 22 Jan 2019 11:28:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:53098 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729272AbfAVQ2y (ORCPT ); Tue, 22 Jan 2019 11:28:54 -0500 Received: from bbrezillon (91-160-177-164.subs.proxad.net [91.160.177.164]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B2E0A2085A; Tue, 22 Jan 2019 16:28:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548174533; bh=ZI+xnBU5OJzwlF+oyj/gaqOn1LGJeEAsSOJfjTpm780=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=lhBF2L5PZ/xYEHwP5t3tfjbWIRIPQsdyA9tWr3X+SeUfKnB7eru/rLrch2Sk6xo/v YXnKQhOJ69LrB2OJbQuax+JRenVZu/ooiS2xhIl5enoqFFLLX0xTax8lfDeSAlud4j ZL4mjT2l2b3Ili2qd6lXTy989HLXuyogwfZ99dps= Date: Tue, 22 Jan 2019 17:28:42 +0100 From: Boris Brezillon To: Schrempf Frieder Cc: "boris.brezillon@bootlin.com" , "miquel.raynal@bootlin.com" , "richard@nod.at" , "linux-kernel@vger.kernel.org" , "linux-mtd@lists.infradead.org" , David Woodhouse , Brian Norris , Marek Vasut Subject: Re: [PATCH v2 4/4] mtd: rawnand: AMD: Also use the last page for bad block markers Message-ID: <20190122172842.0c36876f@bbrezillon> In-Reply-To: <20190122112258.20042-5-frieder.schrempf@kontron.de> References: <20190122112258.20042-1-frieder.schrempf@kontron.de> <20190122112258.20042-5-frieder.schrempf@kontron.de> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 22 Jan 2019 11:23:33 +0000 Schrempf Frieder wrote: > From: Frieder Schrempf > > According to the datasheet of some Cypress SLC NANDs, the bad > block markers can be in the first, second or last page of a block. > So let's check all three locations. > > Signed-off-by: Frieder Schrempf Reviewed-by: Boris Brezillon > --- > drivers/mtd/nand/raw/nand_amd.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/mtd/nand/raw/nand_amd.c b/drivers/mtd/nand/raw/nand_amd.c > index 6202cbf7ee8d..2ffcddff3e27 100644 > --- a/drivers/mtd/nand/raw/nand_amd.c > +++ b/drivers/mtd/nand/raw/nand_amd.c > @@ -40,7 +40,13 @@ static void amd_nand_decode_id(struct nand_chip *chip) > static int amd_nand_init(struct nand_chip *chip) > { > if (nand_is_slc(chip)) > - chip->options |= NAND_BBM_FIRSTPAGE | NAND_BBM_SECONDPAGE; > + /* > + * According to the datasheet of some Cypress SLC NANDs, > + * the bad block markers can be in the first, second or last > + * page of a block. So let's check all three locations. > + */ > + chip->options |= NAND_BBM_FIRSTPAGE | NAND_BBM_SECONDPAGE | > + NAND_BBM_LASTPAGE; > > return 0; > }