From: Bo Shen Date: Tue, 3 Oct 2017 05:47:59 +0000 (-0700) Subject: ARM: stm32f7: fix prescaler calculation of timer X-Git-Tag: v2017.11-rc2~72 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=72dee54b4e75894ef521ae282be00edd7284d1e0;p=u-boot ARM: stm32f7: fix prescaler calculation of timer As the timer 2 is on APB1 bus, the maximum of clock frequency of APB1 timer clock is half of SYSCLK. Then to calculate the timer prescaler for timer 2 which need to be divided by 2. Signed-off-by: Bo Shen Reviewed-by: Vikas Manocha --- diff --git a/arch/arm/mach-stm32/stm32f7/timer.c b/arch/arm/mach-stm32/stm32f7/timer.c index c15f8bbe32..b04c1013e9 100644 --- a/arch/arm/mach-stm32/stm32f7/timer.c +++ b/arch/arm/mach-stm32/stm32f7/timer.c @@ -26,7 +26,7 @@ int timer_init(void) /* Stop the timer */ writel(readl(&gpt1_regs_ptr->cr1) & ~GPT_CR1_CEN, &gpt1_regs_ptr->cr1); - writel((CONFIG_SYS_CLK_FREQ/CONFIG_SYS_HZ_CLOCK) - 1, + writel((CONFIG_SYS_CLK_FREQ / 2 / CONFIG_SYS_HZ_CLOCK) - 1, &gpt1_regs_ptr->psc); /* Configure timer for auto-reload */