[U-Boot] [U-BOOT][PATCH]mmc: modify setting tran_speed and change csd's instead of response value

Jaehoon Chung jh80.chung at samsung.com
Fri Jun 18 08:13:25 CEST 2010


This patch do the following
1. we need not use cmd.response, because we assinged cmd.response value to mmc->csd.
2. mmc_set_clock() is hard setting, that is not good solution
   and if mmc is not MMC_MODE_HS, mmc will set card's tran_speed.

 Signed-off-by: Jaehoon Chung <jh80.chung at samsung.com>

---
 drivers/mmc/mmc.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index cf4ea16..fd80a27 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -666,7 +666,7 @@ int mmc_startup(struct mmc *mmc)
 	mmc->csd[3] = cmd.response[3];
 
 	if (mmc->version == MMC_VERSION_UNKNOWN) {
-		int version = (cmd.response[0] >> 26) & 0xf;
+		int version = (mmc->csd[0] >> 26) & 0xf;
 
 		switch (version) {
 			case 0:
@@ -691,17 +691,17 @@ int mmc_startup(struct mmc *mmc)
 	}
 
 	/* divide frequency by 10, since the mults are 10x bigger */
-	freq = fbase[(cmd.response[0] & 0x7)];
-	mult = multipliers[((cmd.response[0] >> 3) & 0xf)];
+	freq = fbase[(mmc->csd[0] & 0x7)];
+	mult = multipliers[((mmc->csd[0] >> 3) & 0xf)];
 
 	mmc->tran_speed = freq * mult;
 
-	mmc->read_bl_len = 1 << ((cmd.response[1] >> 16) & 0xf);
+	mmc->read_bl_len = 1 << ((mmc->csd[1] >> 16) & 0xf);
 
 	if (IS_SD(mmc))
 		mmc->write_bl_len = mmc->read_bl_len;
 	else
-		mmc->write_bl_len = 1 << ((cmd.response[3] >> 22) & 0xf);
+		mmc->write_bl_len = 1 << ((mmc->csd[3] >> 22) & 0xf);
 
 	if (mmc->high_capacity) {
 		csize = (mmc->csd[1] & 0x3f) << 16
@@ -794,11 +794,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