@@ -195,6 +195,9 @@ if [\fIchunk\-bytes\fR] is omitted, mmc-utils will try to run ffu using the larg
.BI opt_ffu1 " \fIimage\-file\-name\fR " " \fIdevice\fR " " [\fIchunk\-bytes\fR]
Optional FFU mode 1, it's the same as 'ffu', but uses CMD23+CMD25 for repeated downloads and remains in FFU mode until completion.
.TP
+.BI opt_ffu2 " \fIimage\-file\-name\fR " " \fIdevice\fR " " [\fIchunk\-bytes\fR]
+Optional FFU mode 2, uses CMD25+CMD12 Open-ended Multiple-block write to download and remains in FFU mode until completion.
+.TP
.BI erase " " \fItype\fR " " \fIstart-address\fR " " \fIend\-address\fR " " \fIdevice\fR
Send Erase CMD38 with specific argument to the device.
.br
@@ -239,6 +239,11 @@ static struct Command commands[] = {
"Optional FFU mode 1, it's the same as 'ffu', but uses CMD23+CMD25 for repeated downloads and remains in FFU mode until completion.\n",
NULL
},
+ { do_opt_ffu2, -2,
+ "opt_ffu2", "<image name> <device> [chunk-bytes]\n"
+ "Optional FFU mode 2, uses CMD25+CMD12 Open-ended Multiple-block write to download and remains in FFU mode until completion.\n",
+ NULL
+ },
{ do_erase, -4,
"erase", "<type> " "<start address> " "<end address> " "<device>\n"
"Send Erase CMD38 with specific argument to the <device>\n\n"
@@ -27,6 +27,7 @@
#define MMC_BOOT_INITIATION_ARG 0xFFFFFFFA
#define MMC_SWITCH 6 /* ac [31:0] See below R1b */
#define MMC_SEND_EXT_CSD 8 /* adtc R1 */
+#define MMC_STOP_TRANSMISSION 12 /* ac R1b */
#define MMC_SEND_STATUS 13 /* ac [31:16] RCA R1 */
#define R1_SWITCH_ERROR (1 << 7) /* sx, c */
#define MMC_SWITCH_MODE_WRITE_BYTE 0x03 /* Set target to value */
@@ -63,7 +63,8 @@
// Firmware Update (FFU) download modes
enum ffu_download_mode {
FFU_DEFAULT_MODE, // Default mode: Uses CMD23+CMD25; exits FFU mode after each loop.
- FFU_OPT_MODE1 // Optional mode 1: Uses CMD23+CMD25; but stays in FFU mode during download.
+ FFU_OPT_MODE1, // Optional mode 1: Uses CMD23+CMD25; but stays in FFU mode during download.
+ FFU_OPT_MODE2 // Optional mode 2: Uses CMD25+CMD12 Open-ended Multiple-block write to download
};
static inline __u32 per_byte_htole32(__u8 *arr)
@@ -2853,6 +2854,12 @@ static void set_ffu_download_cmd(struct mmc_ioc_multi_cmd *multi_cmd,
multi_cmd->cmds[0].flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC;
set_single_cmd(&multi_cmd->cmds[1], MMC_WRITE_MULTIPLE_BLOCK, 1, bytes / 512, arg);
mmc_ioc_cmd_set_data(multi_cmd->cmds[1], buf + offset);
+ } else if (ffu_mode == FFU_OPT_MODE2) {
+ set_single_cmd(&multi_cmd->cmds[0], MMC_WRITE_MULTIPLE_BLOCK, 1, bytes / 512, arg);
+ multi_cmd->cmds[0].flags = MMC_RSP_R1 | MMC_CMD_ADTC;
+ mmc_ioc_cmd_set_data(multi_cmd->cmds[0], buf + offset);
+ set_single_cmd(&multi_cmd->cmds[1], MMC_STOP_TRANSMISSION, 0, 0, 0);
+ multi_cmd->cmds[1].flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC;
}
}
@@ -3205,6 +3212,11 @@ int do_opt_ffu1(int nargs, char **argv)
return __do_ffu(nargs, argv, FFU_OPT_MODE1);
}
+int do_opt_ffu2(int nargs, char **argv)
+{
+ return __do_ffu(nargs, argv, FFU_OPT_MODE2);
+}
+
int do_general_cmd_read(int nargs, char **argv)
{
int dev_fd;
@@ -43,6 +43,7 @@ int do_cache_en(int nargs, char **argv);
int do_cache_dis(int nargs, char **argv);
int do_ffu(int nargs, char **argv);
int do_opt_ffu1(int nargs, char **argv);
+int do_opt_ffu2(int nargs, char **argv);
int do_read_scr(int argc, char **argv);
int do_read_cid(int argc, char **argv);
int do_read_csd(int argc, char **argv);