@@ -201,6 +201,9 @@ Same as 'ffu', but uses CMD25+CMD12 Open-ended Multiple-block write to download
.BI ffu4 " \fIimage\-file\-name\fR " " \fIdevice\fR " " [\fIchunk\-bytes\fR]
Same as 'ffu', but uses CMD24 Single-block write to download, exiting FFU mode after each block is written.
.TP
+.BI ffu5 " \fIimage\-file\-name\fR " " \fIdevice\fR " " [\fIchunk\-bytes\fR]
+Same as 'ffu', but uses CMD24 Single-block write for repeated downloads, remaining 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
@@ -249,6 +249,11 @@ static struct Command commands[] = {
"Same as 'ffu', but uses CMD24 Single-block write to download, exiting FFU mode after each block written.\n",
NULL
},
+ { do_ffu5, -2,
+ "ffu5", "<image name> <device> [chunk-bytes]\n"
+ "Same as 'ffu', but uses CMD24 Single-block write for repeated downloads, remaining 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"
@@ -2844,8 +2844,12 @@ static void set_ffu_download_cmd(struct mmc_ioc_multi_cmd *multi_cmd, __u8 *ext_
set_single_cmd(&multi_cmd->cmds[1], MMC_WRITE_BLOCK, 1, 1, arg);
mmc_ioc_cmd_set_data(multi_cmd->cmds[1], buf + offset);
fill_switch_cmd(&multi_cmd->cmds[2], EXT_CSD_MODE_CONFIG, EXT_CSD_NORMAL_MODE);
+ } else if (ffu_mode == 5) {
+ set_single_cmd(&multi_cmd->cmds[0], MMC_WRITE_BLOCK, 1, 1, arg);
+ mmc_ioc_cmd_set_data(multi_cmd->cmds[0], buf + offset);
}
}
+
static int enter_ffu_mode(int *dev_fd)
{
int ret;
@@ -2933,6 +2937,8 @@ static int do_ffu_download(int *dev_fd, __u8 *ext_csd, __u8 *fw_buf, off_t fw_si
num_of_cmds = 2;
else if (ffu_mode == 4)
num_of_cmds = 3; /* in FFU mode 4, mmc_ioc_multi_cmd contains 3 commands */
+ else if (ffu_mode == 5)
+ num_of_cmds = 1; /* in FFU mode 5, it is single command mode */
/* allocate maximum required */
multi_cmd = calloc(1, sizeof(struct mmc_ioc_multi_cmd) + num_of_cmds * sizeof(struct mmc_ioc_cmd));
@@ -2957,11 +2963,14 @@ do_retry:
/* prepare multi_cmd for FFU based on cmd to be used */
set_ffu_download_cmd(multi_cmd, ext_csd, bytes_per_loop, fw_buf, off, ffu_mode);
- /* send ioctl with multi-cmd, download firmware bundle */
- ret = ioctl(*dev_fd, MMC_IOC_MULTI_CMD, multi_cmd);
+ if (num_of_cmds > 1)
+ /* send ioctl with multi-cmd, download firmware bundle */
+ ret = ioctl(*dev_fd, MMC_IOC_MULTI_CMD, multi_cmd);
+ else
+ ret = ioctl(*dev_fd, MMC_IOC_CMD, &multi_cmd->cmds[0]);
if (ret) {
- perror("Multi-cmd ioctl");
+ perror("ioctl failed");
/*
* In case multi-cmd ioctl failed before exiting from
* ffu mode
@@ -3075,8 +3084,8 @@ static int __do_ffu(int nargs, char **argv, __u8 ffu_mode)
goto out;
}
- if (ffu_mode ==4)
- /* FFU mode 4 uses CMD24, the write is limited to single-block operations*/
+ if (ffu_mode ==4 || ffu_mode == 5)
+ /* FFU mode 4/5 uses CMD24, the write is limited to single-block operations*/
default_chunk = 512;
sect_done = do_ffu_download((int *)&dev_fd, ext_csd, fw_buf, fw_size, default_chunk, ffu_mode);
@@ -3165,6 +3174,10 @@ int do_ffu4(int nargs, char **argv) {
return __do_ffu(nargs, argv, 4);
}
+int do_ffu5(int nargs, char **argv) {
+ return __do_ffu(nargs, argv, 5);
+}
+
int do_general_cmd_read(int nargs, char **argv)
{
int dev_fd;
@@ -45,6 +45,7 @@ int do_ffu(int nargs, char **argv);
int do_ffu2(int nargs, char **argv);
int do_ffu3(int nargs, char **argv);
int do_ffu4(int nargs, char **argv);
+int do_ffu5(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);