forked from len0rd/rockbox
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
This commit is contained in:
parent
145135f99f
commit
08641941bb
1 changed files with 22 additions and 8 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue