mbox series

[v1,0/5] Add multiple FFU modes based on eMMC specification 6.6.18 for flexible firmware updates

Message ID 20241001203811.26279-1-beanhuo@iokpp.de
Headers show
Series Add multiple FFU modes based on eMMC specification 6.6.18 for flexible firmware updates | expand

Message

Bean Huo Oct. 1, 2024, 8:38 p.m. UTC
Hi Avri,

Based on our discussion during 2024 ALPSS, here are the patches for eMMC FFU.

This patch series introduces several new FFU modes, as outlined in the eMMC specification 6.6.18,
to enhance the flexibility and reliability of firmware downloads to eMMC devices in the filed.

The purpose of these patches is to offer different FFU modes to compatible with different vendors,
allowing for various command sequences to optimize for different operational needs, ensuring both
atomicity and smoothness of firmware updates. These additional FFU modes provide multiple options
for performing firmware updates under different circumstances:

1, The host can choose between different update strategies depending on the device’s capabilities
and the size of the firmware bundle.
2, Ensuring that firmware downloads are treated as a single operation, preventing partial updates
that could leave the device in an unstable state.
3, Some modes are designed to keep the device in FFU mode throughout the entire process, minimizing
the risk of premature exits or failures during updates.

By supporting these modes, we aim to enhance the robustness and flexibility of the FFU process,
accommodating a wider range of firmware sizes and ensuring smoother, more reliable FFU in the field.


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 commands

 Makefile   |   1 +
 mmc.c      |  14 +-
 mmc.h      |   1 +
 mmc_cmds.c | 274 --------------------------------------
 mmc_cmds.h |  52 ++++++++
 mmc_ffu.c  | 385 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 449 insertions(+), 278 deletions(-)
 create mode 100644 mmc_ffu.c