1 --- a/drivers/mtd/devices/Kconfig
2 +++ b/drivers/mtd/devices/Kconfig
3 @@ -110,6 +110,14 @@ config MTD_SPEAR_SMI
5 This enable SNOR support on SPEAR platforms using SMI controller
7 +config M25PXX_PREFER_SMALL_SECTOR_ERASE
8 + bool "Prefer small sector erase"
9 + depends on MTD_M25P80
12 + This option enables use of the small erase sectors if that is
13 + supported by the flash chip.
16 tristate "Support SST25L (non JEDEC) SPI Flash chips"
18 --- a/drivers/mtd/devices/m25p80.c
19 +++ b/drivers/mtd/devices/m25p80.c
22 #define JEDEC_MFR(_jedec_id) ((_jedec_id) >> 16)
24 +#ifdef CONFIG_M25PXX_PREFER_SMALL_SECTOR_ERASE
25 +#define PREFER_SMALL_SECTOR_ERASE 1
27 +#define PREFER_SMALL_SECTOR_ERASE 0
30 /****************************************************************************/
33 @@ -918,7 +924,7 @@ static int m25p_probe(struct spi_device
34 flash->mtd._write = m25p80_write;
36 /* prefer "small sector" erase if possible */
37 - if (info->flags & SECT_4K) {
38 + if (PREFER_SMALL_SECTOR_ERASE && (info->flags & SECT_4K)) {
39 flash->erase_opcode = OPCODE_BE_4K;
40 flash->mtd.erasesize = 4096;
41 } else if (info->flags & SECT_4K_PMC) {