int argc, char *const argv[])
{
struct mmc *mmc;
+ struct disk_partition info;
u32 blk, cnt, n;
- if (argc != 3)
+ if (argc < 2 || argc > 3)
return CMD_RET_USAGE;
- blk = hextoul(argv[1], NULL);
- cnt = hextoul(argv[2], NULL);
-
mmc = init_mmc_device(curr_device, false);
if (!mmc)
return CMD_RET_FAILURE;
+ if (argc == 3) {
+ blk = hextoul(argv[1], NULL);
+ cnt = hextoul(argv[2], NULL);
+ } else if (part_get_info_by_name(mmc_get_blk_desc(mmc), argv[1], &info) >= 0) {
+ blk = info.start;
+ cnt = info.size;
+ } else {
+ return CMD_RET_FAILURE;
+ }
+
printf("MMC erase: dev # %d, block # %d, count %d ... ",
curr_device, blk, cnt);
"mmc swrite addr blk#\n"
#endif
"mmc erase blk# cnt\n"
+ "mmc erase partname\n"
"mmc rescan [mode]\n"
"mmc part - lists available partition on current mmc device\n"
"mmc dev [dev] [part] [mode] - show or set current mmc device [partition] and set mode\n"
mmc read addr blk# cnt
mmc write addr blk# cnt
mmc erase blk# cnt
+ mmc erase partname
mmc rescan [mode]
mmc part
mmc dev [dev] [part] [mode]
cnt
block count
-The 'mmc erase' command erases *cnt* blocks on the MMC device starting at block *blk#*.
+The 'mmc erase' command erases *cnt* blocks on the MMC device starting at block *blk#* or
+the entire partition specified by *partname*.
blk#
start block offset
cnt
block count
+ partname
+ partition name
The 'mmc rescan' command scans the available MMC device.