aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mmc/mmc_block.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c
index d91fcf7c3178..abcf19116d70 100644
--- a/drivers/mmc/mmc_block.c
+++ b/drivers/mmc/mmc_block.c
@@ -359,7 +359,12 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
359 md->block_bits = card->csd.read_blkbits; 359 md->block_bits = card->csd.read_blkbits;
360 360
361 blk_queue_hardsect_size(md->queue.queue, 1 << md->block_bits); 361 blk_queue_hardsect_size(md->queue.queue, 1 << md->block_bits);
362 set_capacity(md->disk, card->csd.capacity); 362
363 /*
364 * The CSD capacity field is in units of read_blkbits.
365 * set_capacity takes units of 512 bytes.
366 */
367 set_capacity(md->disk, card->csd.capacity << (card->csd.read_blkbits - 9));
363 } 368 }
364 out: 369 out:
365 return md; 370 return md;
@@ -373,7 +378,7 @@ mmc_blk_set_blksize(struct mmc_blk_data *md, struct mmc_card *card)
373 378
374 mmc_card_claim_host(card); 379 mmc_card_claim_host(card);
375 cmd.opcode = MMC_SET_BLOCKLEN; 380 cmd.opcode = MMC_SET_BLOCKLEN;
376 cmd.arg = 1 << card->csd.read_blkbits; 381 cmd.arg = 1 << md->block_bits;
377 cmd.flags = MMC_RSP_R1; 382 cmd.flags = MMC_RSP_R1;
378 err = mmc_wait_for_cmd(card->host, &cmd, 5); 383 err = mmc_wait_for_cmd(card->host, &cmd, 5);
379 mmc_card_release_host(card); 384 mmc_card_release_host(card);
@@ -412,10 +417,9 @@ static int mmc_blk_probe(struct mmc_card *card)
412 if (err) 417 if (err)
413 goto out; 418 goto out;
414 419
415 printk(KERN_INFO "%s: %s %s %dKiB %s\n", 420 printk(KERN_INFO "%s: %s %s %luKiB %s\n",
416 md->disk->disk_name, mmc_card_id(card), mmc_card_name(card), 421 md->disk->disk_name, mmc_card_id(card), mmc_card_name(card),
417 (card->csd.capacity << card->csd.read_blkbits) / 1024, 422 get_capacity(md->disk) >> 1, mmc_blk_readonly(card)?"(ro)":"");
418 mmc_blk_readonly(card)?"(ro)":"");
419 423
420 mmc_set_drvdata(card, md); 424 mmc_set_drvdata(card, md);
421 add_disk(md->disk); 425 add_disk(md->disk);