mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 13:15:18 -05:00
sd-as3525: do not reverse 2 times long responses, read them directly in the needed order
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25185 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
db7aedf93a
commit
c3c7306098
1 changed files with 7 additions and 18 deletions
|
|
@ -241,15 +241,13 @@ static bool send_cmd(const int drive, const int cmd, const int arg,
|
||||||
if(status & MCI_RESPONSE_ERROR) /* timeout or crc failure */
|
if(status & MCI_RESPONSE_ERROR) /* timeout or crc failure */
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(status & MCI_CMD_RESP_END) /*Response passed CRC check */
|
if(status & MCI_CMD_RESP_END) /* Response passed CRC check */
|
||||||
{
|
{
|
||||||
if(flags & MCI_LONG_RESP)
|
if(flags & MCI_LONG_RESP)
|
||||||
{ /* replace short response with long response */
|
{ /* response[0] has already been read */
|
||||||
/* store the response in reverse words order */
|
response[1] = MCI_RESP1(drive);
|
||||||
response[0] = MCI_RESP3(drive);
|
response[2] = MCI_RESP2(drive);
|
||||||
response[1] = MCI_RESP2(drive);
|
response[3] = MCI_RESP3(drive);
|
||||||
response[2] = MCI_RESP1(drive);
|
|
||||||
response[3] = MCI_RESP0(drive);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -270,9 +268,6 @@ static int sd_init_card(const int drive)
|
||||||
unsigned long response;
|
unsigned long response;
|
||||||
long init_timeout;
|
long init_timeout;
|
||||||
bool sd_v2 = false;
|
bool sd_v2 = false;
|
||||||
unsigned long temp_reg[4];
|
|
||||||
int i;
|
|
||||||
|
|
||||||
|
|
||||||
/* MCLCK on and set to 400kHz ident frequency */
|
/* MCLCK on and set to 400kHz ident frequency */
|
||||||
MCI_CLOCK(drive) = MCI_IDENTSPEED;
|
MCI_CLOCK(drive) = MCI_IDENTSPEED;
|
||||||
|
|
@ -310,12 +305,9 @@ static int sd_init_card(const int drive)
|
||||||
|
|
||||||
/* CMD2 send CID */
|
/* CMD2 send CID */
|
||||||
if(!send_cmd(drive, SD_ALL_SEND_CID, 0, MCI_RESP|MCI_LONG_RESP|MCI_ARG,
|
if(!send_cmd(drive, SD_ALL_SEND_CID, 0, MCI_RESP|MCI_LONG_RESP|MCI_ARG,
|
||||||
temp_reg))
|
card_info[drive].cid))
|
||||||
return -3;
|
return -3;
|
||||||
|
|
||||||
for(i=0; i<4; i++)
|
|
||||||
card_info[drive].cid[3-i] = temp_reg[i];
|
|
||||||
|
|
||||||
/* CMD3 send RCA */
|
/* CMD3 send RCA */
|
||||||
if(!send_cmd(drive, SD_SEND_RELATIVE_ADDR, 0, MCI_RESP|MCI_ARG,
|
if(!send_cmd(drive, SD_SEND_RELATIVE_ADDR, 0, MCI_RESP|MCI_ARG,
|
||||||
&card_info[drive].rca))
|
&card_info[drive].rca))
|
||||||
|
|
@ -350,12 +342,9 @@ static int sd_init_card(const int drive)
|
||||||
|
|
||||||
/* CMD9 send CSD */
|
/* CMD9 send CSD */
|
||||||
if(!send_cmd(drive, SD_SEND_CSD, card_info[drive].rca,
|
if(!send_cmd(drive, SD_SEND_CSD, card_info[drive].rca,
|
||||||
MCI_RESP|MCI_LONG_RESP|MCI_ARG, temp_reg))
|
MCI_RESP|MCI_LONG_RESP|MCI_ARG, card_info[drive].csd))
|
||||||
return -9;
|
return -9;
|
||||||
|
|
||||||
for(i=0; i<4; i++)
|
|
||||||
card_info[drive].csd[3-i] = temp_reg[i];
|
|
||||||
|
|
||||||
sd_parse_csd(&card_info[drive]);
|
sd_parse_csd(&card_info[drive]);
|
||||||
|
|
||||||
#if defined(HAVE_MULTIDRIVE)
|
#if defined(HAVE_MULTIDRIVE)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue