diff mbox series

[U-Boot,RESEND,07/14] mach-stm32: stmf32f4: timer: remove clock_get() call

Message ID 1513068585-10812-8-git-send-email-patrice.chotard@st.com
State Accepted
Commit dcb11959d85596982c935040b8b6d237f31e7e4d
Delegated to: Tom Rini
Headers show
Series Convert STM3F4 to DT and driver model | expand

Commit Message

Patrice CHOTARD Dec. 12, 2017, 8:49 a.m. UTC
From: Patrice Chotard <patrice.chotard@st.com>

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 | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Tom Rini Jan. 10, 2018, 4:42 p.m. UTC | #1
On Tue, Dec 12, 2017 at 09:49:38AM +0100, patrice.chotard@st.com wrote:

> From: Patrice Chotard <patrice.chotard@st.com>
> 
> 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>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/arch/arm/mach-stm32/stm32f4/timer.c b/arch/arm/mach-stm32/stm32f4/timer.c
index 163f461..00b1d4a 100644
--- a/arch/arm/mach-stm32/stm32f4/timer.c
+++ b/arch/arm/mach-stm32/stm32f4/timer.c
@@ -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);