Skip to content

Commit 079d634

Browse files
committed
Merge tag 'mtd/mtk-spi-nand-for-5.19' into nand/next
Mediatek ECC changes: * Also parse the default nand-ecc-engine property if available * Make mtk_ecc.c a separated module Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2 parents 9b2152f + 4c5bf4b commit 079d634

7 files changed

Lines changed: 16 additions & 5 deletions

File tree

drivers/mtd/nand/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ config MTD_NAND_ECC_MXIC
5353
help
5454
This enables support for the hardware ECC engine from Macronix.
5555

56+
config MTD_NAND_ECC_MEDIATEK
57+
tristate "Mediatek hardware ECC engine"
58+
depends on HAS_IOMEM
59+
select MTD_NAND_ECC
60+
help
61+
This enables support for the hardware ECC engine from Mediatek.
62+
5663
endmenu
5764

5865
endmenu

drivers/mtd/nand/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
nandcore-objs := core.o bbt.o
44
obj-$(CONFIG_MTD_NAND_CORE) += nandcore.o
5+
obj-$(CONFIG_MTD_NAND_ECC_MEDIATEK) += ecc-mtk.o
56

67
obj-y += onenand/
78
obj-y += raw/
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
#include <linux/of.h>
1616
#include <linux/of_platform.h>
1717
#include <linux/mutex.h>
18-
19-
#include "mtk_ecc.h"
18+
#include <linux/mtd/nand-ecc-mtk.h>
2019

2120
#define ECC_IDLE_MASK BIT(0)
2221
#define ECC_IRQ_EN BIT(0)
@@ -279,7 +278,10 @@ struct mtk_ecc *of_mtk_ecc_get(struct device_node *of_node)
279278
struct mtk_ecc *ecc = NULL;
280279
struct device_node *np;
281280

282-
np = of_parse_phandle(of_node, "ecc-engine", 0);
281+
np = of_parse_phandle(of_node, "nand-ecc-engine", 0);
282+
/* for backward compatibility */
283+
if (!np)
284+
np = of_parse_phandle(of_node, "ecc-engine", 0);
283285
if (np) {
284286
ecc = mtk_ecc_get(np);
285287
of_node_put(np);

drivers/mtd/nand/raw/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ config MTD_NAND_QCOM
374374

375375
config MTD_NAND_MTK
376376
tristate "MTK NAND controller"
377+
depends on MTD_NAND_ECC_MEDIATEK
377378
depends on ARCH_MEDIATEK || COMPILE_TEST
378379
depends on HAS_IOMEM
379380
help

drivers/mtd/nand/raw/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ obj-$(CONFIG_MTD_NAND_SUNXI) += sunxi_nand.o
4848
obj-$(CONFIG_MTD_NAND_HISI504) += hisi504_nand.o
4949
obj-$(CONFIG_MTD_NAND_BRCMNAND) += brcmnand/
5050
obj-$(CONFIG_MTD_NAND_QCOM) += qcom_nandc.o
51-
obj-$(CONFIG_MTD_NAND_MTK) += mtk_ecc.o mtk_nand.o
51+
obj-$(CONFIG_MTD_NAND_MTK) += mtk_nand.o
5252
obj-$(CONFIG_MTD_NAND_MXIC) += mxic_nand.o
5353
obj-$(CONFIG_MTD_NAND_TEGRA) += tegra_nand.o
5454
obj-$(CONFIG_MTD_NAND_STM32_FMC2) += stm32_fmc2_nand.o

drivers/mtd/nand/raw/mtk_nand.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <linux/iopoll.h>
1818
#include <linux/of.h>
1919
#include <linux/of_device.h>
20-
#include "mtk_ecc.h"
20+
#include <linux/mtd/nand-ecc-mtk.h>
2121

2222
/* NAND controller register definition */
2323
#define NFI_CNFG (0x00)

0 commit comments

Comments
 (0)