Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp14134536rwb; Sun, 27 Nov 2022 18:19:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf7ehQC3QdV4EUUeVurfaltLAv5M8p7Ev9UMuvKZJJ9IF03NE/A0whDNFiIEl5xOYflOJsBp X-Received: by 2002:a17:903:3292:b0:188:ec14:e3a3 with SMTP id jh18-20020a170903329200b00188ec14e3a3mr28837397plb.154.1669601957900; Sun, 27 Nov 2022 18:19:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669601957; cv=none; d=google.com; s=arc-20160816; b=jbsLg9Fkti9vO6cPhFdCy6u4vnu+RaTDi1LduNvG4Bi+rtOtzPZr+gCaUXxD9/QLU9 83b2etJ9nYAcQU+ku1qGB1Mcsg92rE3QEPteW8P3YF469GwGihU0FoEeh53/DSSZliRZ WBXPfDyHXB9EvASeoMf/NuSxUUbzX2wx8Uo5yWC8ex/M31c1g2hcyV6nADmlXSkxSEkS V/BWk+O9i8PNeC+dapOUFld/0z76f2htpq9yT5zFK+dZdmSMYM9IqvOpoBkZwoR3cZc6 FvnjoQ2MvzkjM3o6MVtLUdv4P9YfSTJUl1mAFZFNcX5KTc1OYmyQ87hSpBQeRdnRvudR 9SEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=479YBqB7D3YUT4aLc4suZrRCmV+3rhzglGjA8sFA9To=; b=0D9bq3vZqVAB05g2x97mDWhpSXqB05NinYv6eOpCcPTx3dzoAkN68qxH1wW9/1JsVY NkENnCrtv80TzAdtfYcUl0EiofrQh23TJaTykfdHRaE8l4PL8pvB2JEkIfwdtfYu+Kt/ Ccn58BnN74mJCdyiDlIV0qLrx5Xz7T7XFwT4+AhvPt9cLiZZYf7rgFn/sseXECkGCYnn fLg08ZAcazICkKsqLnVdggdWebNKIXWPhEtwQNPG91pz3HYS9sjsP4FgjlUCFao7TWPR DFE6sDfKtA9OflG8D/X0BhDxN25JIS/pogxuhQFrxlUO7OERtweX9HWvENwwnP8YhnVa 5xhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=mWKzeOWC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i8-20020a1709026ac800b0018981449921si3235390plt.107.2022.11.27.18.19.07; Sun, 27 Nov 2022 18:19:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=mWKzeOWC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229820AbiK1CIG (ORCPT + 85 others); Sun, 27 Nov 2022 21:08:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229794AbiK1CH6 (ORCPT ); Sun, 27 Nov 2022 21:07:58 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C3432DD2; Sun, 27 Nov 2022 18:07:54 -0800 (PST) X-UUID: ee501b2239f44f5080bc872aae0ab0a1-20221128 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=479YBqB7D3YUT4aLc4suZrRCmV+3rhzglGjA8sFA9To=; b=mWKzeOWCbpOBmBlP7ZQUkcXdrAr6DfZrpQZGY0lWOJ9bnnpDd7JoKUbtjhvcyh8Ym/Ti1o63RFywQLEiZOpem4EZ/jj4E7KhvXHFeJ/AlojPVeEAWrXRH0VbRatvKrcZ2MKiFKs/fPPvLgJvayw/bqBETZDT1v3bjt5Ypwgnkow=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.14,REQID:c91c1379-6300-40f8-9029-4f05e82ff366,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:100,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:95 X-CID-INFO: VERSION:1.1.14,REQID:c91c1379-6300-40f8-9029-4f05e82ff366,IP:0,URL :0,TC:0,Content:-5,EDM:0,RT:0,SF:100,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTI ON:quarantine,TS:95 X-CID-META: VersionHash:dcaaed0,CLOUDID:7fa761dc-6ad4-42ff-91f3-18e0272db660,B ulkID:221128100749RRBKCHAF,BulkQuantity:0,Recheck:0,SF:38|28|17|19|48,TC:n il,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: ee501b2239f44f5080bc872aae0ab0a1-20221128 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1494220039; Mon, 28 Nov 2022 10:07:48 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs13n1.mediatek.inc (172.21.101.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Mon, 28 Nov 2022 10:07:47 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Mon, 28 Nov 2022 10:07:45 +0800 From: Xiangsheng Hou To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , Mark Brown , Chuanhong Guo CC: Xiangsheng Hou , , , , , , , , Subject: [PATCH 4/9] mtd: nand: ecc-mtk: add ecc support fot mt7986 IC Date: Mon, 28 Nov 2022 10:06:08 +0800 Message-ID: <20221128020613.14821-5-xiangsheng.hou@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221128020613.14821-1-xiangsheng.hou@mediatek.com> References: <20221128020613.14821-1-xiangsheng.hou@mediatek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org add ecc support fot mt7986 IC Signed-off-by: Xiangsheng Hou --- drivers/mtd/nand/ecc-mtk.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/mtd/nand/ecc-mtk.c b/drivers/mtd/nand/ecc-mtk.c index 9f9b201fe706..c2f6cfa76a04 100644 --- a/drivers/mtd/nand/ecc-mtk.c +++ b/drivers/mtd/nand/ecc-mtk.c @@ -79,6 +79,10 @@ static const u8 ecc_strength_mt7622[] = { 4, 6, 8, 10, 12 }; +static const u8 ecc_strength_mt7986[] = { + 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24 +}; + enum mtk_ecc_regs { ECC_ENCPAR00, ECC_ENCIRQ_EN, @@ -483,6 +487,17 @@ static const struct mtk_ecc_caps mtk_ecc_caps_mt7622 = { .pg_irq_sel = 0, }; +static const struct mtk_ecc_caps mtk_ecc_caps_mt7986 = { + .err_mask = 0x1f, + .err_shift = 8, + .ecc_strength = ecc_strength_mt7986, + .ecc_regs = mt2712_ecc_regs, + .num_ecc_strength = 11, + .ecc_mode_shift = 5, + .parity_bits = 14, + .pg_irq_sel = 1, +}; + static const struct of_device_id mtk_ecc_dt_match[] = { { .compatible = "mediatek,mt2701-ecc", @@ -493,6 +508,9 @@ static const struct of_device_id mtk_ecc_dt_match[] = { }, { .compatible = "mediatek,mt7622-ecc", .data = &mtk_ecc_caps_mt7622, + }, { + .compatible = "mediatek,mt7986-ecc", + .data = &mtk_ecc_caps_mt7986, }, {}, }; -- 2.25.1