fusee: fix sdmmc speed modes

This commit is contained in:
hexkyz
2020-11-11 18:05:30 +00:00
committed by SciresM
parent d233b482fb
commit 5e342d8c52
5 changed files with 80 additions and 80 deletions

View File

@@ -734,11 +734,11 @@ static int sdmmc_sd_switch_hs_low(sdmmc_device_t *device, uint8_t *status)
return 0;
/* Reconfigure the internal clock. */
if (!sdmmc_select_speed(device->sdmmc, SDMMC_SPEED_UHS_SDR104))
if (!sdmmc_select_speed(device->sdmmc, SDMMC_SPEED_SD_SDR104))
return 0;
/* Run tuning. */
if (!sdmmc_execute_tuning(device->sdmmc, SDMMC_SPEED_UHS_SDR104, MMC_SEND_TUNING_BLOCK))
if (!sdmmc_execute_tuning(device->sdmmc, SDMMC_SPEED_SD_SDR104, MMC_SEND_TUNING_BLOCK))
return 0;
}
else if (status[13] & SD_MODE_UHS_SDR50) /* High-speed SDR50 is supported. */
@@ -748,11 +748,11 @@ static int sdmmc_sd_switch_hs_low(sdmmc_device_t *device, uint8_t *status)
return 0;
/* Reconfigure the internal clock. */
if (!sdmmc_select_speed(device->sdmmc, SDMMC_SPEED_UHS_SDR50))
if (!sdmmc_select_speed(device->sdmmc, SDMMC_SPEED_SD_SDR50))
return 0;
/* Run tuning. */
if (!sdmmc_execute_tuning(device->sdmmc, SDMMC_SPEED_UHS_SDR50, MMC_SEND_TUNING_BLOCK))
if (!sdmmc_execute_tuning(device->sdmmc, SDMMC_SPEED_SD_SDR50, MMC_SEND_TUNING_BLOCK))
return 0;
}
else if (status[13] & SD_MODE_UHS_SDR12) /* High-speed SDR12 is supported. */
@@ -762,11 +762,11 @@ static int sdmmc_sd_switch_hs_low(sdmmc_device_t *device, uint8_t *status)
return 0;
/* Reconfigure the internal clock. */
if (!sdmmc_select_speed(device->sdmmc, SDMMC_SPEED_UHS_SDR12))
if (!sdmmc_select_speed(device->sdmmc, SDMMC_SPEED_SD_SDR12))
return 0;
/* Run tuning. */
if (!sdmmc_execute_tuning(device->sdmmc, SDMMC_SPEED_UHS_SDR12, MMC_SEND_TUNING_BLOCK))
if (!sdmmc_execute_tuning(device->sdmmc, SDMMC_SPEED_SD_SDR12, MMC_SEND_TUNING_BLOCK))
return 0;
}
else
@@ -791,7 +791,7 @@ static int sdmmc_sd_switch_hs_high(sdmmc_device_t *device, uint8_t *status)
return 0;
/* Reconfigure the internal clock. */
if (!sdmmc_select_speed(device->sdmmc, SDMMC_SPEED_UHS_SDR25))
if (!sdmmc_select_speed(device->sdmmc, SDMMC_SPEED_SD_SDR25))
return 0;
/* Peek the SD card's status. */
@@ -848,7 +848,7 @@ int sdmmc_device_sd_init(sdmmc_device_t *device, sdmmc_t *sdmmc, SdmmcBusWidth b
memset(device, 0, sizeof(sdmmc_device_t));
/* Try to initialize the driver. */
if (!sdmmc_init(sdmmc, SDMMC_1, SDMMC_VOLTAGE_3V3, SDMMC_BUS_WIDTH_1BIT, SDMMC_SPEED_SD_INIT))
if (!sdmmc_init(sdmmc, SDMMC_1, SDMMC_VOLTAGE_3V3, SDMMC_BUS_WIDTH_1BIT, SDMMC_SPEED_SD_IDENT))
{
sdmmc_error(sdmmc, "Failed to initialize the SDMMC driver!");
return 0;
@@ -881,7 +881,7 @@ int sdmmc_device_sd_init(sdmmc_device_t *device, sdmmc_t *sdmmc, SdmmcBusWidth b
sdmmc_info(sdmmc, "Sent if cond to SD card!");
/* Get the SD card's operating conditions. */
if (!sdmmc_sd_send_op_cond(device, is_sd_ver2, (bus_width == SDMMC_BUS_WIDTH_4BIT) && (bus_speed == SDMMC_SPEED_UHS_SDR104)))
if (!sdmmc_sd_send_op_cond(device, is_sd_ver2, (bus_width == SDMMC_BUS_WIDTH_4BIT) && (bus_speed == SDMMC_SPEED_SD_SDR104)))
{
sdmmc_error(sdmmc, "Failed to send op cond!");
return 0;
@@ -927,7 +927,7 @@ int sdmmc_device_sd_init(sdmmc_device_t *device, sdmmc_t *sdmmc, SdmmcBusWidth b
if (!device->is_180v)
{
/* Reconfigure the internal clock. */
if (!sdmmc_select_speed(device->sdmmc, SDMMC_SPEED_SD_LEGACY))
if (!sdmmc_select_speed(device->sdmmc, SDMMC_SPEED_SD_DS))
{
sdmmc_error(sdmmc, "Failed to apply the correct bus speed!");
return 0;
@@ -1005,7 +1005,7 @@ int sdmmc_device_sd_init(sdmmc_device_t *device, sdmmc_t *sdmmc, SdmmcBusWidth b
sdmmc_info(sdmmc, "Switched to high-speed from low voltage!");
}
else if ((device->scr.sda_vsn & (SD_SCR_SPEC_VER_1 | SD_SCR_SPEC_VER_2)) && ((bus_speed != SDMMC_SPEED_SD_LEGACY)))
else if ((device->scr.sda_vsn & (SD_SCR_SPEC_VER_1 | SD_SCR_SPEC_VER_2)) && ((bus_speed != SDMMC_SPEED_SD_DS)))
{
/* Switch to high-speed from high voltage (if possible). */
if (!sdmmc_sd_switch_hs_high(device, switch_status))
@@ -1404,7 +1404,7 @@ int sdmmc_device_mmc_init(sdmmc_device_t *device, sdmmc_t *sdmmc, SdmmcBusWidth
memset(device, 0, sizeof(sdmmc_device_t));
/* Try to initialize the driver. */
if (!sdmmc_init(sdmmc, SDMMC_4, SDMMC_VOLTAGE_1V8, SDMMC_BUS_WIDTH_1BIT, SDMMC_SPEED_MMC_INIT))
if (!sdmmc_init(sdmmc, SDMMC_4, SDMMC_VOLTAGE_1V8, SDMMC_BUS_WIDTH_1BIT, SDMMC_SPEED_MMC_IDENT))
{
sdmmc_error(sdmmc, "Failed to initialize the SDMMC driver!");
return 0;