Skip to content

Commit aaea0b8

Browse files
linuswdlezcano
authored andcommitted
clocksource/drivers/nomadik-mtu: Handle 32kHz clock
It happens on the U8420-sysclk Ux500 PRCMU firmware variant that the MTU clock is just 32768 Hz, and in this mode the minimum ticks is 5 rather than two. I think this is simply so that there is enough time for the register write to propagate through the interconnect to the registers. Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent ad7794d commit aaea0b8

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

drivers/clocksource/nomadik-mtu.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ static int __init nmdk_timer_init(void __iomem *base, int irq,
186186
{
187187
unsigned long rate;
188188
int ret;
189+
int min_ticks;
189190

190191
mtu_base = base;
191192

@@ -194,7 +195,8 @@ static int __init nmdk_timer_init(void __iomem *base, int irq,
194195

195196
/*
196197
* Tick rate is 2.4MHz for Nomadik and 2.4Mhz, 100MHz or 133 MHz
197-
* for ux500.
198+
* for ux500, and in one specific Ux500 case 32768 Hz.
199+
*
198200
* Use a divide-by-16 counter if the tick rate is more than 32MHz.
199201
* At 32 MHz, the timer (with 32 bit counter) can be programmed
200202
* to wake-up at a max 127s a head in time. Dividing a 2.4 MHz timer
@@ -230,7 +232,12 @@ static int __init nmdk_timer_init(void __iomem *base, int irq,
230232
pr_err("%s: request_irq() failed\n", "Nomadik Timer Tick");
231233
nmdk_clkevt.cpumask = cpumask_of(0);
232234
nmdk_clkevt.irq = irq;
233-
clockevents_config_and_register(&nmdk_clkevt, rate, 2, 0xffffffffU);
235+
if (rate < 100000)
236+
min_ticks = 5;
237+
else
238+
min_ticks = 2;
239+
clockevents_config_and_register(&nmdk_clkevt, rate, min_ticks,
240+
0xffffffffU);
234241

235242
mtu_delay_timer.read_current_timer = &nmdk_timer_read_current_timer;
236243
mtu_delay_timer.freq = rate;

0 commit comments

Comments
 (0)