Boot from emmc mmc0

Showing results for 
Search instead for 
Did you mean: 

Boot from emmc mmc0

No ratings

Boot from emmc mmc0

In the i.MX8MP support 3 SDIO interface, and in the reference board i.MX 8M Plus LPDDR4 EVK design default use the eMMC connect to the USDHC3 to boot up from emmc,use the SD card connect to the USDHC2 port. When the U-Boot starts, it will detect the starting slot and automatically set mmcdev and mmcroot, for the USDHC3 in the default Linux set is mmc dev 2.

But some customer need to change to the mmc dev 0, make the mmc0 work, see the following introduction.


1 For the EMMC

        MMC (multiMedia card) is a communication protocol that supports two modes, SPI and MMC. EMMC is a chip that supports MMC protocol. Both eMMC and SD card package the flash controller and NAND Flash together, but their interfaces are different. eMMC is generally BGA packaged and soldered on PCB.



EMMC includes 11 signals, namely CLK, CMD, DATA0-7 and Data Strobe. The specific signals are as follows:

CLK: It is used to output clock signal from the host side, synchronize data transmission and drive device operation. Each cycle can be transmitted on the rising or falling edge, or both

CMD: The signal is mainly used by the host to send a command to the eMMC and the eMMC to send a response to the host.

DAT0-7: DAT0-7 signal is mainly used for data transmission between Host and eMMC. After the eMMC is powered on or soft reset, only DAT0 can transmit data. After initialization, DAT0-3 or DAT0-7 can be configured for data transmission, that is, the data bus can be configured as 4 bits or 8 bits.

Data Strobe: The clock signal is sent to the host by eMMC with the same frequency as the CLK signal. It is used for synchronization of data reception at the host side. The Data Strobe signal can only be configured and enabled in the HS400 mode. After being enabled, the stability of data transmission can be improved and the bus tuning process can be omitted.

2 For the EMMC design on the i.MX8MP LPDDR4 EVK

2.1 The i.MX8MP

The i.MX8MP there is 3 SDIO interface,and the i.MX8MP has 3 USDHC ports:USDHC1, USDHC2 and USDHC3.



At i MX8MP supports SD/MMC/eSD/eMMC/SDXC, and starts and boots using the USDHC port based on setting of the BOOT_MODE[3:0] pins.







In the reference design, eMMC is connected to USDHC3, and SD card is connected to USDHC2. USDHC3 is used as the eMMC boot device by default on the development board. We can see the detailed definitions of the three USDHC interfaces in the reference manual. Among them, USDHC1 and USDHC3 are 8 bits and support 8-bit data, while USDHC2 only supports 4-bit data.



2.2 Hardware and software design



The hardware design is as shown above. The eMMC is connected to the SD3 interface, and the software is configured in this way by default.


Note: It should be noted here that although the i. MX8MP USDHC1 supports 8bit, it can be used to connect to EMMC, i The MX8MP does not support booting from the SD1 interface. You can see from the boot mode pins above that there is no corresponding setting. Special attention should be paid to this. Some customers will ignore this when designing hardware. This is the design. There is no way for the software to start from USDHC1.

2.3 The port number of the default BSP

In the i.MX 8M Plus LPDDR4 EVK development board design, the eMMC is connected to the USDHC3 as the default boot device When the U-Boot starts, it will detect the starting slot, and automatically set mmcdev and mmcroot. For USDHC3, the default is mmc dev 2.



The device structure of SD/MMC cards is similar. MMC should be the predecessor of SD, but the design of MMC at that time was half that of SD. Therefore, the SD/MMC driver is universal, and the device node of Linux continues the name of MMC.


Meaning of blk: blk is a block device, and the number after ⾯ is the serial number of the device


Meaning of p: p indicates partition, and p1 is the first partition


We can see the correspondence between the USDHC interface and the mmc under Linux. The kernel MMC module now uses a fixed mmcblk index for the uSDHC slot. The default BSP is "mmc2=&usdhc3":


  1. In the design of the MX 8M Plus LPDDR4 EVK development board, by default, the eMMC is connected to the USDHC3, SD3 is used, and mmcblk2 is used in the SD3 slot. When setting the kernel parameters in the u-boot, you can see that:

### select mmc dev 2 (USDHC3) on the i.MX 8M Mini EVK, i.MX 8M Nano EVK, and i.MX 8M Plus EVK:

U-Boot > mmc dev 2 0

For the emmc the related port is :mmcblk2

By default, the flash target is MMC: 2 after the Demo images burning of the development board is started.



3 mmc0 work as emmc device and boot up

We need to modify the device, u-boot, kernel related part for the mmc0 work on the android BSP,

3.1 Software modify

2.2.1 u-boot:

Dts section


memory@40000000 {

                 device_type = "memory";

                 reg = <0x0 0x40000000 0 0xc0000000>,

                       <0x1 0x00000000 0 0xc0000000>;


aliases { /* SD/MMC: eMMC/SD slot numbering fix */

       mmc0 = &usdhc3; /*Modify the usdhc3 and mmc0, default is mmc2*/

       mmc1 = &usdhc2; /* usdhc2 and mmc0 do not change*/

       mmc2 = &usdhc1; /*Modify the usdhc1 to mmc2, make the usdhc1 work*/


reg_can1_stby: regulator-can1-stby {…..}

Board secton


int board_init(void)


        struct arm_smccc_res res;


int board_mmc_get_env_dev(int devno)


       if(devno == 0)

        return devno + 2;


        else if (devno == 2)

        return devno - 2;



        return devno;



int mmc_map_to_kernel_blk(int devno)


        return devno;


int board_late_init(void)






int spl_mmc_load_image(struct spl_image_info *spl_image,

                        struct spl_boot_device *bootdev)


Default settings:




2.2.2 kernel section:

In the kernel section need to change all the related mmcblk2 to mmcblk0.                  

2.2.3 device section modify:

Change all the related mmcblk2 to mmcblk0.

Change the uuu_imx_android_flash.bat


if not [%soc_name:imx8mp=%] == [%soc_name%] (

 set vid=0x1fc9& set pid=00x0146& set chip=MX8MP

 set uboot_env_start=0x2000& set uboot_env_len=0x8

 - set emmc_num=2& set sd_num=1

+ set emmc_num=0& set sd_num=1

 set board=evk

 goto :device_info_end


All the modify see the Patch in the attachment.

Version history
Revision #:
1 of 1
Last update:
‎09-30-2022 09:11 AM
Updated by: