Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3412446imm; Fri, 25 May 2018 05:24:07 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrYoPZfv7LnWF0G2NgUhwFEWv+IPmgPydAvOS1TmQjLHc00INKmpE42cto/Caw16EUMnIX0 X-Received: by 2002:a62:ecdc:: with SMTP id e89-v6mr2366622pfm.33.1527251046971; Fri, 25 May 2018 05:24:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527251046; cv=none; d=google.com; s=arc-20160816; b=UjUcL3y6/LEOGlqp0jkSUzf96772VFuWbQnbnTXZ5hNXV+BQ7AtB1OpXhLREGB+Igs TlaNpEfcSlIqzT8jareUlC/lF8ZTEu4Lu1reQGhVChrgw2gWAA3t31a0XF7nVc2wKum8 X9gpeZof0k9HzBMXt5ZDMVH67ppUH591kmwn5ku1BoQQSAXQJdECjeZS684es4DJSy0e 35GAudD0IFyf9JrYv/aBKTSzBvtshI/mHFU8yOK3m86/phoV8Y0SB5EHdeCRiKXrL66B uDIjYlVE5s8ogNJGv2gqiNfg0UQlQ/zQFqcva51SPH1KQOmIwS2Yk2PuVJrjbNdtMj7G vSRA== 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=hvEwA2vaVZE7y2EfKCfgSgPQZ0ZCWhNF2cMXH5j9kYI=; b=pKRTt5pdzWJ3eivdWBjidFGxmG+dDelhKTf+3cStJ81a35GxLmTdJG8BHgUKz25jGI QKNnb5vKYqmP3AtddL4KUnzY2jkshChXUBHhEUvfo4/OBo2ASpRVw9GA54FUVpbJlAu1 GI7cMYvEKMLHNSLM1OPseo0Z1y3x8f/EaXM9CJMzf+yLEuLnRW5iiVIY7riK3XQKxefQ ikgr4sNR7ISxUq0seQh0xvTgiRwNpBbAMS8swWOPhyu2QeeDfFJOwGYLVc0xtxfJXkqZ aN+4AkEVdR71np2m/PtLvAScgbzB4Bfz0TFqx1czJNzFaPr6b4ep5lBCd3ocgBpUr+aQ 1GDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Agb1ls9X; dkim=pass header.i=@codeaurora.org header.s=default header.b=e9iOTJMV; 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 k1-v6si4817669pgo.543.2018.05.25.05.23.52; Fri, 25 May 2018 05:24:06 -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=Agb1ls9X; dkim=pass header.i=@codeaurora.org header.s=default header.b=e9iOTJMV; 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 S966804AbeEYMWK (ORCPT + 99 others); Fri, 25 May 2018 08:22:10 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:47204 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966747AbeEYMWH (ORCPT ); Fri, 25 May 2018 08:22:07 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id ECFB960F8F; Fri, 25 May 2018 12:22:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1527250926; bh=aXeDI0kQ0wdx7wb3HX17Eb7kfAT0mQLofh1Q1Lyblg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Agb1ls9XWGa/0DmDqvXWehW+q7RaqzNPfrOA2tDxJ8PVkE7Jfd4hf6Dmvg5SIXbso 1+ugUAiOS+nwgyXWzHEaq0KGIx0ObHH3MtOmOaBu9PEBxWUY2ouNz2SFvyQQKYDavh ZoudIAjGuNnXXBRx2q47ZBa1Xoxr37Cso67imUu0= 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 A6A2660290; Fri, 25 May 2018 12:22:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1527250925; bh=aXeDI0kQ0wdx7wb3HX17Eb7kfAT0mQLofh1Q1Lyblg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e9iOTJMVFupdOx+HGi9IyM+5TSvB40yJOkaipLvAK1U70PgOnAu+xFRkWi+YaOMJx qpEP5Dbk6SOVsY3ii9Tbvd7VmaFr5DXOx0RndWxoO0+0upFGl3tenYQHcsjWydpRih 2VLWDkUP3xeKcDSPVhiVwfMd18WkxyNHf1qAicKc= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org A6A2660290 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 , Cyrille Pitchen , 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 v3 02/16] mtd: rawnand: denali: use helper function for ecc setup Date: Fri, 25 May 2018 17:51:30 +0530 Message-Id: <1527250904-21988-3-git-send-email-absahu@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1527250904-21988-1-git-send-email-absahu@codeaurora.org> References: <1527250904-21988-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 Use the NAND core helper function nand_ecc_choose_conf to tune the ECC parameters instead of the function locally defined. CC: Masahiro Yamada Acked-by: Miquel Raynal Signed-off-by: Abhishek Sahu --- * Changes from v2: 1. Changed commit message * 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..a586a1d 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_choose_conf(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