Received: by 10.192.165.148 with SMTP id m20csp3979367imm; Tue, 8 May 2018 00:23:17 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr9iiKs/eCc/kttnWRXLqj048ogEUV9QO9lJdtrETunBdoIfpdDf/ou/ppF6ow+KT74wVLL X-Received: by 10.98.87.84 with SMTP id l81mr39046947pfb.56.1525764197558; Tue, 08 May 2018 00:23:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525764197; cv=none; d=google.com; s=arc-20160816; b=LFACWTxiGdY/wvcndeP6K29oUqJ9qIJDbgJf9xvo+j5PZDrCKgTtveNcGLdyYTD7d4 gyxRadH6i/Rf8+DXKr8zJ9dw8qGqNemntrCTXZ9Wj1KDnOftnXUN2400BdNsKOoI7DZN SBVJZVKMvpeJAVyohdy9oUdYlIULRCyCfHCoeyo3GD4F5Z+PrKWHVETnrKFUq5LtD/cN AfhoUKRaZoTgqQw5LkujC7fl3ULL1NrX167vjgR4aLXBOF9XIRaC9d/ZqcctPXiRWTf/ awiTSHBdet9W6BBWjJyHO/GVT3uiN8uzLyDnsUC+Qn56oUYSQz8NAvJl4yWIkIOugzFu HK8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=OkFiEQbN4KbFSMCrtCfuZ3VpRLOTFtbN7dBZ3QvbO/E=; b=ukmZmLnuoXCpifJxIJxTZ2uEAclUuVaRX4T6eDPln1cHwH/4A0D5mb5j5IFoRJjMTP a1+Cmm7BPkokc3idJ/OPYnExbepG1KkkX2ImenLGOTUAb+0hWgYpifNAkpHi1NhbsxE/ OoB4r6r8QzQhaQSFjPOw6KEmqG//I85lMuZcq0JTr+1p+Wrd5s+3LQkkR1IUPA1OdxfB yutI40f89oXqewLvoTuAs78/2nff94ORQAOfv26HT2dHfkIALsb2CQLSUpYFwdiVJPza 3Halxx6mT49RdZk2ZbW/eZ8SraMicHwiFhsjK76PLfcCooNkd3RT/ezuCEy0LVLTg2l5 RIGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=fLfM3bYN; dkim=pass header.i=@codeaurora.org header.s=default header.b=CW6eUmC5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p91-v6si23237070plb.457.2018.05.08.00.23.03; Tue, 08 May 2018 00:23:17 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=fLfM3bYN; dkim=pass header.i=@codeaurora.org header.s=default header.b=CW6eUmC5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754678AbeEHHWc (ORCPT + 99 others); Tue, 8 May 2018 03:22:32 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:33380 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754412AbeEHHWb (ORCPT ); Tue, 8 May 2018 03:22:31 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 88B0460881; Tue, 8 May 2018 07:22:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525764150; bh=pyaUi6bzfhK7GVQUYlg8js5O3/6jiarz36JAp+j4SJA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=fLfM3bYNGLl5qu7T9luWYieX6Vy6cMGIQbQzm8CwODWnS+S4V5zO0XEVN3z0B2o6L naLeWYTDgGP0CW906HeRlM7oeLwHXnqRp/0NRX1FVFQjLBt8+FmQbFK3popmu7NKGn TsvO6rSeI6Cg6SpPT57yKz/W1BcaUfWIDaMkrdRw= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 54326601A0; Tue, 8 May 2018 07:22:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525764149; bh=pyaUi6bzfhK7GVQUYlg8js5O3/6jiarz36JAp+j4SJA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=CW6eUmC5N046YRGh//k7Xv2bOaimXdGvd7H2yQQZc/t+bK/ZtibkgJBH8mEYQSNNh VoyPF2JVod0BJEs13tDX4q++4D7OsZ6bfE4HAwkmjZR0A4YdS2dTDq2DZJol/Fu/xM jUVmZKhCURaEzPkPOiQx9jUPfKP2s0Vi3KxgYe+I= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 08 May 2018 12:52:29 +0530 From: Abhishek Sahu To: Boris Brezillon Cc: Archit Taneja , Richard Weinberger , Masahiro Yamada , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Marek Vasut , linux-mtd@lists.infradead.org, Miquel Raynal , Andy Gross , Brian Norris , David Woodhouse Subject: Re: [PATCH v2 01/14] mtd: rawnand: helper function for setting up ECC parameters In-Reply-To: <20180507101646.3df649b0@bbrezillon> References: <1525350041-22995-1-git-send-email-absahu@codeaurora.org> <1525350041-22995-2-git-send-email-absahu@codeaurora.org> <20180507101646.3df649b0@bbrezillon> Message-ID: X-Sender: absahu@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-05-07 13:46, Boris Brezillon wrote: > On Thu, 3 May 2018 17:50:28 +0530 > Abhishek Sahu wrote: > >> commit 2c8f8afa7f92 ("mtd: nand: add generic helpers to check, >> match, maximize ECC settings") provides generic helpers which >> drivers can use for setting up ECC parameters. >> >> Since same board can have different ECC strength nand chips so >> following is the logic for setting up ECC strength and ECC step >> size, which can be used by most of the drivers. >> >> 1. If both ECC step size and ECC strength are already set >> (usually by DT) then just check whether this setting >> is supported by NAND controller. >> 2. If NAND_ECC_MAXIMIZE is set, then select maximum ECC strength >> supported by NAND controller. >> 3. Otherwise, try to match the ECC step size and ECC strength closest >> to the chip's requirement. If available OOB size can't fit the chip >> requirement then select maximum ECC strength which can be fit with >> available OOB size with warning. >> >> This patch introduces nand_ecc_param_setup function which calls the >> required helper functions for the above logic. The drivers can use >> this single function instead of calling the 3 helper functions >> individually. >> >> CC: Masahiro Yamada >> Signed-off-by: Abhishek Sahu >> --- >> * Changes from v1: >> >> NEW PATCH >> >> drivers/mtd/nand/raw/nand_base.c | 42 >> ++++++++++++++++++++++++++++++++++++++++ >> include/linux/mtd/rawnand.h | 3 +++ >> 2 files changed, 45 insertions(+) >> >> diff --git a/drivers/mtd/nand/raw/nand_base.c >> b/drivers/mtd/nand/raw/nand_base.c >> index 72f3a89..dd7a984 100644 >> --- a/drivers/mtd/nand/raw/nand_base.c >> +++ b/drivers/mtd/nand/raw/nand_base.c >> @@ -6249,6 +6249,48 @@ int nand_maximize_ecc(struct nand_chip *chip, >> } >> EXPORT_SYMBOL_GPL(nand_maximize_ecc); >> >> +/** >> + * nand_ecc_param_setup - Set the ECC strength and ECC step size >> + * @chip: nand chip info structure >> + * @caps: ECC engine caps info structure >> + * @oobavail: OOB size that the ECC engine can use >> + * >> + * Choose the ECC strength according to following logic >> + * >> + * 1. If both ECC step size and ECC strength are already set (usually >> by DT) >> + * then check if it is supported by this controller. >> + * 2. If NAND_ECC_MAXIMIZE is set, then select maximum ECC strength. >> + * 3. Otherwise, try to match the ECC step size and ECC strength >> closest >> + * to the chip's requirement. If available OOB size can't fit the >> chip >> + * requirement then fallback to the maximum ECC step size and ECC >> strength >> + * and print the warning. >> + * >> + * On success, the chosen ECC settings are set. >> + */ >> +int nand_ecc_param_setup(struct nand_chip *chip, >> + const struct nand_ecc_caps *caps, int oobavail) > > Can we rename this function "nand_ecc_choose_conf()". Thanks Boris. I will rename this function. Regards, Abhishek