Skip to content

Commit 5387b09

Browse files
committed
timer: orion-timer: Fix problem with early static variable
We've noticed that at least one Kirkwood board (Pogo v4) has problems with the new orion DM timer implementation. Debugging revealed that this issue is related with the static variable "early_init_done" which does not work correctly before relocation in all cases. This patch removes this static variable and replaces it's functionality via a function that detects if the timer is already initialized. Signed-off-by: Stefan Roese <[email protected]> Cc: Pali Rohár <[email protected]> Cc: Michael Walle <[email protected]> Cc: Tony Dinh <[email protected]> Tested-by: Tony Dinh <[email protected]>
1 parent 3089d12 commit 5387b09

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

drivers/timer/orion-timer.c

+7-3
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,19 @@ struct orion_timer_priv {
2323

2424
#define MVEBU_TIMER_FIXED_RATE_25MHZ 25000000
2525

26-
static bool early_init_done __section(".data") = false;
26+
static bool early_init_done(void *base)
27+
{
28+
if (readl(base + TIMER_CTRL) & TIMER0_EN)
29+
return true;
30+
return false;
31+
}
2732

2833
/* Common functions for early (boot) and DM based timer */
2934
static void orion_timer_init(void *base, enum input_clock_type type)
3035
{
3136
/* Only init the timer once */
32-
if (early_init_done)
37+
if (early_init_done(base))
3338
return;
34-
early_init_done = true;
3539

3640
writel(~0, base + TIMER0_VAL);
3741
writel(~0, base + TIMER0_RELOAD);

0 commit comments

Comments
 (0)