Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4145105yba; Wed, 17 Apr 2019 05:39:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqwyeSYA3p66JiZPozJh9Tk6y59VzPyvQHPUinFIiUyLMgrxrN+Cpehi2+FIgB3LDJlbioFD X-Received: by 2002:a63:cf0d:: with SMTP id j13mr82503843pgg.34.1555504799150; Wed, 17 Apr 2019 05:39:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555504799; cv=none; d=google.com; s=arc-20160816; b=k2nxTE7k0eZ11QJTjORELEur5x7C7nbi4spsKxFG1YZGhbwkFA1OsEgB9rmENC4opF yUdUsLH7yHHIgjo8dIJIG5iTRcqCgm5hMthzimgQnvs6Np0M5NFQcyKVOsXv7+N/m2cO CXprkKupRK0PRVaqw5yAcHQabbLEOZoIz+WzilCxp7QdaovBJnYiiV79Iu0AHfB2my7S BNCyhgiLxVWYrMOrZSuuHPdqeC8IDtMcvp07r/lKQkXjpUWShNeJwBTLpZYAUsKmCW/A 1iE1o+AGQnEA6SZEUb4WFbbV1OLvkfuZ137HJxA9bGuS0KhTFzSOYmJPqjDtFjKfTqzM zwZQ== 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=03wDppnzhve77lspOeg4GU6pno8ABydnPLGhbbyPK8vMsjxOJvVEF1EHbF1/xhjnWB JOUcod20O6s664nCxmNZ9KIiLLlcCFnPHcyuOO/Ivfwb8OVbW0WYOmR3htvzI6JyPMvE TnW9zjD/l/uxOMoO2w/25G0YT85v6FMAAoytm/WHg8lpprTurK//8hF/5qx2ctOCMhGm /CMGvnnOqndAW6tW6tulUYybs4N7zOeTqVTzDFt1wA4P/5GTQ4BJ2F4Hwbulch6mU8Pl QbXpX3iFDw6NfeQc0w+p7ifGdcDhItIUmmlA2jyygGAZNxjvSmAJE73T0aZi9Bw5PLIH ePXg== 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 b12si49628698pgl.264.2019.04.17.05.39.43; Wed, 17 Apr 2019 05:39:59 -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 S1732201AbfDQMg5 convert rfc822-to-8bit (ORCPT + 99 others); Wed, 17 Apr 2019 08:36:57 -0400 Received: from skedge03.snt-world.com ([91.208.41.68]:35542 "EHLO skedge03.snt-world.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732139AbfDQMgl (ORCPT ); Wed, 17 Apr 2019 08:36:41 -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 65A9067A907; Wed, 17 Apr 2019 14:36:38 +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:36:38 +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:36:38 +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 v6 7/7] mtd: rawnand: AMD: Also use the last page for bad block markers Thread-Topic: [PATCH v6 7/7] mtd: rawnand: AMD: Also use the last page for bad block markers Thread-Index: AQHU9Rozi+u5QNYUbkGmI8iWLBfBdg== Date: Wed, 17 Apr 2019 12:36:37 +0000 Message-ID: <20190417123631.22545-8-frieder.schrempf@kontron.de> References: <20190417123631.22545-1-frieder.schrempf@kontron.de> In-Reply-To: <20190417123631.22545-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: 65A9067A907.AD77B 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