diff options
-rw-r--r-- | drivers/mmc/mmc_block.c | 49 |
1 files changed, 4 insertions, 45 deletions
diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c index d6fcc467b503..a0e0dad1b419 100644 --- a/drivers/mmc/mmc_block.c +++ b/drivers/mmc/mmc_block.c | |||
@@ -319,52 +319,11 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card) | |||
319 | md->read_only = mmc_blk_readonly(card); | 319 | md->read_only = mmc_blk_readonly(card); |
320 | 320 | ||
321 | /* | 321 | /* |
322 | * Figure out a workable block size. MMC cards have: | 322 | * Both SD and MMC specifications state (although a bit |
323 | * - two block sizes, one for read and one for write. | 323 | * unclearly in the MMC case) that a block size of 512 |
324 | * - may support partial reads and/or writes | 324 | * bytes must always be supported by the card. |
325 | * (allows block sizes smaller than specified) | ||
326 | */ | 325 | */ |
327 | md->block_bits = card->csd.read_blkbits; | 326 | md->block_bits = 9; |
328 | if (card->csd.write_blkbits != card->csd.read_blkbits) { | ||
329 | if (card->csd.write_blkbits < card->csd.read_blkbits && | ||
330 | card->csd.read_partial) { | ||
331 | /* | ||
332 | * write block size is smaller than read block | ||
333 | * size, but we support partial reads, so choose | ||
334 | * the smaller write block size. | ||
335 | */ | ||
336 | md->block_bits = card->csd.write_blkbits; | ||
337 | } else if (card->csd.write_blkbits > card->csd.read_blkbits && | ||
338 | card->csd.write_partial) { | ||
339 | /* | ||
340 | * read block size is smaller than write block | ||
341 | * size, but we support partial writes. Use read | ||
342 | * block size. | ||
343 | */ | ||
344 | } else { | ||
345 | /* | ||
346 | * We don't support this configuration for writes. | ||
347 | */ | ||
348 | printk(KERN_ERR "%s: unable to select block size for " | ||
349 | "writing (rb%u wb%u rp%u wp%u)\n", | ||
350 | mmc_card_id(card), | ||
351 | 1 << card->csd.read_blkbits, | ||
352 | 1 << card->csd.write_blkbits, | ||
353 | card->csd.read_partial, | ||
354 | card->csd.write_partial); | ||
355 | md->read_only = 1; | ||
356 | } | ||
357 | } | ||
358 | |||
359 | /* | ||
360 | * Refuse to allow block sizes smaller than 512 bytes. | ||
361 | */ | ||
362 | if (md->block_bits < 9) { | ||
363 | printk(KERN_ERR "%s: unable to support block size %u\n", | ||
364 | mmc_card_id(card), 1 << md->block_bits); | ||
365 | ret = -EINVAL; | ||
366 | goto err_kfree; | ||
367 | } | ||
368 | 327 | ||
369 | md->disk = alloc_disk(1 << MMC_SHIFT); | 328 | md->disk = alloc_disk(1 << MMC_SHIFT); |
370 | if (md->disk == NULL) { | 329 | if (md->disk == NULL) { |