[PATCH 2/2] m25p80: use proper erasesize for SECT_4K devices

Paul Fertser fercerpav at gmail.com
Thu Sep 15 07:31:45 EDT 2011


This fixes a bug that causes only the first 4K out of every 64K to be
erased on SECT_4K devices.

Signed-off-by: Paul Fertser <fercerpav at gmail.com>
---
 drivers/nor/m25p80.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/nor/m25p80.c b/drivers/nor/m25p80.c
index 6f650a5..31193cf 100644
--- a/drivers/nor/m25p80.c
+++ b/drivers/nor/m25p80.c
@@ -760,7 +760,10 @@ static int m25p_probe(struct device_d *dev)
 	flash->name = (char *)id->name;
 	flash->info = info;
 	flash->size = info->sector_size * info->n_sectors;
-	flash->erasesize = info->sector_size;
+	if (info->flags & SECT_4K)
+		flash->erasesize = 4096;
+	else
+		flash->erasesize = info->sector_size;
 	flash->cdev.size = info->sector_size * info->n_sectors;
 	flash->cdev.dev = dev;
 	flash->cdev.ops = &m25p80_ops;
-- 
1.7.2.3




More information about the barebox mailing list