Merge branch 'master' into ozonet
[lede-git/.git] / target / linux / generic / patches-4.9 / 450-mtd-nand-allow-to-use-platform-specific-chip-fixup.patch
1 --- a/include/linux/mtd/nand.h  2017-05-25 16:45:05.000000000 +0300
2 +++ b/include/linux/mtd/nand.h  2017-05-28 09:45:05.016541089 +0300
3 @@ -1053,6 +1053,7 @@ struct platform_nand_chip {
4         unsigned int options;
5         unsigned int bbt_options;
6         const char **part_probe_types;
7 +       int (*chip_fixup)(struct mtd_info *mtd);
8  };
9  
10  /* Keep gcc happy */
11 --- a/drivers/mtd/nand/plat_nand.c      2017-05-25 16:45:05.000000000 +0300
12 +++ b/drivers/mtd/nand/plat_nand.c      2017-05-28 10:01:49.235556815 +0300
13 @@ -86,11 +86,23 @@ static int plat_nand_probe(struct platfo
14         }
15  
16         /* Scan to find existence of the device */
17 -       if (nand_scan(mtd, pdata->chip.nr_chips)) {
18 +       if (nand_scan_ident(mtd, pdata->chip.nr_chips, NULL)) {
19                 err = -ENXIO;
20                 goto out;
21         }
22  
23 +       if (pdata->chip.chip_fixup) {
24 +               err = pdata->chip.chip_fixup(mtd);
25 +               if (err)
26 +                       goto out;
27 +       }
28 +
29 +       if (nand_scan_tail(mtd)) {
30 +               err = -ENXIO;
31 +               goto out;
32 +       }
33 +
34 +
35         part_types = pdata->chip.part_probe_types;
36  
37         err = mtd_device_parse_register(mtd, part_types, NULL,