Received: by 2002:a05:6a10:83d0:0:0:0:0 with SMTP id o16csp31768pxh; Thu, 7 Apr 2022 13:05:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5MWnFIkvq6KcWAf7tu/uORqR4N+88NXk8wMPTNLBKXYaquhGKvh+80C7I6HjiDlp0vVbU X-Received: by 2002:a63:3d82:0:b0:39c:c817:afc7 with SMTP id k124-20020a633d82000000b0039cc817afc7mr3795284pga.407.1649361908391; Thu, 07 Apr 2022 13:05:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649361908; cv=none; d=google.com; s=arc-20160816; b=SrIvVdeu3kW0xpfMHwgdDJWKiiDZxDsHro2xwICDKuRFnX6fnDqPgITvPe1tZgzchB WuBMSl3m1M1oDdRAdf8myYqGS+qEpXtT3trb1CeqDKz2iN2xtmZ+IC5bz0PODD4gkJCF PAwvR9eawbKLUa955Y1yoXp5dOPbFgTdtZqbtya63rr4BAOthWV9KrX/+0xYBCySZngM kkuj74NFdq+pyzinmWV6ZAPCHwjlx2pi/M5k1g552BtEp4Hkz6B4NiXbvgcpfDGp1dxA +Z/z0r7BXNBxUM6nUv0dEuhTWS/ebygecE6Bu/D/HWTPtiZPg1MIfG/T3rOX3GrjZzAh Yb7Q== 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=mGH5xnhdPLR3rdztXJZoJ5J2yhaEr42Rk1zHYPZDixQ=; b=ZSckhNiXZauf+2slcfk2If2hNs7Za3Q4FdnQNkv4i0EjQ8qUkmswqdGNUQMp7XKfN0 3B+Z2i9x6rq7/AlhKkX52gQEu6uR+Nf2t0CYaa0HgdQbpa9IcVjEc/q1Lj8BBl3ZULi3 wjQQ5s/7bp/np6z0x2cGelgo07y5tP02X33Ws42PkVYGOd00RQJfuRxNqFbLsnT0Q6AA FR4gguOEoyIQeUtPY2f2hdqffS9WGu1XpDFbsvALS3zbVs6ztQOJAVMCK+Up+9W+jYG8 zf84k0h/9722k0KGGrA++AP/qHxqWoXshgmh/05k/PDQpE6yPb/16UHPfQhtZMa06yIY VjXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KpNSzqed; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id l4-20020a170903244400b00153b2d164e8si716258pls.240.2022.04.07.13.05.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 13:05:08 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KpNSzqed; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AEB6729F13B; Thu, 7 Apr 2022 12:29:11 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344445AbiDGPJ2 (ORCPT + 99 others); Thu, 7 Apr 2022 11:09:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243342AbiDGPJW (ORCPT ); Thu, 7 Apr 2022 11:09:22 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6DF41F081E; Thu, 7 Apr 2022 08:07:16 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id w7so5664443pfu.11; Thu, 07 Apr 2022 08:07:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mGH5xnhdPLR3rdztXJZoJ5J2yhaEr42Rk1zHYPZDixQ=; b=KpNSzqedxIOz5ELn4/BmV5Dfe/fZt6S2tlFYES8RdNNR16lFR8GXf8GJptPpUFZlA4 17/wKM7SjhuMkZiNrbFh6tj9J/ysdkI7/vTHa4LZF0q2G+dGNkUsZSIkT/18otHMM31l MLmo5GSvskz+rI9++jXLpG7nxQWNQSFSW+Qlg7RwIJLLeq/tO6lAZKmR+5kOti7E84HU Gk+/Kku+W6VWWTW4sYT8SLSBdezCYDv4A1BCUU5/PTzsFR+lYJCcfW5t+kIOWvKUkNBz zuOJvpuB5agXi9nqxX9mPYpWS37gKb23y37zANFpK+4sRn/wCwAy76EePYSr/SxvL/WN 8hvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mGH5xnhdPLR3rdztXJZoJ5J2yhaEr42Rk1zHYPZDixQ=; b=XjJP31tE6fLMF4IKi6zYHrwwu+qAoTlMjNPnYvDrZScjzSBiT8x99d9m8IH/f1oMex jGIAwIcxjKIEji1upbNQFmFFTYZM7hjpu6iNDLRy/zTwZZvfUzd22XSkA3LceLR50Zya UGzIlpGVmdQcgVPUfTjs6CwcNDD7kkonCCuY0LDmAecikk0fzJBsPFLXhmYrZloFLwiQ y+nIaEf5La9nDmnIx7pqgknvyNSouTxAxvQemTkFXJCxF3NTFFaE7g7GInyl5j3Yf4ZL 3qwhSL6JF3goN0PG4SnqcgHQw9j2RptZdyaB2tNs1tR4QbV5GA9PyYCnnK2Q+bboatMT 9qsQ== X-Gm-Message-State: AOAM532xk2zGgaRfJKEd9BTzi8AD766cM7Yt9VC1UGoXFldJhjBE4L4W qFtIKgCunrQiUednlo3Y0W1ju+OR+rQ80gKvJOQ= X-Received: by 2002:a05:6a00:18a5:b0:4fa:e6f0:d410 with SMTP id x37-20020a056a0018a500b004fae6f0d410mr14716311pfh.28.1649344036065; Thu, 07 Apr 2022 08:07:16 -0700 (PDT) Received: from guoguo-omen.lan ([2401:c080:1400:4da2:b701:47d5:9291:4cf9]) by smtp.gmail.com with ESMTPSA id x2-20020a63aa42000000b0038265eb2495sm19329908pgo.88.2022.04.07.08.07.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 08:07:15 -0700 (PDT) From: Chuanhong Guo To: linux-spi@vger.kernel.org Cc: Chuanhong Guo , Mark Brown , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Roger Quadros , Thomas Bogendoerfer , Cai Huoqing , Florian Fainelli , Colin Ian King , Wolfram Sang , Paul Cercueil , Pratyush Yadav , Yu Kuai , devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Mediatek SoC support), linux-mediatek@lists.infradead.org (moderated list:ARM/Mediatek SoC support), linux-kernel@vger.kernel.org (open list), linux-mtd@lists.infradead.org (open list:NAND FLASH SUBSYSTEM) Subject: [PATCH v4 1/5] mtd: nand: make mtk_ecc.c a separated module Date: Thu, 7 Apr 2022 23:06:48 +0800 Message-Id: <20220407150652.21885-2-gch981213@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220407150652.21885-1-gch981213@gmail.com> References: <20220407150652.21885-1-gch981213@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 this code will be used in mediatek snfi spi-mem controller with pipelined ECC engine. Signed-off-by: Chuanhong Guo --- Change since v1: actually make it a module instead of a part of nandcore.o (ECC_MXIC probablly needs a similar fix.) Change since v2: None Change since v3: None drivers/mtd/nand/Kconfig | 7 +++++++ drivers/mtd/nand/Makefile | 1 + drivers/mtd/nand/{raw/mtk_ecc.c => ecc-mtk.c} | 3 +-- drivers/mtd/nand/raw/Kconfig | 1 + drivers/mtd/nand/raw/Makefile | 2 +- drivers/mtd/nand/raw/mtk_nand.c | 2 +- .../nand/raw/mtk_ecc.h => include/linux/mtd/nand-ecc-mtk.h | 0 7 files changed, 12 insertions(+), 4 deletions(-) rename drivers/mtd/nand/{raw/mtk_ecc.c => ecc-mtk.c} (99%) rename drivers/mtd/nand/raw/mtk_ecc.h => include/linux/mtd/nand-ecc-mtk.h (100%) diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig index 9b249826ef93..2f3e02ab72ed 100644 --- a/drivers/mtd/nand/Kconfig +++ b/drivers/mtd/nand/Kconfig @@ -53,6 +53,13 @@ config MTD_NAND_ECC_MXIC help This enables support for the hardware ECC engine from Macronix. +config MTD_NAND_ECC_MEDIATEK + tristate "Mediatek hardware ECC engine" + depends on HAS_IOMEM + select MTD_NAND_ECC + help + This enables support for the hardware ECC engine from Mediatek. + endmenu endmenu diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile index a4e6b7ae0614..19e1291ac4d5 100644 --- a/drivers/mtd/nand/Makefile +++ b/drivers/mtd/nand/Makefile @@ -2,6 +2,7 @@ nandcore-objs := core.o bbt.o obj-$(CONFIG_MTD_NAND_CORE) += nandcore.o +obj-$(CONFIG_MTD_NAND_ECC_MEDIATEK) += ecc-mtk.o obj-y += onenand/ obj-y += raw/ diff --git a/drivers/mtd/nand/raw/mtk_ecc.c b/drivers/mtd/nand/ecc-mtk.c similarity index 99% rename from drivers/mtd/nand/raw/mtk_ecc.c rename to drivers/mtd/nand/ecc-mtk.c index 49ab3448b9b1..74ddaa46ba7c 100644 --- a/drivers/mtd/nand/raw/mtk_ecc.c +++ b/drivers/mtd/nand/ecc-mtk.c @@ -15,8 +15,7 @@ #include #include #include - -#include "mtk_ecc.h" +#include #define ECC_IDLE_MASK BIT(0) #define ECC_IRQ_EN BIT(0) diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig index 9b078e78f3fa..8b6d7a515445 100644 --- a/drivers/mtd/nand/raw/Kconfig +++ b/drivers/mtd/nand/raw/Kconfig @@ -374,6 +374,7 @@ config MTD_NAND_QCOM config MTD_NAND_MTK tristate "MTK NAND controller" + depends on MTD_NAND_ECC_MEDIATEK depends on ARCH_MEDIATEK || COMPILE_TEST depends on HAS_IOMEM help diff --git a/drivers/mtd/nand/raw/Makefile b/drivers/mtd/nand/raw/Makefile index 88a566513c56..fa1d00120310 100644 --- a/drivers/mtd/nand/raw/Makefile +++ b/drivers/mtd/nand/raw/Makefile @@ -48,7 +48,7 @@ obj-$(CONFIG_MTD_NAND_SUNXI) += sunxi_nand.o obj-$(CONFIG_MTD_NAND_HISI504) += hisi504_nand.o obj-$(CONFIG_MTD_NAND_BRCMNAND) += brcmnand/ obj-$(CONFIG_MTD_NAND_QCOM) += qcom_nandc.o -obj-$(CONFIG_MTD_NAND_MTK) += mtk_ecc.o mtk_nand.o +obj-$(CONFIG_MTD_NAND_MTK) += mtk_nand.o obj-$(CONFIG_MTD_NAND_MXIC) += mxic_nand.o obj-$(CONFIG_MTD_NAND_TEGRA) += tegra_nand.o obj-$(CONFIG_MTD_NAND_STM32_FMC2) += stm32_fmc2_nand.o diff --git a/drivers/mtd/nand/raw/mtk_nand.c b/drivers/mtd/nand/raw/mtk_nand.c index 66f04c693c87..d540454cbbdf 100644 --- a/drivers/mtd/nand/raw/mtk_nand.c +++ b/drivers/mtd/nand/raw/mtk_nand.c @@ -17,7 +17,7 @@ #include #include #include -#include "mtk_ecc.h" +#include /* NAND controller register definition */ #define NFI_CNFG (0x00) diff --git a/drivers/mtd/nand/raw/mtk_ecc.h b/include/linux/mtd/nand-ecc-mtk.h similarity index 100% rename from drivers/mtd/nand/raw/mtk_ecc.h rename to include/linux/mtd/nand-ecc-mtk.h -- 2.35.1