Re: [PATCH v5 4/7] drivers: mtd: nand: Add qpic_common API file

From: Md Sadre Alam
Date: Mon May 20 2024 - 05:51:51 EST




On 5/16/2024 6:07 PM, Miquel Raynal wrote:
Hello,

--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -61,6 +61,14 @@ config MTD_NAND_ECC_MEDIATEK
help
This enables support for the hardware ECC engine from Mediatek.
+config QPIC_COMMON
+ tristate "QPIC common api file"
+ depends on ARCH_QCOM || COMPILE_TEST
+ help
+ This enables support for common api for qpic nand controller.
+ common apis will be used by both raw nand driver and serial nand
+ driver.

This should probably not be a standalone selectable item. Make it
automatically selected by the users including the common header.
Ok.

+
endmenu
endmenu
diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
index 19e1291ac4d5..c0c1f8bd0220 100644
--- a/drivers/mtd/nand/Makefile
+++ b/drivers/mtd/nand/Makefile
@@ -3,6 +3,7 @@
nandcore-objs := core.o bbt.o
obj-$(CONFIG_MTD_NAND_CORE) += nandcore.o
obj-$(CONFIG_MTD_NAND_ECC_MEDIATEK) += ecc-mtk.o
+obj-$(CONFIG_QPIC_COMMON) += qpic_common.o
obj-y += onenand/
obj-y += raw/
diff --git a/drivers/mtd/nand/qpic_common.c b/drivers/mtd/nand/qpic_common.c
new file mode 100644
index 000000000000..d48892141365
--- /dev/null
+++ b/drivers/mtd/nand/qpic_common.c
@@ -0,0 +1,741 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2016, The Linux Foundation. All rights reserved.
+ */
+#include <linux/bitops.h>
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/dmaengine.h>
+#include <linux/dma-mapping.h>
+#include <linux/dma/qcom_adm.h>
+#include <linux/dma/qcom_bam_dma.h>
+#include <linux/module.h>
+#include <linux/mtd/partitions.h>
+#include <linux/mtd/rawnand.h>

No raw NAND include in the common file. If there is something raw NAND
specific, it should not be here.
Ok , will fix in next patch

+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/mtd/nand-qpic-common.h>

Thanks,
Miquèl