diff options
| author | Frank Li <Frank.Li@nxp.com> | 2026-03-10 22:07:39 +0300 |
|---|---|---|
| committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2026-03-11 18:34:22 +0300 |
| commit | ee78d466db8a001d137d6f9c97010b343aee456b (patch) | |
| tree | 933c95b08f37bd30a68f3b1610519bd5debcb88c | |
| parent | f7bd1948a5461df9e1027d5bd9a511e754146689 (diff) | |
| download | linux-ee78d466db8a001d137d6f9c97010b343aee456b.tar.xz | |
mtd: rawnand: ifc: set chip->of_node to nand@0 child node if present
The nand-controller.yaml binding requires a child node (e.g. nand@0) under
the NAND controller. However, the driver currently assigns the controller's
of_node directly to the NAND chip.
Search for the first child node with the "nand" prefix and assign it to
chip->of_node. This filters out properties such as "partition" that may be
placed under the controller node in some older DTS files.
Fall back to using the controller's of_node if no suitable child node is
found to maintain backward compatibility.
This issue went unnoticed because the default behavior works for most NAND
chips.
Signed-off-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
| -rw-r--r-- | drivers/mtd/nand/raw/fsl_ifc_nand.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/mtd/nand/raw/fsl_ifc_nand.c b/drivers/mtd/nand/raw/fsl_ifc_nand.c index dd88b22a91bd..fad0334f759d 100644 --- a/drivers/mtd/nand/raw/fsl_ifc_nand.c +++ b/drivers/mtd/nand/raw/fsl_ifc_nand.c @@ -7,6 +7,7 @@ * Author: Dipen Dudhat <Dipen.Dudhat@freescale.com> */ +#include <linux/cleanup.h> #include <linux/module.h> #include <linux/platform_device.h> #include <linux/types.h> @@ -863,7 +864,14 @@ static int fsl_ifc_chip_init(struct fsl_ifc_mtd *priv) /* Fill in fsl_ifc_mtd structure */ mtd->dev.parent = priv->dev; - nand_set_flash_node(chip, priv->dev->of_node); + + struct device_node *np __free(device_node) = + of_get_next_child_with_prefix(priv->dev->of_node, NULL, "nand"); + + if (np) + nand_set_flash_node(chip, np); + else + nand_set_flash_node(chip, priv->dev->of_node); /* fill in nand_chip structure */ /* set up function call table */ |
