Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7278542imu; Tue, 22 Jan 2019 03:26:20 -0800 (PST) X-Google-Smtp-Source: ALg8bN7c2WGhCCH/6jLXfhy1XghMcdVr9K6ZquBHgEtYnan+uD1vpu5WcOsHqqOux24/PSrEOjOp X-Received: by 2002:a63:70c:: with SMTP id 12mr30735058pgh.352.1548156380127; Tue, 22 Jan 2019 03:26:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548156380; cv=none; d=google.com; s=arc-20160816; b=XyNRF83gjpmzwOhEQ0fCghOVHn4d8OI+b4jgP0aiDF62fDZ7ZfRcJooIP5y1qBbRpn Gv1OX2XEQv/9HYXRrEr3fwq7YH/Qc7i+WVnm+xzh88QRGdaEPlYnus86gVKOBjyOxJHn q9y2oN6B1YMwVL8cZc68sf4VN5Eb/m3HNnpErl45XlBc7HDZJwtK8u0vuHm7viRwWLCN W5elMUL+Tu+ksE5Qk6AZvdkfqaCauKUbUt0x7AtwSA9cnZ6G7y2JEEbv0+jI5tTRrHV9 Tei7RYCnJJQ4E4ncwET/Uzk0wBQZQaYOV1EfEu71OGKx8AJyTm9NyD5czFfJmHOfLVLN kVEg== 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=x5mb5FCR6m608nfwq2yRc8r4s/ObflhD7WH1j8dANok=; b=VrOE2N2Tvg/cB7VFCGWvii9YEgDim7aWT7Uwtkih5nHQxXqJdW0njSwA484jT1wE4U yJU10aygPm6aeCav9B9dQI9uTdNd91ZRaaEJbLppmlOHPfXBgeUlZI8Bz/GBUIzhzd2u RkpA5PBOPUELL4LAvd8TxEW2z62nYK2MU1emaalsmY/8/br46QhS8L1/v7tsjtlIZVEU 7zEdAER3vpUIUejz6ZK5v11VnZzhW1Jd7Np4ds2XPDOhWfbxuBEv7mWiyxlepNiLLyFW 0rPX0EgxQwic8vkOuT7pLTau13kzt1sZh3pFK8Q2N4/rZFjgRBPRd3DgQG8vifAMq5k/ vJVQ== 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 v5si15696458ply.74.2019.01.22.03.26.04; Tue, 22 Jan 2019 03:26:20 -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 S1728191AbfAVLXi convert rfc822-to-8bit (ORCPT + 99 others); Tue, 22 Jan 2019 06:23:38 -0500 Received: from skedge03.snt-world.com ([91.208.41.68]:53520 "EHLO skedge03.snt-world.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728130AbfAVLXh (ORCPT ); Tue, 22 Jan 2019 06:23:37 -0500 Received: from sntmail12r.snt-is.com (unknown [10.203.32.182]) (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 4942467BC80; Tue, 22 Jan 2019 12:23:34 +0100 (CET) Received: from sntmail12r.snt-is.com (10.203.32.182) by sntmail12r.snt-is.com (10.203.32.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1466.3; Tue, 22 Jan 2019 12:23:33 +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; Tue, 22 Jan 2019 12:23:33 +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" , Boris Brezillon , David Woodhouse , Brian Norris , Marek Vasut Subject: [PATCH v2 4/4] mtd: rawnand: AMD: Also use the last page for bad block markers Thread-Topic: [PATCH v2 4/4] mtd: rawnand: AMD: Also use the last page for bad block markers Thread-Index: AQHUskTpTzjPUA7KgEi6PjsxnlDFDg== Date: Tue, 22 Jan 2019 11:23:33 +0000 Message-ID: <20190122112258.20042-5-frieder.schrempf@kontron.de> References: <20190122112258.20042-1-frieder.schrempf@kontron.de> In-Reply-To: <20190122112258.20042-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.43] 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: 4942467BC80.AC29D X-SnT-MailScanner: Found to be clean X-SnT-MailScanner-SpamCheck: X-SnT-MailScanner-From: frieder.schrempf@kontron.de X-SnT-MailScanner-To: bbrezillon@kernel.org, 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 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; } -- 2.17.1