--- a/include/linux/mtd/nand.h 2017-05-25 16:45:05.000000000 +0300 +++ b/include/linux/mtd/nand.h 2017-05-28 09:45:05.016541089 +0300 @@ -1053,6 +1053,7 @@ struct platform_nand_chip { unsigned int options; unsigned int bbt_options; const char **part_probe_types; + int (*chip_fixup)(struct mtd_info *mtd); }; /* Keep gcc happy */ --- a/drivers/mtd/nand/plat_nand.c 2017-05-25 16:45:05.000000000 +0300 +++ b/drivers/mtd/nand/plat_nand.c 2017-05-28 10:01:49.235556815 +0300 @@ -86,11 +86,23 @@ static int plat_nand_probe(struct platfo } /* Scan to find existence of the device */ - if (nand_scan(mtd, pdata->chip.nr_chips)) { + if (nand_scan_ident(mtd, pdata->chip.nr_chips, NULL)) { err = -ENXIO; goto out; } + if (pdata->chip.chip_fixup) { + err = pdata->chip.chip_fixup(mtd); + if (err) + goto out; + } + + if (nand_scan_tail(mtd)) { + err = -ENXIO; + goto out; + } + + part_types = pdata->chip.part_probe_types; err = mtd_device_parse_register(mtd, part_types, NULL,