0040-nand-hack.patch 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. --- a/drivers/mtd/nand/nand_base.c
  2. +++ b/drivers/mtd/nand/nand_base.c
  3. @@ -2027,6 +2027,9 @@ static int nand_do_read_ops(struct mtd_i
  4. __func__, buf);
  5. read_retry:
  6. +#ifdef CONFIG_MTK_MTD_NAND
  7. + ret = chip->read_page(mtd, chip, bufpoi, page);
  8. +#else
  9. chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
  10. /*
  11. @@ -2045,6 +2048,7 @@ read_retry:
  12. else
  13. ret = chip->ecc.read_page(mtd, chip, bufpoi,
  14. oob_required, page);
  15. +#endif
  16. if (ret < 0) {
  17. if (use_bufpoi)
  18. /* Invalidate page cache */
  19. @@ -3214,8 +3218,11 @@ int nand_erase_nand(struct mtd_info *mtd
  20. (page + pages_per_block))
  21. chip->pagebuf = -1;
  22. +#ifdef CONFIG_MTK_MTD_NAND
  23. + status = chip->erase_mtk(mtd, page & chip->pagemask);
  24. +#else
  25. status = chip->erase(mtd, page & chip->pagemask);
  26. -
  27. +#endif
  28. /*
  29. * See if operation failed and additional status checks are
  30. * available
  31. @@ -4409,6 +4416,7 @@ int nand_scan_ident(struct mtd_info *mtd
  32. * cmdfunc() both expect cmd_ctrl() to be populated,
  33. * so we need to check that that's the case
  34. */
  35. + printk("%s:%s[%d]%p %p %p\n", __FILE__, __func__, __LINE__, chip->cmdfunc, chip->select_chip, chip->cmd_ctrl);
  36. pr_err("chip.cmd_ctrl() callback is not provided");
  37. return -EINVAL;
  38. }
  39. --- a/drivers/mtd/nand/nand_device_list.h
  40. +++ b/drivers/mtd/nand/nand_device_list.h
  41. @@ -44,6 +44,8 @@ static const flashdev_info gen_FlashTabl
  42. {0xADBC, 0x905554, 5, 16, 512, 128, 2048, 64, 0x10801011, "H9DA4GH4JJAMC", 0},
  43. {0x01F1, 0x801D01, 4, 8, 128, 128, 2048, 64, 0x30C77fff, "S34ML01G100TF", 0},
  44. {0x92F1, 0x8095FF, 4, 8, 128, 128, 2048, 64, 0x30C77fff, "F59L1G81A", 0},
  45. + {0xC8DA, 0x909544, 5, 8, 256, 128, 2048, 64, 0x30C77fff, "F59L2G81A", 0},
  46. + {0xC8DC, 0x909554, 5, 8, 512, 128, 2048, 64, 0x30C77fff, "F59L4G81A", 0},
  47. {0xECD3, 0x519558, 5, 8, 1024, 128, 2048, 64, 0x44333, "K9K8G8000", 0},
  48. {0xC2F1, 0x801DC2, 4, 8, 128, 128, 2048, 64, 0x30C77fff, "MX30LF1G08AA", 0},
  49. {0x98D3, 0x902676, 5, 8, 1024, 256, 4096, 224, 0x00C25332, "TC58NVG3S0F", 0},
  50. --- a/include/linux/mtd/nand.h
  51. +++ b/include/linux/mtd/nand.h
  52. @@ -825,6 +825,10 @@ struct nand_chip {
  53. const struct nand_data_interface *conf,
  54. bool check_only);
  55. +#ifdef CONFIG_MTK_MTD_NAND
  56. + int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip, u8 *buf, int page);
  57. + int (*erase_mtk)(struct mtd_info *mtd, int page);
  58. +#endif /* CONFIG_MTK_MTD_NAND */
  59. int chip_delay;
  60. unsigned int options;