From ee7dfeb5f9b63f6714ccd2273b58ffc35abd2682 Mon Sep 17 00:00:00 2001
From: Kenneth Johansson <kenneth@southpole.se>
Date: Tue, 6 Nov 2018 17:25:51 +0100
Subject: [PATCH] Fix device tree pointer from u-boot to work with CONFIG_EVA
 option.

only work for the CONFIG_LTQ_EVA_1GB sub option.
---
 arch/mips/lantiq/grx500/prom.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/mips/lantiq/grx500/prom.c b/arch/mips/lantiq/grx500/prom.c
index ac00c8da2..200fd78fa 100755
--- a/arch/mips/lantiq/grx500/prom.c
+++ b/arch/mips/lantiq/grx500/prom.c
@@ -157,8 +157,18 @@ static void plat_early_init_devtree(void)
 	 * Load the builtin devicetree. This causes the chosen node to be
 	 * parsed resulting in our memory appearing
 	 */
-	if (fw_passed_dtb) /* used by CONFIG_MIPS_APPENDED_RAW_DTB as well */
+
+	if (fw_passed_dtb){ /* used by CONFIG_MIPS_APPENDED_RAW_DTB as well */
+#if defined(CONFIG_LTQ_EVA_1GB) &&  ! defined(CONFIG_MIPS_APPENDED_RAW_DTB)
+		/* in this option we have the kernel linked at 0x60000000 instead of 0x80000000 */
+		/* u-boot assumes the first one so pointer from u-boot is pointing to wrong address */
+		pr_info("Using Device tree (DTB) from bootloader %p (%p)\n", (void *)(fw_passed_dtb - 0x20000000), (void*)fw_passed_dtb);
+		fw_passed_dtb -= 0x20000000; /* KEN: compensate for the change in BASE address for the kernel. */
+#else
+		pr_info("Using Device tree (DTB) appended to kernel image %p\n", fw_passed_dtb);
+#endif
 		dtb = (void *)fw_passed_dtb;
+	}
 	else if (__dtb_start != __dtb_end)
 		dtb = (void *)__dtb_start;
 	else
-- 
GitLab