Changes between Version 2 and Version 3 of MMC

12/01/2017 04:34:36 PM (5 years ago)
Tim Harvey

added eMMC details


  • MMC

    v2 v3  
    33= !MultiMediaCard (MMC) =
    44A !MultiMediaCard (MMC) is a memory card standard used for solid-state storage typically used in digital cameras, smart-phones, and portable media players. There are several form-factors of cards that fall under the specification. MMC cards use the SDIO data bus standard.
     8== Embedded Multi-Media Controller (eMMC) ==
     9Embedded Multi-Media Controller (eMMC) refers to a package consisting of both flash memory and a flash memory controller integrated into a single on-board chip.
     11eMMC is very similar to a microSD but differs in the following ways:
     12 * supports several hardware partitions
     13 * 8-bit data bus
     14 * device is on-board and thus non removable
     16Gateworks uses eMMC on several of its products:
     17 * Newport:
     18  - GW630x / GW640x: 8GiB (16MB BOOT0, 16MB BOOT1, 4MB RPMB, 7.09GiB USER)
     19 * Ventana:
     20  - GW560x: 8GiB 8GiB (16MB BOOT0, 16MB BOOT1, 4MB RPMB, 7.09GiB USER)
     24=== eMMC Partitions ===
     25eMMC devices are partitioned into several hardware partitions but only one can be selected at a time:
     26 - BOOT - one or more small partitions intended for boot firmware (eMMC 4.3 spec requires 2 boot and 1 user partition)
     27 - RPMB - Replay Protected Memory Block - intended to store secure data (ie DRM content protection keys) (eMMC 4.4 spec adds the requirement of an RPMB partition)
     28 - USER - a large partition intended for general storage
     31 * BOOT and RPMB partitions are configured as SLC while USER can be SLC or MLC.
     32 * Read / Write commands sent to an eMMC do not directly address the hardware partitions but instead a special command is used to select a partition.
     33 * A Card Specific Data (CSD) register (EXT_CSD[179]) is used to configure what partition is selected at power-up. This can be configured within Linux via the {{{mmc-utils}}} application, or within U-Boot via the {{{mmc partconf}}} command (see below).
     34 * It is up to the user to decide if and how to use each of the hardware partitions.
     36Both Linux (see [#emmc-linux below]) and U-Boot (see [#emmc-uboot below]) support accessing the various partitions but in different ways.
     40=== eMMC PARTITION_CONFIG (Boot partition selection) ===
     41Because eMMC provides multiple hardware partitions but only one can be selected at a time. A non-volatile register in the eMMC device provides a PARTITION_CONFIG that is used to determine what partition is selected at power-up for boot devices. To access this data you need to read/write a 'Card Specific Data' or CSD register (EXT_CSD[179] - EXT_CSC_PART_CONFIG). This can be done both in Linux (see [#emmc-linux below]) or U-Boot (see [#emmc-uboot below]).
     45=== U-Boot Support ===
     46U-Boot provides access to eMMC devices through the {{{mmc}}} command and interface but adds an additional argument to the {{{mmc}}} interface to describe the hardware partition. The interface is therefore described as 'mmc <dev> <part>' where 'dev' is the mmc device (some boards have more than one) and 'part' is the hardware partition: 0=user, 1=boot0, 2=boot1.
     48Use the {{{mmc dev}}} command to specify the device and partition:
     50mmc dev 0 0 # select user hw partition
     51mmc dev 0 1 # select boot0 hw partition
     52mmc dev 0 2 # select boot1 hw partition
     55If U-Boot has been built with {{{CONFIG_SUPPORT_EMMC_BOOT}}} some additional mmc commands are available:
     56 * mmc bootbus <dev> <boot_bus_width> <reset_boot_bus_width> <boot_mode>
     57 * mmc bootpart-resize <dev> <boot-part-size-mb> <rpmb-part-size-mb>
     58 * mmc partconf <dev> <boot_ack> <boot-partition> <partition-access> # set PARTITION_CONFIG field
     59 * mmc rst-function <dev> <value> # change RST_n_FUNCTION field between 0|1|2 (write-once)
     61The {{{mmc partconf}}} command can be used to configure the PARTITION_CONFIG specifying what hardware partition to boot from:
     63mmc partconf 0 0 0 0 # disable boot partition (default unset condition; boots from user partition)
     64mmc partconf 0 1 1 0 # set boot0 partition (with ack)
     65mmc partconf 0 1 2 0 # set boot1 partition (with ack)
     66mmc partconf 0 1 7 0 # set user partition (with ack)
     69If U-Boot has been built with {{{CONFIG_SUPPORT_EMMC_RPMB}}} the {{{mmc rpmb}}} command is available for reading, writing and programming the key for the Replay Protection Memory Block (RPMB) partition in eMMC.
     73=== Linux Support ===
     74Linux presents the various hardware partitions as separate devices:
     75 - /dev/mmcblk0boot0 - BOOT0 partition
     76 - /dev/mmcblk0boot1 - BOOT1 partition
     77 - /dev/mmcblk0rpmb - RPMB partition
     78 - /dev/mmcblk0 - USER partition
     80Note that the BOOT partitions by default are read-only as they are typically used for sensitive boot firmware. To write to them you can disable {{{force_ro}}} in sysfs via:
     82echo 0 > /sys/class/block/mmcblk0boot0/force_ro
     85The Linux {{{mmc}}} application provides access to eMMC configuration through CSD registers. This open-source application is available at
     86 * To build it:
     88git clone git://
     89cd mmc-utils
     92 * Alternatively you can install this from a pre-built deb:
     93  * Newport (arm64):
     96dpkg -i mmc-utils_0~gita3d3331-3~armbian5.35+1_arm64.deb
     98 * Ventana (armhf):
     101dpkg -i mmc-utils_0~gita3d3331-3~armbian5.35+1_armhf.deb
     104You can use the {{{mmc}}} utility to configure the eMMC PARTITION_CONFIG to specify the boot device on power-up via {{{mmc bootpart enable <boot_partition> <send_ack> <device>}}} where boot_partition specifies the hardware partition (1=boot0, 2=boot1, 7=user), send_ack specifies the device must send an awknoledgement (for fast boot), and device is the root mmc block device of the eMMC:
     106# set boot partition to boot0
     107mmc bootpart enable 1 0 /dev/mmcblk0
     108# set boot partition to boot1
     109mmc bootpart enable 2 0 /dev/mmcblk0
     110# set boot partition to user
     111mmc bootpart enable 7 0 /dev/mmcblk0
     114Some additional use cases:
     116# show PARTITION_CONFIG:
     117mmc extcsd read /dev/mmcblk0 | grep PARTITION_CONFIG
     118# show BUS CONFIG:
     119mmc extcsd read /dev/mmcblk0 | grep BOOT_BUS_CONDITIONS
     120# disable boot partition
     121mmc bootpart enable 0 0 /dev/mmcblk0
     125 *