diff mbox series

[U-Boot,v3,1/9] sunxi: board: Print error after power initialization fails

Message ID 49c3a6b97b606353c6edf67474e7df15320f6894.1542823428.git-series.plaes@plaes.org
State Accepted
Commit a8011eb84dfac5187cebf00ed8bc981bdb5c1fa1
Delegated to: Jagannadha Sutradharudu Teki
Headers show
Series Stop AXP from crashing when enabling LDO3 | expand

Commit Message

Priit Laes Nov. 21, 2018, 6:05 p.m. UTC
From: Olliver Schinagl <oliver@schinagl.nl>

Currently during init, we enable all power, then enable the dram and
after that check whether there was an error during power-up.

This makes little sense, we should enable power and then check if power
was brought up properly before we continue to initialize other things.

This patch moves the DRAM init after the power failure check.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Signed-off-by: Priit Laes <plaes@plaes.org>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
---
 board/sunxi/board.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 64ccbc7..26284db 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -637,13 +637,6 @@  void sunxi_board_init(void)
 	power_failed |= axp_set_sw(IS_ENABLED(CONFIG_AXP_SW_ON));
 #endif
 #endif
-	printf("DRAM:");
-	gd->ram_size = sunxi_dram_init();
-	printf(" %d MiB\n", (int)(gd->ram_size >> 20));
-	if (!gd->ram_size)
-		hang();
-
-	sunxi_spl_store_dram_size(gd->ram_size);
 
 	/*
 	 * Only clock up the CPU to full speed if we are reasonably
@@ -652,7 +645,16 @@  void sunxi_board_init(void)
 	if (!power_failed)
 		clock_set_pll1(CONFIG_SYS_CLK_FREQ);
 	else
-		printf("Failed to set core voltage! Can't set CPU frequency\n");
+		printf("Error setting up the power controller.\n"
+		       "CPU frequency not set.\n");
+
+	printf("DRAM:");
+	gd->ram_size = sunxi_dram_init();
+	printf(" %d MiB\n", (int)(gd->ram_size >> 20));
+	if (!gd->ram_size)
+		hang();
+
+	sunxi_spl_store_dram_size(gd->ram_size);
 }
 #endif