forked from len0rd/rockbox
sd-as3525v2: do not reverse 2 times long responses, read them directly in the needed order
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25184 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
291e2b1ae6
commit
db7aedf93a
1 changed files with 6 additions and 17 deletions
|
@ -382,14 +382,11 @@ static bool send_cmd(const int cmd, const int arg, const int flags,
|
||||||
|
|
||||||
if(flags & MCI_LONG_RESP)
|
if(flags & MCI_LONG_RESP)
|
||||||
{
|
{
|
||||||
/* store the response in little endian order for the words */
|
response[3] = MCI_RESP3;
|
||||||
response[0] = MCI_RESP3;
|
response[2] = MCI_RESP2;
|
||||||
response[1] = MCI_RESP2;
|
response[1] = MCI_RESP1;
|
||||||
response[2] = MCI_RESP1;
|
|
||||||
response[3] = MCI_RESP0;
|
|
||||||
}
|
}
|
||||||
else
|
response[0] = MCI_RESP0;
|
||||||
response[0] = MCI_RESP0;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -397,10 +394,8 @@ static bool send_cmd(const int cmd, const int arg, const int flags,
|
||||||
static int sd_init_card(void)
|
static int sd_init_card(void)
|
||||||
{
|
{
|
||||||
unsigned long response;
|
unsigned long response;
|
||||||
unsigned long temp_reg[4];
|
|
||||||
long init_timeout;
|
long init_timeout;
|
||||||
bool sd_v2 = false;
|
bool sd_v2 = false;
|
||||||
int i;
|
|
||||||
|
|
||||||
/* assume 24 MHz clock / 60 = 400 kHz */
|
/* assume 24 MHz clock / 60 = 400 kHz */
|
||||||
MCI_CLKDIV = (MCI_CLKDIV & ~(0xFF)) | 0x3C; /* CLK_DIV_0 : bits 7:0 */
|
MCI_CLKDIV = (MCI_CLKDIV & ~(0xFF)) | 0x3C; /* CLK_DIV_0 : bits 7:0 */
|
||||||
|
@ -437,12 +432,9 @@ static int sd_init_card(void)
|
||||||
} while(!(card_info.ocr & (1<<31)) );
|
} while(!(card_info.ocr & (1<<31)) );
|
||||||
|
|
||||||
/* CMD2 send CID */
|
/* CMD2 send CID */
|
||||||
if(!send_cmd(SD_ALL_SEND_CID, 0, MCI_RESP|MCI_LONG_RESP, temp_reg))
|
if(!send_cmd(SD_ALL_SEND_CID, 0, MCI_RESP|MCI_LONG_RESP, card_info.cid))
|
||||||
return -5;
|
return -5;
|
||||||
|
|
||||||
for(i=0; i<4; i++)
|
|
||||||
card_info.cid[3-i] = temp_reg[i];
|
|
||||||
|
|
||||||
/* CMD3 send RCA */
|
/* CMD3 send RCA */
|
||||||
if(!send_cmd(SD_SEND_RELATIVE_ADDR, 0, MCI_RESP, &card_info.rca))
|
if(!send_cmd(SD_SEND_RELATIVE_ADDR, 0, MCI_RESP, &card_info.rca))
|
||||||
return -4;
|
return -4;
|
||||||
|
@ -451,12 +443,9 @@ static int sd_init_card(void)
|
||||||
|
|
||||||
/* CMD9 send CSD */
|
/* CMD9 send CSD */
|
||||||
if(!send_cmd(SD_SEND_CSD, card_info.rca,
|
if(!send_cmd(SD_SEND_CSD, card_info.rca,
|
||||||
MCI_RESP|MCI_LONG_RESP, temp_reg))
|
MCI_RESP|MCI_LONG_RESP, card_info.csd))
|
||||||
return -5;
|
return -5;
|
||||||
|
|
||||||
for(i=0; i<4; i++)
|
|
||||||
card_info.csd[3-i] = temp_reg[i];
|
|
||||||
|
|
||||||
sd_parse_csd(&card_info);
|
sd_parse_csd(&card_info);
|
||||||
|
|
||||||
/* Card back to full speed */
|
/* Card back to full speed */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue