From patchwork Wed Mar 19 13:23:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: y@karo-electronics.de X-Patchwork-Id: 331730 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from casper.infradead.org (unknown [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8F7072C00B9 for ; Thu, 20 Mar 2014 00:27:33 +1100 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WQGWY-0002WR-Sa; Wed, 19 Mar 2014 13:27:15 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WQGWV-0002vZ-Ec; Wed, 19 Mar 2014 13:27:11 +0000 Received: from mail.karo-electronics.de ([81.173.242.67]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WQGWK-0002tp-6q; Wed, 19 Mar 2014 13:27:00 +0000 From: y@karo-electronics.de To: Arnd Bergmann , Artem Bityutskiy , Brian Norris , David Woodhouse , Fabio Estevam , Huang Shijie , Ian Campbell , Kumar Gala , =?UTF-8?q?Lothar=20Wa=C3=9Fmann?= , Mark Rutland , Pawel Moll , Rob Herring , Rob Landley , Russell King , Sascha Hauer , Shawn Guo , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org Subject: [PATCH] mtd: gpmi: make blockmark swapping optional Date: Wed, 19 Mar 2014 14:23:26 +0100 Message-Id: <1395235406-13449-1-git-send-email-y> X-Mailer: git-send-email 1.7.10.4 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140319_092700_520374_87D98BB9 X-CRM114-Status: GOOD ( 12.79 ) X-Spam-Score: -1.7 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [81.173.242.67 listed in list.dnswl.org] 0.3 MSGID_NOFQDN1 Message-ID with no domain name -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.6 INVALID_MSGID Message-Id is not valid, according to RFC 2822 X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Lothar Waßmann With a flash-based BBT there is no reason to move the Factory Bad Block Marker from the data area buffer (to where it is mapped by the GPMI NAND controller) to the OOB buffer. Thus, make this feature configurable via DT. This is required for the Ka-Ro electronics platforms. Signed-off-by: Lothar Waßmann --- Documentation/devicetree/bindings/mtd/gpmi-nand.txt | 3 +++ arch/arm/boot/dts/imx28-tx28.dts | 1 + drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 10 +++++++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/mtd/gpmi-nand.txt b/Documentation/devicetree/bindings/mtd/gpmi-nand.txt index 458d596..f28949a 100644 --- a/Documentation/devicetree/bindings/mtd/gpmi-nand.txt +++ b/Documentation/devicetree/bindings/mtd/gpmi-nand.txt @@ -25,6 +25,9 @@ Optional properties: discoverable or this property is not enabled, the software may chooses an implementation-defined ECC scheme. + - fsl,no-blockmark-swap: Don't swap the bad block marker from the OOB + area with the byte in the data area but rely on the + BBT for identifying bad blocks. The device tree may optionally contain sub-nodes describing partitions of the address space. See partition.txt for more detail. diff --git a/arch/arm/boot/dts/imx28-tx28.dts b/arch/arm/boot/dts/imx28-tx28.dts index e14bd86..7d2bea8 100644 --- a/arch/arm/boot/dts/imx28-tx28.dts +++ b/arch/arm/boot/dts/imx28-tx28.dts @@ -247,6 +247,7 @@ &gpmi { pinctrl-0 = <&gpmi_pins_a &gpmi_status_cfg>; nand-on-flash-bbt; + fsl,no-blockmark-swap; status = "okay"; }; diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c index bb77f75..98562eb 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c @@ -1632,9 +1632,6 @@ static int gpmi_init_last(struct gpmi_nand_data *this) struct bch_geometry *bch_geo = &this->bch_geometry; int ret; - /* Set up swap_block_mark, must be set before the gpmi_set_geometry() */ - this->swap_block_mark = !GPMI_IS_MX23(this); - /* Set up the medium geometry */ ret = gpmi_set_geometry(this); if (ret) @@ -1701,6 +1698,13 @@ static int gpmi_nand_init(struct gpmi_nand_data *this) if (of_get_nand_on_flash_bbt(this->dev->of_node)) chip->bbt_options |= NAND_BBT_USE_FLASH | NAND_BBT_NO_OOB; + /* Set up swap_block_mark, must be set before the gpmi_set_geometry() */ + if (!of_property_read_bool(this->dev->of_node, "fsl,no-blockmark-swap")) + this->swap_block_mark = !GPMI_IS_MX23(this); + + dev_dbg(this->dev, "Blockmark swapping %sabled\n", + this->swap_block_mark ? "en" : "dis"); + /* * Allocate a temporary DMA buffer for reading ID in the * nand_scan_ident().