bcm53xx: add support for Asus RT-N18U LEDs & buttons
[openwrt.git] / target / linux / bcm53xx / patches-3.14 / 401-mtd-spi-nor-add-Kconfig-option-to-disable-4K-sectors.patch
1 --- a/drivers/mtd/spi-nor/Kconfig
2 +++ b/drivers/mtd/spi-nor/Kconfig
3 @@ -7,6 +7,20 @@ menuconfig MTD_SPI_NOR
4  
5  if MTD_SPI_NOR
6  
7 +config MTD_SPI_NOR_USE_4K_SECTORS
8 +       bool "Use small 4096 B erase sectors"
9 +       default y
10 +       help
11 +         Many flash memories support erasing small (4096 B) sectors. Depending
12 +         on the usage this feature may provide performance gain in comparison
13 +         to erasing whole blocks (32/64 KiB).
14 +         Changing small part of flash content is usually faster with small
15 +         sectors. On the other hand erasing should be faster when using 64 KiB
16 +         block instead of 16 × 4 KiB sectors.
17 +
18 +         Please note that some tools/drivers/filesystems may not work with
19 +         4096 B erase size (e.g. UBIFS requires 15 KiB as a minimum).
20 +
21  config SPI_FSL_QUADSPI
22         tristate "Freescale Quad SPI controller"
23         depends on ARCH_MXC
24 --- a/drivers/mtd/spi-nor/spi-nor.c
25 +++ b/drivers/mtd/spi-nor/spi-nor.c
26 @@ -987,6 +987,7 @@ int spi_nor_scan(struct spi_nor *nor, co
27             nor->wait_till_ready == spi_nor_wait_till_ready)
28                 nor->wait_till_ready = spi_nor_wait_till_fsr_ready;
29  
30 +#ifdef CONFIG_MTD_SPI_NOR_USE_4K_SECTORS
31         /* prefer "small sector" erase if possible */
32         if (info->flags & SECT_4K) {
33                 nor->erase_opcode = SPINOR_OP_BE_4K;
34 @@ -994,7 +995,9 @@ int spi_nor_scan(struct spi_nor *nor, co
35         } else if (info->flags & SECT_4K_PMC) {
36                 nor->erase_opcode = SPINOR_OP_BE_4K_PMC;
37                 mtd->erasesize = 4096;
38 -       } else {
39 +       } else
40 +#endif
41 +       {
42                 nor->erase_opcode = SPINOR_OP_SE;
43                 mtd->erasesize = info->sector_size;
44         }