[U-Boot] [Patch] MMC: modified calculated mmc-capacity & set mmc trans speed

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@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

Dear Jae hoon Chung,
In message 91990fe21003020213s793b09acx4cde328f7555c594@mail.gmail.com you wrote:
The patches do the following
- =A0 =A0 If mmc is size is more than 2GB, need to calculate using the
ext_csd register.
- =A0 =A0 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@samsung.com
Your patch is line wrapped and white space damaged. Please make sure to use git-send-email to submit your patches (or fix your mailer configuration. Do NOT copy & paste patches, this will not work.
Best regards,
Wolfgang Denk
participants (2)
-
Jae hoon Chung
-
Wolfgang Denk