[PATCH 07/10] board_f/r: Allow selection of CONFIG_TIMER_EARLY w/o CONFIG_TIMER

Stefan Roese sr at denx.de
Wed Sep 21 16:06:22 CEST 2022


The early timer functions provided via CONFIG_TIMER_EARLY don't need
CONFIG_TIMER to be enabled, as they don't make use of the DM timer
and uclass interface. This patch now allow the selection of
CONFIG_TIMER_EARLY w/o CONFIG_TIMER, enabling this early timer
functionality also for non CONFIG_TIMER drivers.

With this change it's necessary to guard the dm_timer_init() call
in initr_dm_devices() & initf_dm() additionally via CONFIG_TIMER.

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

diff --git a/common/board_f.c b/common/board_f.c
index f92d7b9faf4c..b1f67bfa72aa 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -787,7 +787,7 @@ static int initf_dm(void)
 	if (ret)
 		return ret;
 
-	if (IS_ENABLED(CONFIG_TIMER_EARLY)) {
+	if (IS_ENABLED(CONFIG_TIMER) && IS_ENABLED(CONFIG_TIMER_EARLY)) {
 		ret = dm_timer_init();
 		if (ret)
 			return ret;
diff --git a/common/board_r.c b/common/board_r.c
index 50670b5615a5..56575e552df8 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -254,7 +254,7 @@ static int initr_dm_devices(void)
 {
 	int ret;
 
-	if (IS_ENABLED(CONFIG_TIMER_EARLY)) {
+	if (IS_ENABLED(CONFIG_TIMER) && IS_ENABLED(CONFIG_TIMER_EARLY)) {
 		ret = dm_timer_init();
 		if (ret)
 			return ret;
diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig
index fd8745ffc2e0..91107b662b7e 100644
--- a/drivers/timer/Kconfig
+++ b/drivers/timer/Kconfig
@@ -39,7 +39,6 @@ config VPL_TIMER
 
 config TIMER_EARLY
 	bool "Allow timer to be used early in U-Boot"
-	depends on TIMER
 	# initr_bootstage() requires a timer and is called before initr_dm()
 	# so only the early timer is available
 	default y if X86 && BOOTSTAGE
-- 
2.37.3



More information about the U-Boot mailing list