diff mbox series

[v2,2/3] sunxi: Use sunxi_get_boot_device

Message ID ed9bb5ce0628da5d17da9f50d25aa3521f4bb718.1505246502.git-series.maxime.ripard@free-electrons.com
State Accepted
Commit f4c3523c98588b528601f40c0c16106379ea6eda
Headers show
Series mmc: sunxi: index hack removal | expand

Commit Message

Maxime Ripard Sept. 12, 2017, 8:02 p.m. UTC
Our current board code duplicates a bit the sunxi_get_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 mbox series

Patch

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 70e01437c4f4..9c7fc4168894 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;
 
 	env_set("fel_booted", NULL);
 	env_set("fel_scriptaddr", NULL);
+
+	boot = sunxi_get_boot_device();
 	/* determine if we are running in FEL mode */
-	if (!is_boot0_magic(SPL_ADDR + 4)) { /* eGON.BT0 */
+	if (boot == BOOT_DEVICE_BOARD) {
 		env_set("fel_booted", "1");
 		parse_spl_header(SPL_ADDR);
 	}