diff options
Diffstat (limited to 'drivers/mmc/card/block.c')
-rw-r--r-- | drivers/mmc/card/block.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index d73cac84d9f2..1d1e469e08ea 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -57,7 +57,6 @@ struct mmc_blk_data { | |||
57 | struct mmc_queue queue; | 57 | struct mmc_queue queue; |
58 | 58 | ||
59 | unsigned int usage; | 59 | unsigned int usage; |
60 | unsigned int block_bits; | ||
61 | unsigned int read_only; | 60 | unsigned int read_only; |
62 | }; | 61 | }; |
63 | 62 | ||
@@ -231,11 +230,11 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) | |||
231 | if (!mmc_card_blockaddr(card)) | 230 | if (!mmc_card_blockaddr(card)) |
232 | brq.cmd.arg <<= 9; | 231 | brq.cmd.arg <<= 9; |
233 | brq.cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; | 232 | brq.cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; |
234 | brq.data.blksz = 1 << md->block_bits; | 233 | brq.data.blksz = 512; |
235 | brq.stop.opcode = MMC_STOP_TRANSMISSION; | 234 | brq.stop.opcode = MMC_STOP_TRANSMISSION; |
236 | brq.stop.arg = 0; | 235 | brq.stop.arg = 0; |
237 | brq.stop.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC; | 236 | brq.stop.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC; |
238 | brq.data.blocks = req->nr_sectors >> (md->block_bits - 9); | 237 | brq.data.blocks = req->nr_sectors; |
239 | 238 | ||
240 | if (brq.data.blocks > 1) { | 239 | if (brq.data.blocks > 1) { |
241 | /* SPI multiblock writes terminate using a special | 240 | /* SPI multiblock writes terminate using a special |
@@ -351,16 +350,11 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) | |||
351 | if (rq_data_dir(req) != READ) { | 350 | if (rq_data_dir(req) != READ) { |
352 | if (mmc_card_sd(card)) { | 351 | if (mmc_card_sd(card)) { |
353 | u32 blocks; | 352 | u32 blocks; |
354 | unsigned int bytes; | ||
355 | 353 | ||
356 | blocks = mmc_sd_num_wr_blocks(card); | 354 | blocks = mmc_sd_num_wr_blocks(card); |
357 | if (blocks != (u32)-1) { | 355 | if (blocks != (u32)-1) { |
358 | if (card->csd.write_partial) | ||
359 | bytes = blocks << md->block_bits; | ||
360 | else | ||
361 | bytes = blocks << 9; | ||
362 | spin_lock_irq(&md->lock); | 356 | spin_lock_irq(&md->lock); |
363 | ret = __blk_end_request(req, 0, bytes); | 357 | ret = __blk_end_request(req, 0, blocks << 9); |
364 | spin_unlock_irq(&md->lock); | 358 | spin_unlock_irq(&md->lock); |
365 | } | 359 | } |
366 | } else { | 360 | } else { |
@@ -410,13 +404,6 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card) | |||
410 | */ | 404 | */ |
411 | md->read_only = mmc_blk_readonly(card); | 405 | md->read_only = mmc_blk_readonly(card); |
412 | 406 | ||
413 | /* | ||
414 | * Both SD and MMC specifications state (although a bit | ||
415 | * unclearly in the MMC case) that a block size of 512 | ||
416 | * bytes must always be supported by the card. | ||
417 | */ | ||
418 | md->block_bits = 9; | ||
419 | |||
420 | md->disk = alloc_disk(1 << MMC_SHIFT); | 407 | md->disk = alloc_disk(1 << MMC_SHIFT); |
421 | if (md->disk == NULL) { | 408 | if (md->disk == NULL) { |
422 | ret = -ENOMEM; | 409 | ret = -ENOMEM; |
@@ -454,7 +441,7 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card) | |||
454 | 441 | ||
455 | sprintf(md->disk->disk_name, "mmcblk%d", devidx); | 442 | sprintf(md->disk->disk_name, "mmcblk%d", devidx); |
456 | 443 | ||
457 | blk_queue_hardsect_size(md->queue.queue, 1 << md->block_bits); | 444 | blk_queue_hardsect_size(md->queue.queue, 512); |
458 | 445 | ||
459 | if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) { | 446 | if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) { |
460 | /* | 447 | /* |
@@ -492,7 +479,7 @@ mmc_blk_set_blksize(struct mmc_blk_data *md, struct mmc_card *card) | |||
492 | 479 | ||
493 | mmc_claim_host(card->host); | 480 | mmc_claim_host(card->host); |
494 | cmd.opcode = MMC_SET_BLOCKLEN; | 481 | cmd.opcode = MMC_SET_BLOCKLEN; |
495 | cmd.arg = 1 << md->block_bits; | 482 | cmd.arg = 512; |
496 | cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC; | 483 | cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC; |
497 | err = mmc_wait_for_cmd(card->host, &cmd, 5); | 484 | err = mmc_wait_for_cmd(card->host, &cmd, 5); |
498 | mmc_release_host(card->host); | 485 | mmc_release_host(card->host); |