[U-Boot] mmc issue on driving a high speed SD

Damien Wei Huang damien.huang at oa.com.au
Fri Mar 18 02:52:20 CET 2016


Hi,

I have a 26MHz SD card, the mmc driver with u-boot source had incorrectly setting it to 50MHz tran_speed and caused unreliable reading and writing on the SD card.

The variable "mmc->card_caps" had correctly described my SD card with value 0x05. i.e. 4 bit, MMC_MODE_HS, however, in function "static int mmc_startup(struct mmc *mmc)"  with the blow section of code,

"
If (mmc->card_caps & MMC_MODE_HS)
                                mmc->tran_speed = 50000000;
else
                                mmc->tran_speed = 25000000;
"

This section of codes wrongly set the "mmc->tran_speed" to 50MHz without considering there could be two types of high speed, that is 52M, and 26M. and then later on calling the "mmc_set_clock" function with 50MHZ.

Suggested change is given below:

"
If (mmc->card_caps & MMC_MODE_HS) {
                If (mmc->card_caps & (MMC_MODE_HS_52MHz+MMC_MODE_DDR_52MHz))
                                                mmc->tran_speed = 50000000;
else
                                                mmc->tran_speed = 25000000;
}
"


Cheers,
Damien






More information about the U-Boot mailing list