128-2-mtd-nand-support-non-ONFI-timings.patch 839 B

12345678910111213141516171819202122232425262728
  1. --- a/drivers/mtd/nand/nand_base.c
  2. +++ b/drivers/mtd/nand/nand_base.c
  3. @@ -4262,8 +4262,13 @@ static bool find_full_id_nand(struct mtd
  4. chip->ecc_strength_ds = NAND_ECC_STRENGTH(type);
  5. chip->ecc_step_ds = NAND_ECC_STEP(type);
  6. - mode = type->onfi_timing_mode_default;
  7. - chip->sdr_timings = onfi_async_timing_mode_to_sdr_timings(mode);
  8. + if (type->custom_sdr_timing) {
  9. + chip->sdr_timings = type->custom_sdr_timing;
  10. + } else {
  11. + mode = type->onfi_timing_mode_default;
  12. + chip->sdr_timings =
  13. + onfi_async_timing_mode_to_sdr_timings(mode);
  14. + }
  15. *busw = type->options & NAND_BUSWIDTH_16;
  16. --- a/include/linux/mtd/nand.h
  17. +++ b/include/linux/mtd/nand.h
  18. @@ -988,6 +988,7 @@ struct nand_flash_dev {
  19. uint16_t step_ds;
  20. } ecc;
  21. int onfi_timing_mode_default;
  22. + const struct nand_sdr_timings *custom_sdr_timing;
  23. };
  24. /**