diff options
-rw-r--r-- | drivers/mtd/spi-nor/Kconfig | 14 | ||||
-rw-r--r-- | drivers/mtd/spi-nor/spi-nor.c | 5 |
2 files changed, 18 insertions, 1 deletions
diff --git a/drivers/mtd/spi-nor/Kconfig b/drivers/mtd/spi-nor/Kconfig index f8acfa4310ef..64a4f0edabc7 100644 --- a/drivers/mtd/spi-nor/Kconfig +++ b/drivers/mtd/spi-nor/Kconfig | |||
@@ -7,6 +7,20 @@ menuconfig MTD_SPI_NOR | |||
7 | 7 | ||
8 | if MTD_SPI_NOR | 8 | if MTD_SPI_NOR |
9 | 9 | ||
10 | config MTD_SPI_NOR_USE_4K_SECTORS | ||
11 | bool "Use small 4096 B erase sectors" | ||
12 | default y | ||
13 | help | ||
14 | Many flash memories support erasing small (4096 B) sectors. Depending | ||
15 | on the usage this feature may provide performance gain in comparison | ||
16 | to erasing whole blocks (32/64 KiB). | ||
17 | Changing a small part of the flash's contents is usually faster with | ||
18 | small sectors. On the other hand erasing should be faster when using | ||
19 | 64 KiB block instead of 16 × 4 KiB sectors. | ||
20 | |||
21 | Please note that some tools/drivers/filesystems may not work with | ||
22 | 4096 B erase size (e.g. UBIFS requires 15 KiB as a minimum). | ||
23 | |||
10 | config SPI_FSL_QUADSPI | 24 | config SPI_FSL_QUADSPI |
11 | tristate "Freescale Quad SPI controller" | 25 | tristate "Freescale Quad SPI controller" |
12 | depends on ARCH_MXC | 26 | depends on ARCH_MXC |
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index 03e0ab8b2086..11459f6cee50 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c | |||
@@ -1013,6 +1013,7 @@ int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id, | |||
1013 | nor->wait_till_ready == spi_nor_wait_till_ready) | 1013 | nor->wait_till_ready == spi_nor_wait_till_ready) |
1014 | nor->wait_till_ready = spi_nor_wait_till_fsr_ready; | 1014 | nor->wait_till_ready = spi_nor_wait_till_fsr_ready; |
1015 | 1015 | ||
1016 | #ifdef CONFIG_MTD_SPI_NOR_USE_4K_SECTORS | ||
1016 | /* prefer "small sector" erase if possible */ | 1017 | /* prefer "small sector" erase if possible */ |
1017 | if (info->flags & SECT_4K) { | 1018 | if (info->flags & SECT_4K) { |
1018 | nor->erase_opcode = SPINOR_OP_BE_4K; | 1019 | nor->erase_opcode = SPINOR_OP_BE_4K; |
@@ -1020,7 +1021,9 @@ int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id, | |||
1020 | } else if (info->flags & SECT_4K_PMC) { | 1021 | } else if (info->flags & SECT_4K_PMC) { |
1021 | nor->erase_opcode = SPINOR_OP_BE_4K_PMC; | 1022 | nor->erase_opcode = SPINOR_OP_BE_4K_PMC; |
1022 | mtd->erasesize = 4096; | 1023 | mtd->erasesize = 4096; |
1023 | } else { | 1024 | } else |
1025 | #endif | ||
1026 | { | ||
1024 | nor->erase_opcode = SPINOR_OP_SE; | 1027 | nor->erase_opcode = SPINOR_OP_SE; |
1025 | mtd->erasesize = info->sector_size; | 1028 | mtd->erasesize = info->sector_size; |
1026 | } | 1029 | } |