]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mach-stm32: stmf32f4: timer: remove clock_get() call
authorPatrice Chotard <patrice.chotard@st.com>
Tue, 12 Dec 2017 08:49:38 +0000 (09:49 +0100)
committerTom Rini <trini@konsulko.com>
Wed, 10 Jan 2018 13:05:46 +0000 (08:05 -0500)
In order to use common clock driver between STM32F4 and
STM32F7, remove clock_get() call
As APB_PSC is always set to 2, only case when
clock_get(CLOCK_AHB) != clock_get(CLOCK_APB1) is kept

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
arch/arm/mach-stm32/stm32f4/timer.c

index 163f4616d3f9f92c96a667e73c1207273eaa09f6..00b1d4abdac5ebed76afa1edcc4f9abef5ba01f8 100644 (file)
@@ -51,12 +51,8 @@ int timer_init(void)
 
        setbits_le32(&STM32_RCC->apb1enr, RCC_APB1ENR_TIM2EN);
 
-       if (clock_get(CLOCK_AHB) == clock_get(CLOCK_APB1))
-               writel((clock_get(CLOCK_APB1) / CONFIG_SYS_HZ_CLOCK) - 1,
-                      &tim->psc);
-       else
-               writel(((clock_get(CLOCK_APB1) * 2) / CONFIG_SYS_HZ_CLOCK) - 1,
-                      &tim->psc);
+       writel(((CONFIG_SYS_CLK_FREQ / 2) / CONFIG_SYS_HZ_CLOCK) - 1,
+              &tim->psc);
 
        writel(0xFFFFFFFF, &tim->arr);
        writel(TIM_CR1_CEN, &tim->cr1);