summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2020-11-09 10:26:35 +0100
committerCommit Bot <commit-bot@chromium.org>2020-12-02 09:38:56 +0000
commit696492499f433806a26b4cb0733026444e698c35 (patch)
treebf5ae3e76b9fb94d538d66c0f93aaf026b05e510
parent418d2e8e40b2a9d1530e18e620dc0a41154f713b (diff)
downloadchrome-ec-696492499f433806a26b4cb0733026444e698c35.tar.gz
stm32: update the timer pre-scaler on STM32F4
Add support for changing for the timer source clock frequency on STM32F4 by re-computing the timer pre-scaler value in the HOOK_FREQ_CHANGE callback. Preparatory work to implement power management switching between PLL and HSI as sysclk. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=b:130561737 TEST=manual, verify the output of the 'gettime' console command against the wall clock. BRANCH=fpmcu-bloonchipper Change-Id: Ia7dc24d3b1dbff816b1cebbc87492e678b987dfd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2527048 Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--chip/stm32/hwtimer32.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/chip/stm32/hwtimer32.c b/chip/stm32/hwtimer32.c
index 12057ad762..a643ccc134 100644
--- a/chip/stm32/hwtimer32.c
+++ b/chip/stm32/hwtimer32.c
@@ -142,7 +142,7 @@ defined(CHIP_FAMILY_STM32H7)
}
#if defined(CHIP_FAMILY_STM32L) || defined(CHIP_FAMILY_STM32L4) || \
- defined(CHIP_FAMILY_STM32H7)
+ defined(CHIP_FAMILY_STM32F4) || defined(CHIP_FAMILY_STM32H7)
/* for families using a variable clock feeding the timer */
static void update_prescaler(void)
{
@@ -183,7 +183,8 @@ static void update_prescaler(void)
#endif /* CONFIG_WATCHDOG_HELP */
}
DECLARE_HOOK(HOOK_FREQ_CHANGE, update_prescaler, HOOK_PRIO_DEFAULT);
-#endif /* CHIP_FAMILY_STM32L || CHIP_FAMILY_STM32L4 || CHIP_FAMILY_STM32H7 */
+#endif /* CHIP_FAMILY_STM32L || CHIP_FAMILY_STM32L4 || */
+ /* CHIP_FAMILY_STM32F4 || CHIP_FAMILY_STM32H7 */
int __hw_clock_source_init(uint32_t start_t)
{