From db7aedf93ae18a316bda25a5de4b0eca6eb5ad43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?= Date: Sun, 14 Mar 2010 21:38:36 +0000 Subject: [PATCH] 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 --- firmware/target/arm/as3525/sd-as3525v2.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/firmware/target/arm/as3525/sd-as3525v2.c b/firmware/target/arm/as3525/sd-as3525v2.c index 94b46017da..5a8565e822 100644 --- a/firmware/target/arm/as3525/sd-as3525v2.c +++ b/firmware/target/arm/as3525/sd-as3525v2.c @@ -382,14 +382,11 @@ static bool send_cmd(const int cmd, const int arg, const int flags, if(flags & MCI_LONG_RESP) { - /* store the response in little endian order for the words */ - response[0] = MCI_RESP3; - response[1] = MCI_RESP2; - response[2] = MCI_RESP1; - response[3] = MCI_RESP0; + response[3] = MCI_RESP3; + response[2] = MCI_RESP2; + response[1] = MCI_RESP1; } - else - response[0] = MCI_RESP0; + response[0] = MCI_RESP0; } 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) { unsigned long response; - unsigned long temp_reg[4]; long init_timeout; bool sd_v2 = false; - int i; /* assume 24 MHz clock / 60 = 400 kHz */ 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)) ); /* 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; - for(i=0; i<4; i++) - card_info.cid[3-i] = temp_reg[i]; - /* CMD3 send RCA */ if(!send_cmd(SD_SEND_RELATIVE_ADDR, 0, MCI_RESP, &card_info.rca)) return -4; @@ -451,12 +443,9 @@ static int sd_init_card(void) /* CMD9 send CSD */ 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; - for(i=0; i<4; i++) - card_info.csd[3-i] = temp_reg[i]; - sd_parse_csd(&card_info); /* Card back to full speed */