Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4128168yba; Wed, 17 Apr 2019 05:19:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqw0kaikNkdBP+dP2OHouxzwLDHQWtwYCtsydyHfNN9gQAwZp4p6AVdMv9aKYOJxr3fddUHO X-Received: by 2002:a62:524e:: with SMTP id g75mr87386992pfb.106.1555503550543; Wed, 17 Apr 2019 05:19:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555503550; cv=none; d=google.com; s=arc-20160816; b=p8lUIL5xSDcVI3Uf0bPrVO9d7S8hyarasMtqLjWlbZWuGkJTOV33tC1+FlpNcGpYn1 jFV5cXVxBia6E/IpD1y/6I2AbZRrR3LUQjqeHoFphQpxR/+dwnrHbO2UyUqI8nusiHOp ZLM68w1JE0zBlGbeCbPWuuvmYy8fRSNxOK6OQIqTlTIbUyk6SN12gq73BoI7LU/BcnPA YNSTLI5jwCKOXmNm7a2jABeTNAdQwylh1exFt8RRx/bneaeogzlpow4LVjaDCNs90rO5 YvvnXq85BOZLGdG/jNrlhYueUgjsxDku6w1VuUwRbEwnP2Gm2H6ZF7tGT9iqETHbWw/6 PxKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=Epl1Ra2oi0FqDtmG+CUO/So9zVjxICkkNwngPcfrGo0=; b=Lj6xkPnmNqqxjwdtPamtcjOjc4coV/b6bdTiBY5tYt+hS6sttRR1XgmI5kTS9cj0pK pmeiNk4+glgm/xMf45349DN6CC3Zg3FBCKfLfAic27zwwSizP7fA8ulXmkrijEcaCFIp eulXvOA4zhnmASqEYhviqLL4avyyNxjGJ/I+tSKzRCHfbtu+xnqrXkrUATKTEAPVYIPp ClsptqST9bwwF3C9Fxu3Ii9nIJ9hKeU6cjYV4A170w31VnpW6CZFAHtMk4dG6fSvKL6C 27ivypIe2szF7RpknCrYG20Qe/f8ZRaim7FzWI36b6E0t9uss3D4MT4ToHYVrJ3YyG3f D2YA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v22si34747137pfm.151.2019.04.17.05.18.55; Wed, 17 Apr 2019 05:19:10 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732103AbfDQMPZ convert rfc822-to-8bit (ORCPT + 99 others); Wed, 17 Apr 2019 08:15:25 -0400 Received: from skedge03.snt-world.com ([91.208.41.68]:57598 "EHLO skedge03.snt-world.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732089AbfDQMPZ (ORCPT ); Wed, 17 Apr 2019 08:15:25 -0400 Received: from sntmail11s.snt-is.com (unknown [10.203.32.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by skedge03.snt-world.com (Postfix) with ESMTPS id E4F9667A90D; Wed, 17 Apr 2019 14:15:22 +0200 (CEST) Received: from sntmail12r.snt-is.com (10.203.32.182) by sntmail11s.snt-is.com (10.203.32.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 17 Apr 2019 14:15:22 +0200 Received: from sntmail12r.snt-is.com ([fe80::e551:8750:7bba:3305]) by sntmail12r.snt-is.com ([fe80::e551:8750:7bba:3305%3]) with mapi id 15.01.1713.004; Wed, 17 Apr 2019 14:15:22 +0200 From: Schrempf Frieder To: "bbrezillon@kernel.org" , "miquel.raynal@bootlin.com" , "richard@nod.at" , "linux-kernel@vger.kernel.org" CC: "linux-mtd@lists.infradead.org" , "Schrempf Frieder" , David Woodhouse , Brian Norris , Marek Vasut Subject: [PATCH v5 7/7] mtd: rawnand: AMD: Also use the last page for bad block markers Thread-Topic: [PATCH v5 7/7] mtd: rawnand: AMD: Also use the last page for bad block markers Thread-Index: AQHU9Rc743Pb6Chxu0qoBon/7p5J4w== Date: Wed, 17 Apr 2019 12:15:22 +0000 Message-ID: <20190417121420.21752-8-frieder.schrempf@kontron.de> References: <20190417121420.21752-1-frieder.schrempf@kontron.de> In-Reply-To: <20190417121420.21752-1-frieder.schrempf@kontron.de> Accept-Language: de-DE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.25.9.193] x-c2processedorg: 51b406b7-48a2-4d03-b652-521f56ac89f3 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-SnT-MailScanner-Information: Please contact the ISP for more information X-SnT-MailScanner-ID: E4F9667A90D.AE508 X-SnT-MailScanner: Not scanned: please contact your Internet E-Mail Service Provider for details X-SnT-MailScanner-SpamCheck: X-SnT-MailScanner-From: frieder.schrempf@kontron.de X-SnT-MailScanner-To: bbrezillon@kernel.org, computersforpeace@gmail.com, dwmw2@infradead.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, marek.vasut@gmail.com, miquel.raynal@bootlin.com, richard@nod.at X-Spam-Status: No Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Miquel Raynal --- 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 1417559d3057..6217555c19a6 100644 --- a/drivers/mtd/nand/raw/nand_amd.c +++ b/drivers/mtd/nand/raw/nand_amd.c @@ -45,7 +45,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; } -- 2.17.1