fusee: work around some dual-init SDMMC issues

This commit is contained in:
Kate J. Temkin
2018-05-23 06:14:38 -06:00
parent ef9adabb40
commit eaf8e559d6
3 changed files with 44 additions and 16 deletions

View File

@@ -15,6 +15,13 @@
static bool g_ahb_redirect_enabled = false;
// Only use voltage switching in stage2 and later.
#ifdef FUSEE_STAGE1_SRC
#define MMC_VOLTAGE_SWITCHING_ALLOWED false
#else
#define MMC_VOLTAGE_SWITCHING_ALLOWED true
#endif
/* Global sd struct. */
static struct mmc g_sd_mmc = {0};
static bool g_sd_initialized = false;
@@ -26,7 +33,7 @@ int initialize_sd_mmc(void) {
}
if (!g_sd_initialized) {
int rc = sdmmc_init(&g_sd_mmc, SWITCH_MICROSD);
int rc = sdmmc_init(&g_sd_mmc, SWITCH_MICROSD, MMC_VOLTAGE_SWITCHING_ALLOWED);
if (rc == 0) {
g_sd_initialized = true;
return 0;