[PATCH 2/4] ARM: zynq: zedboard: allow lowlevel init to be called as second stage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 arch/arm/boards/avnet-zedboard/lowlevel.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/boards/avnet-zedboard/lowlevel.c b/arch/arm/boards/avnet-zedboard/lowlevel.c
index b50c36b28869..9b90ef112b46 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);
 
-- 
2.23.0


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



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux