Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3441277pxb; Mon, 4 Apr 2022 17:06:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+/p3V6sB7UzYVMnfjJsWCfPFogzlOA+0YvWQA+hDN0Z43fveqoUB01+dHwiZJXttYkgH6 X-Received: by 2002:a17:90a:3842:b0:1c6:d666:b01 with SMTP id l2-20020a17090a384200b001c6d6660b01mr839443pjf.161.1649117200727; Mon, 04 Apr 2022 17:06:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649117200; cv=none; d=google.com; s=arc-20160816; b=TZXcJSXh6OZ+HSSqJch5dUJwcud3Vhr3HOwaTI/smdXuUrAs9P6WdpDJeKeq092CXf LpwWMwtrg40go9MNigrzzdRTV8KubMiCdevj3CtJecZRM8AQwL1CQUeIvRjcRaSYTkiJ mR43I40AVRQ5YWDt0mrGYyQaJY6ntkT6kCxCgCcb3hedKMToW2LL3Zu1NPyFoyD6kI+f huo/7k4dyqYc4DR8fISpn+M7k02MYBi5plys7JhstPNtWN2a4nJ96XD8skBsL1vf69Bn V+dJG/j/VBgBdNWYQCw7T2m+Q/eosXn2SSxGIL0xgULMn9o0KhlmmvA8G4QVnl9LeCIw PDXA== 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=vyrqHELlKNXA/M2+zx7CFD/1nfCk80dDQzAqwlfKPhM=; b=EikA0hZ/1PV4vnXMKUqigsnlcE2QQaSyN5+IPUPu/G3lWplEExstNeVr+SxcECkPml Gntr9JwCjHGGiuHKjUybEs+nD3mmjrfSJPfAJnSyDrnd1EqpSOoO8N2JC7gg1RWQhaxP 2Yrx9lFJGmE216DYl3+DJ6wxr5+Y40bQ1Qd1SbW4jJyOsvZZsdpTREj+CpesnWouhi7e x4Du9FbJoCm2IZ6pvc7WC7dO7orqF0v/iPmEbFCZAyNGJ6fcLj7l1cVfMnk9wma4EiGP 4wuXbcYpi9ps25NmWUp6Ri/ay3MHXS86eijqksLS9caFpSppwSoQcRRtuoeWl1BUw+tT i8oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=YF13fRlz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id s10-20020a056a0008ca00b004fe3a6f4b19si1126191pfu.152.2022.04.04.17.06.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 17:06:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=YF13fRlz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 48AF863BCF; Mon, 4 Apr 2022 16:40:41 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358550AbiDCNOp (ORCPT + 99 others); Sun, 3 Apr 2022 09:14:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357672AbiDCNOo (ORCPT ); Sun, 3 Apr 2022 09:14:44 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15FBFA1BE; Sun, 3 Apr 2022 06:12:50 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id 125so1020614pgc.4; Sun, 03 Apr 2022 06:12:50 -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=vyrqHELlKNXA/M2+zx7CFD/1nfCk80dDQzAqwlfKPhM=; b=YF13fRlzzdDeT9fkWpExq0iVWbmI7rlCyz8KJf+E1klDtQ8pmpOAySB8evDcrA7R4T pgSLXQ+uQCtqpLDk2sHP19FC+2lZ81TyUGrm4Pw1xj+oIra0j0LuzsapriHk7SjB0anC QwH5X3/xqZbXu9Ift/XS2x2At46aUEzi/FRAs0YHCzjdmQXSYuJJgSOaGxSF6QbPPIoH tyHyBx77cbj4s0eNJHw5W6s0CdyQCLkQKm77OsOyUK9/67XRGzUTwRnXPfwJcZ/G5Di8 sU7GH181GNFtpl6OFL50jhRVS5jfIhVrbI3GRmwIRC0RdTYmoiFubzElzPrm2o7E0r3R MnAQ== 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=vyrqHELlKNXA/M2+zx7CFD/1nfCk80dDQzAqwlfKPhM=; b=wB5t9Kx9uts5GmOvc8c93qYKHPJ8LarIuby89LfQq64K9d3rFJJ9rOR20BjGvKzcWH rASKfxtRGJTMZJ+6yg5yR+8obfe5m8JVkxOWQrU+6nhxCdfMmfZHjjtZyfwTrWcwFnBt Oy/IutK2qmJ+WeKXbTrEOC+eB5R43qO/3LbSIIl5E0N4mK6hwQ8NO+F1GUUG1BYt6x6C pIQTAakt6LHPtDfS8gV9C6qyh/Q5ig2HZlGVEzOnM+kXl9223Jj2RVrGxOurKbL5bEot /R5Uk3bOrEL/XtLz//U3RDy0eR3VhFno4fOYInmdCStMoee5fO0kltpvRzh+VmINct2K 3CYA== X-Gm-Message-State: AOAM532aPXPyyVHJiRZg9lUdeSW+Tayq0Wa+O1P1wm9n3gTW7IzEv4Qn TvF+YyAa0wA5+VtMhYEgLkw= X-Received: by 2002:a05:6a00:e0b:b0:4fa:a167:5b35 with SMTP id bq11-20020a056a000e0b00b004faa1675b35mr19448085pfb.69.1648991569527; Sun, 03 Apr 2022 06:12:49 -0700 (PDT) Received: from guoguo-omen.lan ([222.201.153.219]) by smtp.gmail.com with ESMTPSA id x123-20020a623181000000b004fdf99d25f6sm1554857pfx.80.2022.04.03.06.12.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Apr 2022 06:12:49 -0700 (PDT) From: Chuanhong Guo To: linux-spi@lists.infradead.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 , linux-spi@vger.kernel.org (open list:SPI SUBSYSTEM), 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 1/4] mtd: nand: make mtk_ecc.c a separated module Date: Sun, 3 Apr 2022 21:11:51 +0800 Message-Id: <20220403131154.1267887-2-gch981213@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220403131154.1267887-1-gch981213@gmail.com> References: <20220403131154.1267887-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 --- 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..39df4621ac25 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 + bool "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..e5f40ed9300f 100644 --- a/drivers/mtd/nand/Makefile +++ b/drivers/mtd/nand/Makefile @@ -11,3 +11,4 @@ nandcore-$(CONFIG_MTD_NAND_ECC) += ecc.o nandcore-$(CONFIG_MTD_NAND_ECC_SW_HAMMING) += ecc-sw-hamming.o nandcore-$(CONFIG_MTD_NAND_ECC_SW_BCH) += ecc-sw-bch.o nandcore-$(CONFIG_MTD_NAND_ECC_MXIC) += ecc-mxic.o +nandcore-$(CONFIG_MTD_NAND_ECC_MEDIATEK) += ecc-mtk.o 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