From patchwork Thu May 1 09:56:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 29481 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f72.google.com (mail-pa0-f72.google.com [209.85.220.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DDF64203F3 for ; Thu, 1 May 2014 09:58:26 +0000 (UTC) Received: by mail-pa0-f72.google.com with SMTP id rd3sf13721666pab.3 for ; Thu, 01 May 2014 02:58:26 -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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=uLwyvELCSpnvnn5SQ1nvSKUq8mhVSeZUmeH9+2Cw85I=; b=FAQVGJcPfrMs+8P48uh/h14w4wy8sOdG1Db+KwbdscxkxI9zMJXbQo3jV8bPjLuOgA AjgbYoEFCWoiH/Zw7y4TnPD1SxbtFiqggAnN4FrIHadZ5JPY12IBfqBe0tSibbzk57/E YcLvU8Gx9JCZ6e1b9NaOUl4BJFbZ88V6o9nV9xgWp9wSJfy8Xxn/aRJwfUCr92JzS7ES gw9mKdgWOx8YW7dqS8jkRe4uHNYFmLoyg+Uwr/KKb5ohRpha8FkVs7bGe2RfgEfYfqtN yJeyrz00F5SE2+ZGuuL6z8xF2f9S4S/7QdzWq4ednpNSF/v/aiie9EYNtxDsHKfiT5vc o+BQ== X-Gm-Message-State: ALoCoQk5UGCQNL8EeVVIlEue3YmfMMGFEcetMN8nQzbUIjyoyjK5vAPqPpV4PGF/Z0M9V9Dt3Ww4 X-Received: by 10.66.233.65 with SMTP id tu1mr5053353pac.35.1398938305939; Thu, 01 May 2014 02:58:25 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.19.9 with SMTP id 9ls961907qgg.75.gmail; Thu, 01 May 2014 02:58:25 -0700 (PDT) X-Received: by 10.220.105.4 with SMTP id r4mr968166vco.27.1398938305807; Thu, 01 May 2014 02:58:25 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id u18si227173vew.84.2014.05.01.02.58.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:58:25 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id im17so3799900vcb.28 for ; Thu, 01 May 2014 02:58:25 -0700 (PDT) X-Received: by 10.58.74.38 with SMTP id q6mr8022297vev.7.1398938305750; Thu, 01 May 2014 02:58:25 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp12971vcb; Thu, 1 May 2014 02:58:24 -0700 (PDT) X-Received: by 10.195.12.14 with SMTP id em14mr8193556wjd.15.1398938304451; Thu, 01 May 2014 02:58:24 -0700 (PDT) Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com [209.85.212.171]) by mx.google.com with ESMTPS id j8si583399wix.10.2014.05.01.02.58.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:58:24 -0700 (PDT) Received-SPF: none (google.com: lee.jones@linaro.org does not designate permitted sender hosts) client-ip=209.85.212.171; Received: by mail-wi0-f171.google.com with SMTP id hm4so407842wib.16 for ; Thu, 01 May 2014 02:58:24 -0700 (PDT) X-Received: by 10.180.212.48 with SMTP id nh16mr1441971wic.49.1398938303970; Thu, 01 May 2014 02:58:23 -0700 (PDT) Received: from lee--X1.home (host109-148-238-223.range109-148.btcentralplus.com. [109.148.238.223]) by mx.google.com with ESMTPSA id bj5sm2696494wib.3.2014.05.01.02.58.22 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:58:23 -0700 (PDT) From: Lee Jones To: linux-kernel@vger.kernel.org Cc: computersforpeace@gmail.com, linux-mtd@lists.infradead.org, kernel@stlinux.com, Lee Jones Subject: [PATCH 38/47] mtd: nand: stm_nand_bch: dump bad blocks Date: Thu, 1 May 2014 10:56:45 +0100 Message-Id: <1398938214-17847-39-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1398938214-17847-1-git-send-email-lee.jones@linaro.org> References: <1398938214-17847-1-git-send-email-lee.jones@linaro.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: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Inform the user of any known bad blocks during initialisation. Conversely, if there aren't any known bad blocks, let the user know the good news. Signed-off-by: Lee Jones --- drivers/mtd/nand/stm_nand_bch.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/mtd/nand/stm_nand_bch.c b/drivers/mtd/nand/stm_nand_bch.c index a06dca8..6aaa118 100644 --- a/drivers/mtd/nand/stm_nand_bch.c +++ b/drivers/mtd/nand/stm_nand_bch.c @@ -1259,6 +1259,28 @@ static int bch_scan_bbt(struct mtd_info *mtd) return 0; } +static void nandi_dump_bad_blocks(struct nandi_controller *nandi) +{ + int bad_count = 0; + uint32_t block; + uint8_t *bbt = nandi->info.bbt_info.bbt; + uint8_t mark; + + pr_info("BBT:\n"); + for (block = 0; block < nandi->blocks_per_device; block++) { + mark = bbt_get_block_mark(bbt, block); + if (mark != BBT_MARK_GOOD) { + pr_info("\t\tBlock 0x%08x [%05u] marked bad [%s]\n", + block << nandi->block_shift, block, + (mark == BBT_MARK_BAD_FACTORY) ? + "Factory" : "Wear"); + bad_count++; + } + } + if (bad_count == 0) + pr_info("\t\tNo bad blocks listed in BBT\n"); +} + /* * Initialisation */ @@ -2021,6 +2043,8 @@ static int stm_nand_bch_probe(struct platform_device *pdev) if (err) return err; + nandi_dump_bad_blocks(nandi); + return 0; }