[PATCH 3/3] MTD: spi-nor: add flag to not use sector erase.
Michal Suchanek
hramrach at gmail.com
Thu Apr 30 14:13:12 PDT 2015
The sector size of the flash memory is unclear from datasheet or may
possibly vary between chips so add a flag to always use 4k blocks.
Currently 4k blocks are always used when possible but in the future
somebody might want to do some optimizations with sector erase.
Signed-off-by: Michal Suchanek <hramrach at gmail.com>
---
drivers/mtd/spi-nor/spi-nor.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index de73cf5..371e91c 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -55,6 +55,7 @@ struct flash_info {
#define SPI_NOR_DUAL_READ 0x20 /* Flash supports Dual Read */
#define SPI_NOR_QUAD_READ 0x40 /* Flash supports Quad Read */
#define USE_FSR 0x80 /* use flag status register */
+#define NO_SPINOR_OP_SE 0x100 /* do not erase sectors */
};
#define JEDEC_MFR(info) ((info)->id[0])
@@ -333,6 +334,7 @@ static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr)
/* REVISIT in some cases we could speed up erasing large regions
* by using SPINOR_OP_SE instead of SPINOR_OP_BE_4K. We may have set up
* to use "small sector erase", but that's not always optimal.
+ * The block size for SPINOR_OP_SE is unknown/untested for some flashes.
*/
/* "sector"-at-a-time erase */
@@ -551,7 +553,7 @@ static const struct spi_device_id spi_nor_ids[] = {
{ "mb85rs1mt", INFO(0x047f27, 0, 128 * 1024, 1, SPI_NOR_NO_ERASE) },
/* GigaDevice */
- { "gd25q41b", INFO(0xc84013, 0, 64 * 1024, 8, SECT_4K) },
+ { "gd25q41b", INFO(0xc84013, 0, 64 * 1024, 8, SECT_4K | NO_SPINOR_OP_SE) },
{ "gd25q32", INFO(0xc84016, 0, 64 * 1024, 64, SECT_4K) },
{ "gd25q64", INFO(0xc84017, 0, 64 * 1024, 128, SECT_4K) },
{ "gd25q128", INFO(0xc84018, 0, 64 * 1024, 256, SECT_4K) },
--
2.1.4
More information about the linux-mtd
mailing list