Patchwork [U-Boot,RFC,29/36] x86 - Move test for cold boot into init functions

login
register
mail settings
Submitter Graeme Russ
Date Jan. 3, 2011, 7:46 p.m.
Message ID <1294084016-2674-30-git-send-email-graeme.russ@gmail.com>
Download mbox | patch
Permalink /patch/77335/
State Superseded
Delegated to: Graeme Russ
Headers show

Comments

Graeme Russ - Jan. 3, 2011, 7:46 p.m.
---
 arch/i386/cpu/sc520/sc520.c |    7 ++++---
 arch/i386/lib/board.c       |   17 +++++++----------
 2 files changed, 11 insertions(+), 13 deletions(-)

--
1.7.1.422.g049e9

Patch

diff --git a/arch/i386/cpu/sc520/sc520.c b/arch/i386/cpu/sc520/sc520.c
index 19c7100..8145f1a 100644
--- a/arch/i386/cpu/sc520/sc520.c
+++ b/arch/i386/cpu/sc520/sc520.c
@@ -45,15 +45,16 @@  int cpu_init_f(void)
 		gd->cpu_clk = 100000000;
 	}

-
 	/* wait at least one millisecond */
 	asm("movl	$0x2000, %%ecx\n"
 	    "0:		pushl %%ecx\n"
 	    "popl	%%ecx\n"
 	    "loop 0b\n": : : "ecx");

-	/* turn on the SDRAM write buffer */
-	writeb(0x11, &sc520_mmcr->dbctl);
+	if (gd->flags & GD_FLG_COLD_BOOT) {
+		/* turn on the SDRAM write buffer */
+		writeb(0x11, &sc520_mmcr->dbctl);
+	}

 	return x86_cpu_init_f();
 }
diff --git a/arch/i386/lib/board.c b/arch/i386/lib/board.c
index 1118322..b04367b 100644
--- a/arch/i386/lib/board.c
+++ b/arch/i386/lib/board.c
@@ -209,16 +209,13 @@  void board_init_f (ulong boot_flags)
 	dest_addr -= (bss_end - text_start);
 	rel_offset = text_start - dest_addr;

-	/* Perform low-level initialization only when cold booted */
-	if (gd->flags & GD_FLG_COLD_BOOT) {
-		/* First stage CPU initialization */
-		if (cpu_init_f() != 0)
-			hang();
-
-		/* First stage Board initialization */
-		if (board_early_init_f() != 0)
-			hang();
-	}
+	/* First stage CPU initialization */
+	if (cpu_init_f() != 0)
+		hang();
+
+	/* First stage Board initialization */
+	if (board_early_init_f() != 0)
+		hang();

 	/* Copy U-Boot into RAM */
 	dst_addr = (ulong *)dest_addr;