* Copyright (C) 2010-2015 Freescale Semiconductor, Inc.
* Copyright (C) 2008 Embedded Alley Solutions, Inc.
*/
+#include <linux/cleanup.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/slab.h>
/* init the nand_chip{}, we don't support a 16-bit NAND Flash bus. */
nand_set_controller_data(chip, this);
- nand_set_flash_node(chip, this->pdev->dev.of_node);
+
+ struct device_node *np __free(device_node) =
+ of_get_next_child_with_prefix(this->pdev->dev.of_node, NULL, "nand");
+
+ if (np)
+ nand_set_flash_node(chip, np);
+ else
+ nand_set_flash_node(chip, this->pdev->dev.of_node);
+
chip->legacy.block_markbad = gpmi_block_markbad;
chip->badblock_pattern = &gpmi_bbt_descr;
chip->options |= NAND_NO_SUBPAGE_WRITE;