[U-Boot] [PATCH] mmc: modified calculated mmc-capacity & set mmc trans_speed

Jae hoon Chung jh80.chung at gmail.com
Thu Apr 8 05:36:58 CEST 2010


The patches do the following
1. If mmc size is more than 2GB , we need to calculated using the
extended 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's trans_speed.


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

---
 drivers/mmc/mmc.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index cf4ea16..c985924 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -410,6 +410,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);
@@ -794,12 +798,11 @@ 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 */
 	mmc->block_dev.lun = 0;
-- 
1.6.0.4


More information about the U-Boot mailing list