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: sjg@chromium.org, trini@konsulko.com
Subject: [PATCH 08/10] board_f/r: Don't call timer_init() when TIMER is enabled
Date: Wed, 21 Sep 2022 16:06:23 +0200	[thread overview]
Message-ID: <20220921140625.999002-9-sr@denx.de> (raw)
In-Reply-To: <20220921140625.999002-1-sr@denx.de>

The timer initialization is done implicitly when CONFIG_TIMER is
enabled. There is no need to re-configure the timer again. Even worse,
another call to the timer init function may lead to a re-init of the
counter register and therefore non consecutive timer values.

This patch makes sure, that timer_init() is not called in case that
CONFIG_TIMER is configured.

Signed-off-by: Stefan Roese <sr@denx.de>
---
 common/board_f.c | 2 +-
 common/board_r.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/common/board_f.c b/common/board_f.c
index b1f67bfa72aa..fbc5d3e9d205 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -851,7 +851,7 @@ static const init_fnc_t init_sequence_f[] = {
 	/* get CPU and bus clocks according to the environment variable */
 	get_clocks,		/* get CPU and bus clocks (etc.) */
 #endif
-#if !defined(CONFIG_M68K)
+#if !defined(CONFIG_M68K) && !IS_ENABLED(CONFIG_TIMER)
 	timer_init,		/* initialize timer */
 #endif
 #if defined(CONFIG_BOARD_POSTCLK_INIT)
diff --git a/common/board_r.c b/common/board_r.c
index 56575e552df8..149cfdc3d351 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -745,7 +745,8 @@ static init_fnc_t init_sequence_r[] = {
 	kgdb_init,
 #endif
 	interrupt_init,
-#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_M68K)
+#if (defined(CONFIG_MICROBLAZE) || defined(CONFIG_M68K)) && \
+	!IS_ENABLED(CONFIG_TIMER)
 	timer_init,		/* initialize timer */
 #endif
 #if defined(CONFIG_LED_STATUS)
-- 
2.37.3


  parent reply	other threads:[~2022-09-21 14:07 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21 14:06 [PATCH 00/10] bootstage: Migrate from timer_get_boot_us() to timer_get_us() Stefan Roese
2022-09-21 14:06 ` [PATCH 01/10] arm: arch_timer: Add timer_early functions Stefan Roese
2022-09-25 14:15   ` Simon Glass
2022-09-21 14:06 ` [PATCH 02/10] arm: imx: syscounter: " Stefan Roese
2022-09-25 14:15   ` Simon Glass
2022-09-21 14:06 ` [PATCH 03/10] arm: armv8: generic_timer: " Stefan Roese
2022-09-25 14:15   ` Simon Glass
2022-09-21 14:06 ` [PATCH 04/10] timer: cadence-ttc: " Stefan Roese
2022-09-25 14:15   ` Simon Glass
2022-09-26 14:11     ` Stefan Roese
2022-09-28  1:54       ` Simon Glass
2022-09-30 12:02         ` Michal Simek
2022-09-30 13:45           ` Stefan Roese
2022-10-04 11:49             ` Michal Simek
2022-10-04 14:54               ` Stefan Roese
2022-10-04 16:29               ` Simon Glass
2022-10-05  6:59                 ` Michal Simek
2022-09-21 14:06 ` [PATCH 05/10] timer: omap-timer: " Stefan Roese
2022-09-21 14:06 ` [PATCH 06/10] timer: rockchip_timer: " Stefan Roese
2022-09-24  7:57   ` Kever Yang
2022-09-21 14:06 ` [PATCH 07/10] board_f/r: Allow selection of CONFIG_TIMER_EARLY w/o CONFIG_TIMER Stefan Roese
2022-09-25 14:15   ` Simon Glass
2022-09-26 13:52     ` Stefan Roese
2022-09-28  1:54       ` Simon Glass
2022-09-30  5:36         ` Stefan Roese
2022-09-30 13:28           ` Simon Glass
2022-09-30 13:52             ` Stefan Roese
2022-09-21 14:06 ` Stefan Roese [this message]
2022-09-21 14:06 ` [PATCH 09/10] bootstage: Migrate from timer_get_boot_us() to timer_get_us() Stefan Roese
2022-09-28 10:20   ` Simon Glass
2022-09-30 11:30   ` Michal Simek
2022-09-21 14:06 ` [PATCH 10/10] bootstage/timer: Treewide remove timer_get_boot_us() Stefan Roese
2022-09-25 14:15   ` Simon Glass

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=20220921140625.999002-9-sr@denx.de \
    --to=sr@denx.de \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --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