dm: blk: Add 'erase' generic block device commands

Add support for doing 'erase' using the generic block commands
framework.

Signed-off-by: Varadarajan Narayanan <quic_varada@quicinc.com>
diff --git a/cmd/blk_common.c b/cmd/blk_common.c
index 4c05a4e..5652970 100644
--- a/cmd/blk_common.c
+++ b/cmd/blk_common.c
@@ -107,6 +107,23 @@
 			printf("%ld blocks written: %s\n", n,
 			       n == cnt ? "OK" : "ERROR");
 			return n == cnt ? CMD_RET_SUCCESS : CMD_RET_FAILURE;
+		} else if (strcmp(argv[1], "erase") == 0) {
+			lbaint_t blk = hextoul(argv[2], NULL);
+			ulong cnt = hextoul(argv[3], NULL);
+			struct blk_desc *desc;
+			ulong n;
+
+			printf("\n%s erase: device %d block # "LBAFU", count %lu ... ",
+			       if_name, *cur_devnump, blk, cnt);
+
+			if (blk_get_desc(uclass_id, *cur_devnump, &desc))
+				return CMD_RET_FAILURE;
+
+			n = blk_derase(desc, blk, cnt);
+
+			printf("%ld blocks erased: %s\n", n,
+			       n == cnt ? "OK" : "ERROR");
+			return n == cnt ? CMD_RET_SUCCESS : CMD_RET_FAILURE;
 		} else {
 			return CMD_RET_USAGE;
 		}