mirror of
https://github.com/CTCaer/hekate
synced 2024-12-22 19:31:12 +00:00
bdk: sdmmc correct exit on eMMC < 4.0 modules
This commit is contained in:
parent
9aa55c2d76
commit
ee465b98af
1 changed files with 7 additions and 2 deletions
|
@ -152,12 +152,16 @@ int sdmmc_storage_execute_vendor_cmd(sdmmc_storage_t *storage, u32 arg)
|
||||||
|
|
||||||
resp = -1;
|
resp = -1;
|
||||||
u32 timeout = get_tmr_ms() + 1500;
|
u32 timeout = get_tmr_ms() + 1500;
|
||||||
while (resp != (R1_READY_FOR_DATA | R1_STATE(R1_STATE_TRAN)))
|
while (true)
|
||||||
{
|
{
|
||||||
_sdmmc_storage_get_status(storage, &resp, 0);
|
_sdmmc_storage_get_status(storage, &resp, 0);
|
||||||
|
|
||||||
|
if (resp == (R1_READY_FOR_DATA | R1_STATE(R1_STATE_TRAN)))
|
||||||
|
break;
|
||||||
|
|
||||||
if (get_tmr_ms() > timeout)
|
if (get_tmr_ms() > timeout)
|
||||||
break;
|
break;
|
||||||
|
msleep(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
return _sdmmc_storage_check_card_status(resp);
|
return _sdmmc_storage_check_card_status(resp);
|
||||||
|
@ -703,7 +707,7 @@ DPRINTF("[MMC] set blocklen to 512\n");
|
||||||
|
|
||||||
// Check system specification version, only version 4.0 and later support below features.
|
// Check system specification version, only version 4.0 and later support below features.
|
||||||
if (storage->csd.mmca_vsn < CSD_SPEC_VER_4)
|
if (storage->csd.mmca_vsn < CSD_SPEC_VER_4)
|
||||||
return 1;
|
goto done;
|
||||||
|
|
||||||
if (!_mmc_storage_switch_buswidth(storage, bus_width))
|
if (!_mmc_storage_switch_buswidth(storage, bus_width))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -730,6 +734,7 @@ DPRINTF("[MMC] successfully switched to HS mode\n");
|
||||||
|
|
||||||
sdmmc_card_clock_powersave(storage->sdmmc, SDMMC_POWER_SAVE_ENABLE);
|
sdmmc_card_clock_powersave(storage->sdmmc, SDMMC_POWER_SAVE_ENABLE);
|
||||||
|
|
||||||
|
done:
|
||||||
storage->initialized = 1;
|
storage->initialized = 1;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in a new issue