diff mbox

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

Message ID 20170301125224.25994-2-oliver@schinagl.nl
State Changes Requested
Delegated to: Jaehoon Chung
Headers show

Commit Message

Olliver Schinagl March 1, 2017, 12:52 p.m. UTC
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 <oliver@schinagl.nl>
---
 board/sunxi/board.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

Comments

Icenowy Zheng March 1, 2017, 1:07 p.m. UTC | #1
01.03.2017, 20:52, "Olliver Schinagl" <oliver@schinagl.nl>:
> 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.

Seems meaningful... at least some Pine64 wrongly set its DRAM voltage
when booting.

>
> Signed-off-by: Olliver Schinagl <oliver@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+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
diff mbox

Patch

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