mirror of
https://github.com/CTCaer/hekate
synced 2024-12-22 11:21:23 +00:00
Add support for SD cards that report wrong info
Some vendors, *I'm looking at you Samsung*, report support for 1.8 voltage, even though the card does not support it. So, disable low voltage support for now until the behavior is changed to act more like what Linux does. (re-initializing the SD card and disables the low voltage switch). Fix the switch to high speed mode for high voltages also. Additionally, correct the IF COND reply. 0xAA is the important part.
This commit is contained in:
parent
fc0a94bd84
commit
5363029e60
1 changed files with 6 additions and 5 deletions
11
ipl/sdmmc.c
11
ipl/sdmmc.c
|
@ -492,7 +492,7 @@ static int _sd_storage_send_if_cond(sdmmc_storage_t *storage)
|
||||||
if (!sdmmc_get_rsp(storage->sdmmc, &resp, 4, SDMMC_RSP_TYPE_5))
|
if (!sdmmc_get_rsp(storage->sdmmc, &resp, 4, SDMMC_RSP_TYPE_5))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return (resp & 0xFFF) == 0x1AA ? 1 : 0;
|
return (resp & 0xFF) == 0xAA ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _sd_storage_get_op_cond_once(sdmmc_storage_t *storage, u32 *cond, int is_version_1, int supports_low_voltage)
|
static int _sd_storage_get_op_cond_once(sdmmc_storage_t *storage, u32 *cond, int is_version_1, int supports_low_voltage)
|
||||||
|
@ -518,8 +518,9 @@ static int _sd_storage_get_op_cond(sdmmc_storage_t *storage, int is_version_1, i
|
||||||
{
|
{
|
||||||
if (cond & 0x40000000)
|
if (cond & 0x40000000)
|
||||||
storage->has_sector_access = 1;
|
storage->has_sector_access = 1;
|
||||||
|
// TODO: Some SD Card incorrectly report low voltage support
|
||||||
if (cond & 0x1000000 && supports_low_voltage)
|
// Disable it for now
|
||||||
|
if (cond & 0x1000000 && supports_low_voltage && 0)
|
||||||
{
|
{
|
||||||
//The low voltage regulator configuration is valid for SDMMC1 only.
|
//The low voltage regulator configuration is valid for SDMMC1 only.
|
||||||
if (storage->sdmmc->id == SDMMC_1 &&
|
if (storage->sdmmc->id == SDMMC_1 &&
|
||||||
|
@ -537,7 +538,7 @@ static int _sd_storage_get_op_cond(sdmmc_storage_t *storage, int is_version_1, i
|
||||||
}
|
}
|
||||||
if (get_tmr() > timeout)
|
if (get_tmr() > timeout)
|
||||||
break;
|
break;
|
||||||
sleep(1000);
|
sleep(10000); // Needs to be at least 10ms for some SD Cards
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -815,7 +816,7 @@ int sdmmc_storage_init_sd(sdmmc_storage_t *storage, sdmmc_t *sdmmc, u32 id, u32
|
||||||
}
|
}
|
||||||
DPRINTF("[sd] enabled highspeed (low voltage)\n");
|
DPRINTF("[sd] enabled highspeed (low voltage)\n");
|
||||||
}
|
}
|
||||||
else if (type != 6 && storage->scr[0] & 0xF != 0)
|
else if (type != 6 && (storage->scr[0] & 0xF) != 0)
|
||||||
{
|
{
|
||||||
if (!_sd_storage_enable_highspeed_high_volt(storage, buf))
|
if (!_sd_storage_enable_highspeed_high_volt(storage, buf))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue