1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-05 19:51:45 +00:00

fusee: actually obey the SD spec when switching voltage

This commit is contained in:
Kate J. Temkin 2018-05-10 07:10:37 -07:00
parent 5b5aa38486
commit 402b69c549

View file

@ -321,6 +321,8 @@ enum sdmmc_command_magic {
/* Misc constants */
MMC_DEFAULT_BLOCK_ORDER = 9,
MMC_VOLTAGE_SWITCH_TIME = 5000, // 5mS
MMC_POST_CLOCK_DELAY = 1000, // 1mS
};
@ -789,12 +791,17 @@ static int sdmmc1_switch_to_low_voltage(struct mmc *mmc)
}
// Rerun the main clock calibration...
rc = sdmmc_run_autocal(mmc, true);
rc = sdmmc_run_autocal(mmc, false);
if (rc)
mmc_print(mmc, "WARNING: failed to re-calibrate after voltage switch!");
// ... and ensure the host is set up to apply the relevant change.
sdmmc_set_working_voltage(mmc, MMC_VOLTAGE_1V8);
udelay(MMC_VOLTAGE_SWITCH_TIME);
// Enable the SD clock.
sdmmc_clock_enable(mmc, true);
udelay(MMC_POST_CLOCK_DELAY);
mmc_debug(mmc, "now running from 1V8");
return 0;