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

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

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

Signed-off-by: Olliver Schinagl <oli...@schinagl.nl>
---
 board/sunxi/board.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 53656383d5..5467015860 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -540,11 +540,6 @@ void sunxi_board_init(void)
        power_failed |= axp_set_sw(IS_ENABLED(CONFIG_AXP_SW_ON));
 #endif
 #endif
-       printf("DRAM:");
-       ramsize = sunxi_dram_init();
-       printf(" %d MiB\n", (int)(ramsize >> 20));
-       if (!ramsize)
-               hang();
 
        /*
         * Only clock up the CPU to full speed if we are reasonably
@@ -553,7 +548,14 @@ 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:");
+       ramsize = sunxi_dram_init();
+       printf(" %d MiB\n", (int)(ramsize >> 20));
+       if (!ramsize)
+               hang();
 }
 #endif
 
-- 
2.11.0

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to