[PATCH 4/6] mci: Use csd_max_dtr when appropriate
Sascha Hauer
s.hauer at pengutronix.de
Fri May 31 03:14:01 EDT 2013
The csd_max_dtr tells us at which speed a card is able to operate,
so use it to adjust the cards clock where appropriate.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
drivers/mci/mci-core.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index d7b8fc9..54660dc 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -919,7 +919,7 @@ static int mci_startup_sd(struct mci *mci)
if (mci->card_caps & MMC_MODE_HS)
mci_set_clock(mci, 50000000);
else
- mci_set_clock(mci, 25000000);
+ mci_set_clock(mci, mci->csd_max_dtr);
return 0;
}
@@ -929,6 +929,7 @@ static int mci_startup_mmc(struct mci *mci)
struct mci_host *host = mci->host;
int err;
int idx = 0;
+ int max_dtr;
static unsigned ext_csd_bits[] = {
EXT_CSD_BUS_WIDTH_4,
EXT_CSD_BUS_WIDTH_8,
@@ -941,13 +942,15 @@ static int mci_startup_mmc(struct mci *mci)
/* if possible, speed up the transfer */
if (mci->card_caps & MMC_MODE_HS) {
if (mci->card_caps & MMC_MODE_HS_52MHz)
- mci_set_clock(mci, 52000000);
+ max_dtr = 52000000;
else
- mci_set_clock(mci, 26000000);
+ max_dtr = 26000000;
} else {
- mci_set_clock(mci, 20000000);
+ max_dtr = mci->csd_max_dtr;
}
+ mci_set_clock(mci, max_dtr);
+
/*
* Unlike SD, MMC cards dont have a configuration register to notify
* supported bus width. So bus test command should be run to identify
--
1.8.2.rc2
More information about the barebox
mailing list