eMMC

이재하·2023년 6월 29일

6.1 eMMC overview

All communication between host and device are controlled by the host. The host sends a command, that results in a device response.

A general overview of the command flow is shown in Figure 25 for the device identification mode and in Figure 27 for the data transfer mode. The commnads are listed in the commnad tables. The dependecies between current state, received command and following state are listed in Table 60. Five operation modes are defined for the eMMC system ( hosts and devices) :

  • Boot mode :
    The device will be in boot mode after power cycle, reception of CMD0 with argument of 0xF0F0F0F0 or the assertion of hardware reset signal.

  • Device identification mode :
    The device will be in device identification mode after boot operation mode in finished or if host and/or device does not support boot operation mode. The device will be in this mode, untill the SET_RCA command(CM3)is received.

  • Interrupt mode
    Host and device enter and exit interrupt mode simultaneously. In interrupt mode there is no data transfer.

  • Data transfer mode
    The device will enter data transfer mode once an RCA is assigned to it. The host will enter data transfer mode after identifying the device on the bus.

  • Inactive mode
    The device will enter inactive mode if either the device operating voltage range or access mode is not valid. The device can also enter inactive mode with GO_INACTIVE_STATE command(CMD15).

Table 5 shows the dependecies between bus modes, operation modes and device states.

Table 5 - CMD line modes overview

Device stateOperation modeCMD line mode
Inactive stateInactive ModeOpen-dran
Pre-Idle stateBoot Mode
Pre-Boot State
Idle StateDevice identification mode
Ready State
Identification state
Stand-by StateData Tranfer modepush pull
Sleep State
Transfer State
Bus Test State
Sending data state
Receive-data state
Programming State
Disconnect State
Boot StateBoot mode
Wait-IRQ StateInterrupt modeOpen-drain

6.2 Partition Management

6.2.1 General

The default area of the memory device consists of a User Data Area to store data, two possible boot area partitions for booting and the Replay Protected Memory Block Area Partition to managa data in an autheniticated and replay protected manner. The memory configruation initially consists of User Data Area and RPMB Area Partitions and Boot Area Partitions and Boot Area Partitions ( whose dimenstions and technology features are defined by the memory manufacturere).

The embedded device also offers the host the possibility to configrue additional local memory partitions with independent address spaces, starting from logical address 0x00000000, for different usage models.

Therefore the memory block areas can be classified as follows:

  • Two Boot Area Partitions, whose size is multiple of 128KB and where booting from eMMC can be performed.

  • One RPMB Partition accessed through a trusted mechanism, whose size is defined as multiple of 128KB.

  • Four General Purpose Area Partitions to store sensitive data or for other host usage models, whose sizes are a multiple of a Write Protect Group.

Each of the General Purpose Area Partitions can be implemented with enhanced or extended technological features( suech as better reliability) that distinguish them from the default storage media.

부트 영역 파티션 두 개: 이 파티션의 크기는 128KB의 배수이며, eMMC에서 부팅할 수 있습니다.
신뢰된 메커니즘을 통해 액세스되는 RPMB 파티션 하나: 이 파티션의 크기는 128KB의 배수로 정의됩니다.

6.2.1 General
Boot and RPMB Area Partitions's sizes and attributes are defined by the memory manufacturer(read - only), while General Purpose Area Partitions'sizes and attributes can be programmed by the host only once in the device life-cycle(one time programmable).

Moreover, the host is free to configure one segment in the User Data Area to be implemented as enhanced storage media, and to specify its starting location and size in terms of Write Protect Groups. The attributes of This Enganced User Data Area can be programmed only once during the device life-cycle(one-time programmable).

6.2.1 General

General Purpose Partitions and Enhanced User Data Area configuration by the host can have effects on data previously stored(they will be destroyed) and the device initialization time. In particular, the initialization time after first power cycle subsequent to the configuration can exceed the maimum initialization time defined by the specs since the internal controller could execute opertaions to set tup the configurations stated by the host.

More generally also the following initialization phases can be affected by the new configuration. Max Power up timings shall be specified in the device technical literature.

호스트에 의한 일반용도 파티션 및 향상된 사용자 데이터 영역 구성은 이전에 저장된 데이터에 영향을 미칠 수 있으며(데이터가 파괴될 수 있음), 장치 초기화 시간에도 영향을 줄 수 있습니다. 특히, 구성 이후 첫 번째 전원 사이클 이후의 초기화 시간은 호스트가 지정한 구성을 설정하기 위해 내부 컨트롤러가 작업을 수행할 수 있기 때문에 사양에서 정의된 최대 초기화 시간을 초과할 수 있습니다.

6.2.2 Command restrictions
Some restrictions for the commnads that can be issued to each partition is defined:

  • Boot Partitions

    • Command classes Class0, Class2 and Class4 are admitted. Still usage of any other command than CMD0, CMD6, CMD8, CMD12, CMd13, CMD15 or commands defined in 6.6.22 shall be considered as illegal one.
  • RPMB Partition

    • Only commands of classes Class0, Class2 and Class4 are admitted.
  • General Purpose Partitions

    • Command classes 0,2,4,5,6 are admitted.
    • Write Protection can be set individually for each write protect group in each partition. So the host can set write protection types differently in each write protect group.

    In the Enhanced User Data Area, all the commands belonging to the classes admiitted in the User Data Area can be issued.

    6.2.3 Extended Partitions Attribute

Each General Purpose Partition can have a different extended partition attribute. The list of attribute types includes:

  • Default - no extended attribute is set
  • System code - a partition taht is rarely updated and contains important system fiels
  • Non-Persistent - a parition that is used for temporary information(e.g., swap file to extend the host virtual memory space)

Using the extended attribute, the device can optimize the mixture if storage media characteristics to better suit the intended uses per partition.

A single partition cannot have both enhanced and extended attributes set for it.

6.2.4 Configure partitions

Bit0 (PARTITIONING_EN) in PARTITIONING_SUPPORT field of the Properties segment in the Extended CSD reigster indicate if the memroy device supports partitioning features. Bit 1 (ENH_ATTRIBUTE_EN - 향상된) in the same field indicates if the memory device supports enhanced features attrubute in the General Purpose Partitions and in the Enhanced User Data Area. Bit 2 (EXT_ATTRIBUTE_EN - 확장된) in the same field indicates if the memory device supports extended partitions attribute in the General Purpose Partitions. On this specification, Bit 2-0 in PARTITIONING_SUPPORT shall be set to 1.

The attributes of General Purpose Partitions and Enhanced User Data Area can be programmed by the host setting the corresponding values in the Extended CSD reigsters only once in the device life-cycle. In particular, the host may issues a SWITCH command to set the R/W field of partition features containing the following parameters.

  • General Purpose Partitions - size and attribute of max 4 partition. The fields in the Modes segment of the EXT_CSD register to be set are:

    • GP_SIZE_MULT_GP0 - GP_SIZE_MULT_GP3 for the size
    • PARTITIONS_ATTRIBUTE for the Enhanced attribute
    • EXT_PARTITIONS_ATTRIBUTE for the extended attribute
  • Enhanced User Data Area - start address and attribute of the region. The fields in the Modes segment of the EXT_CSD reigster to be set are:

    • ENH_START_ADDR for the start address
    • ENH_SIZE_MULT for the size
    • PARTITIONS_ATTRIBUTE for the Enhance attribute The Enhanced User Data Area start address(ENH_START_ADDR in the Extended CSD) shall be write protect group aligned. It is a group address in byte units, for densities up to 2GB, and in sector units for densities greater than 2GB. The device will ignore the LSBs below the write group size and will align the Enhanced User Data Area start address to the Write Protct Group the address(in bytes or sectors)
      belongs to. The address space of the enhanced user data area is continuous to the address for the reset of the user data area(there is no address gap between the enhanced user data area and the rest of the user data area).

The granularity of General Purpose Partitions and of the Enhanced User Data Area is in units of High Capacity Write Protect Group Sizes. When the partition parameters are configured, ERASE_GROUP_DEF bit in the Extended CSD shall be set to indicate that High Capacity Erase Group Sizes and High Capacity Write Protect Group Sizes are to be used. If the partition parameters are sent to a device by CMD6 before setting ERASE_GROUP_DEF bit, the slave shows SWITCH_ERROR.

Once the device is partitioned and the configuration is stable, all the Command Class 5 and 6 commands will be referred to the high capacity erase groups and write protect groups.

In addition to partitioning parameters fields mentioned before, the host shall set Bit 0 in PARTITION_SETTING_COMPLETED in Modes segment: in this way the host notifies the device that the setting procedure has been successfully completed. This bit setting is to protect partitioning sequence against unexpected power loss event : if a sudden power loss o

6.2.4 Configure partitions

Device in Tran Sate
-> The host wants to configure the device partitioning
if(PARTITIONENG_EN == 1)
if(Does the Host want to set ENH attribute to partitions?)
if(ENH_ATTRIBUTE == 1)

Yes
-> Set :
Number of General Purpose partitions,
General Purpose Partitions sizes and enhanced attribute, Enhanced User Data Area size, start address and enhanced attribute

No
-> Set :
Number of General Purpose partitions, General Purpose Partitions sizes


Flow Chart for General Purpose Partitions & Enhanced User Data Area parameter setting.

PARTITIONING_SETTING_COMPLETED
(to notify the device that the host has complete
partitioning configuration)

Power cycle

Possible Change in Size Parameters for User Data Area

Partition Correctly configured

6.2.4 Configure partitions
A CMD13 shall be issued by the host to make sure that all the parameters are correctly set. If any of the partitioning parameter is not correct a SWITCH_ERROR will be raised by the device. Since the device will not know the total size of configured partitions and user area until PARTITION_SETTING_COMPLETED bit is set, device may show SWITCH_ERROR when host set PARTITION_SETTING_COMPLETED bit, if the total size of the configured partitions and user data area does not fit in the available space of the device.

In this case, all the setting will be cleared after the next power cycle. So the host needs to set proper values in each of partition configuration register bytes again.

The device will actually configure itself, according to the partition parameters in the Extended CSD, only after a power cycle .

Any valid commands issued after PARTITION_SETTING_COMPLETED bit is set but before a pwer cycle takes place will be normally executed.

Any previous incomplete partitioning configuration sequence before this bit is set will be cancelled upon a power cycle.

After the power cycle following the partition configuration, C_SZIE value for up to 2 GB devices and SEC_COUNT value for more than 2GB devices will be changed to indicate the size of user dat aarea after the configuration.

The size compared to 2 GB shall be the size of user data area before configuring partitions(e.g., for more than 2GB devices before configuring partitions, SEC_COUNT shall keep indicating the size of user data area includes the size of enhaanced User Data ara in the user area.

So host may need to read thesse calues after the power cycle to calculate the size of the user data area. Access mode shall keep after configuring partitions.


파티션 구성 이후의 전원 사이클 이후에는, 2GB 미만의 장치의 경우 C_SIZE 값 및 2GB 이상의 장치의 경우 SEC_COUNT 값이 변경되어 파티션 구성 이후의 사용자 데이터 영역의 크기를 나타냅니다.

2GB에 비해 크기가 큰 경우, 파티션을 구성하기 전의 사용자 데이터 영역의 크기를 나타냅니다 (예: 2GB 이상의 장치의 경우 파티션을 구성하기 전에 SEC_COUNT는 사용자 영역의 크기를 나타내며, 이 영역에는 Enhanced User Data Area의 크기가 포함됩니다).

따라서 호스트는 전원 사이클 이후에 이러한 값을 읽어 사용자 데이터 영역의 크기를 계산해야 할 수 있습니다. 파티션 구성 후에는 액세스 모드가 유지됩니다.

If the host tries to change General Purpose partitions and Enhanced User Data Area features by using CMD6 after a power up following the configuration procedure, the device will assert the SWITCH_ERROR bit in the status register of CMD6 response withour per forming any internal action.

Partitions configuration parameters are stored in one time programmable fields of the Extended CSD register. The host can read them by a CMD8 even though the PARTITION_SETTING_COMPLETED has not yet been set but the execution of partitioning will take place only after the following power up. It is recommended to avoid changes on these parameters after reading them since they are one time programmable fields.

The host shall follow the folw chart in Figure 16 for configuring the parameters of General Purpose Area Partitions and Enanced Use rData Area; otherwise undefined behacior may result./

6.2.5 Access partitions

After every power-up, when the host uses a device that partition are configured, it must set the ERASE_GROUP_DEF bit to high before high before issuing read, write, erase and write protect commands, because this bit is reset after power-up. Ohterwise, these may not work correctly and it may leave the stored data in an unknown state.

Each time the host wants to access a partition the following flow shall be executed :

1) Set PARTITION_ACCESS bits in the PARTITION_CONFIG field of the Extended CSD register in order to address one of the partitions,

2) Issue commands referred to the selected partition,

3) Restore default access to the User Data Area or re-direction the access to another partition.

All the reset events(CMD0 or hardware reset) will restore the access by default to the User Data Area. If an unwnanted power loss occurs, the access will be by default resotred to the User Data Area. When the host tries to accesss a partition that has not been created before, the devices sets the SWITCH_ERROR bit in the status register and will not change the PARTITION_ACCESS bits.

모든 초기화 이벤트(CMD0 또는 하드웨어 초기화)는 기본적으로 사용자 데이터 영역으로 액세스를 복원합니다. 원치 않는 전원 손실이 발생할 경우, 액세스는 기본적으로 사용자 데이터 영역으로 복원됩니다. 호스트가 이전에 생성되지 않은 파티션에 액세스하려고 할 때, 장치는 상태 레지스터의 SWITCH_ERROR 비트를 설정하고 PARTITION_ACCESS 비트를 변경하지 않습니다.

6.3 Boot operation mode

In boot operation mode, the master can read boot data from the slave by keeping CMD line low or sending CMD0 with argument + 0xFFFFFFFA, before issuing
CMD1. The data can be read from either boot area or user area depending on register setting.

6.3.1 Device reset to Pre-idle state
The device may enter into Pre-idle state through any of the following four mechanism:

  • After power on by the host, the device(even if it has been in Inactive state) is in Pre-idle state.

  • GO_PRE_IDLE_STATE command(CMD0 with argument of 0xF0F0F0) is the software reset command and puts the device into Pre-idle State.

  • Hardware reset may be used by host resetting a device, moving the device to Pre-idle state and disabling power on period write protect on blocks that had been set as power-on write protect becfore the reset was asserted.
    When the device receives GO_PRO_IDEL_STATE command(CMD0 with 0xF0F0F0F0) of assertion of harware resett signal during sleep state, the device also moves to Pre idle state.

6.3.1 Device reset to Pre-idle state
GO_PRE_IDLE_STATE command or hardware RESET assertion, the device's output bus drivers are in high-impedance state and the device is initialized with a default relative device address(0x001) and with a default driver stage register setting,

6.3.2 Boot partition

There are two partition regions. The minimum size of each boot partition is 128KB. Boot partition size is calculated as follows: Maximum boot partition size = 128K byte X BOOT_SIZE_MULT
BOOT_SIZE_MULT : the value in Extended CSD register byte[226]
The boot partitions are separated from the user area as shown in Figure 19.

Figure 19- Memory partition

Slave has boot configuration in Extended CSD register byte[179]. The master can choose the configuration by setting the register using CMD6(switch). Slave also can be configured to boot from the user area by setting the BOOT_PARTITION_ENABLE bits in the EXT_CSD reigster, byte[179] to 111b.

6.3.3 Boot operation
If the CMD line is held LOW for 74 clock cycles and more after power-up or reset opertaion(either through CMD0 with the argument of 0xF0F0F0F0 or assertion of hardware reset for eMMC, if it is enabled in Extended CSD reigster byte[162], bit[1:0]) before the first command is issued, the slave recognize that boot mode is being initiated and starts preparing boot data internally.

The partition that from the master will read the boot data can be selected in advance using EXT_CSD byte[179], bits[5:3]. The data size taht the master can read during boot operation can be calculated as 128KB X BOOT_SIZE_MULT(EXT_CSD byte[226]). Within 1 second after the CMD line goes LOW, the slave starts to send the first boot data to the master on the DAT line. The master must keep the CMD line LOW to read all of the boot data. The master must use push pull mode until boot operation is terminated.

The master can choose to use single data rate mode with backward-compatible interface timing, single data rate with high-speed interface timing or dual data rate timing by setting a proper value in EXT_CSD register byte[177] bits [4:3]. EXT_CSD register byte[228], bit 2 tells the master if the high-speed timming during boot is upported by tehj device.

The master also can choose to use the dual data rate mode with interface shown in Table 208 during boot by setting "10" in EXT_CSD register byte[177], bit[4:3]. EXT_CSD reigster byte[228], bit 1 tells the master if the dual data rate mode during boot is supported by the device.

HS200 & HS400 mode is not supported during boot operation.

The master can choose to receive boot achnowlege from the slave by setting "1" in EXT_CSD register, byte[179], bit 6, so that the master can recognize that the slave is operating in boot mode.

If boot acknowledge is enabled, the slave has to send acknowledge pattern "010" to the master within 50ms after the CMD line goes LOW. If boot acknowledge is disabled, the slave will not send out

In the signle data rate mode, data is clocked out by the device and sampled by the host with the rising edge of the clock and there is a single CRC per line.

In the dual data rate mode, data is clcoked out with both the rising edge of the clock and the falling edge of the clock and there are two CRC appended per data line. In this mode, the block length is always 512 bytes, and bytes come interleaved in either 4-bit or 8-bit width configuration. Bytes with odd number (1,3,5,...,511) shall be sampled on the rising edge of the clock by the host and bytes with even number (2,4,6,...,512) shall be sampled on the falling edge of the clock by the host. The device will append two CRC16 per each valid data line, on corresponding to the bits of the 256 odd byte to be sampled on the rising edge of the clock by the host and the second for the ramaining bits of the 256 even bytes of the block to be sampled on the falling edge of the clock by the host.

All timings on DAT lines shall follow DDR timing mode. The start bit, the end bit and Boot acknowledge bits are only valid on the rising edge of the clock by the host and the second for the remaining bits of the 256 even bytes of the block to be sampled on the falling edge of the clock by the host.

All timings on DAT lines shall follow DDR timing mode. The start bit, the end bit and Boot acknowledge bits are only valid on the rsing edge of the clock. The value of the falling edge is not guaranteed.

The master can terminate boot mode with the CMD line HIGH. If the master pulls the CMD line HIGH in the middle of data transfer, the slave has to terminate the data trasfer or acknowledge pattern within Nst clock cycles(one data cycle and end biy cycle). If the master terminates boot mode between consecutive blocks, the slave must relase the data line with in Nst clock cycles.

Boot operation will be terminated when all contents of the enabled boot data are sent to the maseter. After boot operation is executed, the slave shall be ready for CMD1 operation and the master needs to start a normal MMC initialization sequence by sending CMD1.

0개의 댓글