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. @@ -110,6 +110,14 @@ config MTD_SPEAR_SMI
  4. help
  5. This enable SNOR support on SPEAR platforms using SMI controller
  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. @@ -76,6 +76,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. @@ -918,7 +924,7 @@ static int m25p_probe(struct spi_device
  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) {