diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-04-25 07:43:13 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-04-25 07:43:13 +0000 |
commit | a8040053087f6e87318af6a83f40da57bc5fd374 (patch) | |
tree | d8c7b5c88df68c24eb906a082734396670c3a90c /os/hal/ports/STM32 | |
parent | f45d6a094caf868b4223999ee6cab4eb781ab60b (diff) | |
download | ChibiOS-a8040053087f6e87318af6a83f40da57bc5fd374.tar.gz ChibiOS-a8040053087f6e87318af6a83f40da57bc5fd374.tar.bz2 ChibiOS-a8040053087f6e87318af6a83f40da57bc5fd374.zip |
Power saving mode for SDMMCv1 driver.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10176 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/ports/STM32')
-rw-r--r-- | os/hal/ports/STM32/LLD/SDMMCv1/hal_sdc_lld.c | 19 | ||||
-rw-r--r-- | os/hal/ports/STM32/LLD/SDMMCv1/hal_sdc_lld.h | 6 |
2 files changed, 23 insertions, 2 deletions
diff --git a/os/hal/ports/STM32/LLD/SDMMCv1/hal_sdc_lld.c b/os/hal/ports/STM32/LLD/SDMMCv1/hal_sdc_lld.c index d22fb31d6..791be5750 100644 --- a/os/hal/ports/STM32/LLD/SDMMCv1/hal_sdc_lld.c +++ b/os/hal/ports/STM32/LLD/SDMMCv1/hal_sdc_lld.c @@ -543,14 +543,29 @@ void sdc_lld_set_data_clk(SDCDriver *sdcp, sdcbusclk_t clk) { #if 0
if (SDC_CLK_50MHz == clk) {
sdcp->sdmmc->CLKCR = (sdcp->sdmmc->CLKCR & 0xFFFFFF00U) |
+#if STM32_SDC_SDMMC_PWRSAV
+ SDMMC_CLKDIV_HS | SDMMC_CLKCR_BYPASS |
+ SDMMC_CLKCR_PWRSAV;
+#else
SDMMC_CLKDIV_HS | SDMMC_CLKCR_BYPASS;
+#endif
}
- else
+ else {
+#if STM32_SDC_SDMMC_PWRSAV
+ sdcp->sdmmc->CLKCR = (sdcp->sdmmc->CLKCR & 0xFFFFFF00U) | SDMMC_CLKDIV_HS |
+ SDMMC_CLKCR_PWRSAV;
+#else
sdcp->sdmmc->CLKCR = (sdcp->sdmmc->CLKCR & 0xFFFFFF00U) | SDMMC_CLKDIV_HS;
+#endif
+ }
#else
(void)clk;
- sdcp->sdmmc->CLKCR = (sdcp->sdmmc->CLKCR & 0xFFFFFF00U) | SDMMC_CLKDIV_HS;
+#if STM32_SDC_SDMMC_PWRSAV
+#else
+ sdcp->sdmmc->CLKCR = (sdcp->sdmmc->CLKCR & 0xFFFFFF00U) | SDMMC_CLKDIV_HS |
+ SDMMC_CLKCR_PWRSAV;
+#endif
#endif
}
diff --git a/os/hal/ports/STM32/LLD/SDMMCv1/hal_sdc_lld.h b/os/hal/ports/STM32/LLD/SDMMCv1/hal_sdc_lld.h index 4479a1c5b..9f4490da3 100644 --- a/os/hal/ports/STM32/LLD/SDMMCv1/hal_sdc_lld.h +++ b/os/hal/ports/STM32/LLD/SDMMCv1/hal_sdc_lld.h @@ -84,6 +84,12 @@ */
#if !defined(STM32_SDC_SDMMC_CLOCK_DELAY) || defined(__DOXYGEN__)
#define STM32_SDC_SDMMC_CLOCK_DELAY 10
+
+/**
+ * @brief Card clock power saving enable.
+ */
+#if !defined(STM32_SDC_SDMMC_PWRSAV) || defined(__DOXYGEN__)
+#define STM32_SDC_SDMMC_PWRSAV TRUE
#endif
/**
|