From ba540e0be90f1055fd9d40b0a6858f96aff6b180 Mon Sep 17 00:00:00 2001 From: Cyril Bur Date: Fri, 17 Nov 2017 11:02:45 +1100 Subject: external/pflash: Fix erasing within a single erase block It is possible to erase within a single erase block. Currently the pflash code assumes that if the erase starts part way into an erase block it is because it needs to be aligned up to the boundary with the next erase block. Doing an erase smaller than a single erase block will cause underflows and looping forever on erase. Fixes: ae6cb86c2 ("external/pflash: Reinstate the progress bars") Signed-off-by: Cyril Bur Signed-off-by: Stewart Smith --- libflash/libflash.c | 4 ---- libflash/libflash.h | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'libflash') diff --git a/libflash/libflash.c b/libflash/libflash.c index bf2e58e..ad25b61 100644 --- a/libflash/libflash.c +++ b/libflash/libflash.c @@ -23,10 +23,6 @@ #include "ecc.h" #include "blocklevel.h" -#ifndef MIN -#define MIN(a, b) ((a) < (b) ? (a) : (b)) -#endif - static const struct flash_info flash_info[] = { { 0xc22018, 0x01000000, FL_ERASE_ALL | FL_CAN_4B, "Macronix MXxxL12835F"}, { 0xc22019, 0x02000000, FL_ERASE_ALL | FL_CAN_4B, "Macronix MXxxL25635F"}, diff --git a/libflash/libflash.h b/libflash/libflash.h index ff3a982..01b4d60 100644 --- a/libflash/libflash.h +++ b/libflash/libflash.h @@ -28,6 +28,10 @@ */ #include +#ifndef MIN +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#endif + /* Flash chip, opaque */ struct flash_chip; struct spi_flash_ctrl; -- cgit v1.1