From 39b443a5ee1f9bfaeafc95adae91afcdd66eaf4c Mon Sep 17 00:00:00 2001 From: Mikael Larsson Date: Mon, 24 Jan 2011 16:30:07 +0100 Subject: 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 Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/13312 Reviewed-by: QATOOLS Reviewed-by: Sebastian RASMUSSEN Reviewed-by: Michael BRANDT --- drivers/mmc/mmc.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'drivers') 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]; -- cgit v1.2.3