From patchwork Thu May 1 09:56:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 29483 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f200.google.com (mail-qc0-f200.google.com [209.85.216.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E69FF203F3 for ; Thu, 1 May 2014 09:58:28 +0000 (UTC) Received: by mail-qc0-f200.google.com with SMTP id l6sf9486022qcy.11 for ; Thu, 01 May 2014 02:58:28 -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=he9vN0uFMSFtM+uNQnuoOCxv5NgTVsMCiHX7PBW3gO4=; b=GR8sPuFGOKooFa+1oarINV+VogyWAher0SufVnB8+KyyYIkwmN00RX2VMhap2/rAZT NECi2n7siKSIJiTxBqUJTS9ApzMESKJuNVtwFtmaWoqx2c3QBn+F7Cq5IPei0kEuib0z v4M8nJV4/xNxuXCNM0dBvsHoyWFRIubd/KRj16et25QoU/uTRSA3TxCWfhdRlpghcELg TNw1RCP+Ty9S36b40kfFG5S51tKV+3Df6iu1cWjSDHtyCJRHG/5V0HCQhrTwID/R0k+E ERhEKshaoKZrjrge1qClD2atFAbmj0JLYAmoRIMX27ywsw1TBkVr9CpEobTRF/bxQ7ix KYwA== X-Gm-Message-State: ALoCoQkTwzI3CBJf3g2NMpV0iF8f5WuOOzRhCwnOWo7f+ceN8ZE6b/ldnEkoRYYh3CIQPcFZdlzB X-Received: by 10.58.142.135 with SMTP id rw7mr5005034veb.14.1398938308714; Thu, 01 May 2014 02:58:28 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.30.4 with SMTP id c4ls1014368qgc.51.gmail; Thu, 01 May 2014 02:58:28 -0700 (PDT) X-Received: by 10.58.31.136 with SMTP id a8mr8425262vei.20.1398938308608; Thu, 01 May 2014 02:58:28 -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 sq9si5950777vdc.89.2014.05.01.02.58.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:58:28 -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.128.174; Received: by mail-ve0-f174.google.com with SMTP id oz11so3602564veb.33 for ; Thu, 01 May 2014 02:58:28 -0700 (PDT) X-Received: by 10.220.69.72 with SMTP id y8mr8130570vci.21.1398938308545; Thu, 01 May 2014 02:58:28 -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 ib8csp12976vcb; Thu, 1 May 2014 02:58:28 -0700 (PDT) X-Received: by 10.194.6.106 with SMTP id z10mr8163099wjz.1.1398938307720; Thu, 01 May 2014 02:58:27 -0700 (PDT) Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by mx.google.com with ESMTPS id wq6si10527044wjb.232.2014.05.01.02.58.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:58:27 -0700 (PDT) Received-SPF: none (google.com: lee.jones@linaro.org does not designate permitted sender hosts) client-ip=209.85.212.182; Received: by mail-wi0-f182.google.com with SMTP id d1so403836wiv.9 for ; Thu, 01 May 2014 02:58:27 -0700 (PDT) X-Received: by 10.180.8.66 with SMTP id p2mr1478371wia.37.1398938307226; Thu, 01 May 2014 02:58:27 -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.25 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:58:26 -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 40/47] mtd: nand: stm_nand_bch: fetch the bit-flips threshold Date: Thu, 1 May 2014 10:56:47 +0100 Message-Id: <1398938214-17847-41-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: , 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 0f96f75..e742655 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) */ @@ -2030,6 +2036,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,