[U-Boot] [Patch] MMC: modified calculated mmc-capacity & set mmc trans speed
Jae hoon Chung
jh80.chung at gmail.com
Tue Mar 2 11:13:44 CET 2010
The patches do the following
1. If mmc is size is more than 2GB, need to calculate using the
ext_csd register.
2. mmc_set_clock() is hard setting, that is not good solution.
If mmc is not MMC_MODE_HS, mmc will set card is tran_speed
Signed-off-by: Jaehoon Chung <jh80.chung at samsung.com>
---
drivers/mmc/mmc.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index b69ce15..13fa5c9 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -395,6 +395,10 @@ int mmc_change_freq(struct mmc *mmc)
if (ext_csd[212] || ext_csd[213] || ext_csd[214] || ext_csd[215])
mmc->high_capacity = 1;
+ if (mmc->high_capacity)
+ mmc->capacity = ((ext_csd[215] << 24) |
(ext_csd[214] << 16) |
+ (ext_csd[213] << 8 | ext_csd[212]));
+
cardtype = ext_csd[196] & 0xf;
err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_HS_TIMING, 1);
@@ -779,11 +783,12 @@ int mmc_startup(struct mmc *mmc)
if (mmc->card_caps & MMC_MODE_HS) {
if (mmc->card_caps & MMC_MODE_HS_52MHz)
- mmc_set_clock(mmc, 52000000);
+ mmc->tran_speed = 52000000;
else
- mmc_set_clock(mmc, 26000000);
- } else
- mmc_set_clock(mmc, 20000000);
+ mmc->tran_speed = 26000000;
+ }
+
+ mmc_set_clock(mmc, mmc->tran_speed);
}
/* fill in device description */
--
1.6.0.4
More information about the U-Boot
mailing list