diff mbox

[U-Boot,3/4] sunxi: Use spl_boot_device

Message ID 20170823114136.10919-4-maxime.ripard@free-electrons.com
State Rejected
Delegated to: Jagannadha Sutradharudu Teki
Headers show

Commit Message

Maxime Ripard Aug. 23, 2017, 11:41 a.m. UTC
Our current board code duplicates a bit the spl_boot_device logic. Now that
we can use that function in the full-flavoured U-Boot, remove that
duplication and call the function instead.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 board/sunxi/board.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Chen-Yu Tsai Aug. 24, 2017, 3:42 a.m. UTC | #1
On Wed, Aug 23, 2017 at 7:41 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> Our current board code duplicates a bit the spl_boot_device logic. Now that
> we can use that function in the full-flavoured U-Boot, remove that
> duplication and call the function instead.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
>  board/sunxi/board.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
> index 800f412b383d..e1d48140878f 100644
> --- a/board/sunxi/board.c
> +++ b/board/sunxi/board.c
> @@ -32,6 +32,7 @@
>  #include <libfdt.h>
>  #include <nand.h>
>  #include <net.h>
> +#include <spl.h>
>  #include <sy8106a.h>
>  #include <asm/setup.h>
>
> @@ -720,11 +721,14 @@ static void setup_environment(const void *fdt)
>  int misc_init_r(void)
>  {
>         __maybe_unused int ret;
> +       uint boot;
>
>         setenv("fel_booted", NULL);
>         setenv("fel_scriptaddr", NULL);

This doesn't apply on master due to commit 382bee57f19b
("env: Rename setenv() to env_set()")

ChenYu

> +
> +       boot = spl_boot_device();
>         /* determine if we are running in FEL mode */
> -       if (!is_boot0_magic(SPL_ADDR + 4)) { /* eGON.BT0 */
> +       if (boot == BOOT_DEVICE_BOARD) {
>                 setenv("fel_booted", "1");
>                 parse_spl_header(SPL_ADDR);
>         }
> --
> 2.13.5
>
diff mbox

Patch

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 800f412b383d..e1d48140878f 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -32,6 +32,7 @@ 
 #include <libfdt.h>
 #include <nand.h>
 #include <net.h>
+#include <spl.h>
 #include <sy8106a.h>
 #include <asm/setup.h>
 
@@ -720,11 +721,14 @@  static void setup_environment(const void *fdt)
 int misc_init_r(void)
 {
 	__maybe_unused int ret;
+	uint boot;
 
 	setenv("fel_booted", NULL);
 	setenv("fel_scriptaddr", NULL);
+
+	boot = spl_boot_device();
 	/* determine if we are running in FEL mode */
-	if (!is_boot0_magic(SPL_ADDR + 4)) { /* eGON.BT0 */
+	if (boot == BOOT_DEVICE_BOARD) {
 		setenv("fel_booted", "1");
 		parse_spl_header(SPL_ADDR);
 	}