summaryrefslogtreecommitdiff
path: root/drivers/mmc/mmc_block.c
diff options
context:
space:
mode:
authorPierre Ossman <drzeus@drzeus.cx>2007-02-17 22:15:27 +0100
committerPierre Ossman <drzeus@drzeus.cx>2007-05-01 13:04:15 +0200
commit85a18ad93ec66888d85758630019b10a84257f3c (patch)
tree46b1b7f72a8d4baac51916ca4ea09884ed043822 /drivers/mmc/mmc_block.c
parentde85989511f3a0e15b04d18582b23d428d6ddbbd (diff)
mmc: MMC sector based cards
Support for MMC 4.2 sector based cards. This tweaks the init a bit and reads a new field out of the EXT_CSD. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc/mmc_block.c')
-rw-r--r--drivers/mmc/mmc_block.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c
index 95b0da6abe87..63fbde8756ac 100644
--- a/drivers/mmc/mmc_block.c
+++ b/drivers/mmc/mmc_block.c
@@ -491,11 +491,20 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
blk_queue_hardsect_size(md->queue.queue, 1 << md->block_bits);
- /*
- * The CSD capacity field is in units of read_blkbits.
- * set_capacity takes units of 512 bytes.
- */
- set_capacity(md->disk, card->csd.capacity << (card->csd.read_blkbits - 9));
+ if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) {
+ /*
+ * The EXT_CSD sector count is in number or 512 byte
+ * sectors.
+ */
+ set_capacity(md->disk, card->ext_csd.sectors);
+ } else {
+ /*
+ * The CSD capacity field is in units of read_blkbits.
+ * set_capacity takes units of 512 bytes.
+ */
+ set_capacity(md->disk,
+ card->csd.capacity << (card->csd.read_blkbits - 9));
+ }
return md;
err_putdisk: