summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
authorJack Halpin <jack.halpin@gmail.com>2010-05-05 04:35:08 +0000
committerJack Halpin <jack.halpin@gmail.com>2010-05-05 04:35:08 +0000
commit08641941bbe3e1bf3088a6e7da71176bb25ae69f (patch)
tree58b4ba292b816a51e01c83d7c2c43708c628dff1 /firmware/target
parent145135f99f9453af8593c8a9e1cae8556abde3de (diff)
sd-as3525v2.c: Implement 4 bit widebus for SD Transfers.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25820 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/as3525/sd-as3525v2.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/firmware/target/arm/as3525/sd-as3525v2.c b/firmware/target/arm/as3525/sd-as3525v2.c
index 0886753f61..754b6fa5e2 100644
--- a/firmware/target/arm/as3525/sd-as3525v2.c
+++ b/firmware/target/arm/as3525/sd-as3525v2.c
@@ -534,11 +534,29 @@ static int sd_init_card(const int drive)
sd_parse_csd(&card_info[drive]);
-
-#ifndef HAVE_MULTIDRIVE
/* CMD7 w/rca: Select card to put it in TRAN state */
if(!send_cmd(drive, SD_SELECT_CARD, card_info[drive].rca, MCI_NO_RESP, NULL))
return -12;
+
+#ifndef BOOTLOADER
+ /* Switch to to 4 bit widebus mode */
+ if(sd_wait_for_state(drive, SD_TRAN) < 0)
+ return -13;
+ /* CMD55 */
+ if(!send_cmd(drive, SD_APP_CMD, card_info[drive].rca, MCI_NO_RESP, NULL))
+ return -14;
+ /* ACMD6 */
+ if(!send_cmd(drive, SD_SET_BUS_WIDTH, 2, MCI_NO_RESP, NULL))
+ return -15;
+ mci_delay();
+ /* CMD55 */
+ if(!send_cmd(drive, SD_APP_CMD, card_info[drive].rca, MCI_NO_RESP, NULL))
+ return -16;
+ /* ACMD42 */
+ if(!send_cmd(drive, SD_SET_CLR_CARD_DETECT, 0, MCI_NO_RESP, NULL))
+ return -17;
+ /* Now that card is widebus make controller aware */
+ MCI_CTYPE |= (1<<drive);
#endif
card_info[drive].initialized = 1;
@@ -783,11 +801,9 @@ static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start,
}
}
-#ifdef HAVE_MULTIDRIVE
/* CMD7 w/rca: Select card to put it in TRAN state */
if(!send_cmd(drive, SD_SELECT_CARD, card_info[drive].rca, MCI_NO_RESP, NULL))
- return -13;
-#endif
+ return -18;
last_disk_activity = current_tick;
dma_retain();
@@ -875,12 +891,10 @@ static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start,
dma_release();
-#ifdef HAVE_MULTIDRIVE
/* CMD lines are separate, not common, so we need to actively deselect */
/* CMD7 w/rca =0 : deselects card & puts it in STBY state */
if(!send_cmd(drive, SD_DESELECT_CARD, 0, MCI_NO_RESP, NULL))
- return -14;
-#endif
+ return -19;
#ifndef BOOTLOADER
sd_enable(false);