[U-Boot] [PATCH v4 012/100] board_r: Move early-timer init later

Simon Glass sjg at chromium.org
Fri Nov 22 04:17:37 UTC 2019


At present the early timer init happens as soon as driver mode is set up.
This makes it impossible to do any in that needs driver model but must run
before devices are problem (as needed with Intel's FSP-S, for example).

In any case it is not a good idea to tie probing of particular drivers too
closely to the DM init.

Create a new function to init the timer and put it a bit later in the
sequence.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v4:
- Add new patch to move early-timer init later

Changes in v3: None
Changes in v2: None

 common/board_r.c        | 19 ++++++++++++++-----
 drivers/pinctrl/Kconfig | 14 ++++++++++++++
 2 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/common/board_r.c b/common/board_r.c
index 4253d0c61c..e31e9c5c16 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -306,16 +306,24 @@ static int initr_dm(void)
 	bootstage_accum(BOOTSTATE_ID_ACCUM_DM_R);
 	if (ret)
 		return ret;
-#ifdef CONFIG_TIMER_EARLY
-	ret = dm_timer_init();
-	if (ret)
-		return ret;
-#endif
 
 	return 0;
 }
 #endif
 
+static int initr_dm_devices(void)
+{
+	int ret;
+
+	if (IS_ENABLED(CONFIG_TIMER_EARLY)) {
+		ret = dm_timer_init();
+		if (ret)
+			return ret;
+	}
+
+	return 0;
+}
+
 static int initr_bootstage(void)
 {
 	bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_R, "board_init_r");
@@ -702,6 +710,7 @@ static init_fnc_t init_sequence_r[] = {
 	efi_memory_init,
 #endif
 	initr_binman,
+	initr_dm_devices,
 	stdio_init_tables,
 	initr_serial,
 	initr_announce,
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
index eadcfd6652..449f614eb2 100644
--- a/drivers/pinctrl/Kconfig
+++ b/drivers/pinctrl/Kconfig
@@ -82,6 +82,13 @@ config SPL_PINCTRL
 	  This option is an SPL-variant of the PINCTRL option.
 	  See the help of PINCTRL for details.
 
+config TPL_PINCTRL
+	bool "Support pin controllers in TPL"
+	depends on TPL && TPL_DM
+	help
+	  This option is an TPL variant of the PINCTRL option.
+	  See the help of PINCTRL for details.
+
 config SPL_PINCTRL_FULL
 	bool "Support full pin controllers in SPL"
 	depends on SPL_PINCTRL && SPL_OF_CONTROL
@@ -91,6 +98,13 @@ config SPL_PINCTRL_FULL
 	  This option is an SPL-variant of the PINCTRL_FULL option.
 	  See the help of PINCTRL_FULL for details.
 
+config TPL_PINCTRL_FULL
+	bool "Support full pin controllers in TPL"
+	depends on TPL_PINCTRL && TPL_OF_CONTROL
+	help
+	  This option is an TPL-variant of the PINCTRL_FULL option.
+	  See the help of PINCTRL_FULL for details.
+
 config SPL_PINCTRL_GENERIC
 	bool "Support generic pin controllers in SPL"
 	depends on SPL_PINCTRL_FULL
-- 
2.24.0.432.g9d3f5f5b63-goog



More information about the U-Boot mailing list