diff --git a/firmware/target/arm/as3525/ata_sd_as3525.c b/firmware/target/arm/as3525/ata_sd_as3525.c index f6dd8385b1..9d395ad084 100644 --- a/firmware/target/arm/as3525/ata_sd_as3525.c +++ b/firmware/target/arm/as3525/ata_sd_as3525.c @@ -243,7 +243,7 @@ static int sd_init_card(const int drive) { unsigned long response; long init_timeout; - bool sdhc; + bool sd_v2 = false; unsigned long temp_reg[4]; int i; @@ -252,10 +252,10 @@ static int sd_init_card(const int drive) mci_delay(); - sdhc = false; + /* CMD8 Check for v2 sd card */ if(send_cmd(drive, SD_SEND_IF_COND, 0x1AA, MCI_RESP|MCI_ARG, &response)) if((response & 0xFFF) == 0x1AA) - sdhc = true; + sd_v2 = true; /* timeout for initialization is 1sec, from SD Specification 2.00 */ init_timeout = current_tick + HZ; @@ -272,8 +272,8 @@ static int sd_init_card(const int drive) return -3; } - /* acmd41 */ - if(!send_cmd(drive, SD_APP_OP_COND, (sdhc ? 0x40FF8000 : (1<<23)), + /* acmd41 If we have a v2 sd card set HCS bit[30] with voltage range */ + if(!send_cmd(drive, SD_APP_OP_COND, (0x00FF8000 | (sd_v2 ? 1<<30 : 0)), MCI_RESP|MCI_ARG, &card_info[drive].ocr)) { return -4;