Received: by 10.192.165.148 with SMTP id m20csp1776304imm; Thu, 3 May 2018 05:21:55 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqr6U+4cujJ6gaZnqfWADgGdHdXJNVF/oToeXf20yVvGFPw6AuNxtb4NSckkRe4C8zwGNsI X-Received: by 2002:a17:902:3225:: with SMTP id y34-v6mr24283998plb.180.1525350115570; Thu, 03 May 2018 05:21:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525350115; cv=none; d=google.com; s=arc-20160816; b=MWskd5qYxEYR7SQBPe92ZLNZ02Wm8tEUH5+eOAIGJ534BdpLhIzG1KWZdTgtU9J3IA vYKLU3x19vTljMlD0V7ecDj2dK51ywiEWQIBkOADsXzC505dF9qA/5ZdLjQUJIHP+VRW j4bXbPu8FUwRaCU6VnBVV9NPuSNFei2dDf0xBOma/heTVTOXSeTi9Fib0M50qaG6x4h5 zUB+ja5gdLaFrOL9iQpaAlendf+kJKwCStEl47uYQyLGKk3J4oYxpCe3dcC2E8lzLhkc OHteyqfgDoj9+VY8XSmLUNRhRIp3OrGfdQI6eitgbxpVxHIv0IN8sDqD4UWzAwcjIpPu WmRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=8l1ym+SttUxQ5CSkz9m9Rh7+AM9jzsDIoYptlE4EXzs=; b=u721D5uSgtY+OZVf64XkUW90Y6dRfMNUC08SHlPA5Vg7gZhVtBe4gKPxDKRJieGwdv 8amueB6f67vX2lBo47arFsWatWc8oFVGa1R7a4/McnzvcjZqqABKEapruAeCCxCI3fO0 aXWv4GzItvr+iV7rHEdgMyWSaXiJomgm4bW2RjfARkkZvWwoeM8KYZM6/4KoVuhyuTTr FflU1alP2LEsdv0m9Nyd8crlu1bAroxJo/l8N0/LUu+yVnajBqAowUF60r1VErBkeOfy cyqBUgHWQYxQdEkzfvSBLqD3yUjggrgJm26hpmeibcpzo7cUUGr+zd0OtSDJKSIdEwKW Ys4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=fAuihqOe; dkim=pass header.i=@codeaurora.org header.s=default header.b=hr1Nsdwa; 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 c129si13305088pfc.367.2018.05.03.05.21.40; Thu, 03 May 2018 05:21:55 -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=fAuihqOe; dkim=pass header.i=@codeaurora.org header.s=default header.b=hr1Nsdwa; 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 S1751931AbeECMVL (ORCPT + 99 others); Thu, 3 May 2018 08:21:11 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:41196 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751805AbeECMVD (ORCPT ); Thu, 3 May 2018 08:21:03 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 9A08D60588; Thu, 3 May 2018 12:21:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525350062; bh=o/Fz5rPCTrS0jE2MAbpkASS+jAR6lL+4R7omzwZZnjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fAuihqOeWIBNZEgIkPc+N4n40BI1dsK7bWK8l3oRXxVPwmla5gYAAEUpEBOLJ42mL khYFFwHnNbg7/Q/bv/KKyAlbq9oh/7z7PgfgIr/1qp6KM8Ud422cupVh/q47aBh+zM 3/mJ3m1FwvWXp5R5Ffm+JBJ9cxy1PH6b2NB60mcs= 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 absahu-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: absahu@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 6AB7C60588; Thu, 3 May 2018 12:20:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525350061; bh=o/Fz5rPCTrS0jE2MAbpkASS+jAR6lL+4R7omzwZZnjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hr1NsdwakO2BS+dpQ/X1EOvlknyoF90mf92WSoqIRypALSXzoQxO04WJUusEZvPYE ugjsd4+sGrwckjDFLK2SOqgL1EcCs3xqpH3M0c8fJKMdM71P+WxmWdA5DgEaMbDKi0 02loIuK/bCTenSG2gRrA7UgQtt42P4O65mSTnOQk= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 6AB7C60588 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=absahu@codeaurora.org From: Abhishek Sahu To: Boris Brezillon Cc: David Woodhouse , Brian Norris , Marek Vasut , Richard Weinberger , Miquel Raynal , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, Andy Gross , Archit Taneja , Abhishek Sahu , Masahiro Yamada Subject: [PATCH v2 02/14] mtd: rawnand: denali: use helper function for ecc setup Date: Thu, 3 May 2018 17:50:29 +0530 Message-Id: <1525350041-22995-3-git-send-email-absahu@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1525350041-22995-1-git-send-email-absahu@codeaurora.org> References: <1525350041-22995-1-git-send-email-absahu@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now, the NAND base layer has helper function for ecc parameters setup which does the same thing. CC: Masahiro Yamada Signed-off-by: Abhishek Sahu --- * Changes from v1: NEW PATCH drivers/mtd/nand/raw/denali.c | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/drivers/mtd/nand/raw/denali.c b/drivers/mtd/nand/raw/denali.c index 2a302a1..d75f4e5 100644 --- a/drivers/mtd/nand/raw/denali.c +++ b/drivers/mtd/nand/raw/denali.c @@ -1120,33 +1120,6 @@ int denali_calc_ecc_bytes(int step_size, int strength) } EXPORT_SYMBOL(denali_calc_ecc_bytes); -static int denali_ecc_setup(struct mtd_info *mtd, struct nand_chip *chip, - struct denali_nand_info *denali) -{ - int oobavail = mtd->oobsize - denali->oob_skip_bytes; - int ret; - - /* - * If .size and .strength are already set (usually by DT), - * check if they are supported by this controller. - */ - if (chip->ecc.size && chip->ecc.strength) - return nand_check_ecc_caps(chip, denali->ecc_caps, oobavail); - - /* - * We want .size and .strength closest to the chip's requirement - * unless NAND_ECC_MAXIMIZE is requested. - */ - if (!(chip->ecc.options & NAND_ECC_MAXIMIZE)) { - ret = nand_match_ecc_req(chip, denali->ecc_caps, oobavail); - if (!ret) - return 0; - } - - /* Max ECC strength is the last thing we can do */ - return nand_maximize_ecc(chip, denali->ecc_caps, oobavail); -} - static int denali_ooblayout_ecc(struct mtd_info *mtd, int section, struct mtd_oob_region *oobregion) { @@ -1317,7 +1290,8 @@ int denali_init(struct denali_nand_info *denali) chip->ecc.mode = NAND_ECC_HW_SYNDROME; chip->options |= NAND_NO_SUBPAGE_WRITE; - ret = denali_ecc_setup(mtd, chip, denali); + ret = nand_ecc_param_setup(chip, denali->ecc_caps, + mtd->oobsize - denali->oob_skip_bytes); if (ret) { dev_err(denali->dev, "Failed to setup ECC settings.\n"); goto disable_irq; -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation