Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5866394imu; Wed, 30 Jan 2019 05:04:02 -0800 (PST) X-Google-Smtp-Source: ALg8bN7AL8e9Msckb6mvL2/Ex8ea6HQtNGQfFDZu5VY6LERSEg88kJD8HJJnr8jhJqq+A2lDHyk+ X-Received: by 2002:a63:cd4c:: with SMTP id a12mr27965141pgj.252.1548853442735; Wed, 30 Jan 2019 05:04:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548853442; cv=none; d=google.com; s=arc-20160816; b=NY9tVFAQmYhwm8OBNesc8ZbsRT+twXEWjO/sgdJ8UDbTD1XJqCrThv8ZlAJzglrhgP bSr6ZHOjSrIVI5HJtwy8hg471RaTyHpHZXd6ZbKxWhMzmNjApugw8y0v6rMM2iirdY7S luIOvwC1xVu1FifB9bVowLWhftXYhbOcZOJBFZdsVkL3AQelgrwcuZUhXI0u14xg7tLx 9T8iM00RK+02Y1XD4CEDQVkEScSQ+5tgZxggmdVP/hDupj2BboqYuBz6h8+zGukFK8Qq qk0TjtejC2fYwg95F0o7DTzgI8FMA4v7gZjIEi2FdfmSPYxrI/LuLZya5+S+PFC05WSW CZvg== 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=IP30jTR1GONF+2azYOONk6b4Gw/3glfKihsT6LkwrWg=; b=pNrh5lt8IHpwLT7tcC2fudL/39gXcPquTF8k0ug8/BEZHZhIN1o9UCL5/AdPCuFnnJ yRdf354my1spoWibYP3TENFnMNKQgZ1JeB/YDtJCotWkQslLBB5XULu7uIvizHyD5t44 q0T1A00Bd5nryk0FmVA0yVXETW+AoFRDyz8Wm7rPYqNnQKELXlXQA+GPtZz+jzOGboeB iVIUaUZec6OcW5HqOqifmwtA/ybO/URAuWXp6Xa+aQ5BYp07uV7qdz4AsZ2DpNOTrZ0C +2iC7QMmNflyBBpmxzLjQjqVn2pf3ofy0wEXPkgWOACctoD19EfaIZ4wopwYMWzWhvof U0FA== 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 g34si1471236pld.15.2019.01.30.05.03.47; Wed, 30 Jan 2019 05:04:02 -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 S1731056AbfA3NB5 convert rfc822-to-8bit (ORCPT + 99 others); Wed, 30 Jan 2019 08:01:57 -0500 Received: from skedge04.snt-world.com ([91.208.41.69]:56988 "EHLO skedge04.snt-world.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731003AbfA3NBz (ORCPT ); Wed, 30 Jan 2019 08:01:55 -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 7DC096AC46C; Wed, 30 Jan 2019 14:01:52 +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; Wed, 30 Jan 2019 14:01:52 +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; Wed, 30 Jan 2019 14:01:52 +0100 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 v3 5/5] mtd: rawnand: AMD: Also use the last page for bad block markers Thread-Topic: [PATCH v3 5/5] mtd: rawnand: AMD: Also use the last page for bad block markers Thread-Index: AQHUuJv3FiSqWJszx02tfyXFVIZI3w== Date: Wed, 30 Jan 2019 13:01:52 +0000 Message-ID: <20190130130111.32724-6-frieder.schrempf@kontron.de> References: <20190130130111.32724-1-frieder.schrempf@kontron.de> In-Reply-To: <20190130130111.32724-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: 7DC096AC46C.AE96B 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 --- 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