Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Frank Li and committed by
Miquel Raynal
ee78d466 f7bd1948

+9 -1
+9 -1
drivers/mtd/nand/raw/fsl_ifc_nand.c
··· 7 7 * Author: Dipen Dudhat <Dipen.Dudhat@freescale.com> 8 8 */ 9 9 10 + #include <linux/cleanup.h> 10 11 #include <linux/module.h> 11 12 #include <linux/platform_device.h> 12 13 #include <linux/types.h> ··· 864 863 865 864 /* Fill in fsl_ifc_mtd structure */ 866 865 mtd->dev.parent = priv->dev; 867 - nand_set_flash_node(chip, priv->dev->of_node); 866 + 867 + struct device_node *np __free(device_node) = 868 + of_get_next_child_with_prefix(priv->dev->of_node, NULL, "nand"); 869 + 870 + if (np) 871 + nand_set_flash_node(chip, np); 872 + else 873 + nand_set_flash_node(chip, priv->dev->of_node); 868 874 869 875 /* fill in nand_chip structure */ 870 876 /* set up function call table */