Skip to content

Commit 582e3c9

Browse files
committedJan 2, 2023
- orion-timer: Fix problem with early static variable (Stefan)
2 parents 3089d12 + 5387b09 commit 582e3c9

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)
Please sign in to comment.