450-mtd-nand-allow-to-use-platform-specific-chip-fixup.patch 925 B

12345678910111213141516171819202122232425262728293031323334353637
  1. ---
  2. drivers/mtd/nand/plat_nand.c | 13 ++++++++++++-
  3. include/linux/mtd/nand.h | 1 +
  4. 2 files changed, 13 insertions(+), 1 deletion(-)
  5. --- a/include/linux/mtd/nand.h
  6. +++ b/include/linux/mtd/nand.h
  7. @@ -851,6 +851,7 @@ struct platform_nand_chip {
  8. unsigned int options;
  9. unsigned int bbt_options;
  10. const char **part_probe_types;
  11. + int (*chip_fixup)(struct mtd_info *mtd);
  12. };
  13. /* Keep gcc happy */
  14. --- a/drivers/mtd/nand/plat_nand.c
  15. +++ b/drivers/mtd/nand/plat_nand.c
  16. @@ -90,7 +90,18 @@ static int plat_nand_probe(struct platfo
  17. }
  18. /* Scan to find existence of the device */
  19. - if (nand_scan(&data->mtd, pdata->chip.nr_chips)) {
  20. + if (nand_scan_ident(&data->mtd, pdata->chip.nr_chips, NULL)) {
  21. + err = -ENXIO;
  22. + goto out;
  23. + }
  24. +
  25. + if (pdata->chip.chip_fixup) {
  26. + err = pdata->chip.chip_fixup(&data->mtd);
  27. + if (err)
  28. + goto out;
  29. + }
  30. +
  31. + if (nand_scan_tail(&data->mtd)) {
  32. err = -ENXIO;
  33. goto out;
  34. }