public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Cc: "Michael Walle" <michael@walle.cc>, "Pali Rohár" <pali@kernel.org>
Subject: [PATCH 2/2] timer: orion-timer: Only init timer once
Date: Wed, 21 Sep 2022 08:26:42 +0200	[thread overview]
Message-ID: <20220921062642.910994-2-sr@denx.de> (raw)
In-Reply-To: <20220921062642.910994-1-sr@denx.de>

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>
---
 drivers/timer/orion-timer.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/timer/orion-timer.c b/drivers/timer/orion-timer.c
index cd63ea916237..d0eab3ce781d 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
-- 
2.37.3


  reply	other threads:[~2022-09-21  6:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21  6:26 [PATCH 1/2] arm: mvebu: Remove timer.c Stefan Roese
2022-09-21  6:26 ` Stefan Roese [this message]
2022-10-06 10:46   ` [PATCH 2/2] timer: orion-timer: Only init timer once Stefan Roese
2022-10-06 10:46 ` [PATCH 1/2] arm: mvebu: Remove timer.c Stefan Roese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220921062642.910994-2-sr@denx.de \
    --to=sr@denx.de \
    --cc=michael@walle.cc \
    --cc=pali@kernel.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox