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: 27001 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f199.google.com (mail-ob0-f199.google.com [209.85.214.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 425F420062 for ; Tue, 25 Mar 2014 08:42:46 +0000 (UTC) Received: by mail-ob0-f199.google.com with SMTP id wo20sf569362obc.10 for ; Tue, 25 Mar 2014 01:42:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=5g81oknCrn6Ke7Pth/scqxq4lREFVmxpDKCS2Tc9+fY=; b=e4Oy6Lvl/9LW+37cusVFpz1tzcgUXojvySEg3M3bV9w/du5QsBg6kHw+SLAKodcYIf q5kKpCDfxSwVsVimkyNBPVYYFDg4LcBWqx20kBQyQ078f+wnvD45kPm0f75DMFOPOsp1 7vX4QA3gcHr8umsHgujcJL0+bnFx+U390DGreE8ej1ZGPjkONT8ahWxbX3gtxb/tMAzD +ifexDwcxIoIOWfSG2JwvO+MujcZtpsRytKNJd8cSL7BIfp1NXveX7aA1vIrIwW2lHc7 rlBRH3iqcMw12d1TC4BT68TqZA8N2NFKjrdWIeZOlBmQ+NgnePQ/U83m7ocoQn9kfSC2 aprA== X-Gm-Message-State: ALoCoQkQrHD4sa2CT9uMOT+cUwXneu23G4tkFnIIwYXnFixJAsO0bqrT4+Ew/mZzgTKAMstbkKv/ X-Received: by 10.182.213.5 with SMTP id no5mr14395888obc.15.1395736965625; Tue, 25 Mar 2014 01:42:45 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.18.175 with SMTP id 44ls132698qgf.24.gmail; Tue, 25 Mar 2014 01:42:45 -0700 (PDT) X-Received: by 10.52.253.75 with SMTP id zy11mr15762923vdc.10.1395736965499; Tue, 25 Mar 2014 01:42:45 -0700 (PDT) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id sk2si3545736vcb.90.2014.03.25.01.42.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 01:42:45 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.181; Received: by mail-ve0-f181.google.com with SMTP id oy12so147506veb.40 for ; Tue, 25 Mar 2014 01:42:45 -0700 (PDT) X-Received: by 10.58.188.52 with SMTP id fx20mr118851vec.28.1395736965415; Tue, 25 Mar 2014 01:42:45 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp286477vck; Tue, 25 Mar 2014 01:42:44 -0700 (PDT) X-Received: by 10.66.190.138 with SMTP id gq10mr40383568pac.108.1395736964509; Tue, 25 Mar 2014 01:42:44 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id my2si10943930pbc.68.2014.03.25.01.42.14; Tue, 25 Mar 2014 01:42:14 -0700 (PDT) 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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753179AbaCYIV0 (ORCPT + 26 others); Tue, 25 Mar 2014 04:21:26 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:63463 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753021AbaCYIVX (ORCPT ); Tue, 25 Mar 2014 04:21:23 -0400 Received: by mail-wi0-f172.google.com with SMTP id hi5so3184530wib.5 for ; Tue, 25 Mar 2014 01:21:22 -0700 (PDT) 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 Cc: lee.jones@linaro.org, kernel@stlinux.com, computersforpeace@gmail.com, linux-mtd@lists.infradead.org, dwmw2@infradead.org, angus.clark@st.com, pekon@ti.com 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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; }