[U-Boot] [PATCH 4/7 V5] mmc: Update the handling of returned erase block

Haijun Zhang haijun.zhang at freescale.com
Mon Dec 30 09:20:55 CET 2013


If the block range was not aligned, we try to align the range size,
The block range actually erased should be less or equal to the block
range sent. If error occured during erase procedure witch part of them
being erased, users should resend the block rang to continue erase the
rest of them.

zero return, has failed.

Signed-off-by: Haijun Zhang <haijun.zhang at freescale.com>
---
changes for V5:
	- Changed the judgement way of block number returned from erase command

 common/cmd_mmc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index 67a94a7..d83d1e2 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -397,6 +397,13 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			BUG();
 		}
 
+		if (state == MMC_ERASE) {
+			printf("%d blocks %s: %s\n",
+			       n ? n : 0, argv[1],
+			       n ? "OK" : "ERROR");
+			return !n;
+		}
+
 		printf("%d blocks %s: %s\n",
 				n, argv[1], (n == cnt) ? "OK" : "ERROR");
 		return (n == cnt) ? 0 : 1;
-- 
1.8.4.1




More information about the U-Boot mailing list