summaryrefslogtreecommitdiff
path: root/drivers/timer
diff options
context:
space:
mode:
authorStefan Roese <sr@denx.de>2022-09-21 08:26:42 +0200
committerStefan Roese <sr@denx.de>2022-10-06 10:15:35 +0200
commit37bb396669b27aa62fe8bc5eeb6bfde92e09c2d3 (patch)
tree98e7317469c0931ab67c309287572484ca23463e /drivers/timer
parent2de00f342faf8085763869b2c55479028839b957 (diff)
timer: orion-timer: Only init timer once
Move the code making sure that the timer is initialized only once into orion_timer_init(), which is called from timer_early_init() and from orion_timer_probe(). This way the timer is not re-initialized. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Michael Walle <michael@walle.cc> Cc: Pali Rohár <pali@kernel.org>
Diffstat (limited to 'drivers/timer')
-rw-r--r--drivers/timer/orion-timer.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/timer/orion-timer.c b/drivers/timer/orion-timer.c
index cd63ea9162..d0eab3ce78 100644
--- a/drivers/timer/orion-timer.c
+++ b/drivers/timer/orion-timer.c
@@ -28,6 +28,11 @@ static bool early_init_done __section(".data") = 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)
+ return;
+ early_init_done = true;
+
writel(~0, base + TIMER0_VAL);
writel(~0, base + TIMER0_RELOAD);
@@ -51,11 +56,6 @@ static uint64_t orion_timer_get_count(void *base)
/* Early (e.g. bootstage etc) timer functions */
static void notrace timer_early_init(void)
{
- /* Only init the timer once */
- if (early_init_done)
- return;
- early_init_done = true;
-
if (IS_ENABLED(CONFIG_ARCH_MVEBU))
orion_timer_init((void *)MVEBU_TIMER_BASE, INPUT_CLOCK_25MHZ);
else