summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNitin Ghate <nghate@nvidia.com>2010-07-20 18:55:59 +0530
committerGary King <gking@nvidia.com>2010-07-20 09:43:38 -0700
commitbb1a7adb7e06600782f0aab4eb5c53848871c3ba (patch)
tree295a0882b9d90474a88f90adce5f8794d1c91a1b
parent05b8a0683f0ae76328f2d03c13c15b1b98059aba (diff)
MMC: fix to report correct disk space in case of emmc 4.3+ cards
change to subtract the boot partiotion size from the entire device size so that proper device size is reported. updated the code as per suggestions from Gary, removed the comment bug: 683019 Change-Id: Iaa1a8d773dc1b876eb1da55823ff44a7f745d234 Reviewed-on: http://git-master/r/3496 Tested-by: Nitin Ghate <nghate@nvidia.com> Reviewed-by: Gary King <gking@nvidia.com>
-rwxr-xr-xdrivers/mmc/core/mmc.c5
-rw-r--r--include/linux/mmc/mmc.h2
2 files changed, 5 insertions, 2 deletions
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 3a37ecab4a37..e4c905f15c6d 100755
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -166,6 +166,7 @@ static int mmc_read_ext_csd(struct mmc_card *card)
{
int err;
u8 *ext_csd;
+ unsigned offs;
BUG_ON(!card);
@@ -229,12 +230,14 @@ static int mmc_read_ext_csd(struct mmc_card *card)
ext_csd[EXT_CSD_SEC_CNT + 3] << 24;
if (card->ext_csd.sectors) {
#ifdef CONFIG_EMBEDDED_MMC_START_OFFSET
- unsigned offs;
offs = card->host->ops->get_host_offset(card->host);
offs >>= 9;
BUG_ON(offs >= card->ext_csd.sectors);
card->ext_csd.sectors -= offs;
#endif
+ offs = ext_csd[EXT_CSD_BOOT_SIZE_MULTI] * SZ_256K / 512;
+ card->ext_csd.sectors -= offs;
+
}
}
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index cdf2dd8c9ee6..a65a02349ef2 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -258,7 +258,7 @@ struct _mmc_csd {
#define EXT_CSD_REV 192 /* RO */
#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */
#define EXT_CSD_S_A_TIMEOUT 217
-
+#define EXT_CSD_BOOT_SIZE_MULTI 226
/*
* EXT_CSD field definitions
*/