summaryrefslogtreecommitdiff
path: root/drivers/mmc/mmc.c
diff options
context:
space:
mode:
authorMikael Larsson <mikael.xt.larsson@stericsson.com>2011-01-24 16:30:07 +0100
committerMichael BRANDT <michael.brandt@stericsson.com>2011-01-25 10:16:59 +0100
commit39b443a5ee1f9bfaeafc95adae91afcdd66eaf4c (patch)
tree6bbaf67eeb7f6dbc298c4601369bf8643ac552bd /drivers/mmc/mmc.c
parentb4f340af5537094fc72076b8e9de9b27e1c35b20 (diff)
Correct capacity calculation for high capacity mmc
This adds the correct calculation for high capacity mmc. ST-Ericsson ID: N/A ST-Ericsson FOSS-OUT ID: Trivial Change-Id: I4a6b152d02f22d4abba790177fcfb200ba853192 Signed-off-by: Mikael Larsson <mikael.xt.larsson@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/13312 Reviewed-by: QATOOLS Reviewed-by: Sebastian RASMUSSEN <sebastian.rasmussen@stericsson.com> Reviewed-by: Michael BRANDT <michael.brandt@stericsson.com>
Diffstat (limited to 'drivers/mmc/mmc.c')
-rw-r--r--drivers/mmc/mmc.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 31af3ad87..89f78ffa3 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -491,14 +491,12 @@ static int mmc_change_freq(struct mmc *mmc)
if (err)
return err;
- /*
- * TODO:
- * If high capacity card is found (same as access mode is set to sector
- * adress mode), SEC_COUNT in the ext register is where to find out the
- * density. SEC_COUNT x 512 bytes = density. This might be a good spot
- * where to find out the densisty, since the ext register is already
- * read.
- */
+ if (mmc->high_capacity)
+ mmc->capacity = (u64)(ext_csd[EXT_CSD_SEC_CNT + 0] << 0 |
+ ext_csd[EXT_CSD_SEC_CNT + 1] << 8 |
+ ext_csd[EXT_CSD_SEC_CNT + 2] << 16 |
+ ext_csd[EXT_CSD_SEC_CNT + 3] << 24) *
+ mmc->read_bl_len;
mmc->wr_rel_param = ext_csd[EXT_CSD_WR_REL_PARAM];
mmc->rel_wr_sec_c = ext_csd[EXT_CSD_REL_WR_SEC_C];