Skip to content

How to configure pSLC mode for MLC eMMC devices#

Irreversible Operations

Reconfiguration can only be performed once and cannot be changed afterwards! Therefore, there is a risk of rendering the device unusable and beyond repair!

Date Loss

Reconfiguring the user data area will erase all data previously stored on that area! Therefore, if a reconfiguration is required, it is recommended to perform this operation once before using the module.

Reduced Space

Reconfiguring from MLC to pSLC operating mode increases the reliability of the eMMC at the cost of usable storage capacity. Depending on the technology and device, you should expect at least a halving of the usable storage capacity!

Device-specific Configuration

Both the internal structure with block sizes and alignment, as well as the ratio of MLC to pSLC storage capacity are manufacturer and technology dependent! So different eMMC devices with the same nominal MLC storage capacity may provide different usable storage capacities in their pSLC configuration.

Introduction#

The following steps show how to reconfigure an MLC eMMC device to pSLC mode. Commands from the U-Boot bootloader and Linux command-line tools are used for this purpose.

The procedure demonstrates the reconfiguration of a 32 GiB MLC eMMC device on the Kontron OSM-S SOM for i.MX93 (40099 311 01) as an example.

For other modules, the configuration values in the commands must be adapted according to the hardware properties.

Reconfiguration can be performed either in U-Boot or using the mmc command in Linux. The following only describes the reconfiguration using commands in the U-Boot bootloader.

Reconfiguration in U-Boot#

After starting the U-Boot bootloader, the appropriate eMMC interface must first be selected

=> mmc list
FSL_SDHC: 0
FSL_SDHC: 1 (SD)

=> mmc dev 0
switch to partitions #0, OK
mmc0(part 0) is current device

Now display the current eMMC configuration

=> mmc info
Device: FSL_SDHC
Manufacturer ID: 11
OEM: 0
Name: 032G01 
Bus Speed: 100000000
Mode: HS400ES (200MHz)
Rd Block Len: 512
MMC version 5.1
High Capacity: Yes
Capacity: 29.1 GiB
Bus Width: 8-bit DDR
Erase Group Size: 512 KiB
HC WP Group Size: 8 MiB
User Capacity: 29.1 GiB
Boot Capacity: 8 MiB ENH
RPMB Capacity: 4 MiB ENH
Boot area 0 is not write protected
Boot area 1 is not write protected

In general, the configuration can now be performed using the mmc hwpartition command. The command requires the start block and the number of blocks. The unit for this is 512 bytes.

In pSLC mode, the usable size of the eMMC user data area changes. Unfortunately, the maximum size of the user data area in pSLC mode cannot be read directly via U-Boot command. With Linux this is possible using the mmc command (see section below).

To find out the maximum number of available blocks in pSLC mode (in units of HC WP Group Size), the mmc hwpartition command can be called with an intentionally too-large block count. It is important to use the check suffix to only verify the configuration without really writing it!

For the 32 GiB eMMC on our board, we can use a value of 32 * (1024**3) / 512 = 67108864. This is certainly larger than the finally available pSLC size will be, and causes U-Boot to generate an error message from which we can determine the maximum pSLC size.

=> mmc hwpartition user enh 0 67108864 wrrel on check
Partition configuration:
    User Enhanced Start: 0 Bytes
    User Enhanced Size: 32 GiB
    User partition write reliability: on
    No GP1 partition
    No GP2 partition
    No GP3 partition
    No GP4 partition
Total enhanced size exceeds maximum (4096 > 1243)
Failed!

The output Total enhanced size exceeds maximum (4096 > 1243) shows that the eMMC in pSLC mode can have a maximum size of

1243 * HC_WP_Group_Size[8 MiB] = 10427039744 [Bytes]

or

10427039744 / 512 = 20365312 [512 byte blocks]

Before configuring the user data area as pSLC storage, it should be first verified for correctness using the following command:

=> mmc hwpartition user enh 0 20365312 wrrel on check
Partition configuration:
    User Enhanced Start: 0 Bytes
    User Enhanced Size: 9.7 GiB
    User partition write reliability: on
    No GP1 partition
    No GP2 partition
    No GP3 partition
    No GP4 partition

This configuration is accepted by U-Boot. It can be seen that the user data area in pSLC configuration will be approximately 9.7 GiB for this eMMC type. This is lower than 30% of the original MLC storage size!

Once the correct configuration has been found, the eMMC device can now be permanently configured by calling the command with the complete parameter:

=> mmc hwpartition user enh 0 20365312 wrrel on complete
Partition configuration:
    User Enhanced Start: 0 Bytes
    User Enhanced Size: 9.7 GiB
    User partition write reliability: on
    No GP1 partition
    No GP2 partition
    No GP3 partition
    No GP4 partition
Partitioning successful, power-cycle to make effective

The module should then be restarted. The following eMMC configuration output now shows the new size of the user data area:

=> mmc info
Device: FSL_SDHC
Manufacturer ID: 11
OEM: 0
Name: 032G01 
Bus Speed: 100000000
Mode: HS400ES (200MHz)
Rd Block Len: 512
MMC version 5.1
High Capacity: Yes
Capacity: 9.7 GiB
Bus Width: 8-bit DDR
Erase Group Size: 512 KiB
HC WP Group Size: 8 MiB
User Capacity: 9.7 GiB ENH WRREL
User Enhanced Start: 0 Bytes
User Enhanced Size: 9.7 GiB
Boot Capacity: 8 MiB ENH
RPMB Capacity: 4 MiB ENH
Boot area 0 is not write protected
Boot area 1 is not write protected

Partial pSLC

It is also possible to configure only parts of the eMMC storage for pSLC mode. In this case, the values for the mmc hwpartition command must be adjusted according to the requirements. Note that the pSLC area must be aligned to HC_WP_Group_Size boundaries!

Determining eMMC hardware parameters (optional)#

mmc Command

The Linux mmc command used here is not included in the standard Yocto BSP! It can be compiled for the appropriate architecture under Yocto using bitbake mmc-utils or by adding mmc-utils to your IMAGE_INSTALL variable of your Yocto image recipe.

The maximum size of the eMMC user data area in pSLC mode can also be determined in advance under Linux using the mmc command:

root@kontron-mx93:~# mmc extcsd read /dev/mmcblk0 | grep "HC_ERASE_GRP_SIZE\|HC_WP_GRP_SIZE\|MAX_ENH_SIZE_MULT"

High-capacity erase unit size [HC_ERASE_GRP_SIZE: 0x01]
High-capacity W protect group size [HC_WP_GRP_SIZE: 0x10]
Max Enhanced Area Size [MAX_ENH_SIZE_MULT]: 0x0004db

This gives an alignment size of

ALIGNMENT = HC_ERASE_GRP_SIZE * 512 [KiB] * HC_WP_GRP_SIZE = 8 [MiB]

and the maximum total size of the pSLC storage area is

MAX_ENH_SIZE_MULT * ALIGNMENT = 9944 [MiB]

which equals

9944 * (1024 * 1024) / 512 = 20365312 [512 byte blocks]

This value represents the maximum number of available 512 byte blocks in pSLC mode for this eMMC device.