e04b754d8cea087583e8b0decdd9c7bc84913661
[openwrt/svn-archive/archive.git] / target / linux / generic / patches-2.6.35 / 080-mtd_plat_nand_chip_fixup.patch
1 --- a/include/linux/mtd/nand.h
2 +++ b/include/linux/mtd/nand.h
3 @@ -512,6 +512,7 @@ struct platform_nand_chip {
4 int chip_delay;
5 unsigned int options;
6 const char **part_probe_types;
7 + int (*chip_fixup)(struct mtd_info *mtd);
8 void (*set_parts)(uint64_t size,
9 struct platform_nand_chip *chip);
10 void *priv;
11 --- a/drivers/mtd/nand/plat_nand.c
12 +++ b/drivers/mtd/nand/plat_nand.c
13 @@ -91,7 +91,18 @@ static int __devinit plat_nand_probe(str
14 }
15
16 /* Scan to find existance of the device */
17 - if (nand_scan(&data->mtd, 1)) {
18 + if (nand_scan_ident(&data->mtd, 1, NULL)) {
19 + res = -ENXIO;
20 + goto out;
21 + }
22 +
23 + if (pdata->chip.chip_fixup) {
24 + res = pdata->chip.chip_fixup(&data->mtd);
25 + if (res)
26 + goto out;
27 + }
28 +
29 + if (nand_scan_tail(&data->mtd)) {
30 err = -ENXIO;
31 goto out;
32 }