UPSTREAM mmc_utils: add ffu support

Adding support for field firmware update over multiple command ioctl.
As multiple command ioctl is supported only from kernel 4.4, this patch
should be used against kernel 4.4 and above.

Known issues:
- There is no support for Multiple Block write commands (CMD25) in existing
  IOCTL implementation
- In case MODE_OPERATION_CODES field is not supported by the device
  manual reset of the device/platform is required.
  The reset issue discussed in another email thread - " [RFC 0/6] mmc:
  Field Firmware Update"

Conflicts:
  mmc.c : rename the old ffu command old_ffu.
  mmc.h
  mmc_cmds.c

BUG=b:110793849
CQ-DEPEND=CL:1114458
TEST=On 4.4 eve, check we can upgrade eMMC firmware.

Signed-off-by: Yaniv Agman <yaniv.agman@sandisk.com>
Signed-off-by: Avi Shchislowski <avi.shchislowski@sandisk.com>
Signed-off-by: Chris Ball <chris@printf.net>
(cherry picked from commit 89cd01ed865ac5a2ef3ee86070257d6722900a49)
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>

Change-Id: Ibd91d8a08b3104341e007f81fb27ca7d1783205a
Reviewed-on: https://chromium-review.googlesource.com/1114437
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.c b/mmc.c
index 019f5c3..bd43320 100644
--- a/mmc.c
+++ b/mmc.c
@@ -13,6 +13,9 @@
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 021110-1307, USA.
  *
+ * Modified to add field firmware update support,
+ * those modifications are Copyright (c) 2016 SanDisk Corp.
+ *
  * (This code is based on btrfs-progs/btrfs.c.)
  */
 
@@ -128,12 +131,6 @@
 		"Send Sanitize command to the <device>.\nThis will delete the unmapped memory region of the device.",
 	  NULL
 	},
-	{ do_emmc50_ffu, -2,
-	  "ffu", "[-k hack_type[:hack_value]] <image name> <device>\n"
-		"run eMMC 5.0 Field firmware update.\n"
-		"Device specific hacks can be specificied.",
-	  NULL
-	},
 	{ do_rpmb_write_key, -1,
 	  "rpmb write-key", "<rpmb device> <key file>\n"
 		  "Program authentication key which is 32 bytes length and stored\n"
@@ -229,6 +226,17 @@
 		"Query information about device's block protect capabilities.",
 	  NULL
 	},
+	{ do_emmc50_ffu, -2,
+	  "old_ffu", "[-k hack_type[:hack_value]] <image name> <device>\n"
+		"run eMMC 5.0 Field firmware update.\n"
+		"Device specific hacks can be specificied.",
+	  NULL
+	},
+	{ do_ffu, -2,
+	  "ffu", "<image name> <device>\n"
+		"Run Field Firmware Update with <image name> on <device>.\n",
+	  NULL
+	},
 	{ 0, 0, 0, 0 }
 };