Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3117725imu; Mon, 17 Dec 2018 13:41:39 -0800 (PST) X-Google-Smtp-Source: AFSGD/XXSTwaSxMJ8Nh+7wsVn0uzTC50/YAi8kAu1D45jxK2YmV8KHgkiTxifXEvta5mwDypankY X-Received: by 2002:a17:902:9a98:: with SMTP id w24mr14190135plp.213.1545082899352; Mon, 17 Dec 2018 13:41:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545082899; cv=none; d=google.com; s=arc-20160816; b=cTliDYHQaZEldMMSKbgT6LNZJ9C/8PsjGHXFYRqIp0oKxNKPtgMpLVG8BNKCGM+wqn 9E8M6nQBQtjZypF71Em6G1MlLnjheGV2JIAp7iv/qlbgz5zQDYo/L8CmBYepwV6v6t9b PwQjp+hDg6Ljw92HLK9YeaLjU1yzIJeu1RXHQ1SmYlpvHrSZ1NPCI8789BZDa9XgtkYl zPPC2kFfx2f4plu4aklRAWFyxMJox1/eKw4UtITKNN1hT09WDw2qFYhDYGeLtSRQgPr3 5X2OaJUwGLL9Obal1ayna+FEKeA40PC5zPHSyHGdLujGYzGNPimS4BNcEAv3q7Nr5O6n ueWQ== 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=N+O5/myhZbWIBtiUeYEG77OlYz3Cy0C8t1CwXwhFabM=; b=LS3tOTrQz5eoiD2V27mW01WzwtbAMtctP9OJKLvDgH5fwxh1MQ3ulptQdGt+0vUfIZ YZYcI38FzCd04PaAnLvjPuXaykqDR1Ur9b1JwHMVv2kEhCekvbOktLJ+99wn7Am8VufP Wtb00W0NCTmRYpXNWbuxYbIlgiPllZZHrCu6y/R2eC/xkB5h4fq/1SVTrPFvyttufwV6 /RbGNR3kcKWtPSv8bOcFULdRqvbWfUS169Hm6ilsujEv5schol2gec4+KKGFKbUqvwR9 s5H93TWuFkArceTOS1edi5CfLOiImqeHX18Q4vUkSRSnC0b4Nihj5TyK0kiQtCVRqwEW QfuA== 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 k6si12662983pgr.500.2018.12.17.13.41.24; Mon, 17 Dec 2018 13:41:39 -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; 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 S2387933AbeLQPtT convert rfc822-to-8bit (ORCPT + 99 others); Mon, 17 Dec 2018 10:49:19 -0500 Received: from skedge04.snt-world.com ([91.208.41.69]:43348 "EHLO skedge04.snt-world.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387748AbeLQPtR (ORCPT ); Mon, 17 Dec 2018 10:49:17 -0500 Received: from sntmail10s.snt-is.com (unknown [10.203.32.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by skedge04.snt-world.com (Postfix) with ESMTPS id CDE5667A7C6; Mon, 17 Dec 2018 16:49:15 +0100 (CET) Received: from sntmail12r.snt-is.com (10.203.32.182) by sntmail10s.snt-is.com (10.203.32.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1466.3; Mon, 17 Dec 2018 16:49:15 +0100 Received: from sntmail12r.snt-is.com ([fe80::e551:8750:7bba:3305]) by sntmail12r.snt-is.com ([fe80::e551:8750:7bba:3305%5]) with mapi id 15.01.1466.003; Mon, 17 Dec 2018 16:49:15 +0100 From: Schrempf Frieder To: "boris.brezillon@bootlin.com" , "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 3/3] mtd: rawnand: AMD: Also use the last page for bad block markers Thread-Topic: [PATCH 3/3] mtd: rawnand: AMD: Also use the last page for bad block markers Thread-Index: AQHUliAQeUwRMKaL702zrNgBVREB4g== Date: Mon, 17 Dec 2018 15:49:15 +0000 Message-ID: <1545061693-29216-4-git-send-email-frieder.schrempf@kontron.de> References: <1545061693-29216-1-git-send-email-frieder.schrempf@kontron.de> In-Reply-To: <1545061693-29216-1-git-send-email-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.42] 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: CDE5667A7C6.A01C8 X-SnT-MailScanner: Found to be clean X-SnT-MailScanner-SpamCheck: X-SnT-MailScanner-From: frieder.schrempf@kontron.de X-SnT-MailScanner-To: boris.brezillon@bootlin.com, 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 --- 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 890c5b4..aad5f14 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->bbt_options |= NAND_BBT_SCAN2NDPAGE; + /* + * 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->bbt_options |= NAND_BBT_SCAN2NDPAGE | + NAND_BBT_SCANLASTPAGE; return 0; } -- 2.7.4