SDIO. Added workaround against incorrect 50MHz clock detection.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7785 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
Uladzimir Pylinski 2015-03-19 13:00:36 +00:00
parent 7f91456f2a
commit 08fd7beec6
1 changed files with 10 additions and 0 deletions

View File

@ -326,6 +326,13 @@ static bool sdc_detect_bus_clk(SDCDriver *sdcp, sdcbusclk_t *clk) {
/* Safe default.*/
*clk = SDC_CLK_25MHz;
/* Looks like only "high capacity" cards produce meaningful results during
this clock detection procedure.*/
if (0 == _mmcsd_get_slice(sdcp->csd, MMCSD_CSD_10_CSD_STRUCTURE_SLICE)) {
*clk = SDC_CLK_25MHz;
return HAL_SUCCESS;
}
/* Read switch functions' register.*/
if (sdc_lld_read_special(sdcp, tmp, N, MMCSD_CMD_SWITCH, 0)) {
return HAL_FAILED;
@ -345,6 +352,9 @@ static bool sdc_detect_bus_clk(SDCDriver *sdcp, sdcbusclk_t *clk) {
if (HAL_SUCCESS == sdc_cmd6_check_status(SD_SWITCH_FUNCTION_SPEED, tmp)) {
*clk = SDC_CLK_50MHz;
}
else {
*clk = SDC_CLK_25MHz;
}
}
return HAL_SUCCESS;