diff mbox

[U-Boot,09/16] timer: Set up the real timer after driver model is available

Message ID 1455500220-1324-10-git-send-email-sjg@chromium.org
State Accepted
Commit 1057e6cfe12bf71394fe02e0939f232417882f90
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass Feb. 15, 2016, 1:36 a.m. UTC
When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

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

 common/board_f.c |  6 ++++++
 common/board_r.c | 14 ++++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

Comments

Bin Meng Feb. 16, 2016, 9:21 a.m. UTC | #1
On Mon, Feb 15, 2016 at 9:36 AM, Simon Glass <sjg@chromium.org> wrote:
> When using the early timer, we need to manually trigger setting up the
> real timer. This will not happen automatically. Do this immediately after
> starting driver model.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  common/board_f.c |  6 ++++++
>  common/board_r.c | 14 ++++++++++++--
>  2 files changed, 18 insertions(+), 2 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
diff mbox

Patch

diff --git a/common/board_f.c b/common/board_f.c
index a960144..622093a 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -45,6 +45,7 @@ 
 #include <post.h>
 #include <spi.h>
 #include <status_led.h>
+#include <timer.h>
 #include <trace.h>
 #include <video.h>
 #include <watchdog.h>
@@ -805,6 +806,11 @@  static int initf_dm(void)
 	if (ret)
 		return ret;
 #endif
+#ifdef CONFIG_TIMER_EARLY
+	ret = dm_timer_init();
+	if (ret)
+		return ret;
+#endif
 
 	return 0;
 }
diff --git a/common/board_r.c b/common/board_r.c
index 6c23865..52a9b26 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -46,6 +46,7 @@ 
 #include <serial.h>
 #include <spi.h>
 #include <stdio_dev.h>
+#include <timer.h>
 #include <trace.h>
 #include <watchdog.h>
 #ifdef CONFIG_CMD_AMBAPP
@@ -312,13 +313,22 @@  static int initr_noncached(void)
 #ifdef CONFIG_DM
 static int initr_dm(void)
 {
+	int ret;
+
 	/* Save the pre-reloc driver model and start a new one */
 	gd->dm_root_f = gd->dm_root;
 	gd->dm_root = NULL;
-#ifdef CONFIG_TIMER
+	ret = dm_init_and_scan(false);
+	if (ret)
+		return ret;
+#ifdef CONFIG_TIMER_EARLY
 	gd->timer = NULL;
+	ret = dm_timer_init();
+	if (ret)
+		return ret;
 #endif
-	return dm_init_and_scan(false);
+
+	return 0;
 }
 #endif