The erase command normally makes sure that the selected area is erased, therefore align the parameters to eraseblock boundaries. Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> --- drivers/nor/m25p80.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/nor/m25p80.c b/drivers/nor/m25p80.c index 0f3bcd1..7ff4546 100644 --- a/drivers/nor/m25p80.c +++ b/drivers/nor/m25p80.c @@ -205,8 +205,9 @@ static ssize_t m25p80_erase(struct cdev *cdev, size_t count, loff_t offset) if (offset + count > flash->size) return -EINVAL; - addr = offset; - len = count; + /* Align start and len to erase blocks */ + addr = offset & ~(flash->erasesize - 1); + len = ALIGN(offset + count, flash->erasesize) - addr; /* whole-chip erase? */ if (len == flash->size) { -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox