[U-Boot] [PATCH 2/4] MMC Card Capacity Bug Fix
Alagu Sankar
alagusankar at embwise.com
Wed May 12 11:38:25 CEST 2010
Fixed a bug in card capacity calculation for MMC high-capacity cards.
Signed-off-by: Alagu Sankar <alagusankar at embwise.com>
---
drivers/mmc/mmc.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 959d8ad..e7abf94 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -393,6 +393,7 @@ int mmc_change_freq(struct mmc *mmc)
char ext_csd[512];
char cardtype;
int err;
+ unsigned int sec_count;
mmc->card_caps = 0;
@@ -407,8 +408,14 @@ int mmc_change_freq(struct mmc *mmc)
if (err)
return err;
- if (ext_csd[212] || ext_csd[213] || ext_csd[214] || ext_csd[215])
+ sec_count = ((uint)ext_csd[212] |
+ ((uint)ext_csd[213] << 8) |
+ ((uint)ext_csd[214] << 16) |
+ ((uint)ext_csd[215] << 24));
+ if (sec_count) {
mmc->high_capacity = 1;
+ mmc->capacity = sec_count * 512;
+ }
cardtype = ext_csd[196] & 0xf;
--
1.6.0.6
More information about the U-Boot
mailing list