[v6,013/102] board_r: Move early-timer init later
diff mbox series

Message ID 20191206213936.v6.13.I512896ca7c3c572ad77920cc5c42b9bc223c274a@changeid
State Accepted
Commit dd0edcb2508b9abcf828baede32e6b3da5fc0c8a
Delegated to: Bin Meng
Headers show
Series
  • x86: Add initial support for apollolake
Related show

Commit Message

Simon Glass Dec. 7, 2019, 4:41 a.m. UTC
At present the early timer init happens as soon as driver model is set up.
This makes it impossible to do anything that needs driver model but must
run before devices are probed (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@chromium.org>
---

Changes in v6: None
Changes in v5: None
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 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

Comments

Bin Meng Dec. 8, 2019, 2:06 a.m. UTC | #1
On Sat, Dec 7, 2019 at 12:46 PM Simon Glass <sjg@chromium.org> wrote:
>
> At present the early timer init happens as soon as driver model is set up.
> This makes it impossible to do anything that needs driver model but must
> run before devices are probed (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@chromium.org>
> ---
>
> Changes in v6: None
> Changes in v5: None
> 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 ++++++++++++++-----
>  1 file changed, 14 insertions(+), 5 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Bin Meng Dec. 8, 2019, 2:08 a.m. UTC | #2
On Sun, Dec 8, 2019 at 10:06 AM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> On Sat, Dec 7, 2019 at 12:46 PM Simon Glass <sjg@chromium.org> wrote:
> >
> > At present the early timer init happens as soon as driver model is set up.
> > This makes it impossible to do anything that needs driver model but must
> > run before devices are probed (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@chromium.org>
> > ---
> >
> > Changes in v6: None
> > Changes in v5: None
> > 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 ++++++++++++++-----
> >  1 file changed, 14 insertions(+), 5 deletions(-)
> >
>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

applied to u-boot-x86/next, thanks!

Patch
diff mbox series

diff --git a/common/board_r.c b/common/board_r.c
index 9902c51c5e..9a25f6ec28 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -311,16 +311,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");
@@ -707,6 +715,7 @@  static init_fnc_t init_sequence_r[] = {
 	efi_memory_init,
 #endif
 	initr_binman,
+	initr_dm_devices,
 	stdio_init_tables,
 	initr_serial,
 	initr_announce,