Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2251886imj; Mon, 18 Feb 2019 02:44:33 -0800 (PST) X-Google-Smtp-Source: AHgI3Ib0DVxGcmM+UDlaHrcCUEgSjpVz9G1ULhVxYnA2fKUqHoHsiNCAHtkOYHZybD8C7l9AN1bo X-Received: by 2002:a62:20c9:: with SMTP id m70mr22570223pfj.118.1550486673289; Mon, 18 Feb 2019 02:44:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550486673; cv=none; d=google.com; s=arc-20160816; b=dEdf0B9OdLc4kNFZcMR5TxUmF8KURsKh6sFfLKy2LaPCOj19nipdEebuhD95IoP4iQ llV3zUOG+Zkw2fFw7I8+Ag3F2jn//KqmkwfpSx7sXCF2bgAKoDumBxqL5xHb513hcHN/ mvMsdByCE7ZJnaOJZc1ZwzMh91MVQI3OHLwihqbBo9fVudHPEH8OdJ2/KIH4qoUGezLS KOCFJtgEt0YtJJwCQ6KxMmvNzGfRa6UN3ypggmSS13KxUl7rumxlrz+5OuygF2Io2ldm vHRxGxhHwfXGdQOtbb/MFHbn9UfOWTAh7zcZkoFYEdwppzTOKZwOwmmmcYj/XsjrSGrN RayA== 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=A/o1TOK2jzApYwvuXlpIwbz2NUL2wEO6LHcR596QtyvcBFRBKgAg2sCB5X99faM9bk PgDW7kRni/GVhxVkrVwrP0XIgHEu9rrRD2aQccP+Dd5oTYqbgtEo3uQ8paeu6sZujdXM BVMI6fafgon6u45z84mRPUz7XkRUK4MVk+7WwHJUOiyXYrAcsStCGR7myDEqd1tyWHS0 tZWXepVBTnMcehiiKy1/4qcyxjmjoyza+MIyJWquQdCf5K4hXsFP2yJE4+7WMd6bWh18 AroTqedk/CZf4yx/yChMMfhbi/PaCwl1rqF5gny5d/Y0mBravpUbF0JgmAVLPhdYHuH3 KFMw== 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 y62si9898117pgd.465.2019.02.18.02.44.17; Mon, 18 Feb 2019 02:44:33 -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 S1730228AbfBRKnI convert rfc822-to-8bit (ORCPT + 99 others); Mon, 18 Feb 2019 05:43:08 -0500 Received: from skedge03.snt-world.com ([91.208.41.68]:50256 "EHLO skedge03.snt-world.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730141AbfBRKmt (ORCPT ); Mon, 18 Feb 2019 05:42:49 -0500 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 E571E603769; Mon, 18 Feb 2019 11:42:46 +0100 (CET) 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; Mon, 18 Feb 2019 11:42:46 +0100 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; Mon, 18 Feb 2019 11:42:46 +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 v4 7/7] mtd: rawnand: AMD: Also use the last page for bad block markers Thread-Topic: [PATCH v4 7/7] mtd: rawnand: AMD: Also use the last page for bad block markers Thread-Index: AQHUx3av5nN+rA7yBUm0nQr4UWWfjQ== Date: Mon, 18 Feb 2019 10:42:46 +0000 Message-ID: <20190218104122.18788-8-frieder.schrempf@kontron.de> References: <20190218104122.18788-1-frieder.schrempf@kontron.de> In-Reply-To: <20190218104122.18788-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: E571E603769.AE56B 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