[U-Boot] [Uboot] Question about MMC driver

DongboZhang at viatech.com.cn DongboZhang at viatech.com.cn
Tue Sep 3 06:27:04 CEST 2013


Dear U-Boot maintainer,

 

I have two questions about mmc driver base u-boot-2013.07.

 

Q 1:

In mmc.c, function sd_send_op_cond(), line 506:

line 505:

if (timeout <= 0)

line 506:

    return UNUSABLE_ERR;

I think it should be return TIMEOUT .

Because for MMC card or eMMC device, the program will return at this
place. 

Following code is:

line 1392:

/* If the command timed out, we check for an MMC card */

line 1393:

if (err == TIMEOUT) {

line 1394:

    err = mmc_send_op_cond(mmc);

Now, err is UNUSABLE_ERR, then function mmc_send_op_cond() will never be
invoked.

The MMC card or eMMC device initialization will be failed.

 

 

Q 2:

In mmc.c, function mmc_startup(), line 989 - line 1006:

line 989:

/*

line 990:

* For MMC cards, set the Relative Address.

line 991:

* For SD cards, get the Relatvie Address.

line 992:

* This also puts the cards into Standby State

line 993:

*/

line 994:

if (!mmc_host_is_spi(mmc)) { /* cmd not supported in spi */

line 995:

    cmd.cmdidx = SD_CMD_SEND_RELATIVE_ADDR;

line 996:

    cmd.cmdarg = mmc->rca << 16;

line 997:

    cmd.resp_type = MMC_RSP_R6;

line 998:

 

line 999:

    err = mmc_send_cmd(mmc, &cmd, NULL);

line 1000:

 

line 1001:

    if (err)

line 1002:

       return err;

line 1003:

 

line 1004:

    if (IS_SD(mmc))

line 1005:

       mmc->rca = (cmd.response[0] >> 16) & 0xffff;

line 1006:

}

In this part, the program only handle the RCA of SD cards, not process
the RCA of MMC cards.

Before this part, mmc->rca is 0.

After this part,

for SD card,              mmc->rca is a valid value(e.g. 0x1234)

for MMC card,        mmc->rca still is 0

 

In SD spec v4.0, section 5.4:

The writable 16-bit relative card address register carries the card
address that is published by the card during the card identification.

In MMC spec v4.5, section 7.5:

The writable 16-bit relative Device address(RCA) register carries the
Device address assigned by the host during the Device identification.

 

For SD card, after send CMD3, we will get the RCA value from the SD
card.

But for MMC card or eMMC device, host should set a RCA value to the card
by CMD3.

 

I think setting for RCA of MMC card should be added to this part.

 

BRs

Dongbo

 



More information about the U-Boot mailing list