Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5863999imu; Wed, 30 Jan 2019 05:02:09 -0800 (PST) X-Google-Smtp-Source: ALg8bN7pdwOpUpAZ58MK/FnaV2MBkzWKhPyHNvFCrBhM7yJ7V2KFROP2jKXzKsjx/Yj5sU+SPscN X-Received: by 2002:a63:5b1f:: with SMTP id p31mr27254776pgb.56.1548853329196; Wed, 30 Jan 2019 05:02:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548853329; cv=none; d=google.com; s=arc-20160816; b=u1g6Cab7NwbIpphr+VJWehTo0xCaQD/MxD5qfjDfamVi/Gj6dXE1lC/hztxSr5UCF5 qAvyFQlehrYH/RjDey0paQFGuO1hdGjSxLYZ0kOsDxlC6+/KTlMg9ystxgl63x+gaOfs oSRz3dLEsgAGg6dbvEaxL5dg6yXP06jEL5TYx8OvGmy1VV9TMlXC5cNokR4p9CH7eAeI wQZRL30n7yWwgTu5u61rQhKZfgg8hy3MOJ3vH0aN4gryRlJb3EBDDg5Jp0GQkIHHBLLt jeuIGE4pXle+8bE1GsTMnWReCmQ6m74RAT0NAX7w0cf/eViq3sqC4rxaJhBP1iEGjxky hgCQ== 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:message-id:date:thread-index :thread-topic:subject:cc:to:from; bh=ryg3MhSdqi437dPgf50N9b5niIy6iOVRcywhnWr113o=; b=n+MqQ5YMtZik1wCzXWYqwVsA4CKm/PIgfWsUqhbyxTKHQdXsVa/DAehOSvRFpKNyd0 ezXbGfXzMyU4wCdbVVjPxV6L7UvkeHoKlfPMAJ9/fOyR7s7/eTl/itmAi9ulqKLz5Z7/ 6wOgJplU332IK3QspDP3cyXcBTl3ZIYFLGdj7iieT4hIF1sjQxI1Ux2dfGWAyiIfouta H7GCT9vR1aeQhAuYSpoyf86wulIGoA34UQpNiREAxG/mmvNV0Rpfu+OoArjEFKGFV9iW PPWbm2nHObIRkATTigLzlej4HPpnf1L3LQyU/tmKdRx0iHmxpLJTQkuqNGhaxXDn1oCz rQFQ== 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 p8si1457243pls.83.2019.01.30.05.01.52; Wed, 30 Jan 2019 05:02:09 -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 S1730886AbfA3NBg convert rfc822-to-8bit (ORCPT + 99 others); Wed, 30 Jan 2019 08:01:36 -0500 Received: from skedge04.snt-world.com ([91.208.41.69]:56870 "EHLO skedge04.snt-world.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726915AbfA3NBg (ORCPT ); Wed, 30 Jan 2019 08:01:36 -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 skedge04.snt-world.com (Postfix) with ESMTPS id C72DE6AB0CE; Wed, 30 Jan 2019 14:01:32 +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; Wed, 30 Jan 2019 14:01:32 +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:32 +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" Subject: [PATCH v3 0/5] mtd: rawnand: Support bad block markers in first, second or last page Thread-Topic: [PATCH v3 0/5] mtd: rawnand: Support bad block markers in first, second or last page Thread-Index: AQHUuJvsI+N0hB5xfUiobz2DATnTQw== Date: Wed, 30 Jan 2019 13:01:32 +0000 Message-ID: <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: C72DE6AB0CE.A056D 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, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, 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 Currently supported bad block marker positions within the block are: * in first page only * in last page only * in first or second page After some cleanup and preparation in patch 1 and 2, we make it possible to set NAND_BBM_FIRSTPAGE, NAND_BBM_SECONDPAGE and NAND_BBM_LASTPAGE independently of each other (patch 3). Some ESMT NANDs are known to have been shipped by the manufacturer with bad block markers in the first or last page, instead of the first or second page. Also the datasheets for Cypress/Spansion/AMD NANDs claim that the first, second *and* last page needs to be checked. Therefore in patch 4 and 5 we set all three flags for AMD/Spansion/Cypress and ESMT chips. --- Changes in v3: ============== * Fix bit offsets for new flags in nand_chip->options * Move separation of flags for first and second page markers to a separate patch * Fix cover letter * Fix S-o-b tag * Add R-b tags Changes in v2: ============== * Rebase on 5.0-rc1 * Add patch to move bad block marker position info to a common place and rename/prepare existing flags * improve/rename function nand_bbm_get_next_page() to use new flags --- Frieder Schrempf (5): mtd: nand: Always store info about bad block markers in chip struct mtd: nand: Make flags for bad block marker position more granular mtd: rawnand: Support bad block markers in first, second or last page mtd: rawnand: ESMT: Also use the last page for bad block markers mtd: rawnand: AMD: Also use the last page for bad block markers drivers/mtd/nand/onenand/onenand_base.c | 2 +- drivers/mtd/nand/onenand/onenand_bbt.c | 2 +- drivers/mtd/nand/raw/internals.h | 1 + drivers/mtd/nand/raw/nand_amd.c | 8 +++- drivers/mtd/nand/raw/nand_base.c | 64 +++++++++++++++++-------- drivers/mtd/nand/raw/nand_bbt.c | 28 +++++------ drivers/mtd/nand/raw/nand_esmt.c | 9 +++- drivers/mtd/nand/raw/nand_hynix.c | 4 +- drivers/mtd/nand/raw/nand_macronix.c | 2 +- drivers/mtd/nand/raw/nand_micron.c | 2 +- drivers/mtd/nand/raw/nand_samsung.c | 4 +- drivers/mtd/nand/raw/nand_toshiba.c | 2 +- drivers/mtd/nand/raw/sh_flctl.c | 4 +- include/linux/mtd/bbm.h | 14 +----- include/linux/mtd/rawnand.h | 16 +++++++ 15 files changed, 100 insertions(+), 62 deletions(-) -- 2.17.1