summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMacpaul Lin <macpaul@andestech.com>2011-11-28 16:31:09 +0000
committerAndy Fleming <afleming@freescale.com>2012-01-08 21:28:16 -0600
commit2c3fbf4cbe621680105c5116b37e863a32ce410d (patch)
tree0afeb999498b0e940661ea4b34bdf97297431040
parent4692708d452b054fe5996405ee5cfff1f3b23070 (diff)
downloadu-boot-imx-2c3fbf4cbe621680105c5116b37e863a32ce410d.zip
u-boot-imx-2c3fbf4cbe621680105c5116b37e863a32ce410d.tar.gz
u-boot-imx-2c3fbf4cbe621680105c5116b37e863a32ce410d.tar.bz2
mmc: add host_caps checking avoid switch card improperly
Add a host capability checking to avoid the mmc stack switch the card to HIGHSPEED mode when the card supports HIGHSPEED while the host doesn't. This patch avoid furthur transaction problem when the mmc/sd card runs different mode to the host. Signed-off-by: Macpaul Lin <macpaul@andestech.com>
-rw-r--r--drivers/mmc/mmc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 21665ec..98abf1c 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -785,6 +785,16 @@ retry_scr:
if (!(__be32_to_cpu(switch_status[3]) & SD_HIGHSPEED_SUPPORTED))
return 0;
+ /*
+ * If the host doesn't support SD_HIGHSPEED, do not switch card to
+ * HIGHSPEED mode even if the card support SD_HIGHSPPED.
+ * This can avoid furthur problem when the card runs in different
+ * mode between the host.
+ */
+ if (!((mmc->host_caps & MMC_MODE_HS_52MHz) &&
+ (mmc->host_caps & MMC_MODE_HS)))
+ return 0;
+
err = sd_switch(mmc, SD_SWITCH_SWITCH, 0, 1, (u8 *)switch_status);
if (err)