diff options
author | Tom Rini <trini@konsulko.com> | 2023-01-02 09:36:13 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-01-02 09:36:13 -0500 |
commit | 582e3c9fb2337c2f49faa73ac86dde25f4d56901 (patch) | |
tree | 9a61931429bc320ad8e105a28ff5fdeb0d3098e9 /drivers/timer/orion-timer.c | |
parent | 3089d12a02efd1dc5dce01e0ec0fda9142693b11 (diff) | |
parent | 5387b093cb7914b3c0404da928fa4bafdffac291 (diff) |
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell
- orion-timer: Fix problem with early static variable (Stefan)
Diffstat (limited to 'drivers/timer/orion-timer.c')
-rw-r--r-- | drivers/timer/orion-timer.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/timer/orion-timer.c b/drivers/timer/orion-timer.c index d0eab3ce78..6804bf0fa2 100644 --- a/drivers/timer/orion-timer.c +++ b/drivers/timer/orion-timer.c @@ -23,15 +23,19 @@ struct orion_timer_priv { #define MVEBU_TIMER_FIXED_RATE_25MHZ 25000000 -static bool early_init_done __section(".data") = false; +static bool early_init_done(void *base) +{ + if (readl(base + TIMER_CTRL) & TIMER0_EN) + return true; + return false; +} /* Common functions for early (boot) and DM based timer */ static void orion_timer_init(void *base, enum input_clock_type type) { /* Only init the timer once */ - if (early_init_done) + if (early_init_done(base)) return; - early_init_done = true; writel(~0, base + TIMER0_VAL); writel(~0, base + TIMER0_RELOAD); |