aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/mmc.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2006-01-03 17:38:44 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-01-03 17:38:44 -0500
commita6f6c96b65d7f65a7a7bf5cbe874eda182a6b2cc (patch)
tree5f3bd4dc24866f2b0e593b1457b1f22ec641139b /drivers/mmc/mmc.c
parent88026842b0a760145aa71d69e74fbc9ec118ca44 (diff)
[MMC] Improve MMC card block size selection
Select a block size for IO based on the read and write block size combinations, and whether the card supports partial block reads and/or partial block writes. If we are able to satisfy block reads but not block writes, mark the device read only. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/mmc/mmc.c')
-rw-r--r--drivers/mmc/mmc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index eb41391e06e9..6696f71363b9 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -550,6 +550,11 @@ static void mmc_decode_csd(struct mmc_card *card)
550 csd->capacity = (1 + m) << (e + 2); 550 csd->capacity = (1 + m) << (e + 2);
551 551
552 csd->read_blkbits = UNSTUFF_BITS(resp, 80, 4); 552 csd->read_blkbits = UNSTUFF_BITS(resp, 80, 4);
553 csd->read_partial = UNSTUFF_BITS(resp, 79, 1);
554 csd->write_misalign = UNSTUFF_BITS(resp, 78, 1);
555 csd->read_misalign = UNSTUFF_BITS(resp, 77, 1);
556 csd->write_blkbits = UNSTUFF_BITS(resp, 22, 4);
557 csd->write_partial = UNSTUFF_BITS(resp, 21, 1);
553 } else { 558 } else {
554 /* 559 /*
555 * We only understand CSD structure v1.1 and v1.2. 560 * We only understand CSD structure v1.1 and v1.2.
@@ -579,6 +584,11 @@ static void mmc_decode_csd(struct mmc_card *card)
579 csd->capacity = (1 + m) << (e + 2); 584 csd->capacity = (1 + m) << (e + 2);
580 585
581 csd->read_blkbits = UNSTUFF_BITS(resp, 80, 4); 586 csd->read_blkbits = UNSTUFF_BITS(resp, 80, 4);
587 csd->read_partial = UNSTUFF_BITS(resp, 79, 1);
588 csd->write_misalign = UNSTUFF_BITS(resp, 78, 1);
589 csd->read_misalign = UNSTUFF_BITS(resp, 77, 1);
590 csd->write_blkbits = UNSTUFF_BITS(resp, 22, 4);
591 csd->write_partial = UNSTUFF_BITS(resp, 21, 1);
582 } 592 }
583} 593}
584 594