diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2013-11-27 19:34:50 +0000 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2013-11-30 16:15:35 +0000 |
commit | 2ce484c658d195d245987a63ac11e61992429867 (patch) | |
tree | fd6c476097c296d7b8ae1ec82f8fd23264f90362 | |
parent | cbed7ecafed52f41a06fdd1315e06f5601063606 (diff) | |
download | rockbox-2ce484c658d195d245987a63ac11e61992429867.tar.gz rockbox-2ce484c658d195d245987a63ac11e61992429867.zip |
Revert "imx233: always keep cards in TRAN mode"
This reverts commit 462adf2a0fefbfdbccfafa11c999ac6beb114e8a.
Leaving the card in TRAN results in a huge power consumption because some cards
and internal bridges do not automatically enter power saving mode in TRAN state.
Change-Id: If79efe8cf99b24174889b3a5ebbcb51b07085f58
-rw-r--r-- | firmware/target/arm/imx233/sdmmc-imx233.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/firmware/target/arm/imx233/sdmmc-imx233.c b/firmware/target/arm/imx233/sdmmc-imx233.c index a435b149f2..b43d3b237b 100644 --- a/firmware/target/arm/imx233/sdmmc-imx233.c +++ b/firmware/target/arm/imx233/sdmmc-imx233.c | |||
@@ -530,6 +530,9 @@ static int init_mmc_drive(int drive) | |||
530 | window_start[drive] = 0; | 530 | window_start[drive] = 0; |
531 | window_end[drive] = *sec_count; | 531 | window_end[drive] = *sec_count; |
532 | } | 532 | } |
533 | /* deselect card */ | ||
534 | if(!send_cmd(drive, MMC_DESELECT_CARD, 0, MCI_NO_RESP, NULL)) | ||
535 | return -13; | ||
533 | 536 | ||
534 | /* MMC always support CMD23 */ | 537 | /* MMC always support CMD23 */ |
535 | support_set_block_count[drive] = false; | 538 | support_set_block_count[drive] = false; |
@@ -608,6 +611,18 @@ static int transfer_sectors(int drive, unsigned long start, int count, void *buf | |||
608 | ret = -201; | 611 | ret = -201; |
609 | goto Lend; | 612 | goto Lend; |
610 | } | 613 | } |
614 | /* select card. | ||
615 | * NOTE: rely on SD_SELECT_CARD=MMC_SELECT_CARD */ | ||
616 | if(!send_cmd(drive, SD_SELECT_CARD, SDMMC_RCA(drive), MCI_NO_RESP, NULL)) | ||
617 | { | ||
618 | ret = -20; | ||
619 | goto Lend; | ||
620 | } | ||
621 | /* wait for TRAN state */ | ||
622 | /* NOTE: rely on SD_TRAN=MMC_TRAN */ | ||
623 | ret = wait_for_state(drive, SD_TRAN); | ||
624 | if(ret < 0) | ||
625 | goto Ldeselect; | ||
611 | 626 | ||
612 | /** | 627 | /** |
613 | * NOTE: we need to make sure dma transfers are aligned. This is handled | 628 | * NOTE: we need to make sure dma transfers are aligned. This is handled |
@@ -664,6 +679,12 @@ static int transfer_sectors(int drive, unsigned long start, int count, void *buf | |||
664 | else | 679 | else |
665 | ret = __xfer_sectors(drive, start, count, buf, read); | 680 | ret = __xfer_sectors(drive, start, count, buf, read); |
666 | } | 681 | } |
682 | /* deselect card */ | ||
683 | Ldeselect: | ||
684 | /* CMD7 w/rca =0 : deselects card & puts it in STBY state | ||
685 | * NOTE: rely on SD_DESELECT_CARD=MMC_DESELECT_CARD */ | ||
686 | if(!send_cmd(drive, SD_DESELECT_CARD, 0, MCI_NO_RESP, NULL)) | ||
687 | ret = -23; | ||
667 | Lend: | 688 | Lend: |
668 | /* update led status */ | 689 | /* update led status */ |
669 | led(false); | 690 | led(false); |