From: Lucas Stach <l.stach@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH v2 09/12] vexpress: use device tree provided by QEMU if available
Date: Thu, 12 Oct 2017 12:26:55 +0200 [thread overview]
Message-ID: <20171012102658.17104-9-l.stach@pengutronix.de> (raw)
In-Reply-To: <20171012102658.17104-1-l.stach@pengutronix.de>
From: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
arch/arm/boards/vexpress/lowlevel.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boards/vexpress/lowlevel.c b/arch/arm/boards/vexpress/lowlevel.c
index 0a226b295c2a..9fe7c836b7b6 100644
--- a/arch/arm/boards/vexpress/lowlevel.c
+++ b/arch/arm/boards/vexpress/lowlevel.c
@@ -9,18 +9,34 @@
#include <asm/barebox-arm-head.h>
#include <asm/barebox-arm.h>
#include <asm/system_info.h>
+#include <asm/unaligned.h>
#include <linux/amba/sp804.h>
static inline void start_vexpress_common(void *internal_dt)
{
void *fdt = internal_dt - get_runtime_offset();
+ unsigned long membase, memsize = SZ_512M;
arm_cpu_lowlevel_init();
if (amba_is_arm_sp804(IOMEM(0x10011000)))
- barebox_arm_entry(0x60000000, SZ_512M, fdt);
+ membase = 0x60000000;
else
- barebox_arm_entry(0x80000000, SZ_512M, fdt);
+ membase = 0x80000000;
+
+ /* QEMU may put a DTB at the start of RAM */
+ if (IS_ENABLED(CONFIG_OFDEVICE) &&
+ get_unaligned_be32((void*)membase) == FDT_MAGIC) {
+ fdt = (void*)membase;
+ /*
+ * Need to move membase a bit as the PBL wants to relocate
+ * to the start of RAM, which would overwrite the DTB.
+ */
+ membase += SZ_4M;
+ memsize -= SZ_4M;
+ }
+
+ barebox_arm_entry(membase, memsize, fdt);
}
extern char __dtb_vexpress_v2p_ca9_start[];
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2017-10-12 10:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-12 10:26 [PATCH v2 01/12] ARM: vexpress: always build relocatable image Lucas Stach
2017-10-12 10:26 ` [PATCH v2 02/12] of: populate clock providers before other devices Lucas Stach
2017-10-12 10:26 ` [PATCH v2 03/12] clk: versatile: add basic clocks Lucas Stach
2017-10-12 10:26 ` [PATCH v2 04/12] clocksource: sp804: silently ignore secondary instaces Lucas Stach
2017-10-12 10:26 ` [PATCH v2 05/12] mci: mmci: add DT support Lucas Stach
2017-10-12 10:26 ` [PATCH v2 06/12] ARM: vexpress: switch to DT probe and multi-image build Lucas Stach
2017-10-12 10:26 ` [PATCH v2 07/12] ARM: vexpress: regenerate config Lucas Stach
2017-10-12 10:26 ` [PATCH v2 08/12] docs: add qemu vexpress Lucas Stach
2017-10-12 10:26 ` Lucas Stach [this message]
2017-10-12 10:26 ` [PATCH v2 10/12] vexpress: add bootstate node to the device tree Lucas Stach
2017-10-12 10:26 ` [PATCH v2 11/12] of: base: add function to copy a device tree node Lucas Stach
2017-10-12 10:26 ` [PATCH v2 12/12] ARM: vexpress: add fixup handler for 'virtio, mmio' devices Lucas Stach
2017-10-16 7:31 ` [PATCH v2 01/12] ARM: vexpress: always build relocatable image 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=20171012102658.17104-9-l.stach@pengutronix.de \
--to=l.stach@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