Skip to contentSkip to conversation

dm: timer: Avoid using timer before it is ready

PATCH New Simon Glass 4 participants 5 messages Nov 29, 2015 – Dec 1, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dm: timer: Avoid using timer before it is ready

At present bootstage will try to read the timer very early after relocation. When driver model it used to provide the timer, we cannot read it until driver model is ready. Correct this by adding a separate stage for the post-relocation bootstage init.

This fixes booting on chromebook_link.

---

 common/board_r.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
common/board_r.c +9 -1
index f7118e8..a41fb54 100644
@@ -109,7 +109,6 @@ static int initr_reloc(void)
 {
 	/* tell others: relocation done */
 	gd->flags |= GD_FLG_RELOC | GD_FLG_FULL_MALLOC_INIT;
-	bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_R, "board_init_r");
 
 	return 0;
 }
@@ -310,6 +309,14 @@ static int initr_dm(void)
 }
 #endif
 
+static int initr_bootstage(void)
+{
+	/* We cannot do this before initr_dm() */
+	bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_R, "board_init_r");
+
+	return 0;
+}
+
 __weak int power_init_board(void)
 {
 	return 0;
@@ -748,6 +755,7 @@ init_fnc_t init_sequence_r[] = {
 #ifdef CONFIG_DM
 	initr_dm,
 #endif
+	initr_bootstage,
 #if defined(CONFIG_ARM) || defined(CONFIG_NDS32)
 	board_init,	/* Setup chipselects */
 #endif
Signature · 1 line
2.6.0.rc2.230.g3dd15c0
#1 lore raw

PATCH 1/1 dm: timer: Avoid using timer before it is ready

Hi Simon,

Quoted 5 lines · Simon Glass

At present bootstage will try to read the timer very early after relocation. When driver model it used to provide the timer, we cannot read it until driver model is ready. Correct this by adding a separate stage for the post-relocation bootstage init.

Quoted 8 lines

This fixes booting on chromebook_link.

---

  common/board_r.c | 10 +++++++++-
  1 file changed, 9 insertions(+), 1 deletion(-)
#2 lore raw

PATCH 1/1 dm: timer: Avoid using timer before it is ready

In reply to Simon Glass

Hi Simon,

Quoted 2 lines · Simon Glass

At present bootstage will try to read the timer very early after relocation. When driver model it used to provide the timer, we cannot read it until

When driver model is

Quoted 8 lines

driver model is ready. Correct this by adding a separate stage for the post-relocation bootstage init.

This fixes booting on chromebook_link.

---

Quoted 31 lines
 common/board_r.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
common/board_r.c +8 -1
index f7118e8..a41fb54 100644
@@ -109,7 +109,6 @@ static int initr_reloc(void)
 {
        /* tell others: relocation done */
        gd->flags |= GD_FLG_RELOC | GD_FLG_FULL_MALLOC_INIT;
-       bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_R, "board_init_r");
 
        return 0;
 }
@@ -310,6 +309,14 @@ static int initr_dm(void)
 }
 #endif
 
+static int initr_bootstage(void)
+{
+       /* We cannot do this before initr_dm() */
+       bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_R, "board_init_r");
+
+       return 0;
+}
+
 __weak int power_init_board(void)
 {
        return 0;

common/board_r.c init_fnc_t init_sequence_r[] = {

Quoted 8 lines
common/board_r.c +1 -1
@@ -748,6 +755,7 @@ init_fnc_t init_sequence_r[] = {
 #ifdef CONFIG_DM
        initr_dm,
 #endif
+       initr_bootstage,
 #if defined(CONFIG_ARM) || defined(CONFIG_NDS32)
        board_init,     /* Setup chipselects */
 #endif
--

Regards,
Bin

#3 lore raw

PATCH 1/1 dm: timer: Avoid using timer before it is ready

In reply to Simon Glass
Quoted 9 lines · Simon Glass

At present bootstage will try to read the timer very early after relocation. When driver model it used to provide the timer, we cannot read it until driver model is ready. Correct this by adding a separate stage for the post-relocation bootstage init.

This fixes booting on chromebook_link.

---

Regards
Mugunthan V N

#4 lore raw

PATCH 1/1 dm: timer: Avoid using timer before it is ready

Quoted 8 lines · Mugunthan V N
Quoted 7 lines · Simon Glass

At present bootstage will try to read the timer very early after relocation. When driver model it used to provide the timer, we cannot read it until driver model is ready. Correct this by adding a separate stage for the post-relocation bootstage init.

This fixes booting on chromebook_link.

Quoted 7 lines
Quoted 2 lines

---

Regards
Mugunthan V N

Applied to u-boot-dm.