Hi Avri, Ulf Following the discussions with Avri at the 2024 ALPSS, I am submitting these patches to introduce multiple FFU modes, as defined in the eMMC specification 6.6.18. The new FFU implementation can support diverse vendor requirements and operational conditions. The key benefits include: 1, The host can select the most appropriate update mode based on device capabilities and firmware size. 2, The patches ensure that firmware downloads are treated as a single, uninterrupted operation, preventing partial updates that could compromise device stability. 3, Some new modes keep the device in FFU mode throughout the process, reducing the risk of premature exits and update failures. By supporting these modes, we can better accommodate varying firmware sizes and ensure smoother, more reliable firmware updates across different scenarios. Summary of Changes: FFU mode 1: Uses CMD6 to enter FFU mode, CMD23 to set the block count, CMD25 for multiple-block write, and CMD6 to exit FFU mode. This mode may exit FFU mode during the download if the firmware size exceeds the chunk size. FFU mode 2: Similar to mode 1, but repeats CMD23+CMD25 for each chunk, ensuring FFU mode is maintained throughout the firmware download. FFU mode is only exited after the entire firmware has been successfully downloaded. FFU mode 3: use CMD25+CMD12 for open-ended multiple-block write Introduces a method using CMD25 for open-ended multiple-block writes followed by CMD12 to stop the transmission. This allows for a smoother and more continuous firmware bundle download. FFU mode 4: use CMD6 and CMD24 for single-block write A new mode that uses CMD6 to enter FFU mode, CMD24 for single-block writes, and CMD6 to exit FFU mode after each write cycle. This ensures granular control over each block but may introduce more frequent mode transitions. FFU mode 5: use CMD6 and repeated CMD24 sequence In this mode, CMD6 is used to enter FFU mode, followed by repeated CMD24 single-block writes. After all firmware data is written, CMD6 is used to exit FFU mode, ensuring an atomic and uninterrupted download process. Kind regards, Bean Bean Huo (5): mmc_utils: Extract FFU code to mmc_ffu.c for future FFU mode expansion mmc-utils: Add FFU mode 2 mmc-utils: Add new FFU mode using CMD25+CMD12 for Open-ended write download FW mmc-utils: Added FFU mode 4 that uses CMD6 and CMD24 for single-block firmware download mmc-utils: add FFU mode 5 for firmware download using CMD6 and repeated CMD24 command Makefile | 1 + mmc.c | 14 +- mmc.h | 1 + mmc_cmds.c | 274 ------------------------------------- mmc_cmds.h | 52 +++++++ mmc_ffu.c | 392 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 456 insertions(+), 278 deletions(-) create mode 100644 mmc_ffu.c -- 2.34.1