476-mtd-m25p80-allow-to-disable-small-sector-erase.patch 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. --- a/drivers/mtd/devices/Kconfig
  2. +++ b/drivers/mtd/devices/Kconfig
  3. @@ -102,6 +102,14 @@ config M25PXX_USE_FAST_READ
  4. help
  5. This option enables FAST_READ access supported by ST M25Pxx.
  6. +config M25PXX_PREFER_SMALL_SECTOR_ERASE
  7. + bool "Prefer small sector erase"
  8. + depends on MTD_M25P80
  9. + default y
  10. + help
  11. + This option enables use of the small erase sectors if that is
  12. + supported by the flash chip.
  13. +
  14. config MTD_SST25L
  15. tristate "Support SST25L (non JEDEC) SPI Flash chips"
  16. depends on SPI_MASTER
  17. --- a/drivers/mtd/devices/m25p80.c
  18. +++ b/drivers/mtd/devices/m25p80.c
  19. @@ -84,6 +84,12 @@
  20. #define JEDEC_MFR(_jedec_id) ((_jedec_id) >> 16)
  21. +#ifdef CONFIG_M25PXX_PREFER_SMALL_SECTOR_ERASE
  22. +#define PREFER_SMALL_SECTOR_ERASE 1
  23. +#else
  24. +#define PREFER_SMALL_SECTOR_ERASE 0
  25. +#endif
  26. +
  27. /****************************************************************************/
  28. struct m25p {
  29. @@ -925,7 +931,7 @@ static int __devinit m25p_probe(struct s
  30. flash->mtd.write = m25p80_write;
  31. /* prefer "small sector" erase if possible */
  32. - if (info->flags & SECT_4K) {
  33. + if (PREFER_SMALL_SECTOR_ERASE && (info->flags & SECT_4K)) {
  34. flash->erase_opcode = OPCODE_BE_4K;
  35. flash->mtd.erasesize = 4096;
  36. } else if (info->flags & SECT_4K_PMC) {