summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas Stach <dev@lynxeye.de>2019-12-10 23:03:20 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2019-12-11 09:51:23 +0100
commit9398e9ef1e4d0aebf60b618508c746b0cb6cafb9 (patch)
treee6029182218865f948ae11610877819537438ab8
parent5d2d55ebd6add4ea395022772c5736e67ba68e33 (diff)
downloadbarebox-9398e9ef1e4d0aebf60b618508c746b0cb6cafb9.tar.gz
barebox-9398e9ef1e4d0aebf60b618508c746b0cb6cafb9.tar.xz
ARM: zynq: zedboard: allow lowlevel init to be called as second stage
If the code is already executing in DRAM, the PS7 init must not be executed, as it initializes the DRAM controller. As the OCM can be configured to an address which aliases with the DRAM address space we can't reliably infer if we are running from OCM or DRAM from the execution address. So instead of using the address, look at the OCM mapping, as the BootROM leaves a quite unique mapping behind with 192KB OCM mapped at the low address and 64KB mapped to the high address. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/arm/boards/avnet-zedboard/lowlevel.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/arm/boards/avnet-zedboard/lowlevel.c b/arch/arm/boards/avnet-zedboard/lowlevel.c
index b50c36b288..9b90ef112b 100644
--- a/arch/arm/boards/avnet-zedboard/lowlevel.c
+++ b/arch/arm/boards/avnet-zedboard/lowlevel.c
@@ -31,6 +31,16 @@ extern char __dtb_zynq_zed_start[];
static void avnet_zedboard_ps7_init(void)
{
+ /*
+ * Read OCM mapping configuration, if only the upper 64 KByte are
+ * mapped to the high address, it's very likely that we just got control
+ * from the BootROM. If the mapping is changed something other than the
+ * BootROM was running before us. Skip PS7 init to avoid cutting the
+ * branch we are sitting on in that case.
+ */
+ if ((readl(0xf8000910) & 0xf) != 0x8)
+ return;
+
/* open sesame */
writel(0x0000DF0D, ZYNQ_SLCR_UNLOCK);