devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roger Quadros <rogerq@kernel.org>
To: krzysztof.kozlowski@canonical.com, tony@atomide.com
Cc: robh@kernel.org, kishon@ti.com, nm@ti.com, vigneshr@ti.com,
	linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org, Roger Quadros <rogerq@kernel.org>
Subject: [PATCH v3 3/4] memory: omap-gpmc: Use a compatible match table when checking for NAND controller
Date: Fri, 17 Dec 2021 12:29:44 +0200	[thread overview]
Message-ID: <20211217102945.17432-4-rogerq@kernel.org> (raw)
In-Reply-To: <20211217102945.17432-1-rogerq@kernel.org>

As more compatibles can be added to the GPMC NAND controller driver
use a compatible match table.

Signed-off-by: Roger Quadros <rogerq@kernel.org>
---
 drivers/memory/omap-gpmc.c                   | 8 +++++++-
 drivers/mtd/nand/raw/omap2.c                 | 2 +-
 include/linux/platform_data/mtd-nand-omap2.h | 5 +++++
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index 624153048182..814ddb45c13d 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -2091,6 +2091,7 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
 	u32 val;
 	struct gpio_desc *waitpin_desc = NULL;
 	struct gpmc_device *gpmc = platform_get_drvdata(pdev);
+	bool is_nand = false;
 
 	if (of_property_read_u32(child, "reg", &cs) < 0) {
 		dev_err(&pdev->dev, "%pOF has no 'reg' property\n",
@@ -2183,7 +2184,12 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
 		}
 	}
 
-	if (of_device_is_compatible(child, "ti,omap2-nand")) {
+#if defined(CONFIG_MTD_NAND_OMAP2)
+	if (of_match_node(omap_nand_ids, child))
+		is_nand = true;
+#endif
+
+	if (is_nand) {
 		/* NAND specific setup */
 		val = 8;
 		of_property_read_u32(child, "nand-bus-width", &val);
diff --git a/drivers/mtd/nand/raw/omap2.c b/drivers/mtd/nand/raw/omap2.c
index b26d4947af02..fff834ee726f 100644
--- a/drivers/mtd/nand/raw/omap2.c
+++ b/drivers/mtd/nand/raw/omap2.c
@@ -2352,7 +2352,7 @@ static int omap_nand_remove(struct platform_device *pdev)
 	return ret;
 }
 
-static const struct of_device_id omap_nand_ids[] = {
+const struct of_device_id omap_nand_ids[] = {
 	{ .compatible = "ti,omap2-nand", },
 	{},
 };
diff --git a/include/linux/platform_data/mtd-nand-omap2.h b/include/linux/platform_data/mtd-nand-omap2.h
index de6ada739121..e1bb90a8db03 100644
--- a/include/linux/platform_data/mtd-nand-omap2.h
+++ b/include/linux/platform_data/mtd-nand-omap2.h
@@ -61,4 +61,9 @@ struct gpmc_nand_regs {
 	void __iomem	*gpmc_bch_result5[GPMC_BCH_NUM_REMAINDER];
 	void __iomem	*gpmc_bch_result6[GPMC_BCH_NUM_REMAINDER];
 };
+
+#if defined(CONFIG_MTD_NAND_OMAP2)
+extern const struct of_device_id omap_nand_ids[];
+#endif
+
 #endif
-- 
2.17.1


  parent reply	other threads:[~2021-12-17 10:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-17 10:29 [PATCH v3 0/4] memory: omap-gpmc: Add AM64 SoC support Roger Quadros
2021-12-17 10:29 ` [PATCH v3 1/4] dt-bindings: memory-controllers: ti,gpmc: Add compatible for AM64 Roger Quadros
2021-12-17 10:29 ` [PATCH v3 2/4] memory: omap-gpmc: Add support for GPMC on AM64 SoC Roger Quadros
2021-12-17 10:29 ` Roger Quadros [this message]
2021-12-17 15:21   ` [PATCH v3 3/4] memory: omap-gpmc: Use a compatible match table when checking for NAND controller Krzysztof Kozlowski
2021-12-17 21:33     ` Roger Quadros
2021-12-20 10:53     ` Roger Quadros
2021-12-20 11:05       ` Krzysztof Kozlowski
2021-12-20 11:51         ` Roger Quadros
2021-12-20 13:11           ` Krzysztof Kozlowski
2021-12-17 10:29 ` [PATCH v3 4/4] arm64: arch_k3: Select GPMC device driver Roger Quadros
2021-12-17 15:50   ` Krzysztof Kozlowski
2021-12-17 16:14   ` Nishanth Menon
2021-12-17 21:31     ` Roger Quadros

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211217102945.17432-4-rogerq@kernel.org \
    --to=rogerq@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=kishon@ti.com \
    --cc=krzysztof.kozlowski@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=robh@kernel.org \
    --cc=tony@atomide.com \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).