Skip to contentSkip to conversation

arm: lpc32xx: Fix timer initialization

PATCH In review Gregory CLEMENT 2 participants 2 messages Apr 17, 2019 – Apr 27, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: lpc32xx: Fix timer initialization

The match controller register is not cleared during initialization. However, some bits of this register may reset the TC if tnMRx match it.

As we can't make any assumption about how U-Boot is launched by the first stage bootloader (such as S1L) clearing this register ensure that the timers work as expected.

---
 arch/arm/cpu/arm926ejs/lpc32xx/timer.c | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/cpu/arm926ejs/lpc32xx/timer.c +3 -0
index 404ccbb716..b3ca686040 100644
@@ -33,6 +33,9 @@ static void lpc32xx_timer_reset(struct timer_regs *timer, u32 freq)
 
 	/* Set prescale counter value */
 	writel((get_periph_clk_rate() / freq) - 1, &timer->pr);
+
+	/* Ensure that the counter is not reset when matching TC */
+	writel(0,  &timer->mcr);
 }
 
 static void lpc32xx_timer_count(struct timer_regs *timer, int enable)
Signature · 1 line
2.20.1
#1 lore raw
Quoted 9 lines · Gregory CLEMENT

The match controller register is not cleared during initialization. However, some bits of this register may reset the TC if tnMRx match it.

As we can't make any assumption about how U-Boot is launched by the first stage bootloader (such as S1L) clearing this register ensure that the timers work as expected.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190427/447ff3c3/attachment.sig>