From patchwork Tue Mar 25 08:19:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 26993 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 85B5220062 for ; Tue, 25 Mar 2014 08:27:24 +0000 (UTC) Received: by mail-ob0-f199.google.com with SMTP id wo20sf511599obc.6 for ; Tue, 25 Mar 2014 01:27:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=55TojOkE0URUNrlqucv2+y2KykRFqvXnYJrLcrAsaUQ=; b=JZUAD/1JzCQIe3vqv8aPJETK4vAytWQUlXIhNWyST+soaPeq1m9dkymjhf913G5kfa JyZJ4e5BaGsG7QcMqqi6X0SalE2tgcuTkZa7iTrAPPXC+NgrCF3GaOtWRGUsPiwOAyXQ OSONb/lMvR3dnPmQ3rV2XmfABztbzMPn0n3goDQBknvobHtXT4uiJc7e77sBZhCRNM8m UiyEgYY5DWoTwkys9S0oC/EEj0tz96smTwF4TL5H8PUTOU4kdMLT9OorXtiVDSDEN7OY VsVRASr96ftQLj7f0eypefHC5RwIzJfrG/P6nvSdZg/BgL9/4GDcpX9w3gcBvg7EzJtl QNiA== X-Gm-Message-State: ALoCoQmd+8kqTwurZXRwdC/pHMd/+BNEb+x01GhhPs91UbSe1NrBzLzTl+ov3JG61r0WSyCkXvL8 X-Received: by 10.182.85.65 with SMTP id f1mr14049126obz.33.1395736044116; Tue, 25 Mar 2014 01:27:24 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.83.85 with SMTP id i79ls150309qgd.21.gmail; Tue, 25 Mar 2014 01:27:24 -0700 (PDT) X-Received: by 10.52.165.105 with SMTP id yx9mr46170744vdb.22.1395736044020; Tue, 25 Mar 2014 01:27:24 -0700 (PDT) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id cp10si3587192ved.74.2014.03.25.01.27.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 01:27:24 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.174 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.174; Received: by mail-ve0-f174.google.com with SMTP id oz11so127501veb.19 for ; Tue, 25 Mar 2014 01:27:23 -0700 (PDT) X-Received: by 10.52.78.231 with SMTP id e7mr4652349vdx.28.1395736043943; Tue, 25 Mar 2014 01:27:23 -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 i9csp285605vck; Tue, 25 Mar 2014 01:27:21 -0700 (PDT) X-Received: by 10.180.90.140 with SMTP id bw12mr5513790wib.18.1395736039407; Tue, 25 Mar 2014 01:27:19 -0700 (PDT) Received: from casper.infradead.org (casper.infradead.org. [85.118.1.10]) by mx.google.com with ESMTPS id r18si12211401wiv.66.2014.03.25.01.27.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Mar 2014 01:27:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 85.118.1.10 as permitted sender) client-ip=85.118.1.10; Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSMfT-0001dd-85; Tue, 25 Mar 2014 08:25:08 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSMeI-0002YI-Il; Tue, 25 Mar 2014 08:23:54 +0000 Received: from mail-wi0-f172.google.com ([209.85.212.172]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSMcH-0002FX-Qt for linux-arm-kernel@lists.infradead.org; Tue, 25 Mar 2014 08:21:53 +0000 Received: by mail-wi0-f172.google.com with SMTP id hi5so3186361wib.11 for ; Tue, 25 Mar 2014 01:21:28 -0700 (PDT) X-Received: by 10.180.24.227 with SMTP id x3mr20181356wif.41.1395735688482; Tue, 25 Mar 2014 01:21:28 -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.26 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 01:21:27 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 37/47] mtd: nand: stm_nand_bch: fetch the bit-flips threshold Date: Tue, 25 Mar 2014 08:19:54 +0000 Message-Id: <1395735604-26706-38-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_042150_204043_86E4DF47 X-CRM114-Status: GOOD ( 11.42 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.172 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 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-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.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.174 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 If none is provided by the platform, the default ECC mode will be used. Signed-off-by: Lee Jones --- drivers/mtd/nand/stm_nand_bch.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/mtd/nand/stm_nand_bch.c b/drivers/mtd/nand/stm_nand_bch.c index a0f0ae2..3853e7a 100644 --- a/drivers/mtd/nand/stm_nand_bch.c +++ b/drivers/mtd/nand/stm_nand_bch.c @@ -44,6 +44,12 @@ static int bch_ecc_sizes[] = { [BCH_NO_ECC] = 0, }; +static int bch_ecc_strength[] = { + [BCH_18BIT_ECC] = 18, + [BCH_30BIT_ECC] = 30, + [BCH_NO_ECC] = 0, +}; + /* * Inband Bad Block Table (IBBT) */ @@ -1843,6 +1849,21 @@ static int stm_nand_bch_probe(struct platform_device *pdev) info->ecclayout.eccbytes = nandi->sectors_per_page * bch_ecc_sizes[nandi->bch_ecc_mode]; + /* + * Get bit-flips threshold. A value of '0' is interpreted as + * . + */ + if (pdata->bch_bitflip_threshold) { + nandi->bitflip_threshold = pdata->bch_bitflip_threshold; + } else { + dev_warn(nandi->dev, + "WARNING: bit-flips threshold not specified.\n" + " Defaulting to ECC strength [%d]\n", + bch_ecc_strength[nandi->bch_ecc_mode]); + nandi->bitflip_threshold = + bch_ecc_strength[nandi->bch_ecc_mode]; + } + compatible = bch_check_compatibility(nandi, mtd, chip); if (!compatible) { dev_err(nandi->dev,