UPSTREAM: mmc-utils: Add ability to configure write protect on an eMMC device

Add commands to get and set write protect modes for the specified
areas of the user partition. The ability to set permanent write
protect is #ifdef'd with "DANGEROUS_COMMANDS_ENABLED" because
it has the ability to make the eMMC device and possibly the system
permanently unusable.

Conflicts:
  mmc.c: Reorder command list.

BUG=None
TEST=Compile

Signed-off-by: Al Cooper <alcooperx@gmail.com>
Signed-off-by: Chris Ball <chris@printf.net>
(cherry picked from commit 0ca049f25191c32323ba25a3cfd542b9fdefb473)
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>

Change-Id: I8119e279c2f0cea093c7ee65fbe29fb74382e83c
Reviewed-on: https://chromium-review.googlesource.com/1114439
Commit-Ready: Gwendal Grignou <gwendal@chromium.org>
Tested-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
diff --git a/mmc.h b/mmc.h
index fc8904e..f46d74e 100644
--- a/mmc.h
+++ b/mmc.h
@@ -42,6 +42,9 @@
 #define MMC_READ_MULTIPLE_BLOCK  18   /* adtc [31:0] data addr   R1  */
 #define MMC_WRITE_BLOCK		24	/* adtc [31:0] data addr	R1  */
 #define MMC_WRITE_MULTIPLE_BLOCK 25   /* adtc                    R1  */
+#define MMC_SET_WRITE_PROT	28    /* ac   [31:0] data addr   R1b */
+#define MMC_CLEAR_WRITE_PROT	29    /* ac   [31:0] data addr   R1b */
+#define MMC_SEND_WRITE_PROT_TYPE 31   /* ac   [31:0] data addr   R1  */
 
 /*
  * EXT_CSD fields
@@ -65,6 +68,8 @@
 #define EXT_CSD_CACHE_SIZE_1		250
 #define EXT_CSD_CACHE_SIZE_0		249
 #define EXT_CSD_BOOT_INFO		228	/* R/W */
+#define EXT_CSD_HC_ERASE_GRP_SIZE	224
+#define EXT_CSD_HC_WP_GRP_SIZE		221
 #define EXT_CSD_SEC_COUNT_3		215
 #define EXT_CSD_SEC_COUNT_2		214
 #define EXT_CSD_SEC_COUNT_1		213