mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/2] ARM: i.MX: edmqmx6: Copy fdt to SDRAM
Date: Thu, 30 Jan 2014 10:40:28 +0100	[thread overview]
Message-ID: <1391074829-25877-1-git-send-email-s.hauer@pengutronix.de> (raw)

barebox only recognizes boarddata as dtb if it is inside SDRAM, so
copy the dtb there if necessary.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/dmo-mx6-realq7/lowlevel.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boards/dmo-mx6-realq7/lowlevel.c b/arch/arm/boards/dmo-mx6-realq7/lowlevel.c
index f47575e..7f6168c 100644
--- a/arch/arm/boards/dmo-mx6-realq7/lowlevel.c
+++ b/arch/arm/boards/dmo-mx6-realq7/lowlevel.c
@@ -15,6 +15,7 @@
 #include <common.h>
 #include <sizes.h>
 #include <io.h>
+#include <debug_ll.h>
 #include <asm/sections.h>
 #include <asm/mmu.h>
 #include <asm/barebox-arm-head.h>
@@ -136,26 +137,37 @@ static void sdram_init(void)
 	writel(0x0000047f, 0x021e80a4);
 	writel(0x0000c34f, 0x021e80a8);
 	writel(0x00000001, 0x021e8080);
+	putc_ll('>');
 }
 
 extern char __dtb_imx6q_dmo_realq7_start[];
+extern char __dtb_imx6q_dmo_realq7_end[];
 
 ENTRY_FUNCTION(start_imx6_realq7, r0, r1, r2)
 {
-	uint32_t fdt;
+	unsigned long fdt, sdram = 0x10000000;
 
 	arm_cpu_lowlevel_init();
 
 	arm_setup_stack(0x00940000 - 8);
 
+	fdt = (unsigned long)__dtb_imx6q_dmo_realq7_start - get_runtime_offset();
+
 	if (get_pc() < 0x10000000) {
 		sdram_init();
 
 		mmdc_do_write_level_calibration();
 		mmdc_do_dqs_calibration();
-	}
 
-	fdt = (uint32_t)__dtb_imx6q_dmo_realq7_start - get_runtime_offset();
+		/*
+		 * Copy the devicetree blob to sdram so that the barebox code finds it
+		 * inside valid SDRAM instead of SRAM.
+		 */
+		memcpy((void *)sdram, (void *)fdt,
+				__dtb_imx6q_dmo_realq7_end -
+				__dtb_imx6q_dmo_realq7_start);
+		fdt = sdram;
+	}
 
-	barebox_arm_entry(0x10000000, SZ_2G, fdt);
+	barebox_arm_entry(sdram, SZ_2G, fdt);
 }
-- 
1.8.5.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2014-01-30  9:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-30  9:40 Sascha Hauer [this message]
2014-01-30  9:40 ` [PATCH 2/2] ARM: i.MX: edmqmx6: update defconfig Sascha Hauer
2014-01-30  9:46 ` [PATCH 1/2] ARM: i.MX: edmqmx6: Copy fdt to SDRAM Jan Lübbe
2014-01-30  9:48   ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1391074829-25877-1-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox