From c3c73060989e2f8f9244bdb47d20c24d28153a62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?= Date: Sun, 14 Mar 2010 21:46:25 +0000 Subject: 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 --- firmware/target/arm/as3525/sd-as3525.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) (limited to 'firmware/target/arm') diff --git a/firmware/target/arm/as3525/sd-as3525.c b/firmware/target/arm/as3525/sd-as3525.c index 0afe735e53..5ccb659e00 100644 --- a/firmware/target/arm/as3525/sd-as3525.c +++ b/firmware/target/arm/as3525/sd-as3525.c @@ -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 */ 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) - { /* replace short response with long response */ - /* store the response in reverse words order */ - response[0] = MCI_RESP3(drive); - response[1] = MCI_RESP2(drive); - response[2] = MCI_RESP1(drive); - response[3] = MCI_RESP0(drive); + { /* response[0] has already been read */ + response[1] = MCI_RESP1(drive); + response[2] = MCI_RESP2(drive); + response[3] = MCI_RESP3(drive); } return true; } @@ -270,9 +268,6 @@ static int sd_init_card(const int drive) unsigned long response; long init_timeout; bool sd_v2 = false; - unsigned long temp_reg[4]; - int i; - /* MCLCK on and set to 400kHz ident frequency */ MCI_CLOCK(drive) = MCI_IDENTSPEED; @@ -310,12 +305,9 @@ static int sd_init_card(const int drive) /* CMD2 send CID */ if(!send_cmd(drive, SD_ALL_SEND_CID, 0, MCI_RESP|MCI_LONG_RESP|MCI_ARG, - temp_reg)) + card_info[drive].cid)) return -3; - for(i=0; i<4; i++) - card_info[drive].cid[3-i] = temp_reg[i]; - /* CMD3 send RCA */ if(!send_cmd(drive, SD_SEND_RELATIVE_ADDR, 0, MCI_RESP|MCI_ARG, &card_info[drive].rca)) @@ -350,12 +342,9 @@ static int sd_init_card(const int drive) /* CMD9 send CSD */ 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; - for(i=0; i<4; i++) - card_info[drive].csd[3-i] = temp_reg[i]; - sd_parse_csd(&card_info[drive]); #if defined(HAVE_MULTIDRIVE) -- cgit v1.2.3