From: Martin Blumenstingl <martin.blumenstingl@googlemail.com> To: linux-mtd@lists.infradead.org, devicetree@vger.kernel.org Cc: linux-kernel@vger.kernel.org, tlanger@maxlinear.com, rtanwar@maxlinear.com, miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, Martin Blumenstingl <martin.blumenstingl@googlemail.com> Subject: [PATCH v3 3/8] mtd: rawnand: intel: Read the chip-select line from the correct OF node Date: Sun, 3 Jul 2022 01:12:22 +0200 [thread overview] Message-ID: <20220702231227.1579176-4-martin.blumenstingl@googlemail.com> (raw) In-Reply-To: <20220702231227.1579176-1-martin.blumenstingl@googlemail.com> The chip select has to be read from the flash node which is a child node of the NAND controller. Fixes: 0b1039f016e8a3 ("mtd: rawnand: Add NAND controller support on Intel LGM SoC") Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> --- drivers/mtd/nand/raw/intel-nand-controller.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/raw/intel-nand-controller.c b/drivers/mtd/nand/raw/intel-nand-controller.c index e91b879b32bd..3df3f32423f9 100644 --- a/drivers/mtd/nand/raw/intel-nand-controller.c +++ b/drivers/mtd/nand/raw/intel-nand-controller.c @@ -16,6 +16,7 @@ #include <linux/mtd/rawnand.h> #include <linux/mtd/nand.h> +#include <linux/of.h> #include <linux/platform_device.h> #include <linux/sched.h> #include <linux/slab.h> @@ -580,6 +581,7 @@ static int ebu_nand_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct ebu_nand_controller *ebu_host; + struct device_node *chip_np; struct nand_chip *nand; struct mtd_info *mtd; struct resource *res; @@ -604,7 +606,12 @@ static int ebu_nand_probe(struct platform_device *pdev) if (IS_ERR(ebu_host->hsnand)) return PTR_ERR(ebu_host->hsnand); - ret = device_property_read_u32(dev, "reg", &cs); + chip_np = of_get_next_child(dev->of_node, NULL); + if (!chip_np) + return dev_err_probe(dev, -EINVAL, + "Could not find child node for the NAND chip\n"); + + ret = of_property_read_u32(chip_np, "reg", &cs); if (ret) { dev_err(dev, "failed to get chip select: %d\n", ret); return ret; @@ -660,7 +667,7 @@ static int ebu_nand_probe(struct platform_device *pdev) writel(ebu_host->cs[cs].addr_sel | EBU_ADDR_MASK(5) | EBU_ADDR_SEL_REGEN, ebu_host->ebu + EBU_ADDR_SEL(cs)); - nand_set_flash_node(&ebu_host->chip, dev->of_node); + nand_set_flash_node(&ebu_host->chip, chip_np); mtd = nand_to_mtd(&ebu_host->chip); if (!mtd->name) { -- 2.37.0
WARNING: multiple messages have this Message-ID (diff)
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com> To: linux-mtd@lists.infradead.org, devicetree@vger.kernel.org Cc: linux-kernel@vger.kernel.org, tlanger@maxlinear.com, rtanwar@maxlinear.com, miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, Martin Blumenstingl <martin.blumenstingl@googlemail.com> Subject: [PATCH v3 3/8] mtd: rawnand: intel: Read the chip-select line from the correct OF node Date: Sun, 3 Jul 2022 01:12:22 +0200 [thread overview] Message-ID: <20220702231227.1579176-4-martin.blumenstingl@googlemail.com> (raw) In-Reply-To: <20220702231227.1579176-1-martin.blumenstingl@googlemail.com> The chip select has to be read from the flash node which is a child node of the NAND controller. Fixes: 0b1039f016e8a3 ("mtd: rawnand: Add NAND controller support on Intel LGM SoC") Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> --- drivers/mtd/nand/raw/intel-nand-controller.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/raw/intel-nand-controller.c b/drivers/mtd/nand/raw/intel-nand-controller.c index e91b879b32bd..3df3f32423f9 100644 --- a/drivers/mtd/nand/raw/intel-nand-controller.c +++ b/drivers/mtd/nand/raw/intel-nand-controller.c @@ -16,6 +16,7 @@ #include <linux/mtd/rawnand.h> #include <linux/mtd/nand.h> +#include <linux/of.h> #include <linux/platform_device.h> #include <linux/sched.h> #include <linux/slab.h> @@ -580,6 +581,7 @@ static int ebu_nand_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct ebu_nand_controller *ebu_host; + struct device_node *chip_np; struct nand_chip *nand; struct mtd_info *mtd; struct resource *res; @@ -604,7 +606,12 @@ static int ebu_nand_probe(struct platform_device *pdev) if (IS_ERR(ebu_host->hsnand)) return PTR_ERR(ebu_host->hsnand); - ret = device_property_read_u32(dev, "reg", &cs); + chip_np = of_get_next_child(dev->of_node, NULL); + if (!chip_np) + return dev_err_probe(dev, -EINVAL, + "Could not find child node for the NAND chip\n"); + + ret = of_property_read_u32(chip_np, "reg", &cs); if (ret) { dev_err(dev, "failed to get chip select: %d\n", ret); return ret; @@ -660,7 +667,7 @@ static int ebu_nand_probe(struct platform_device *pdev) writel(ebu_host->cs[cs].addr_sel | EBU_ADDR_MASK(5) | EBU_ADDR_SEL_REGEN, ebu_host->ebu + EBU_ADDR_SEL(cs)); - nand_set_flash_node(&ebu_host->chip, dev->of_node); + nand_set_flash_node(&ebu_host->chip, chip_np); mtd = nand_to_mtd(&ebu_host->chip); if (!mtd->name) { -- 2.37.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2022-07-02 23:12 UTC|newest] Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-07-02 23:12 [PATCH v3 0/8] intel-nand-controller: Fixes, cleanups and questions Martin Blumenstingl 2022-07-02 23:12 ` Martin Blumenstingl 2022-07-02 23:12 ` [PATCH v3 1/8] dt-bindings: mtd: intel: lgm-nand: Fix compatible string Martin Blumenstingl 2022-07-02 23:12 ` Martin Blumenstingl 2022-07-05 20:31 ` Rob Herring 2022-07-05 20:31 ` Rob Herring 2022-09-20 8:16 ` Miquel Raynal 2022-09-20 8:16 ` Miquel Raynal 2022-07-02 23:12 ` [PATCH v3 2/8] dt-bindings: mtd: intel: lgm-nand: Fix maximum chip select value Martin Blumenstingl 2022-07-02 23:12 ` Martin Blumenstingl 2022-09-20 8:16 ` Miquel Raynal 2022-09-20 8:16 ` Miquel Raynal 2022-07-02 23:12 ` Martin Blumenstingl [this message] 2022-07-02 23:12 ` [PATCH v3 3/8] mtd: rawnand: intel: Read the chip-select line from the correct OF node Martin Blumenstingl 2022-09-20 8:16 ` Miquel Raynal 2022-09-20 8:16 ` Miquel Raynal 2022-07-02 23:12 ` [PATCH v3 4/8] mtd: rawnand: intel: Remove undocumented compatible string Martin Blumenstingl 2022-07-02 23:12 ` Martin Blumenstingl 2022-09-20 8:16 ` Miquel Raynal 2022-09-20 8:16 ` Miquel Raynal 2022-07-02 23:12 ` [PATCH v3 5/8] mtd: rawnand: intel: Don't re-define NAND_DATA_IFACE_CHECK_ONLY Martin Blumenstingl 2022-07-02 23:12 ` Martin Blumenstingl 2022-09-20 8:16 ` Miquel Raynal 2022-09-20 8:16 ` Miquel Raynal 2022-07-02 23:12 ` [PATCH v3 6/8] mtd: rawnand: intel: Remove unused nand_pa member from ebu_nand_cs Martin Blumenstingl 2022-07-02 23:12 ` Martin Blumenstingl 2022-09-20 8:16 ` Miquel Raynal 2022-09-20 8:16 ` Miquel Raynal 2022-07-02 23:12 ` [PATCH v3 7/8] mtd: rawnand: intel: Remove unused clk_rate member from struct ebu_nand Martin Blumenstingl 2022-07-02 23:12 ` Martin Blumenstingl 2022-09-20 8:15 ` Miquel Raynal 2022-09-20 8:15 ` Miquel Raynal 2022-07-02 23:12 ` [PATCH v3 8/8] mtd: rawnand: intel: Use devm_platform_ioremap_resource_byname() Martin Blumenstingl 2022-07-02 23:12 ` Martin Blumenstingl 2022-09-20 8:15 ` Miquel Raynal 2022-09-20 8:15 ` Miquel Raynal
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=20220702231227.1579176-4-martin.blumenstingl@googlemail.com \ --to=martin.blumenstingl@googlemail.com \ --cc=devicetree@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mtd@lists.infradead.org \ --cc=miquel.raynal@bootlin.com \ --cc=richard@nod.at \ --cc=rtanwar@maxlinear.com \ --cc=tlanger@maxlinear.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.