public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mmc: fix capacity calculation with high capacity mmc
@ 2010-09-06 13:59 Lei Wen
  2010-09-06 14:07 ` Reinhard Meyer
  0 siblings, 1 reply; 9+ messages in thread
From: Lei Wen @ 2010-09-06 13:59 UTC (permalink / raw)
  To: u-boot

According spec, high capacity mmc should be calculated by sector
number multiply by sector size.

Signed-off-by: Lei Wen <leiwen@marvell.com>
---
 drivers/mmc/mmc.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index ea398a5..bb97171 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -441,6 +441,11 @@ int mmc_change_freq(struct mmc *mmc)
 	if (!ext_csd[185])
 		return 0;
 
+	if (!IS_SD(mmc) && mmc->high_capacity) {
+		mmc->capacity = ext_csd[212] | (ext_csd[213] << 8)
+			| (ext_csd[214] << 16) | (ext_csd[215] << 24);
+		mmc->capacity *= mmc->read_bl_len;
+	}
 	/* High Speed is set, there are two types: 52MHz and 26MHz */
 	if (cardtype & MMC_HS_52MHZ)
 		mmc->card_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS;
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-09-24 10:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-06 13:59 [U-Boot] [PATCH] mmc: fix capacity calculation with high capacity mmc Lei Wen
2010-09-06 14:07 ` Reinhard Meyer
2010-09-06 14:11   ` Lei Wen
2010-09-13  4:04     ` Lei Wen
2010-09-18 21:49       ` Wolfgang Denk
2010-09-19  4:32         ` Reinhard Meyer
2010-09-19  8:27           ` Lei Wen
2010-09-21 14:45         ` John Rigby
2010-09-24 10:49           ` Marek Vasut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox