From patchwork Tue Mar 25 08:19:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 333352 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 EC5DA14008E for ; Tue, 25 Mar 2014 20:56:32 +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 1WSMvK-0001I8-Fn; Tue, 25 Mar 2014 08:41:30 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSMuY-0003Ww-M8; Tue, 25 Mar 2014 08:40:42 +0000 Received: from bombadil.infradead.org ([2001:1868:205::9]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSMs5-0003B8-10 for linux-mtd@merlin.infradead.org; Tue, 25 Mar 2014 08:38:09 +0000 Received: from mail-wi0-f173.google.com ([209.85.212.173]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSMcD-0002Cb-Ex for linux-mtd@lists.infradead.org; Tue, 25 Mar 2014 08:21:45 +0000 Received: by mail-wi0-f173.google.com with SMTP id f8so3187995wiw.0 for ; Tue, 25 Mar 2014 01:21:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=eaoN0SMoJGMXt0brgtyxUEexVtV+/kzZ7m7y9VtPq/Y=; b=N/zDSKRte2aMnXnIOxMWz+n/smnNJ+zakLArbdtTwuvIF/UBTTMn3GLMcNTONEw+uO k4leWjXiNTG0w9KpqCEpr5oN2AtXzUkEY0gtJAMvV1T/NzDgSbYCgduMsDb8B5Pad3y6 FMIVAT5TzTyAYyiUZoYFEmVgjLBLZcDdYIo8nN7EkPRFB4hbILR9Vc/EM1B++IaL+t60 0wTYai1e/YteBFmBWGA7w//T4kOafwWNv6Vd2tdqO8s2O8yTgx8LSM4fJmGcklqOQP7o XBF6ihvXU+qCxRREzTD1j25a5XqboTcYGIRgrbfOGad6hic9BVjJYY5IjcS5Cp4KgbLV nhzQ== X-Gm-Message-State: ALoCoQldQhHxOXHRd43+CQ7kw9qB9duEULWHDOos8Zks3haxc+AJt8IPtc1eaVT+YhCBAdCqbC6f X-Received: by 10.181.11.169 with SMTP id ej9mr21564172wid.18.1395735682800; Tue, 25 Mar 2014 01:21:22 -0700 (PDT) Received: from lee--X1.home (host109-148-113-193.range109-148.btcentralplus.com. [109.148.113.193]) by mx.google.com with ESMTPSA id k4sm5567676wib.19.2014.03.25.01.21.21 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 01:21:22 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 34/47] mtd: nand: stm_nand_bch: load flash-resident BBT Date: Tue, 25 Mar 2014 08:19:51 +0000 Message-Id: <1395735604-26706-35-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1395735604-26706-1-git-send-email-lee.jones@linaro.org> References: <1395735604-26706-1-git-send-email-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140325_012145_650957_C3635D26 X-CRM114-Status: UNSURE ( 9.50 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.173 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record Cc: angus.clark@st.com, kernel@stlinux.com, lee.jones@linaro.org, linux-mtd@lists.infradead.org, pekon@ti.com, computersforpeace@gmail.com, dwmw2@infradead.org 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: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org If load of existing BBT fails (first run), scan device for factory-set BBMs (Bad-Block Markers) and create a new flash-resident. Signed-off-by: Lee Jones --- drivers/mtd/nand/stm_nand_bch.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/mtd/nand/stm_nand_bch.c b/drivers/mtd/nand/stm_nand_bch.c index d1d84c1..6698b1f 100644 --- a/drivers/mtd/nand/stm_nand_bch.c +++ b/drivers/mtd/nand/stm_nand_bch.c @@ -1834,6 +1834,21 @@ static int stm_nand_bch_probe(struct platform_device *pdev) if (err) return err; + /* Load Flash-resident BBT */ + err = bch_load_bbt(nandi, bbt_info); + if (err) { + dev_warn(nandi->dev, + "failed to find BBTs:" + " scanning device for bad-block markers\n"); + + /* Scan, build, and write BBT */ + nandi_scan_build_bbt(nandi, bbt_info); + err = bch_update_bbts(nandi, bbt_info, NAND_IBBT_UPDATE_BOTH, + bbt_info->bbt_vers[0] + 1); + if (err) + return err; + } + return 0; }