mmc: Add support for erase command

Partitions on the eMMC card can be erased using the
command "fastboot erase <name of the partition>".

The size of the erasable unit is the erase group size,
which is read from the CSD register. The partitions
are erased in terms of the erase group size. Any
overflow beyond the erase group size is not erased.

Change-Id: I87e56c192c706360a99883f119c7e3db5f388c7f
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index d318ced..75f51ae 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -851,20 +851,19 @@
 void cmd_erase_mmc(const char *arg, void *data, unsigned sz)
 {
 	unsigned long long ptn = 0;
-	unsigned int out[512] = {0};
 	int index = INVALID_PTN;
+	unsigned long long size;
 
 	index = partition_get_index(arg);
 	ptn = partition_get_offset(index);
+	size = partition_get_size(index);
+
 	if(ptn == 0) {
-		fastboot_fail("partition table doesn't exist");
+		fastboot_fail("Partition table doesn't exist\n");
 		return;
 	}
-
-	/* Simple inefficient version of erase. Just writing
-	   0 in first block */
-	if (mmc_write(ptn , 512, (unsigned int *)out)) {
-		fastboot_fail("failed to erase partition");
+	if (mmc_erase_card(ptn, size)) {
+		fastboot_fail("Failed to erase partition\n");
 		return;
 	}
 	fastboot_okay("");