[PATCH] mtd: m25p80: set erasesize to 1 if device doesn't need erase

Michael Grzeschik m.grzeschik at pengutronix.de
Tue Feb 11 05:49:09 EST 2014


The driver currently set eraseblocksize to sector_size if the device has
the SECT_4K{,_PMC} flag not set. The mtdpart layer will check the
partitions to be bound to eraseblock size bounderies. Devices which do
not need to be erased before use, like e.g. mrams, this will always
trigger if the partition is smaller then the sectorsize. This patch
fixes this by setting the eraseblocksize 1 for such devices.

Signed-off-by: Michael Grzeschik <m.grzeschik at pengutronix.de>
---
 drivers/mtd/devices/m25p80.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index ad1913909702..c7bdce75f574 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -1203,8 +1203,10 @@ static int m25p_probe(struct spi_device *spi)
 		flash->mtd.erasesize = info->sector_size;
 	}
 
-	if (info->flags & M25P_NO_ERASE)
+	if (info->flags & M25P_NO_ERASE) {
 		flash->mtd.flags |= MTD_NO_ERASE;
+		flash->mtd.erasesize = 1;
+	}
 
 	ppdata.of_node = spi->dev.of_node;
 	flash->mtd.dev.parent = &spi->dev;
-- 
1.8.5.3




More information about the linux-mtd mailing list