Changes between Version 39 and Version 40 of MMC


Ignore:
Timestamp:
05/01/2025 05:55:15 PM (4 days ago)
Author:
Tim Harvey
Comment:

added example script to decode emmc PARTITION_CONFIG

Legend:

Unmodified
Added
Removed
Modified
  • MMC

    v39 v40  
    116116- eMMC can be programmed once with enhanced capabilities which is done when the device is partitioned by the manufacturer. This programming includes number of boot partitions, size of replay protected memory block (RPMB), up to four general purpose partitions (which can be 0 len) and a user data area. Some manufacturers will provide the opportunity to re-configure.
    117117
     118Note that changing your eMMC partitioning differs a bit for each eMMC part (Manufacturer make and model) and needs to be done very early on as it can't succeed after a certain number of writes have occurred. If you need a specific partition configuration for a high volume product contact sales@gateworks.com for more info.
     119
    118120
    119121[=#emmc-partconf]
    120122=== eMMC PARTITION_CONFIG (Boot partition selection) ===
    121 Because 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]).
    122 
    123 Note that changing your eMMC partitioning differs a bit for each eMMC part (Manufacturer make and model) and needs to be done very early on as it can't succeed after a certain number of writes have occurred. If you need a specific partition configuration for a high volume product contact sales@gateworks.com for more info.
     123eMMC devices 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]).
    124124
    125125[=#emmc-uboot]
     
    184184}}}
    185185
     186To determine the current eMMC hardware boot partition you need to look at the PARTITION_CONFIG(EXT_CSD![179]) register bits ![5:3] 'BOOT_PARTITION_ENABLE' where 1='Boot Partition 1' (we call this boot0) 2='Boot Partition 2' (we call this boot1) and 7=User area (we call this user).
     187
     188Here is a set of bash commands in Linux that will use {{{mmc}}} (from the {{{mmc-utils}}} package) to read the CSD, decode the value and display the names we use to refer to the boot partition:
     189{{{#!bash
     190PARTITION_CONFIG=$(mmc extcsd read /dev/mmcblk2 | grep PARTITION_CONFIG | grep -o "0x[0-9a-fA-F]\+")
     191BOOT_PARTITION_ENABLE=$(( $(( $((PARTITION_CONFIG)) & 0x38 )) >> 3)) # convert hex to dec and mask off bits[5:3] and shift
     192case $BOOT_PARTITION_ENABLE in
     193  1) echo boot0;; # Boot partition 1
     194  2) echo boot1;; # Boot partition 2
     195  7) echo user;; # User area
     196esac
     197}}}
     198
    186199Some additional use cases:
    187200{{{#!bash
     
    194207}}}
    195208
     209
     210
    196211References:
    197212 * https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/mmc/mmc-tools.txt
     
    201216=== eMMC Enhanced User Area and Pseudo SLC
    202217The eMMC 4.4 standard introduced the concept of 'Enhanced User Area' in order to improve reliability, performance, and endurance. This allows a one-time configuration of the eMMC to configure all or some of the MLC NAND flash as Psuedo SLC (pSLC) where instead of 2 bits per cell it uses 1 bit per cell. This will reduce the available size of the eMMC as a trade-off for improved reliability, performance, and endurance.
     218
     219Note that changing your eMMC partitioning differs a bit for each eMMC part (Manufacturer make and model) and needs to be done very early on as it can't succeed after a certain number of writes have occurred. If you need a specific partition configuration for a high volume product contact sales@gateworks.com for more info.
    203220
    204221The specification for Enhanced User Area does not specify a particular implementation or require eMMC devices to even support Enhanced User Area.