summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2015-08-03 01:28:56 +0200
committerJagan Teki <jteki@openedev.com>2015-08-17 15:59:48 +0530
commit0a02655481834a4ebdf457e43c24729ffd7daf37 (patch)
tree0202005fa3dfe497b6884c3c59ff59675fe7787b /drivers
parent632093b566569329bc6e5b0893bdca01de905314 (diff)
downloadblackbird-obmc-uboot-0a02655481834a4ebdf457e43c24729ffd7daf37.tar.gz
blackbird-obmc-uboot-0a02655481834a4ebdf457e43c24729ffd7daf37.zip
sf: Make 4K sector support configurable
Make the support for 4K subpage I/O on a SPI NOR flash configurable. A board which requires the SPI NOR to be accessed in larger 32KiB or 64KiB pages can disable the 4K subpage support, but by default, the support for 4K subpage I/O is enabled. The functionality of this option is the same as CONFIG_MTD_SPI_NOR_USE_4K_SECTORS in Linux. This is extremely useful in case one uses UBI on a SPI NOR flash. UBI needs at least 15k EBs and can not work on a flash which uses 4k ones, so disabling the support for 4k subpages lets UBI work on such flash. Signed-off-by: Marek Vasut <marex@denx.de> Reviewed-by: Jagan Teki <jteki@openedev.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/spi/Kconfig15
-rw-r--r--drivers/mtd/spi/sf_internal.h4
2 files changed, 19 insertions, 0 deletions
diff --git a/drivers/mtd/spi/Kconfig b/drivers/mtd/spi/Kconfig
index 8b730ff3c5..3f7433cbc2 100644
--- a/drivers/mtd/spi/Kconfig
+++ b/drivers/mtd/spi/Kconfig
@@ -86,6 +86,21 @@ config SPI_FLASH_WINBOND
endif
+config SPI_FLASH_USE_4K_SECTORS
+ bool "Use small 4096 B erase sectors"
+ depends on SPI_FLASH
+ default y
+ help
+ Many flash memories support erasing small (4096 B) sectors. Depending
+ on the usage this feature may provide performance gain in comparison
+ to erasing whole blocks (32/64 KiB).
+ Changing a small part of the flash's contents is usually faster with
+ small sectors. On the other hand erasing should be faster when using
+ 64 KiB block instead of 16 × 4 KiB sectors.
+
+ Please note that some tools/drivers/filesystems may not work with
+ 4096 B erase size (e.g. UBIFS requires 15 KiB as a minimum).
+
config SPI_FLASH_DATAFLASH
bool "AT45xxx DataFlash support"
depends on SPI_FLASH && DM_SPI_FLASH
diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index 9fb555707c..9c95d5616e 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -37,7 +37,11 @@ enum spi_read_cmds {
/* sf param flags */
enum {
+#ifdef CONFIG_SPI_FLASH_USE_4K_SECTORS
SECT_4K = 1 << 0,
+#else
+ SECT_4K = 0 << 0,
+#endif
SECT_32K = 1 << 1,
E_FSR = 1 << 2,
SST_BP = 1 << 3,
OpenPOWER on IntegriCloud