diff options
author | Philip Rakity <prakity@marvell.com> | 2011-02-14 02:13:09 -0500 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2011-03-16 12:30:25 -0400 |
commit | b676f0391a5f6816c047cbd1e2ad2a897f3c161a (patch) | |
tree | e054461c7796123904f57fe4969134e94c2eb8ec /drivers/mmc | |
parent | 2f94e55ae5ddad83e661002985d2ea11b6d51d3d (diff) |
mmc: check if mmc cards < 2GB do sector addressing
Some TOSHIBA MMC cards only support sector addressing even though the
size is < 2GB. According to JEDEC Spec JESD84-A441-1 the ocr register
(bits 30, 29) determine byte/sector mode. Use them.
Signed-off-by: Philip Rakity <prakity@marvell.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/core/mmc.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 6396c5d98e85..14e95f39a7bf 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c | |||
@@ -421,6 +421,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
421 | int err, ddr = 0; | 421 | int err, ddr = 0; |
422 | u32 cid[4]; | 422 | u32 cid[4]; |
423 | unsigned int max_dtr; | 423 | unsigned int max_dtr; |
424 | u32 rocr; | ||
424 | 425 | ||
425 | BUG_ON(!host); | 426 | BUG_ON(!host); |
426 | WARN_ON(!host->claimed); | 427 | WARN_ON(!host->claimed); |
@@ -434,7 +435,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
434 | mmc_go_idle(host); | 435 | mmc_go_idle(host); |
435 | 436 | ||
436 | /* The extra bit indicates that we support high capacity */ | 437 | /* The extra bit indicates that we support high capacity */ |
437 | err = mmc_send_op_cond(host, ocr | (1 << 30), NULL); | 438 | err = mmc_send_op_cond(host, ocr | (1 << 30), &rocr); |
438 | if (err) | 439 | if (err) |
439 | goto err; | 440 | goto err; |
440 | 441 | ||
@@ -522,6 +523,15 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
522 | err = mmc_read_ext_csd(card); | 523 | err = mmc_read_ext_csd(card); |
523 | if (err) | 524 | if (err) |
524 | goto free_card; | 525 | goto free_card; |
526 | |||
527 | /* If doing byte addressing, check if required to do sector | ||
528 | * addressing. Handle the case of <2GB cards needing sector | ||
529 | * addressing. See section 8.1 JEDEC Standard JED84-A441; | ||
530 | * ocr register has bit 30 set for sector addressing. | ||
531 | */ | ||
532 | if (!(mmc_card_blockaddr(card)) && (rocr & (1<<30))) | ||
533 | mmc_card_set_blockaddr(card); | ||
534 | |||
525 | /* Erase size depends on CSD and Extended CSD */ | 535 | /* Erase size depends on CSD and Extended CSD */ |
526 | mmc_set_erase_size(card); | 536 | mmc_set_erase_size(card); |
527 | } | 537 | } |