mmc-utils: correct ffu in case of unsupported MODE_OPERATION_CODES
PATCH 1/1 mmc-utils: correct ffu in case of unsupported MODE_OPERATION_CODES
Move up the return in case MODE_OPERATION_CODES is not supported. According to the specification when MODE_OPERATION_CODES is not supported no checks should be done against NUM_OF_FW_SEC_PROG.
--- mmc_cmds.c | 82 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 42 insertions(+), 40 deletions(-)
mmc_cmds.c +42 -40
@@ -2897,6 +2897,13 @@ do_retry: goto out; } +/* check mode operation for ffu install*/ +if (!ext_csd[EXT_CSD_FFU_FEATURES ]) { +fprintf (stderr,"Please reboot to complete firmware installation on %s\n" , device); + ret =0 ; + goto out; + } + ret =read_extcsd (dev_fd, ext_csd);if (ret) {fprintf (stderr,"Could not read EXT_CSD from %s\n" , device);
@@ -2927,49 +2934,44 @@ do_retry: goto out; } -/* check mode operation for ffu install*/ -if (!ext_csd[EXT_CSD_FFU_FEATURES ]) { -fprintf (stderr,"Please reboot to complete firmware installation on %s\n" , device); - }else { -fprintf (stderr,"Installing firmware on %s...\n" , device); -/* Re-enter ffu mode and install the firmware */ - multi_cmd->num_of_cmds =2 ; - -/* set ext_csd to install mode */ - multi_cmd->cmds[1 ].opcode =MMC_SWITCH ; - multi_cmd->cmds[1 ].blksz =0 ; - multi_cmd->cmds[1 ].blocks =0 ; - multi_cmd->cmds[1 ].arg = (MMC_SWITCH_MODE_WRITE_BYTE <<24 ) | - (EXT_CSD_MODE_OPERATION_CODES <<16 ) | - (EXT_CSD_FFU_INSTALL <<8 ) | -EXT_CSD_CMD_SET_NORMAL ; - multi_cmd->cmds[1 ].flags =MMC_RSP_SPI_R1B |MMC_RSP_R1B |MMC_CMD_AC ; - multi_cmd->cmds[1 ].write_flag =1 ; - -/* send ioctl with multi-cmd */ - ret =ioctl (dev_fd,MMC_IOC_MULTI_CMD , multi_cmd); +fprintf (stderr,"Installing firmware on %s...\n" , device); +/* Re-enter ffu mode and install the firmware */ + multi_cmd->num_of_cmds =2 ; -if (ret) { -perror ("Multi-cmd ioctl failed setting install mode" ); -/* In case multi-cmd ioctl failed before exiting from ffu mode */ -ioctl (dev_fd,MMC_IOC_CMD , &multi_cmd->cmds[3 ]); - goto out; - } +/* set ext_csd to install mode */ + multi_cmd->cmds[1 ].opcode =MMC_SWITCH ; + multi_cmd->cmds[1 ].blksz =0 ; + multi_cmd->cmds[1 ].blocks =0 ; + multi_cmd->cmds[1 ].arg = (MMC_SWITCH_MODE_WRITE_BYTE <<24 ) | + (EXT_CSD_MODE_OPERATION_CODES <<16 ) | + (EXT_CSD_FFU_INSTALL <<8 ) | +EXT_CSD_CMD_SET_NORMAL ; + multi_cmd->cmds[1 ].flags =MMC_RSP_SPI_R1B |MMC_RSP_R1B |MMC_CMD_AC ; + multi_cmd->cmds[1 ].write_flag =1 ; - ret =read_extcsd (dev_fd, ext_csd); -if (ret) { -fprintf (stderr,"Could not read EXT_CSD from %s\n" , device); - goto out; - } +/* send ioctl with multi-cmd */ + ret =ioctl (dev_fd,MMC_IOC_MULTI_CMD , multi_cmd); -/* return status */ - ret = ext_csd[EXT_CSD_FFU_STATUS ]; -if (ret) { -fprintf (stderr,"%s: error %d during FFU install:\n" , device, ret); - goto out; - }else { -fprintf (stderr,"FFU finished successfully\n" ); - } +if (ret) { +perror ("Multi-cmd ioctl failed setting install mode" ); +/* In case multi-cmd ioctl failed before exiting from ffu mode */ +ioctl (dev_fd,MMC_IOC_CMD , &multi_cmd->cmds[3 ]); + goto out; + } + + ret =read_extcsd (dev_fd, ext_csd); +if (ret) { +fprintf (stderr,"Could not read EXT_CSD from %s\n" , device); + goto out; + } + +/* return status */ + ret = ext_csd[EXT_CSD_FFU_STATUS ]; +if (ret) { +fprintf (stderr,"%s: error %d during FFU install:\n" , device, ret); + goto out; + }else { +fprintf (stderr,"FFU finished successfully\n" ); } out:
Signature · 1 line
2.29.0
Adding detail to the description, the functionality of patch from Bruno is described in JESD84-B51A, Chapter 6.6.18, especially in 6th paragraph. --
Aarne Heinonen
-----Original Message-----
From: Bruno Matic <[email protected]>
Sent: Monday, September 19, 2022 7:19 PM
To: [email protected]
Cc: [email protected]; [email protected]; Rossler, Jakob (Nokia - DE/Ulm) <[email protected]>; Heinonen, Aarne (Nokia - FI/Espoo) <[email protected]>; Matic, Bruno (Nokia - DE/Ulm) <[email protected]>
Subject: [PATCH] mmc-utils: correct ffu in case of unsupported MODE_OPERATION_CODES
Move up the return in case MODE_OPERATION_CODES is not supported.
According to the specification when MODE_OPERATION_CODES is not supported no checks should be done against NUM_OF_FW_SEC_PROG.
--- mmc_cmds.c | 82 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 42 insertions(+), 40 deletions(-)
mmc_cmds.c +7 -0
@@ -2897,6 +2897,13 @@ do_retry: goto out; } +/* check mode operation for ffu install*/ +if (!ext_csd[EXT_CSD_FFU_FEATURES ]) { +fprintf (stderr,"Please reboot to complete firmware installation on %s\n" , device); + ret =0 ; + goto out; + } + ret =read_extcsd (dev_fd, ext_csd);if (ret) { fprintf(stderr, "Could not read EXT_CSD from %s\n", device); @@ -2927,49 +2934,44 @@ do_retry:
goto out;
}
- /* check mode operation for ffu install*/
- if (!ext_csd[EXT_CSD_FFU_FEATURES]) {
- fprintf(stderr, "Please reboot to complete firmware installation on %s\n", device);
- } else {
- fprintf(stderr, "Installing firmware on %s...\n", device);
- /* Re-enter ffu mode and install the firmware */
- multi_cmd->num_of_cmds = 2;
-
- /* set ext_csd to install mode */
- multi_cmd->cmds[1].opcode = MMC_SWITCH;
- multi_cmd->cmds[1].blksz = 0;
- multi_cmd->cmds[1].blocks = 0;
- multi_cmd->cmds[1].arg = (MMC_SWITCH_MODE_WRITE_BYTE << 24) |
- (EXT_CSD_MODE_OPERATION_CODES << 16) |
- (EXT_CSD_FFU_INSTALL << 8) |
- EXT_CSD_CMD_SET_NORMAL;
- multi_cmd->cmds[1].flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC;
- multi_cmd->cmds[1].write_flag = 1;
-
- /* send ioctl with multi-cmd */
- ret = ioctl(dev_fd, MMC_IOC_MULTI_CMD, multi_cmd);
+ fprintf(stderr, "Installing firmware on %s...\n", device);
+ /* Re-enter ffu mode and install the firmware */
+ multi_cmd->num_of_cmds = 2;
- if (ret) {
- perror("Multi-cmd ioctl failed setting install mode");
- /* In case multi-cmd ioctl failed before exiting from ffu mode */
- ioctl(dev_fd, MMC_IOC_CMD, &multi_cmd->cmds[3]);
- goto out;
- }
+ /* set ext_csd to install mode */
+ multi_cmd->cmds[1].opcode = MMC_SWITCH;
+ multi_cmd->cmds[1].blksz = 0;
+ multi_cmd->cmds[1].blocks = 0;
+ multi_cmd->cmds[1].arg = (MMC_SWITCH_MODE_WRITE_BYTE << 24) |
+ (EXT_CSD_MODE_OPERATION_CODES << 16) |
+ (EXT_CSD_FFU_INSTALL << 8) |
+ EXT_CSD_CMD_SET_NORMAL;
+ multi_cmd->cmds[1].flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC;
+ multi_cmd->cmds[1].write_flag = 1;
- ret = read_extcsd(dev_fd, ext_csd);
- if (ret) {
- fprintf(stderr, "Could not read EXT_CSD from %s\n", device);
- goto out;
- }
+ /* send ioctl with multi-cmd */
+ ret = ioctl(dev_fd, MMC_IOC_MULTI_CMD, multi_cmd);
- /* return status */
- ret = ext_csd[EXT_CSD_FFU_STATUS];
- if (ret) {
- fprintf(stderr, "%s: error %d during FFU install:\n", device, ret);
- goto out;
- } else {
- fprintf(stderr, "FFU finished successfully\n");
- }
+ if (ret) {
+ perror("Multi-cmd ioctl failed setting install mode");
+ /* In case multi-cmd ioctl failed before exiting from ffu mode */
+ ioctl(dev_fd, MMC_IOC_CMD, &multi_cmd->cmds[3]);
+ goto out;
+ }
+
+ ret = read_extcsd(dev_fd, ext_csd);
+ if (ret) {
+ fprintf(stderr, "Could not read EXT_CSD from %s\n", device);
+ goto out;
+ }
+
+ /* return status */
+ ret = ext_csd[EXT_CSD_FFU_STATUS];
+ if (ret) {
+ fprintf(stderr, "%s: error %d during FFU install:\n", device, ret);
+ goto out;
+ } else {
+ fprintf(stderr, "FFU finished successfully\n");
}
out:
--
2.29.0
Quoted 14 lines
Move up the return in case
MODE_OPERATION_CODESis not supported. According to the specification whenMODE_OPERATION_CODESis not supported no checks should be done againstNUM_OF_FW_SEC_PROG.Signed-off-by Bruno Matic <[email protected]>--- mmc_cmds.c | 82 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 42 insertions(+), 40 deletions(-)mmc_cmds.c +0
-0
mmc_cmds.c do_retry: · line 2901
Quoted 5 lines
mmc_cmds.c +2
-0@@ -2897,6 +2897,13 @@ do_retry: goto out; } +/* check mode operation for ffu install*/ +if (!ext_csd[EXT_CSD_FFU_FEATURES ]) {
You haven't read the ext_csd yet....
Thanks,
Avri
Quoted 100 lines
mmc_cmds.c +5
-0+ fprintf(stderr, "Please reboot to complete firmware installation on %s\n", device); + ret = 0; + goto out; + } + ret =read_extcsd (dev_fd, ext_csd);if (ret) {
fprintf(stderr, "Could not read EXT_CSD from %s\n", device); @@ -
2927,49 +2934,44 @@do_retry:goto out; }mmc_cmds.c +0
-3-/* check mode operation for ffu install*/ -if (!ext_csd[EXT_CSD_FFU_FEATURES ]) { - fprintf(stderr, "Please reboot to complete firmware installation on%s\n", device);
mmc_cmds.c +0
-10- }else { -fprintf (stderr,"Installing firmware on %s...\n" , device); -/* Re-enter ffu mode and install the firmware */ - multi_cmd->num_of_cmds =2 ; - -/* set ext_csd to install mode */ - multi_cmd->cmds[1 ].opcode =MMC_SWITCH ; - multi_cmd->cmds[1 ].blksz =0 ; - multi_cmd->cmds[1 ].blocks =0 ; - multi_cmd->cmds[1 ].arg = (MMC_SWITCH_MODE_WRITE_BYTE <<24 )|
mmc_cmds.c +0
-4- (EXT_CSD_MODE_OPERATION_CODES <<16 ) | - (EXT_CSD_FFU_INSTALL <<8 ) | -EXT_CSD_CMD_SET_NORMAL ; - multi_cmd->cmds[1].flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B |
MMC_CMD_AC;mmc_cmds.c +12
-10- multi_cmd->cmds[1 ].write_flag =1 ; - -/* send ioctl with multi-cmd */ - ret =ioctl (dev_fd,MMC_IOC_MULTI_CMD , multi_cmd); +fprintf (stderr,"Installing firmware on %s...\n" , device); +/* Re-enter ffu mode and install the firmware */ + multi_cmd->num_of_cmds =2 ; -if (ret) { -perror ("Multi-cmd ioctl failed setting install mode" ); -/* In case multi-cmd ioctl failed before exiting from ffu mode */ -ioctl (dev_fd,MMC_IOC_CMD , &multi_cmd->cmds[3 ]); - goto out; - } +/* set ext_csd to install mode */ + multi_cmd->cmds[1 ].opcode =MMC_SWITCH ; + multi_cmd->cmds[1 ].blksz =0 ; + multi_cmd->cmds[1 ].blocks =0 ; + multi_cmd->cmds[1 ].arg = (MMC_SWITCH_MODE_WRITE_BYTE <<24 ) | + (EXT_CSD_MODE_OPERATION_CODES <<16 ) | + (EXT_CSD_FFU_INSTALL <<8 ) | +EXT_CSD_CMD_SET_NORMAL ; + multi_cmd->cmds[1].flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B |
MMC_CMD_AC;mmc_cmds.c +23
-14+ multi_cmd->cmds[1 ].write_flag =1 ; - ret =read_extcsd (dev_fd, ext_csd); -if (ret) { -fprintf (stderr,"Could not read EXT_CSD from %s\n" , device); - goto out; - } +/* send ioctl with multi-cmd */ + ret =ioctl (dev_fd,MMC_IOC_MULTI_CMD , multi_cmd); -/* return status */ - ret = ext_csd[EXT_CSD_FFU_STATUS ]; -if (ret) { -fprintf (stderr,"%s: error %d during FFU install:\n" , device, ret); - goto out; - }else { -fprintf (stderr,"FFU finished successfully\n" ); - } +if (ret) { +perror ("Multi-cmd ioctl failed setting install mode" ); +/* In case multi-cmd ioctl failed before exiting from ffu mode */ +ioctl (dev_fd,MMC_IOC_CMD , &multi_cmd->cmds[3 ]); + goto out; + } + + ret =read_extcsd (dev_fd, ext_csd); +if (ret) { +fprintf (stderr,"Could not read EXT_CSD from %s\n" , device); + goto out; + } + +/* return status */ + ret = ext_csd[EXT_CSD_FFU_STATUS ]; +if (ret) { +fprintf (stderr,"%s: error %d during FFU install:\n" , device, ret); + goto out; + }else { +fprintf (stderr,"FFU finished successfully\n" ); } out: --2.29.0
Quoted 4 lines
Quoted 4 lines
Move up the return in case
MODE_OPERATION_CODESis not supported. According to the specification whenMODE_OPERATION_CODESis not supported no checks should be done againstNUM_OF_FW_SEC_PROG.
And I wasn't able to find in your code, where you are skipping the check against sect_done, In case MODE_OPERATION_CODES field is not supported.
Thanks,
Avri
Quoted 125 lines
Quoted 12 lines
Signed-off-by Bruno Matic <[email protected]>--- mmc_cmds.c | 82 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 42 insertions(+), 40 deletions(-)mmc_cmds.c +0
-0mmc_cmds.c do_retry: · line 2901
Quoted 5 lines
mmc_cmds.c +2
-0@@ -2897,6 +2897,13 @@ do_retry: goto out; } +/* check mode operation for ffu install*/ +if (!ext_csd[EXT_CSD_FFU_FEATURES ]) {You haven't read the
ext_csdyet....Thanks,
AvriQuoted 19 lines
mmc_cmds.c +6
-0+ fprintf(stderr, "Please reboot to complete firmware + installation on %s\n", device); + ret = 0; + goto out; + } + ret =read_extcsd (dev_fd, ext_csd);if (ret) { fprintf(stderr, "Could not read EXT_CSD from %s\n",device); @@ -
2927,49 +2934,44 @@do_retry:goto out; }mmc_cmds.c +0
-3-/* check mode operation for ffu install*/ -if (!ext_csd[EXT_CSD_FFU_FEATURES ]) { - fprintf(stderr, "Please reboot to complete firmware installation on%s\n", device);
mmc_cmds.c do_retry:
Quoted 10 lines
mmc_cmds.c +0
-10- }else { -fprintf (stderr,"Installing firmware on %s...\n" , device); -/* Re-enter ffu mode and install the firmware */ - multi_cmd->num_of_cmds =2 ; - -/* set ext_csd to install mode */ - multi_cmd->cmds[1 ].opcode =MMC_SWITCH ; - multi_cmd->cmds[1 ].blksz =0 ; - multi_cmd->cmds[1 ].blocks =0 ; - multi_cmd->cmds[1].arg = (MMC_SWITCH_MODE_WRITE_BYTE <<24)
Quoted 73 lines
|
mmc_cmds.c +0
-4- (EXT_CSD_MODE_OPERATION_CODES <<16 ) | - (EXT_CSD_FFU_INSTALL <<8 ) | -EXT_CSD_CMD_SET_NORMAL ; - multi_cmd->cmds[1].flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B |
MMC_CMD_AC;mmc_cmds.c +12
-10- multi_cmd->cmds[1 ].write_flag =1 ; - -/* send ioctl with multi-cmd */ - ret =ioctl (dev_fd,MMC_IOC_MULTI_CMD , multi_cmd); +fprintf (stderr,"Installing firmware on %s...\n" , device); +/* Re-enter ffu mode and install the firmware */ + multi_cmd->num_of_cmds =2 ; -if (ret) { -perror ("Multi-cmd ioctl failed setting install mode" ); -/* In case multi-cmd ioctl failed before exiting from ffu mode */ -ioctl (dev_fd,MMC_IOC_CMD , &multi_cmd->cmds[3 ]); - goto out; - } +/* set ext_csd to install mode */ + multi_cmd->cmds[1 ].opcode =MMC_SWITCH ; + multi_cmd->cmds[1 ].blksz =0 ; + multi_cmd->cmds[1 ].blocks =0 ; + multi_cmd->cmds[1 ].arg = (MMC_SWITCH_MODE_WRITE_BYTE <<24 ) | + (EXT_CSD_MODE_OPERATION_CODES <<16 ) | + (EXT_CSD_FFU_INSTALL <<8 ) | +EXT_CSD_CMD_SET_NORMAL ; + multi_cmd->cmds[1].flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B |
MMC_CMD_AC;mmc_cmds.c +23
-14+ multi_cmd->cmds[1 ].write_flag =1 ; - ret =read_extcsd (dev_fd, ext_csd); -if (ret) { -fprintf (stderr,"Could not read EXT_CSD from %s\n" , device); - goto out; - } +/* send ioctl with multi-cmd */ + ret =ioctl (dev_fd,MMC_IOC_MULTI_CMD , multi_cmd); -/* return status */ - ret = ext_csd[EXT_CSD_FFU_STATUS ]; -if (ret) { -fprintf (stderr,"%s: error %d during FFU install:\n" , device, ret); - goto out; - }else { -fprintf (stderr,"FFU finished successfully\n" ); - } +if (ret) { +perror ("Multi-cmd ioctl failed setting install mode" ); +/* In case multi-cmd ioctl failed before exiting from ffu mode */ +ioctl (dev_fd,MMC_IOC_CMD , &multi_cmd->cmds[3 ]); + goto out; + } + + ret =read_extcsd (dev_fd, ext_csd); +if (ret) { +fprintf (stderr,"Could not read EXT_CSD from %s\n" , device); + goto out; + } + +/* return status */ + ret = ext_csd[EXT_CSD_FFU_STATUS ]; +if (ret) { +fprintf (stderr,"%s: error %d during FFU install:\n" , device, ret); + goto out; + }else { +fprintf (stderr,"FFU finished successfully\n" ); } out: --2.29.0
Hi Avri,
ext_csd is read in line 2789, close to the beginning of do_ffu. The mode check and skip is done by the following snippet in the patch:
/* check mode operation for ffu install*/
if (!ext_csd[EXT_CSD_FFU_FEATURES]) {
fprintf(stderr, "Please reboot to complete firmware installation on %s\n", device);
ret = 0;
goto out;
}According to the spec when the FFU_FETURES field is 0 then MODE_OPERATION_CODES is not supported and sect_done checks should be skipped with no error.
Further reads of ext_csd are done in case FFU_FETURES field is 1 - to check the NUM_OF_FW_SEC_PROG value.
I admit that the patch looks ugly but that is because the check was moved up in the code from an if-else block that had to be refactored.
Best regards,
Bruno Matić
-----Original Message-----
From: Avri Altman <[email protected]>
Sent: Monday, September 19, 2022 11:49 PM
To: Avri Altman <[email protected]>; Matic, Bruno (Nokia - DE/Ulm) <[email protected]>; [email protected]
Cc: [email protected]; Rossler, Jakob (Nokia - DE/Ulm) <[email protected]>; Heinonen, Aarne (Nokia - FI/Espoo) <[email protected]>
Subject: RE: [PATCH] mmc-utils: correct ffu in case of unsupported MODE_OPERATION_CODES
Quoted 4 lines
Quoted 4 lines
Move up the return in case
MODE_OPERATION_CODESis not supported. According to the specification whenMODE_OPERATION_CODESis not supported no checks should be done againstNUM_OF_FW_SEC_PROG.
And I wasn't able to find in your code, where you are skipping the check against sect_done, In case MODE_OPERATION_CODES field is not supported.
Thanks,
Avri
Quoted 124 lines
Quoted 11 lines
Signed-off-by Bruno Matic <[email protected]>--- mmc_cmds.c | 82 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 42 insertions(+), 40 deletions(-)mmc_cmds.c do_retry: · line 2901
Quoted 5 lines
mmc_cmds.c +2
-0@@ -2897,6 +2897,13 @@ do_retry: goto out; } +/* check mode operation for ffu install*/ +if (!ext_csd[EXT_CSD_FFU_FEATURES ]) {You haven't read the
ext_csdyet....Thanks,
AvriQuoted 19 lines
mmc_cmds.c +6
-0+ fprintf(stderr, "Please reboot to complete firmware + installation on %s\n", device); + ret = 0; + goto out; + } + ret =read_extcsd (dev_fd, ext_csd);if (ret) { fprintf(stderr, "Could not read EXT_CSD from %s\n",device); @@ -
2927,49 +2934,44 @@do_retry:goto out; }mmc_cmds.c +0
-3-/* check mode operation for ffu install*/ -if (!ext_csd[EXT_CSD_FFU_FEATURES ]) { - fprintf(stderr, "Please reboot to complete firmware installation on%s\n", device);
mmc_cmds.c do_retry:
Quoted 10 lines
mmc_cmds.c +0
-10- }else { -fprintf (stderr,"Installing firmware on %s...\n" , device); -/* Re-enter ffu mode and install the firmware */ - multi_cmd->num_of_cmds =2 ; - -/* set ext_csd to install mode */ - multi_cmd->cmds[1 ].opcode =MMC_SWITCH ; - multi_cmd->cmds[1 ].blksz =0 ; - multi_cmd->cmds[1 ].blocks =0 ; - multi_cmd->cmds[1].arg = (MMC_SWITCH_MODE_WRITE_BYTE <<24)
Quoted 73 lines
|
mmc_cmds.c +0
-4- (EXT_CSD_MODE_OPERATION_CODES <<16 ) | - (EXT_CSD_FFU_INSTALL <<8 ) | -EXT_CSD_CMD_SET_NORMAL ; - multi_cmd->cmds[1].flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B |
MMC_CMD_AC;mmc_cmds.c +12
-10- multi_cmd->cmds[1 ].write_flag =1 ; - -/* send ioctl with multi-cmd */ - ret =ioctl (dev_fd,MMC_IOC_MULTI_CMD , multi_cmd); +fprintf (stderr,"Installing firmware on %s...\n" , device); +/* Re-enter ffu mode and install the firmware */ + multi_cmd->num_of_cmds =2 ; -if (ret) { -perror ("Multi-cmd ioctl failed setting install mode" ); -/* In case multi-cmd ioctl failed before exiting from ffu mode */ -ioctl (dev_fd,MMC_IOC_CMD , &multi_cmd->cmds[3 ]); - goto out; - } +/* set ext_csd to install mode */ + multi_cmd->cmds[1 ].opcode =MMC_SWITCH ; + multi_cmd->cmds[1 ].blksz =0 ; + multi_cmd->cmds[1 ].blocks =0 ; + multi_cmd->cmds[1 ].arg = (MMC_SWITCH_MODE_WRITE_BYTE <<24 ) | + (EXT_CSD_MODE_OPERATION_CODES <<16 ) | + (EXT_CSD_FFU_INSTALL <<8 ) | +EXT_CSD_CMD_SET_NORMAL ; + multi_cmd->cmds[1].flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B |
MMC_CMD_AC;mmc_cmds.c +23
-14+ multi_cmd->cmds[1 ].write_flag =1 ; - ret =read_extcsd (dev_fd, ext_csd); -if (ret) { -fprintf (stderr,"Could not read EXT_CSD from %s\n" , device); - goto out; - } +/* send ioctl with multi-cmd */ + ret =ioctl (dev_fd,MMC_IOC_MULTI_CMD , multi_cmd); -/* return status */ - ret = ext_csd[EXT_CSD_FFU_STATUS ]; -if (ret) { -fprintf (stderr,"%s: error %d during FFU install:\n" , device, ret); - goto out; - }else { -fprintf (stderr,"FFU finished successfully\n" ); - } +if (ret) { +perror ("Multi-cmd ioctl failed setting install mode" ); +/* In case multi-cmd ioctl failed before exiting from ffu mode */ +ioctl (dev_fd,MMC_IOC_CMD , &multi_cmd->cmds[3 ]); + goto out; + } + + ret =read_extcsd (dev_fd, ext_csd); +if (ret) { +fprintf (stderr,"Could not read EXT_CSD from %s\n" , device); + goto out; + } + +/* return status */ + ret = ext_csd[EXT_CSD_FFU_STATUS ]; +if (ret) { +fprintf (stderr,"%s: error %d during FFU install:\n" , device, ret); + goto out; + }else { +fprintf (stderr,"FFU finished successfully\n" ); } out: --2.29.0
Quoted 3 lines
Hi Avri,
ext_csdis read in line 2789, close to the beginning ofdo_ffu.
Ahha - you are in the do_retry clause. Ok.
Quoted 8 lines
The mode check and skip is done by the following snippet in the patch:
/* check mode operation for ffu install*/ if (!ext_csd[EXT_CSD_FFU_FEATURES]) { fprintf(stderr, "Please reboot to complete firmware installation on %s\n", device); ret = 0; goto out; }
Quoted 5 lines
According to the spec when the
FFU_FETURESfield is 0 thenMODE_OPERATION_CODESis not supported andsect_donechecks should be skipped with no error.
Further reads ofext_csdare done in caseFFU_FETURESfield is 1 - to check theNUM_OF_FW_SEC_PROGvalue.
Correct.
Quoted 3 lines
I admit that the patch looks ugly but that is because the check was moved up in the code from an if-else block that had to be refactored.
Actually I find it quite elegant.
Please elaborate the comment above if (!ext_csd[EXT_CSD_FFU_FEATURES]) with your above explanation. Also please add a fixes tag.
Thanks,
Avri
Quoted 156 lines
Best regards,
Bruno Matić-----Original Message-----
From: Avri Altman <[email protected]>
Sent: Monday, September 19, 2022 11:49 PM
To: Avri Altman <[email protected]>; Matic, Bruno (Nokia - DE/Ulm) <[email protected]>; [email protected]
Cc: [email protected]; Rossler, Jakob (Nokia - DE/Ulm) <[email protected]>; Heinonen, Aarne (Nokia - FI/Espoo) <[email protected]>
Subject: RE: [PATCH] mmc-utils: correct ffu in case of unsupportedMODE_OPERATION_CODESQuoted 4 lines
Quoted 4 lines
Move up the return in case
MODE_OPERATION_CODESis not supported. According to the specification whenMODE_OPERATION_CODESis not supported no checks should be done againstNUM_OF_FW_SEC_PROG.And I wasn't able to find in your code, where you are skipping the check against
sect_done, In caseMODE_OPERATION_CODESfield is not supported.Thanks,
AvriQuoted 14 lines
Quoted 14 lines
Signed-off-by Bruno Matic <[email protected]>--- mmc_cmds.c | 82 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 42 insertions(+), 40 deletions(-)mmc_cmds.c +0
-0@@ -2897,6 +2897,13 @@ do_retry: goto out; }Quoted 25 lines
mmc_cmds.c do_retry: · line 2901
Quoted 2 lines
mmc_cmds.c +2
-0+/* check mode operation for ffu install*/ +if (!ext_csd[EXT_CSD_FFU_FEATURES ]) {You haven't read the
ext_csdyet....Thanks,
AvriQuoted 18 lines
mmc_cmds.c +6
-0+ fprintf(stderr, "Please reboot to complete firmware + installation on %s\n", device); + ret = 0; + goto out; + } + ret =read_extcsd (dev_fd, ext_csd);if (ret) { fprintf(stderr, "Could not read EXT_CSD from %s\n",device); @@ -
2927,49 +2934,44 @@do_retry:goto out; }mmc_cmds.c +0
-3-/* check mode operation for ffu install*/ -if (!ext_csd[EXT_CSD_FFU_FEATURES ]) { - fprintf(stderr, "Please reboot to complete firmware installationon
Quoted 11 lines
mmc_cmds.c do_retry:
Quoted 11 lines
%s\n", device);
mmc_cmds.c +0
-10- }else { -fprintf (stderr,"Installing firmware on %s...\n" , device); -/* Re-enter ffu mode and install the firmware */ - multi_cmd->num_of_cmds =2 ; - -/* set ext_csd to install mode */ - multi_cmd->cmds[1 ].opcode =MMC_SWITCH ; - multi_cmd->cmds[1 ].blksz =0 ; - multi_cmd->cmds[1 ].blocks =0 ; - multi_cmd->cmds[1].arg = (MMC_SWITCH_MODE_WRITE_BYTE<<
Quoted 6 lines
24)
Quoted 5 lines
|
mmc_cmds.c +0
-4- (EXT_CSD_MODE_OPERATION_CODES <<16 ) | - (EXT_CSD_FFU_INSTALL <<8 ) | -EXT_CSD_CMD_SET_NORMAL ; - multi_cmd->cmds[1].flags = MMC_RSP_SPI_R1B |
MMC_RSP_R1B|Quoted 9 lines
Quoted 9 lines
MMC_CMD_AC;mmc_cmds.c +3
-4- multi_cmd->cmds[1 ].write_flag =1 ; - -/* send ioctl with multi-cmd */ - ret =ioctl (dev_fd,MMC_IOC_MULTI_CMD , multi_cmd); +fprintf (stderr,"Installing firmware on %s...\n" , device); +/* Re-enter ffu mode and install the firmware */ + multi_cmd->num_of_cmds =2 ;Quoted 3 lines
mmc_cmds.c do_retry:
Quoted 3 lines
mmc_cmds.c +0
-3-if (ret) { -perror ("Multi-cmd ioctl failed setting install mode" ); -/* In case multi-cmd ioctl failed before exiting from ffu mode */
Quoted 8 lines
mmc_cmds.c do_retry:
Quoted 8 lines
mmc_cmds.c +5
-3-ioctl (dev_fd,MMC_IOC_CMD , &multi_cmd->cmds[3 ]); - goto out; - } +/* set ext_csd to install mode */ + multi_cmd->cmds[1 ].opcode =MMC_SWITCH ; + multi_cmd->cmds[1 ].blksz =0 ; + multi_cmd->cmds[1 ].blocks =0 ; + multi_cmd->cmds[1].arg = (MMC_SWITCH_MODE_WRITE_BYTE <<24) |
Quoted 15 lines
Quoted 15 lines
mmc_cmds.c +4
-0+ (EXT_CSD_MODE_OPERATION_CODES <<16 ) | + (EXT_CSD_FFU_INSTALL <<8 ) | +EXT_CSD_CMD_SET_NORMAL ; + multi_cmd->cmds[1].flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B |
MMC_CMD_AC;mmc_cmds.c +3
-5+ multi_cmd->cmds[1 ].write_flag =1 ; - ret =read_extcsd (dev_fd, ext_csd); -if (ret) { -fprintf (stderr,"Could not read EXT_CSD from %s\n" , device); - goto out; - } +/* send ioctl with multi-cmd */ + ret =ioctl (dev_fd,MMC_IOC_MULTI_CMD , multi_cmd);Quoted 4 lines
mmc_cmds.c do_retry:
Quoted 4 lines
mmc_cmds.c +0
-4-/* return status */ - ret = ext_csd[EXT_CSD_FFU_STATUS ]; -if (ret) { - fprintf(stderr, "%s: error %d during FFU install:\n", device,ret);
Quoted 29 lines
Quoted 29 lines
mmc_cmds.c +20
-5- goto out; - }else { -fprintf (stderr,"FFU finished successfully\n" ); - } +if (ret) { +perror ("Multi-cmd ioctl failed setting install mode" ); +/* In case multi-cmd ioctl failed before exiting from ffu mode */ +ioctl (dev_fd,MMC_IOC_CMD , &multi_cmd->cmds[3 ]); + goto out; + } + + ret =read_extcsd (dev_fd, ext_csd); +if (ret) { +fprintf (stderr,"Could not read EXT_CSD from %s\n" , device); + goto out; + } + +/* return status */ + ret = ext_csd[EXT_CSD_FFU_STATUS ]; +if (ret) { +fprintf (stderr,"%s: error %d during FFU install:\n" , device, ret); + goto out; + }else { +fprintf (stderr,"FFU finished successfully\n" ); } out: --2.29.0
PATCH v2 1/1 mmc-utils: Fix ffu in case of unsupported MODE_OPERATION_CODES
Move up the return in case MODE_OPERATION_CODES is not supported. According to the specification when MODE_OPERATION_CODES is not supported no checks should be done against NUM_OF_FW_SEC_PROG.
Changes in v2:
- better explanation in the comment
--- mmc_cmds.c | 85 +++++++++++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 40 deletions(-)
mmc_cmds.c +45 -40
@@ -2897,6 +2897,16 @@ do_retry: goto out; } +/* +* By spec - check if mode operation codes are supported in ffu features, +* if not then skip checking number of sectors programmed after install +*/ +if (!ext_csd[EXT_CSD_FFU_FEATURES ]) { +fprintf (stderr,"Please reboot to complete firmware installation on %s\n" , device); + ret =0 ; + goto out; + } + ret =read_extcsd (dev_fd, ext_csd);if (ret) {fprintf (stderr,"Could not read EXT_CSD from %s\n" , device);
@@ -2927,49 +2937,44 @@ do_retry: goto out; } -/* check mode operation for ffu install*/ -if (!ext_csd[EXT_CSD_FFU_FEATURES ]) { -fprintf (stderr,"Please reboot to complete firmware installation on %s\n" , device); - }else { -fprintf (stderr,"Installing firmware on %s...\n" , device); -/* Re-enter ffu mode and install the firmware */ - multi_cmd->num_of_cmds =2 ; - -/* set ext_csd to install mode */ - multi_cmd->cmds[1 ].opcode =MMC_SWITCH ; - multi_cmd->cmds[1 ].blksz =0 ; - multi_cmd->cmds[1 ].blocks =0 ; - multi_cmd->cmds[1 ].arg = (MMC_SWITCH_MODE_WRITE_BYTE <<24 ) | - (EXT_CSD_MODE_OPERATION_CODES <<16 ) | - (EXT_CSD_FFU_INSTALL <<8 ) | -EXT_CSD_CMD_SET_NORMAL ; - multi_cmd->cmds[1 ].flags =MMC_RSP_SPI_R1B |MMC_RSP_R1B |MMC_CMD_AC ; - multi_cmd->cmds[1 ].write_flag =1 ; - -/* send ioctl with multi-cmd */ - ret =ioctl (dev_fd,MMC_IOC_MULTI_CMD , multi_cmd); +fprintf (stderr,"Installing firmware on %s...\n" , device); +/* Re-enter ffu mode and install the firmware */ + multi_cmd->num_of_cmds =2 ; -if (ret) { -perror ("Multi-cmd ioctl failed setting install mode" ); -/* In case multi-cmd ioctl failed before exiting from ffu mode */ -ioctl (dev_fd,MMC_IOC_CMD , &multi_cmd->cmds[3 ]); - goto out; - } +/* set ext_csd to install mode */ + multi_cmd->cmds[1 ].opcode =MMC_SWITCH ; + multi_cmd->cmds[1 ].blksz =0 ; + multi_cmd->cmds[1 ].blocks =0 ; + multi_cmd->cmds[1 ].arg = (MMC_SWITCH_MODE_WRITE_BYTE <<24 ) | + (EXT_CSD_MODE_OPERATION_CODES <<16 ) | + (EXT_CSD_FFU_INSTALL <<8 ) | +EXT_CSD_CMD_SET_NORMAL ; + multi_cmd->cmds[1 ].flags =MMC_RSP_SPI_R1B |MMC_RSP_R1B |MMC_CMD_AC ; + multi_cmd->cmds[1 ].write_flag =1 ; - ret =read_extcsd (dev_fd, ext_csd); -if (ret) { -fprintf (stderr,"Could not read EXT_CSD from %s\n" , device); - goto out; - } +/* send ioctl with multi-cmd */ + ret =ioctl (dev_fd,MMC_IOC_MULTI_CMD , multi_cmd); -/* return status */ - ret = ext_csd[EXT_CSD_FFU_STATUS ]; -if (ret) { -fprintf (stderr,"%s: error %d during FFU install:\n" , device, ret); - goto out; - }else { -fprintf (stderr,"FFU finished successfully\n" ); - } +if (ret) { +perror ("Multi-cmd ioctl failed setting install mode" ); +/* In case multi-cmd ioctl failed before exiting from ffu mode */ +ioctl (dev_fd,MMC_IOC_CMD , &multi_cmd->cmds[3 ]); + goto out; + } + + ret =read_extcsd (dev_fd, ext_csd); +if (ret) { +fprintf (stderr,"Could not read EXT_CSD from %s\n" , device); + goto out; + } + +/* return status */ + ret = ext_csd[EXT_CSD_FFU_STATUS ]; +if (ret) { +fprintf (stderr,"%s: error %d during FFU install:\n" , device, ret); + goto out; + }else { +fprintf (stderr,"FFU finished successfully\n" ); } out:
Signature · 1 line
2.29.0
RE: [PATCH v2] mmc-utils: Fix ffu in case of unsupported MODE_OPERATION_CODES
Quoted 7 lines
Move up the return in case
MODE_OPERATION_CODESis not supported. According to the specification whenMODE_OPERATION_CODESis not supported no checks should be done againstNUM_OF_FW_SEC_PROG.Changes in v2:
- better explanation in the comment
Thanks,
Avri
Quoted 120 lines
Signed-off-by Bruno Matic <[email protected]>--- mmc_cmds.c | 85 +++++++++++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 40 deletions(-)mmc_cmds.c +10
-0@@ -2897,6 +2897,16 @@ do_retry: goto out; } +/* +* By spec - check if mode operation codes are supported in ffu features, +* if not then skip checking number of sectors programmed after install +*/ +if (!ext_csd[EXT_CSD_FFU_FEATURES ]) { + fprintf(stderr, "Please reboot to complete firmware installation on %s\n", device); + ret = 0; + goto out; + } + ret =read_extcsd (dev_fd, ext_csd);if (ret) {
fprintf(stderr, "Could not read EXT_CSD from %s\n", device); @@ -
2927,49 +2937,44 @@do_retry:goto out; }mmc_cmds.c +0
-3-/* check mode operation for ffu install*/ -if (!ext_csd[EXT_CSD_FFU_FEATURES ]) { - fprintf(stderr, "Please reboot to complete firmware installation on%s\n", device);
mmc_cmds.c +0
-10- }else { -fprintf (stderr,"Installing firmware on %s...\n" , device); -/* Re-enter ffu mode and install the firmware */ - multi_cmd->num_of_cmds =2 ; - -/* set ext_csd to install mode */ - multi_cmd->cmds[1 ].opcode =MMC_SWITCH ; - multi_cmd->cmds[1 ].blksz =0 ; - multi_cmd->cmds[1 ].blocks =0 ; - multi_cmd->cmds[1].arg = (MMC_SWITCH_MODE_WRITE_BYTE <<24) |
mmc_cmds.c +0
-4- (EXT_CSD_MODE_OPERATION_CODES <<16 ) | - (EXT_CSD_FFU_INSTALL <<8 ) | -EXT_CSD_CMD_SET_NORMAL ; - multi_cmd->cmds[1].flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B |
MMC_CMD_AC;mmc_cmds.c +12
-10- multi_cmd->cmds[1 ].write_flag =1 ; - -/* send ioctl with multi-cmd */ - ret =ioctl (dev_fd,MMC_IOC_MULTI_CMD , multi_cmd); +fprintf (stderr,"Installing firmware on %s...\n" , device); +/* Re-enter ffu mode and install the firmware */ + multi_cmd->num_of_cmds =2 ; -if (ret) { -perror ("Multi-cmd ioctl failed setting install mode" ); -/* In case multi-cmd ioctl failed before exiting from ffu mode */ -ioctl (dev_fd,MMC_IOC_CMD , &multi_cmd->cmds[3 ]); - goto out; - } +/* set ext_csd to install mode */ + multi_cmd->cmds[1 ].opcode =MMC_SWITCH ; + multi_cmd->cmds[1 ].blksz =0 ; + multi_cmd->cmds[1 ].blocks =0 ; + multi_cmd->cmds[1 ].arg = (MMC_SWITCH_MODE_WRITE_BYTE <<24 ) | + (EXT_CSD_MODE_OPERATION_CODES <<16 ) | + (EXT_CSD_FFU_INSTALL <<8 ) | +EXT_CSD_CMD_SET_NORMAL ; + multi_cmd->cmds[1].flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B |
MMC_CMD_AC;mmc_cmds.c +23
-14+ multi_cmd->cmds[1 ].write_flag =1 ; - ret =read_extcsd (dev_fd, ext_csd); -if (ret) { -fprintf (stderr,"Could not read EXT_CSD from %s\n" , device); - goto out; - } +/* send ioctl with multi-cmd */ + ret =ioctl (dev_fd,MMC_IOC_MULTI_CMD , multi_cmd); -/* return status */ - ret = ext_csd[EXT_CSD_FFU_STATUS ]; -if (ret) { -fprintf (stderr,"%s: error %d during FFU install:\n" , device, ret); - goto out; - }else { -fprintf (stderr,"FFU finished successfully\n" ); - } +if (ret) { +perror ("Multi-cmd ioctl failed setting install mode" ); +/* In case multi-cmd ioctl failed before exiting from ffu mode */ +ioctl (dev_fd,MMC_IOC_CMD , &multi_cmd->cmds[3 ]); + goto out; + } + + ret =read_extcsd (dev_fd, ext_csd); +if (ret) { +fprintf (stderr,"Could not read EXT_CSD from %s\n" , device); + goto out; + } + +/* return status */ + ret = ext_csd[EXT_CSD_FFU_STATUS ]; +if (ret) { +fprintf (stderr,"%s: error %d during FFU install:\n" , device, ret); + goto out; + }else { +fprintf (stderr,"FFU finished successfully\n" ); } out: --2.29.0
Ulf Hansson
AppliedRe: [PATCH v2] mmc-utils: Fix ffu in case of unsupported MODE_OPERATION_CODES
Quoted 6 lines · Avri Altman
Quoted 6 lines
Move up the return in case
MODE_OPERATION_CODESis not supported. According to the specification whenMODE_OPERATION_CODESis not supported no checks should be done againstNUM_OF_FW_SEC_PROG.
Quoted 9 lines
Quoted 2 lines
Changes in v2:
- better explanation in the commentFixes 89cd01ed865a (mmc_utils: add ffu support)Thanks,
AvriQuoted 2 lines
Signed-off-by Bruno Matic <[email protected]>
Applied to git.kernel.org/pub/scm//utils/mmc/mmc-utils.git master, thanks!
Avri, I assume you are happy with the partch, but just forgot to add your reviewed-by-tag? I added it, but please tell me if I should drop it.
Kind regards
Uffe
Quoted 119 lines
Quoted 118 lines
--- mmc_cmds.c | 85 +++++++++++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 40 deletions(-)mmc_cmds.c +10
-0@@ -2897,6 +2897,16 @@ do_retry: goto out; } +/* +* By spec - check if mode operation codes are supported in ffu features, +* if not then skip checking number of sectors programmed after install +*/ +if (!ext_csd[EXT_CSD_FFU_FEATURES ]) { + fprintf(stderr, "Please reboot to complete firmware installation on %s\n", device); + ret = 0; + goto out; + } + ret =read_extcsd (dev_fd, ext_csd);if (ret) {
fprintf(stderr, "Could not read EXT_CSD from %s\n", device); @@ -
2927,49 +2937,44 @@do_retry:goto out; }mmc_cmds.c +0
-3-/* check mode operation for ffu install*/ -if (!ext_csd[EXT_CSD_FFU_FEATURES ]) { - fprintf(stderr, "Please reboot to complete firmware installation on%s\n", device);
mmc_cmds.c +0
-10- }else { -fprintf (stderr,"Installing firmware on %s...\n" , device); -/* Re-enter ffu mode and install the firmware */ - multi_cmd->num_of_cmds =2 ; - -/* set ext_csd to install mode */ - multi_cmd->cmds[1 ].opcode =MMC_SWITCH ; - multi_cmd->cmds[1 ].blksz =0 ; - multi_cmd->cmds[1 ].blocks =0 ; - multi_cmd->cmds[1].arg = (MMC_SWITCH_MODE_WRITE_BYTE <<24) |
mmc_cmds.c +0
-4- (EXT_CSD_MODE_OPERATION_CODES <<16 ) | - (EXT_CSD_FFU_INSTALL <<8 ) | -EXT_CSD_CMD_SET_NORMAL ; - multi_cmd->cmds[1].flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B |
MMC_CMD_AC;mmc_cmds.c +12
-10- multi_cmd->cmds[1 ].write_flag =1 ; - -/* send ioctl with multi-cmd */ - ret =ioctl (dev_fd,MMC_IOC_MULTI_CMD , multi_cmd); +fprintf (stderr,"Installing firmware on %s...\n" , device); +/* Re-enter ffu mode and install the firmware */ + multi_cmd->num_of_cmds =2 ; -if (ret) { -perror ("Multi-cmd ioctl failed setting install mode" ); -/* In case multi-cmd ioctl failed before exiting from ffu mode */ -ioctl (dev_fd,MMC_IOC_CMD , &multi_cmd->cmds[3 ]); - goto out; - } +/* set ext_csd to install mode */ + multi_cmd->cmds[1 ].opcode =MMC_SWITCH ; + multi_cmd->cmds[1 ].blksz =0 ; + multi_cmd->cmds[1 ].blocks =0 ; + multi_cmd->cmds[1 ].arg = (MMC_SWITCH_MODE_WRITE_BYTE <<24 ) | + (EXT_CSD_MODE_OPERATION_CODES <<16 ) | + (EXT_CSD_FFU_INSTALL <<8 ) | +EXT_CSD_CMD_SET_NORMAL ; + multi_cmd->cmds[1].flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B |
MMC_CMD_AC;mmc_cmds.c +23
-14+ multi_cmd->cmds[1 ].write_flag =1 ; - ret =read_extcsd (dev_fd, ext_csd); -if (ret) { -fprintf (stderr,"Could not read EXT_CSD from %s\n" , device); - goto out; - } +/* send ioctl with multi-cmd */ + ret =ioctl (dev_fd,MMC_IOC_MULTI_CMD , multi_cmd); -/* return status */ - ret = ext_csd[EXT_CSD_FFU_STATUS ]; -if (ret) { -fprintf (stderr,"%s: error %d during FFU install:\n" , device, ret); - goto out; - }else { -fprintf (stderr,"FFU finished successfully\n" ); - } +if (ret) { +perror ("Multi-cmd ioctl failed setting install mode" ); +/* In case multi-cmd ioctl failed before exiting from ffu mode */ +ioctl (dev_fd,MMC_IOC_CMD , &multi_cmd->cmds[3 ]); + goto out; + } + + ret =read_extcsd (dev_fd, ext_csd); +if (ret) { +fprintf (stderr,"Could not read EXT_CSD from %s\n" , device); + goto out; + } + +/* return status */ + ret = ext_csd[EXT_CSD_FFU_STATUS ]; +if (ret) { +fprintf (stderr,"%s: error %d during FFU install:\n" , device, ret); + goto out; + }else { +fprintf (stderr,"FFU finished successfully\n" ); } out: --2.29.0