]> git.sur5r.net Git - u-boot/commitdiff
timer: Set up the real timer after driver model is available
authorSimon Glass <sjg@chromium.org>
Wed, 24 Feb 2016 16:14:50 +0000 (09:14 -0700)
committerSimon Glass <sjg@chromium.org>
Fri, 26 Feb 2016 15:53:10 +0000 (08:53 -0700)
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>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
common/board_f.c
common/board_r.c

index a960144b02f362434fe5985f22e6b56da16e5a91..622093a3915af1326d30bc4de5022f19b1582961 100644 (file)
@@ -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;
 }
index 6c238652790c2d1aa839015a359e3f69e9a09c7b..52a9b262eb1ee415d21b0610da94612912ef7eb8 100644 (file)
@@ -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