summaryrefslogtreecommitdiffstats
path: root/drivers/mci/mci-core.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-06-03 12:27:55 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2013-06-20 16:18:16 +0200
commitdee6282fbfc974c4103895d1ccb1cffb3c0a3412 (patch)
tree1243c4659baff19243798904de5fc9a9ff91f937 /drivers/mci/mci-core.c
parent9590d6f9f13559411c137e5d3390dc7c6d5732b0 (diff)
downloadbarebox-dee6282fbfc974c4103895d1ccb1cffb3c0a3412.tar.gz
barebox-dee6282fbfc974c4103895d1ccb1cffb3c0a3412.tar.xz
mci: Use tran_speed field to fix highspeed MMC card clock
The tran_speed field as decoded from csd is valid in most cases, so use it to determine the maximum clock we can support. It is not valid though for MMC highspeed cards, in this case the csd contains invalid values and we have to set tran_speed explicitly to the maximum speed. As the values passed into mci_set_clock are now based on tran_speed we no longer have to limit the rate to tran_speed in mci_set_clock. The (intended) effect of this patch is that highspeed MMC cards are no longer limited to non highspeed rates. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mci/mci-core.c')
-rw-r--r--drivers/mci/mci-core.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 2829b8e1d6..67668d53f0 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -667,10 +667,6 @@ static void mci_set_clock(struct mci *mci, unsigned clock)
if (clock < host->f_min)
clock = host->f_min;
- /* check against the limit at the card's side */
- if (mci->tran_speed != 0 && clock > mci->tran_speed)
- clock = mci->tran_speed;
-
host->clock = clock; /* the new target frequency */
mci_set_ios(mci);
}
@@ -922,11 +918,8 @@ static int mci_startup_sd(struct mci *mci)
}
mci_set_bus_width(mci, MMC_BUS_WIDTH_4);
}
- /* if possible, speed up the transfer */
- if (mci_caps(mci) & MMC_CAP_SD_HIGHSPEED)
- mci_set_clock(mci, 50000000);
- else
- mci_set_clock(mci, 25000000);
+
+ mci_set_clock(mci, mci->tran_speed);
return 0;
}
@@ -948,13 +941,13 @@ static int mci_startup_mmc(struct mci *mci)
/* if possible, speed up the transfer */
if (mci_caps(mci) & MMC_CAP_MMC_HIGHSPEED) {
if (mci->card_caps & MMC_CAP_MMC_HIGHSPEED_52MHZ)
- mci_set_clock(mci, 52000000);
+ mci->tran_speed = 52000000;
else
- mci_set_clock(mci, 26000000);
- } else {
- mci_set_clock(mci, 20000000);
+ mci->tran_speed = 26000000;
}
+ mci_set_clock(mci, mci->tran_speed);
+
/*
* Unlike SD, MMC cards dont have a configuration register to notify
* supported bus width. So bus test command should be run to identify