diff options
author | Uladzimir Pylinski <barthess@yandex.ru> | 2015-03-19 13:00:36 +0000 |
---|---|---|
committer | Uladzimir Pylinski <barthess@yandex.ru> | 2015-03-19 13:00:36 +0000 |
commit | 08fd7beec63e60dbb0737a1e6487706a6ee897cf (patch) | |
tree | eb0b2b26e9093c8519a43a35e362769b73869fb2 /os | |
parent | 7f91456f2a987f5ee0d38c6606f0c48ea65d2f87 (diff) | |
download | ChibiOS-08fd7beec63e60dbb0737a1e6487706a6ee897cf.tar.gz ChibiOS-08fd7beec63e60dbb0737a1e6487706a6ee897cf.tar.bz2 ChibiOS-08fd7beec63e60dbb0737a1e6487706a6ee897cf.zip |
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
Diffstat (limited to 'os')
-rw-r--r-- | os/hal/src/sdc.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/os/hal/src/sdc.c b/os/hal/src/sdc.c index 45c6604ac..a51e2ce7b 100644 --- a/os/hal/src/sdc.c +++ b/os/hal/src/sdc.c @@ -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;
|