Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3511578pxb; Mon, 4 Apr 2022 19:22:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3kamyXwPxHuyxOZEhJZoIZqaSkqaqxgpGC33hLzRD+T/5jtqF4nyaODVwVfG9tTdk9GMD X-Received: by 2002:a17:902:bf06:b0:14d:8c72:96c6 with SMTP id bi6-20020a170902bf0600b0014d8c7296c6mr1077772plb.156.1649125326216; Mon, 04 Apr 2022 19:22:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649125326; cv=none; d=google.com; s=arc-20160816; b=RvkwjEQHyMtc6Bq+pVhAw6ryxhLh5JuxgFEEUVzxN3xvhEvqjtXeizViVUlKMk0OfP SE62n+ZZJyQl3epp4pN5tK/X+IEX+pj7yHDZSebraBkKGAygcFfCKxW9T6mIBUG60uM8 VBI16Y7/61H4vRU0M62AfG5XPlgZuGIIexyYgpl7PIa8hi7QO7do/hiVpUsjvI7+V9OT I4USuQwkCZ+5WUY7S/k+HZYjQh22GNohrGFAjAtVnJLFIIpAp+26znbQBNgV9iK/Re7r wCp3IhC63LL1TAhmFDCDEfV+WHOBOcoGfao7HEpz77wbwJxPt/NfdJqCaPD8T3YutP1L IGbQ== 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=P6+c78n98WoqJ0xcOEG7TbVsPz8eysqz2CPg0JCMWtM=; b=u40PnYiZp1YANDtF6KSsTQeZXELdKhb5khogBMv3rlqNhurmuDM1N70pjfhJKm8T8V iMybQ0mQZF+D9tMXYsDj4R3G6RdNnERwjPJoU8C0XPQ3oeR/zdckH598p2V+shueE1a8 D1gkUl6+JEl8RgphgteXWMLgP9MLJ7VF4GHNE8tu/uNJk9kU29tzFvtgdoHdoPeh9mZV kLj0wkDiZVNiTEjHzMhETUNw3/TbHyrvLmML+VbNF67FHAXwuJDijfsay1lipky/krvR ars15Bc4vu31KwrnCCEd+DDwNo622qVMnjtMyxznwelMznOK59/kkRGmrbb/VsszKAyZ LWAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GgDh6ugA; 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 l15-20020a17090a384f00b001bd14e01fcfsi596738pjf.189.2022.04.04.19.22.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 19:22:06 -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=GgDh6ugA; 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 B816F2B04C2; Mon, 4 Apr 2022 17:44:07 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350731AbiDDNUp (ORCPT + 99 others); Mon, 4 Apr 2022 09:20:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350689AbiDDNUo (ORCPT ); Mon, 4 Apr 2022 09:20:44 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94B362183A; Mon, 4 Apr 2022 06:18:47 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id i11so8099647plg.12; Mon, 04 Apr 2022 06:18:47 -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=P6+c78n98WoqJ0xcOEG7TbVsPz8eysqz2CPg0JCMWtM=; b=GgDh6ugA1uShmcpnLzreY6O9wiAhOlkLaJDOkFNQXttT4wCsRjZNOxPvXBnzCQ9VI7 ER56yIrb0rJVWpEaGuxIclFr3Kha84XNiuj96py5X7yBD+/BEJKlQAMJWBpgnCUg14mj AlWgVbcErGtHlBDBs0pM0bBbd2L2uCP/1YMyNSQTyr2sX/krzV7a5QUcDjwO81Y/QUBw JQfEJln6zHNIXqS5F8F5Wf8N6ZKBAL1OvrJDfxpELGb34KF3wRMB5iOYo3VKbIrBT6D5 K9lY8zq4e7NBX4SwPwmT3cOZWWc1XXqu8RBRYaVEJ05Q49dSTkfx/9bhziIbhL7jG1dI KrsA== 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=P6+c78n98WoqJ0xcOEG7TbVsPz8eysqz2CPg0JCMWtM=; b=g8Cm6pGswuU8yB96dcq6OSizTrJ+MuBnpaPMCHWB5gdsOVcJCm6eR/CsHQiKsPBeNX 9asbOdgyYaFYCdUT4IlAhmUuelxKpQqpYOgm5ID866VN8pU+FLsA97OWfraRgrifTSnZ 1BvuCH6A1fXAyvS2YUnvMYlvNU6EtP9BnNhCqOyLZwxKObi7tMFRBHjV3+MnB5aPP8WB EhhgnEfeyHlzUHPIZlokogS6S/w7Kf2FI3Yy4CStl3aefi0xtj3SPid3vMISsgGwz6hL mR9yxt98mK5B6AWOHeq/Wu68+VZu8HQcaXwOrE8eVdagx08g2xdhSv2yunwufypXl+bj zNpA== X-Gm-Message-State: AOAM530iILAKy9Im2emTjwCl1iQMmoR8jHOLgFzdM/DfF+oolc1xK+Rr VVVCSwlxrwVAn2zZV84vhKxZ8h3M0CvsB8XCoaY= X-Received: by 2002:a17:90b:3504:b0:1c6:8569:c28d with SMTP id ls4-20020a17090b350400b001c68569c28dmr25935842pjb.92.1649078326718; Mon, 04 Apr 2022 06:18:46 -0700 (PDT) Received: from guoguo-omen.lan ([2401:c080:1400:4da2:b701:47d5:9291:4cf9]) by smtp.gmail.com with ESMTPSA id q13-20020a056a00088d00b004e1bea9c582sm12475705pfj.43.2022.04.04.06.18.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 06:18:46 -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 v3 1/5] mtd: nand: make mtk_ecc.c a separated module Date: Mon, 4 Apr 2022 21:18:14 +0800 Message-Id: <20220404131818.1817794-2-gch981213@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220404131818.1817794-1-gch981213@gmail.com> References: <20220404131818.1817794-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 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